Misc interrupts/LWKT 1/2: interlock the idle thread. Put execution of
[dragonfly.git] / sys / sys / msg.h
1 /* $FreeBSD: src/sys/sys/msg.h,v 1.10.2.1 2000/08/04 22:31:10 peter Exp $ */
2 /* $DragonFly: src/sys/sys/msg.h,v 1.2 2003/06/17 04:28:58 dillon Exp $ */
3 /*      $NetBSD: msg.h,v 1.4 1994/06/29 06:44:43 cgd Exp $      */
4
5 /*
6  * SVID compatible msg.h file
7  *
8  * Author:  Daniel Boulet
9  *
10  * Copyright 1993 Daniel Boulet and RTMX Inc.
11  *
12  * This system call was implemented by Daniel Boulet under contract from RTMX.
13  *
14  * Redistribution and use in source forms, with and without modification,
15  * are permitted provided that this entire comment appears intact.
16  *
17  * Redistribution in binary form may occur without any restrictions.
18  * Obviously, it would be nice if you gave credit where credit is due
19  * but requiring it would be too onerous.
20  *
21  * This software is provided ``AS IS'' without any warranties of any kind.
22  */
23
24 #ifndef _SYS_MSG_H_
25 #define _SYS_MSG_H_
26
27 #include <sys/ipc.h>
28
29 /*
30  * The MSG_NOERROR identifier value, the msqid_ds struct and the msg struct
31  * are as defined by the SV API Intel 386 Processor Supplement.
32  */
33
34 #define MSG_NOERROR     010000          /* don't complain about too long msgs */
35
36 struct msg;
37
38 struct msqid_ds {
39         struct  ipc_perm msg_perm;      /* msg queue permission bits */
40         struct  msg *msg_first; /* first message in the queue */
41         struct  msg *msg_last;  /* last message in the queue */
42         u_long  msg_cbytes;     /* number of bytes in use on the queue */
43         u_long  msg_qnum;       /* number of msgs in the queue */
44         u_long  msg_qbytes;     /* max # of bytes on the queue */
45         pid_t   msg_lspid;      /* pid of last msgsnd() */
46         pid_t   msg_lrpid;      /* pid of last msgrcv() */
47         time_t  msg_stime;      /* time of last msgsnd() */
48         long    msg_pad1;
49         time_t  msg_rtime;      /* time of last msgrcv() */
50         long    msg_pad2;
51         time_t  msg_ctime;      /* time of last msgctl() */
52         long    msg_pad3;
53         long    msg_pad4[4];
54 };
55
56 /*
57  * Structure describing a message.  The SVID doesn't suggest any
58  * particular name for this structure.  There is a reference in the
59  * msgop man page that reads "The structure mymsg is an example of what
60  * this user defined buffer might look like, and includes the following
61  * members:".  This sentence is followed by two lines equivalent
62  * to the mtype and mtext field declarations below.  It isn't clear
63  * if "mymsg" refers to the naem of the structure type or the name of an
64  * instance of the structure...
65  */
66 struct mymsg {
67         long    mtype;          /* message type (+ve integer) */
68         char    mtext[1];       /* message body */
69 };
70
71 #ifdef _KERNEL
72
73 /*
74  * Based on the configuration parameters described in an SVR2 (yes, two)
75  * config(1m) man page.
76  *
77  * Each message is broken up and stored in segments that are msgssz bytes
78  * long.  For efficiency reasons, this should be a power of two.  Also,
79  * it doesn't make sense if it is less than 8 or greater than about 256.
80  * Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of
81  * two between 8 and 1024 inclusive (and panic's if it isn't).
82  */
83 struct msginfo {
84         int     msgmax,         /* max chars in a message */
85                 msgmni,         /* max message queue identifiers */
86                 msgmnb,         /* max chars in a queue */
87                 msgtql,         /* max messages in system */
88                 msgssz,         /* size of a message segment (see notes above) */
89                 msgseg;         /* number of message segments */
90 };
91 extern struct msginfo   msginfo;
92 #endif
93
94 #ifndef _KERNEL
95
96 #include <sys/cdefs.h>
97
98 __BEGIN_DECLS
99 int msgsys __P((int, ...));
100 int msgctl __P((int, int, struct msqid_ds *));
101 int msgget __P((key_t, int));
102 int msgsnd __P((int, void *, size_t, int));
103 int msgrcv __P((int, void*, size_t, long, int));
104 __END_DECLS
105 #endif
106
107 #endif /* !_SYS_MSG_H_ */