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: releng/5.2/sys/sys/msg.h 109895 2003-01-26 20:09:34Z alfred $ */
    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 /*
   61  * XXX there seems to be no prefix reserved for this header, so the name
   62  * "msg" in "struct msg" and the names of all of the nonstandard members
   63  * (mainly "msg_pad*) are namespace pollution.
   64  */
   65 
   66 struct msqid_ds {
   67         struct  ipc_perm msg_perm;      /* msg queue permission bits */
   68         struct  msg *msg_first; /* first message in the queue */
   69         struct  msg *msg_last;  /* last message in the queue */
   70         msglen_t msg_cbytes;    /* number of bytes in use on the queue */
   71         msgqnum_t msg_qnum;     /* number of msgs in the queue */
   72         msglen_t msg_qbytes;    /* max # of bytes on the queue */
   73         pid_t   msg_lspid;      /* pid of last msgsnd() */
   74         pid_t   msg_lrpid;      /* pid of last msgrcv() */
   75         time_t  msg_stime;      /* time of last msgsnd() */
   76         long    msg_pad1;
   77         time_t  msg_rtime;      /* time of last msgrcv() */
   78         long    msg_pad2;
   79         time_t  msg_ctime;      /* time of last msgctl() */
   80         long    msg_pad3;
   81         long    msg_pad4[4];
   82 };
   83 
   84 #if __BSD_VISIBLE
   85 /*
   86  * Structure describing a message.  The SVID doesn't suggest any
   87  * particular name for this structure.  There is a reference in the
   88  * msgop man page that reads "The structure mymsg is an example of what
   89  * this user defined buffer might look like, and includes the following
   90  * members:".  This sentence is followed by two lines equivalent
   91  * to the mtype and mtext field declarations below.  It isn't clear
   92  * if "mymsg" refers to the name of the structure type or the name of an
   93  * instance of the structure...
   94  */
   95 struct mymsg {
   96         long    mtype;          /* message type (+ve integer) */
   97         char    mtext[1];       /* message body */
   98 };
   99 #endif
  100 
  101 #ifdef _KERNEL
  102 
  103 /*
  104  * Based on the configuration parameters described in an SVR2 (yes, two)
  105  * config(1m) man page.
  106  *
  107  * Each message is broken up and stored in segments that are msgssz bytes
  108  * long.  For efficiency reasons, this should be a power of two.  Also,
  109  * it doesn't make sense if it is less than 8 or greater than about 256.
  110  * Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of
  111  * two between 8 and 1024 inclusive (and panic's if it isn't).
  112  */
  113 struct msginfo {
  114         int     msgmax,         /* max chars in a message */
  115                 msgmni,         /* max message queue identifiers */
  116                 msgmnb,         /* max chars in a queue */
  117                 msgtql,         /* max messages in system */
  118                 msgssz,         /* size of a message segment (see notes above) */
  119                 msgseg;         /* number of message segments */
  120 };
  121 extern struct msginfo   msginfo;
  122 
  123 #else /* !_KERNEL */
  124 
  125 __BEGIN_DECLS
  126 int msgctl(int, int, struct msqid_ds *);
  127 int msgget(key_t, int);
  128 /* XXX return value should be ssize_t. */
  129 int msgrcv(int, void *, size_t, long, int);
  130 int msgsnd(int, const void *, size_t, int);
  131 #if __BSD_VISIBLE
  132 int msgsys(int, ...);
  133 #endif
  134 __END_DECLS
  135 
  136 #endif /* _KERNEL */
  137 
  138 #endif /* !_SYS_MSG_H_ */

Cache object: 43e3afe345ab89b6ec196c275ec3ba2b


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