The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/msg.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /* $FreeBSD: releng/7.4/sys/sys/msg.h 196006 2009-07-31 20:32:55Z jhb $ */
    2 /*      $NetBSD: msg.h,v 1.4 1994/06/29 06:44:43 cgd Exp $      */
    3 
    4 /*-
    5  * SVID compatible msg.h file
    6  *
    7  * Author:  Daniel Boulet
    8  *
    9  * Copyright 1993 Daniel Boulet and RTMX Inc.
   10  *
   11  * This system call was implemented by Daniel Boulet under contract from RTMX.
   12  *
   13  * Redistribution and use in source forms, with and without modification,
   14  * are permitted provided that this entire comment appears intact.
   15  *
   16  * Redistribution in binary form may occur without any restrictions.
   17  * Obviously, it would be nice if you gave credit where credit is due
   18  * but requiring it would be too onerous.
   19  *
   20  * This software is provided ``AS IS'' without any warranties of any kind.
   21  */
   22 
   23 #ifndef _SYS_MSG_H_
   24 #define _SYS_MSG_H_
   25 
   26 #include <sys/cdefs.h>
   27 #include <sys/_types.h>
   28 #include <sys/ipc.h>
   29 
   30 /*
   31  * The MSG_NOERROR identifier value, the msqid_ds struct and the msg struct
   32  * are as defined by the SV API Intel 386 Processor Supplement.
   33  */
   34 
   35 #define MSG_NOERROR     010000          /* don't complain about too long msgs */
   36 
   37 typedef unsigned long   msglen_t;
   38 typedef unsigned long   msgqnum_t;
   39 
   40 #ifndef _PID_T_DECLARED
   41 typedef __pid_t         pid_t;
   42 #define _PID_T_DECLARED
   43 #endif
   44 
   45 #ifndef _SIZE_T_DECLARED
   46 typedef __size_t        size_t;
   47 #define _SIZE_T_DECLARED
   48 #endif
   49 
   50 #ifndef _SSIZE_T_DECLARED
   51 typedef __ssize_t       ssize_t;
   52 #define _SSIZE_T_DECLARED
   53 #endif
   54 
   55 #ifndef _TIME_T_DECLARED
   56 typedef __time_t        time_t;
   57 #define _TIME_T_DECLARED
   58 #endif
   59 
   60 #if defined(_KERNEL)
   61 struct msqid_ds_old {
   62         struct  ipc_perm_old msg_perm;  /* msg queue permission bits */
   63         struct  msg *msg_first; /* first message in the queue */
   64         struct  msg *msg_last;  /* last message in the queue */
   65         msglen_t msg_cbytes;    /* number of bytes in use on the queue */
   66         msgqnum_t msg_qnum;     /* number of msgs in the queue */
   67         msglen_t msg_qbytes;    /* max # of bytes on the queue */
   68         pid_t   msg_lspid;      /* pid of last msgsnd() */
   69         pid_t   msg_lrpid;      /* pid of last msgrcv() */
   70         time_t  msg_stime;      /* time of last msgsnd() */
   71         long    msg_pad1;
   72         time_t  msg_rtime;      /* time of last msgrcv() */
   73         long    msg_pad2;
   74         time_t  msg_ctime;      /* time of last msgctl() */
   75         long    msg_pad3;
   76         long    msg_pad4[4];
   77 };
   78 #endif
   79 
   80 /*
   81  * XXX there seems to be no prefix reserved for this header, so the name
   82  * "msg" in "struct msg" and the names of all of the nonstandard members
   83  * (mainly "msg_pad*) are namespace pollution.
   84  */
   85 
   86 struct msqid_ds {
   87         struct  ipc_perm msg_perm;      /* msg queue permission bits */
   88         struct  msg *msg_first; /* first message in the queue */
   89         struct  msg *msg_last;  /* last message in the queue */
   90         msglen_t msg_cbytes;    /* number of bytes in use on the queue */
   91         msgqnum_t msg_qnum;     /* number of msgs in the queue */
   92         msglen_t msg_qbytes;    /* max # of bytes on the queue */
   93         pid_t   msg_lspid;      /* pid of last msgsnd() */
   94         pid_t   msg_lrpid;      /* pid of last msgrcv() */
   95         time_t  msg_stime;      /* time of last msgsnd() */
   96         time_t  msg_rtime;      /* time of last msgrcv() */
   97         time_t  msg_ctime;      /* time of last msgctl() */
   98 };
   99 
  100 #if __BSD_VISIBLE
  101 /*
  102  * Structure describing a message.  The SVID doesn't suggest any
  103  * particular name for this structure.  There is a reference in the
  104  * msgop man page that reads "The structure mymsg is an example of what
  105  * this user defined buffer might look like, and includes the following
  106  * members:".  This sentence is followed by two lines equivalent
  107  * to the mtype and mtext field declarations below.  It isn't clear
  108  * if "mymsg" refers to the name of the structure type or the name of an
  109  * instance of the structure...
  110  */
  111 struct mymsg {
  112         long    mtype;          /* message type (+ve integer) */
  113         char    mtext[1];       /* message body */
  114 };
  115 #endif
  116 
  117 #ifdef _KERNEL
  118 
  119 struct msg {
  120         struct  msg *msg_next;  /* next msg in the chain */
  121         long    msg_type;       /* type of this message */
  122                                 /* >0 -> type of this message */
  123                                 /* 0 -> free header */
  124         u_short msg_ts;         /* size of this message */
  125         short   msg_spot;       /* location of start of msg in buffer */
  126         struct  label *label;   /* MAC Framework label */
  127 };
  128 
  129 /*
  130  * Based on the configuration parameters described in an SVR2 (yes, two)
  131  * config(1m) man page.
  132  *
  133  * Each message is broken up and stored in segments that are msgssz bytes
  134  * long.  For efficiency reasons, this should be a power of two.  Also,
  135  * it doesn't make sense if it is less than 8 or greater than about 256.
  136  * Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of
  137  * two between 8 and 1024 inclusive (and panic's if it isn't).
  138  */
  139 struct msginfo {
  140         int     msgmax,         /* max chars in a message */
  141                 msgmni,         /* max message queue identifiers */
  142                 msgmnb,         /* max chars in a queue */
  143                 msgtql,         /* max messages in system */
  144                 msgssz,         /* size of a message segment (see notes above) */
  145                 msgseg;         /* number of message segments */
  146 };
  147 extern struct msginfo   msginfo;
  148 
  149 /*
  150  * Kernel wrapper for the user-level structure.
  151  */
  152 struct msqid_kernel {
  153         /*
  154          * Data structure exposed to user space.
  155          */
  156         struct  msqid_ds u;
  157 
  158         /*
  159          * Kernel-private components of the message queue.
  160          */
  161         struct  label *label;   /* MAC label */
  162 };
  163 
  164 #else /* !_KERNEL */
  165 
  166 __BEGIN_DECLS
  167 int msgctl(int, int, struct msqid_ds *);
  168 int msgget(key_t, int);
  169 /* XXX return value should be ssize_t. */
  170 int msgrcv(int, void *, size_t, long, int);
  171 int msgsnd(int, const void *, size_t, int);
  172 #if __BSD_VISIBLE
  173 int msgsys(int, ...);
  174 #endif
  175 __END_DECLS
  176 
  177 #endif /* _KERNEL */
  178 
  179 #endif /* !_SYS_MSG_H_ */

Cache object: 53982edd36f1bba99741a0695456d0ce


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.