FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_compat.h"
#include "opt_sysvipc.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysproto.h>
#include <sys/kernel.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/module.h>
#include <sys/msg.h>
#include <sys/racct.h>
#include <sys/syscall.h>
#include <sys/syscallsubr.h>
#include <sys/sysent.h>
#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <sys/jail.h>
#include <security/mac/mac_framework.h>
Go to the source code of this file.
Data Structures | |
struct | msgmap |
struct | msgctl_args |
struct | msgget_args |
struct | msgsnd_args |
struct | msgrcv_args |
Macros | |
#define | DPRINTF(a) (void)0 |
#define | MSGSSZ 8 /* Each segment must be 2^N long */ |
#define | MSGSEG 2048 /* must be less than 32767 */ |
#define | MSGMAX (MSGSSZ*MSGSEG) |
#define | MSGMNB 2048 /* max # of bytes in a queue */ |
#define | MSGMNI 40 |
#define | MSGTQL 40 |
#define | MSQID(ix, ds) ((ix) & 0xffff | (((ds).msg_perm.seq << 16) & 0xffff0000)) |
#define | MSQID_IX(id) ((id) & 0xffff) |
#define | MSQID_SEQ(id) (((id) >> 16) & 0xffff) |
#define | MSG_LOCKED 01000 /* Is this msqid_ds locked? */ |
Functions | |
__FBSDID ("$BSDSUniX$") | |
FEATURE (sysv_msg,"System V message queues support") | |
static | MALLOC_DEFINE (M_MSG,"msg","SVID compatible message queues") |
static int | msginit (void) |
static int | msgunload (void) |
static int | sysvmsg_modload (struct module *, int, void *) |
static void | msg_freehdr (struct msg *msghdr) |
DECLARE_MODULE (sysvmsg, sysvmsg_mod, SI_SUB_SYSV_MSG, SI_ORDER_FIRST) | |
MODULE_VERSION (sysvmsg, 1) | |
int | sys_msgctl (struct thread *td, struct msgctl_args *uap) |
int | kern_msgctl (struct thread *td, int msqid, int cmd, struct msqid_ds *msqbuf) |
int | sys_msgget (struct thread *td, struct msgget_args *uap) |
int | kern_msgsnd (struct thread *td, int msqid, const void *msgp, size_t msgsz, int msgflg, long mtype) |
int | sys_msgsnd (struct thread *td, struct msgsnd_args *uap) |
int | kern_msgrcv (struct thread *td, int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg, long *mtype) |
int | sys_msgrcv (struct thread *td, struct msgrcv_args *uap) |
static int | sysctl_msqids (SYSCTL_HANDLER_ARGS) |
SYSCTL_INT (_kern_ipc, OID_AUTO, msgmax, CTLFLAG_RD,&msginfo.msgmax, 0,"Maximum message size") | |
SYSCTL_INT (_kern_ipc, OID_AUTO, msgmni, CTLFLAG_RDTUN,&msginfo.msgmni, 0,"Number of message queue identifiers") | |
SYSCTL_INT (_kern_ipc, OID_AUTO, msgmnb, CTLFLAG_RDTUN,&msginfo.msgmnb, 0,"Maximum number of bytes in a queue") | |
SYSCTL_INT (_kern_ipc, OID_AUTO, msgtql, CTLFLAG_RDTUN,&msginfo.msgtql, 0,"Maximum number of messages in the system") | |
SYSCTL_INT (_kern_ipc, OID_AUTO, msgssz, CTLFLAG_RDTUN,&msginfo.msgssz, 0,"Size of a message segment") | |
SYSCTL_INT (_kern_ipc, OID_AUTO, msgseg, CTLFLAG_RDTUN,&msginfo.msgseg, 0,"Number of message segments") | |
SYSCTL_PROC (_kern_ipc, OID_AUTO, msqids, CTLTYPE_OPAQUE|CTLFLAG_RD, NULL, 0, sysctl_msqids,"","Message queue IDs") | |
Variables | |
struct msginfo | msginfo |
static int | nfree_msgmaps |
static short | free_msgmaps |
static struct msg * | free_msghdrs |
static char * | msgpool |
static struct msgmap * | msgmaps |
static struct msg * | msghdrs |
static struct msqid_kernel * | msqids |
static struct mtx | msq_mtx |
static struct syscall_helper_data | msg_syscalls [] |
static moduledata_t | sysvmsg_mod |
#define DPRINTF | ( | a | ) | (void)0 |
Definition at line 88 of file sysv_msg.c.
Referenced by kern_msgctl(), kern_msgrcv(), kern_msgsnd(), msginit(), sys_msgctl(), sys_msgget(), sys_msgrcv(), and sys_msgsnd().
#define MSG_LOCKED 01000 /* Is this msqid_ds locked? */ |
Definition at line 148 of file sysv_msg.c.
Referenced by kern_msgsnd(), msgunload(), and sys_msgget().
Definition at line 99 of file sysv_msg.c.
#define MSGMNB 2048 /* max # of bytes in a queue */ |
Definition at line 101 of file sysv_msg.c.
#define MSGMNI 40 |
Definition at line 104 of file sysv_msg.c.
#define MSGSEG 2048 /* must be less than 32767 */ |
Definition at line 97 of file sysv_msg.c.
#define MSGSSZ 8 /* Each segment must be 2^N long */ |
Definition at line 94 of file sysv_msg.c.
#define MSGTQL 40 |
Definition at line 107 of file sysv_msg.c.
#define MSQID | ( | ix, | |
ds | |||
) | ((ix) & 0xffff | (((ds).msg_perm.seq << 16) & 0xffff0000)) |
Definition at line 134 of file sysv_msg.c.
#define MSQID_IX | ( | id | ) | ((id) & 0xffff) |
Definition at line 135 of file sysv_msg.c.
#define MSQID_SEQ | ( | id | ) | (((id) >> 16) & 0xffff) |
Definition at line 136 of file sysv_msg.c.
__FBSDID | ( | "$BSDSUniX$" | ) |
DECLARE_MODULE | ( | sysvmsg | , |
sysvmsg_mod | , | ||
SI_SUB_SYSV_MSG | , | ||
SI_ORDER_FIRST | |||
) |
FEATURE | ( | sysv_msg | , |
"System V message queues support" | |||
) |
int kern_msgctl | ( | struct thread * | td, |
int | msqid, | ||
int | cmd, | ||
struct msqid_ds * | msqbuf | ||
) |
Definition at line 403 of file sysv_msg.c.
References crfree(), DPRINTF, ipcperm(), msg_freehdr(), msginfo, msq_mtx, msqids, panic(), prison_allow(), priv_check(), racct_sub_cred(), time_second, and wakeup().
Referenced by sys_msgctl().
int kern_msgrcv | ( | struct thread * | td, |
int | msqid, | ||
void * | msgp, | ||
size_t | msgsz, | ||
long | msgtyp, | ||
int | msgflg, | ||
long * | mtype | ||
) |
Definition at line 1045 of file sysv_msg.c.
References DPRINTF, ipcperm(), msg_freehdr(), msginfo, msgpool, msq_mtx, msqids, msgmap::next, panic(), prison_allow(), racct_sub_cred(), time_second, and wakeup().
Referenced by sys_msgrcv().
int kern_msgsnd | ( | struct thread * | td, |
int | msqid, | ||
const void * | msgp, | ||
size_t | msgsz, | ||
int | msgflg, | ||
long | mtype | ||
) |
Definition at line 680 of file sysv_msg.c.
References DPRINTF, free_msghdrs, free_msgmaps, hz, ipcperm(), msg_freehdr(), MSG_LOCKED, msginfo, msgpool, msq_mtx, msqids, msgmap::next, nfree_msgmaps, panic(), prison_allow(), racct_add(), racct_sub(), time_second, and wakeup().
Referenced by sys_msgsnd().
|
static |
MODULE_VERSION | ( | sysvmsg | , |
1 | |||
) |
|
static |
Definition at line 349 of file sysv_msg.c.
References free_msghdrs, free_msgmaps, msginfo, msgmap::next, nfree_msgmaps, and panic().
Referenced by kern_msgctl(), kern_msgrcv(), and kern_msgsnd().
|
static |
Definition at line 195 of file sysv_msg.c.
References DPRINTF, free_msghdrs, free_msgmaps, malloc(), msg_syscalls, msghdrs, msginfo, msgpool, msq_mtx, msqids, mtx_init(), msgmap::next, nfree_msgmaps, panic(), and syscall_helper_register().
Referenced by sysvmsg_modload().
|
static |
Definition at line 273 of file sysv_msg.c.
References free(), MSG_LOCKED, msg_syscalls, msghdrs, msginfo, msgpool, msq_mtx, msqids, mtx_destroy(), and syscall_helper_unregister().
Referenced by sysvmsg_modload().
int sys_msgctl | ( | struct thread * | td, |
struct msgctl_args * | uap | ||
) |
Definition at line 383 of file sysv_msg.c.
References DPRINTF, kern_msgctl(), and msgctl_args::msqid.
int sys_msgget | ( | struct thread * | td, |
struct msgget_args * | uap | ||
) |
Definition at line 561 of file sysv_msg.c.
References crhold(), DPRINTF, ipcperm(), msgget_args::key, MSG_LOCKED, msginfo, msq_mtx, msqids, prison_allow(), racct_add(), and time_second.
int sys_msgrcv | ( | struct thread * | td, |
struct msgrcv_args * | uap | ||
) |
Definition at line 1301 of file sysv_msg.c.
References DPRINTF, and kern_msgrcv().
int sys_msgsnd | ( | struct thread * | td, |
struct msgsnd_args * | uap | ||
) |
Definition at line 1016 of file sysv_msg.c.
References DPRINTF, and kern_msgsnd().
SYSCTL_INT | ( | _kern_ipc | , |
OID_AUTO | , | ||
msgmax | , | ||
CTLFLAG_RD | , | ||
&msginfo. | msgmax, | ||
0 | , | ||
"Maximum message size" | |||
) |
SYSCTL_INT | ( | _kern_ipc | , |
OID_AUTO | , | ||
msgmni | , | ||
CTLFLAG_RDTUN | , | ||
&msginfo. | msgmni, | ||
0 | , | ||
"Number of message queue identifiers" | |||
) |
SYSCTL_INT | ( | _kern_ipc | , |
OID_AUTO | , | ||
msgmnb | , | ||
CTLFLAG_RDTUN | , | ||
&msginfo. | msgmnb, | ||
0 | , | ||
"Maximum number of bytes in a queue" | |||
) |
SYSCTL_INT | ( | _kern_ipc | , |
OID_AUTO | , | ||
msgtql | , | ||
CTLFLAG_RDTUN | , | ||
&msginfo. | msgtql, | ||
0 | , | ||
"Maximum number of messages in the system" | |||
) |
SYSCTL_INT | ( | _kern_ipc | , |
OID_AUTO | , | ||
msgssz | , | ||
CTLFLAG_RDTUN | , | ||
&msginfo. | msgssz, | ||
0 | , | ||
"Size of a message segment" | |||
) |
SYSCTL_INT | ( | _kern_ipc | , |
OID_AUTO | , | ||
msgseg | , | ||
CTLFLAG_RDTUN | , | ||
&msginfo. | msgseg, | ||
0 | , | ||
"Number of message segments" | |||
) |
|
static |
Definition at line 1321 of file sysv_msg.c.
SYSCTL_PROC | ( | _kern_ipc | , |
OID_AUTO | , | ||
msqids | , | ||
CTLTYPE_OPAQUE| | CTLFLAG_RD, | ||
NULL | , | ||
0 | , | ||
sysctl_msqids | , | ||
"" | , | ||
"Message queue IDs" | |||
) |
|
static |
Definition at line 317 of file sysv_msg.c.
References msginit(), and msgunload().
|
static |
Definition at line 152 of file sysv_msg.c.
Referenced by kern_msgsnd(), msg_freehdr(), and msginit().
|
static |
Definition at line 151 of file sysv_msg.c.
Referenced by kern_msgsnd(), msg_freehdr(), and msginit().
|
static |
Definition at line 159 of file sysv_msg.c.
Referenced by msginit(), and msgunload().
|
static |
Definition at line 155 of file sysv_msg.c.
Referenced by msginit(), and msgunload().
struct msginfo msginfo |
Definition at line 120 of file sysv_msg.c.
Referenced by kern_msgctl(), kern_msgrcv(), kern_msgsnd(), msg_freehdr(), msginit(), msgunload(), sys_msgget(), and sysctl_msqids().
|
static |
Definition at line 154 of file sysv_msg.c.
|
static |
Definition at line 153 of file sysv_msg.c.
Referenced by kern_msgrcv(), kern_msgsnd(), msginit(), and msgunload().
|
static |
Definition at line 157 of file sysv_msg.c.
Referenced by kern_msgctl(), kern_msgrcv(), kern_msgsnd(), msginit(), msgunload(), and sys_msgget().
|
static |
Definition at line 156 of file sysv_msg.c.
Referenced by kern_msgctl(), kern_msgrcv(), kern_msgsnd(), msginit(), msgunload(), sys_msgget(), and sysctl_msqids().
|
static |
Definition at line 150 of file sysv_msg.c.
Referenced by kern_msgsnd(), msg_freehdr(), and msginit().
|
static |
Definition at line 339 of file sysv_msg.c.