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