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-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* $FreeBSD$ */
    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 #ifdef _WANT_SYSVMSG_INTERNALS
   29 #define _WANT_SYSVIPC_INTERNALS
   30 #endif
   31 #include <sys/ipc.h>
   32 
   33 /*
   34  * The MSG_NOERROR identifier value, the msqid_ds struct and the msg struct
   35  * are as defined by the SV API Intel 386 Processor Supplement.
   36  */
   37 
   38 #define MSG_NOERROR     010000          /* don't complain about too long msgs */
   39 
   40 typedef unsigned long   msglen_t;
   41 typedef unsigned long   msgqnum_t;
   42 
   43 #ifndef _PID_T_DECLARED
   44 typedef __pid_t         pid_t;
   45 #define _PID_T_DECLARED
   46 #endif
   47 
   48 #ifndef _SIZE_T_DECLARED
   49 typedef __size_t        size_t;
   50 #define _SIZE_T_DECLARED
   51 #endif
   52 
   53 #ifndef _SSIZE_T_DECLARED
   54 typedef __ssize_t       ssize_t;
   55 #define _SSIZE_T_DECLARED
   56 #endif
   57 
   58 #ifndef _TIME_T_DECLARED
   59 typedef __time_t        time_t;
   60 #define _TIME_T_DECLARED
   61 #endif
   62 
   63 #if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
   64     defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)
   65 struct msqid_ds_old {
   66         struct  ipc_perm_old msg_perm;  /* msg queue permission bits */
   67         struct  msg *__msg_first;       /* first message in the queue */
   68         struct  msg *__msg_last;        /* last message in the queue */
   69         msglen_t msg_cbytes;    /* number of bytes in use on the queue */
   70         msgqnum_t msg_qnum;     /* number of msgs in the queue */
   71         msglen_t msg_qbytes;    /* max # of bytes on the queue */
   72         pid_t   msg_lspid;      /* pid of last msgsnd() */
   73         pid_t   msg_lrpid;      /* pid of last msgrcv() */
   74         time_t  msg_stime;      /* time of last msgsnd() */
   75         long    msg_pad1;
   76         time_t  msg_rtime;      /* time of last msgrcv() */
   77         long    msg_pad2;
   78         time_t  msg_ctime;      /* time of last msgctl() */
   79         long    msg_pad3;
   80         long    msg_pad4[4];
   81 };
   82 #endif
   83 
   84 /*
   85  * XXX there seems to be no prefix reserved for this header, so the name
   86  * "msg" in "struct msg" and the names of all of the nonstandard members
   87  * are namespace pollution.
   88  */
   89 
   90 struct msqid_ds {
   91         struct  ipc_perm msg_perm;      /* msg queue permission bits */
   92         struct  msg *__msg_first;       /* first message in the queue */
   93         struct  msg *__msg_last;        /* last message in the queue */
   94         msglen_t msg_cbytes;    /* number of bytes in use on the queue */
   95         msgqnum_t msg_qnum;     /* number of msgs in the queue */
   96         msglen_t msg_qbytes;    /* max # of bytes on the queue */
   97         pid_t   msg_lspid;      /* pid of last msgsnd() */
   98         pid_t   msg_lrpid;      /* pid of last msgrcv() */
   99         time_t  msg_stime;      /* time of last msgsnd() */
  100         time_t  msg_rtime;      /* time of last msgrcv() */
  101         time_t  msg_ctime;      /* time of last msgctl() */
  102 };
  103 
  104 #ifdef _KERNEL
  105 struct msg {
  106         struct  msg *msg_next;  /* next msg in the chain */
  107         long    msg_type;       /* type of this message */
  108                                 /* >0 -> type of this message */
  109                                 /* 0 -> free header */
  110         u_short msg_ts;         /* size of this message */
  111         short   msg_spot;       /* location of start of msg in buffer */
  112         struct  label *label;   /* MAC Framework label */
  113 };
  114 #endif
  115 
  116 #if defined(_KERNEL) || defined(_WANT_SYSVMSG_INTERNALS)
  117 /*
  118  * Based on the configuration parameters described in an SVR2 (yes, two)
  119  * config(1m) man page.
  120  *
  121  * Each message is broken up and stored in segments that are msgssz bytes
  122  * long.  For efficiency reasons, this should be a power of two.  Also,
  123  * it doesn't make sense if it is less than 8 or greater than about 256.
  124  * Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of
  125  * two between 8 and 1024 inclusive (and panic's if it isn't).
  126  */
  127 struct msginfo {
  128         int     msgmax;         /* max chars in a message */
  129         int     msgmni;         /* max message queue identifiers */
  130         int     msgmnb;         /* max chars in a queue */
  131         int     msgtql;         /* max messages in system */
  132         int     msgssz;         /* size of a message segment (see note) */
  133         int     msgseg;         /* number of message segments */
  134 };
  135 
  136 /*
  137  * Kernel wrapper for the user-level structure.
  138  */
  139 struct msqid_kernel {
  140         /*
  141          * Data structure exposed to user space.
  142          */
  143         struct  msqid_ds u;
  144 
  145         /*
  146          * Kernel-private components of the message queue.
  147          */
  148         struct  label *label;   /* MAC label */
  149         struct  ucred *cred;    /* creator's credentials */
  150 };
  151 #endif
  152 
  153 #ifdef _KERNEL
  154 extern struct msginfo   msginfo;
  155 
  156 #else /* _KERNEL */
  157 
  158 __BEGIN_DECLS
  159 int msgctl(int, int, struct msqid_ds *);
  160 int msgget(key_t, int);
  161 ssize_t msgrcv(int, void *, size_t, long, int);
  162 int msgsnd(int, const void *, size_t, int);
  163 #if __BSD_VISIBLE
  164 int msgsys(int, ...);
  165 #endif
  166 __END_DECLS
  167 #endif /* !_KERNEL */
  168 
  169 #endif /* !_SYS_MSG_H_ */

Cache object: f32d1694aaf981584bf1f57dac9e54f7


[ 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.