summaryrefslogtreecommitdiffstats
path: root/src/kernel/tests/include/ipcmsg.h
blob: d89894b726cf5562fc2ac49febcb22f78e280440 (plain) (blame)
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
/*
 *
 *   Copyright (c) International Business Machines  Corp., 2001
 *
 *   This program is free software;  you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 *   the GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program;  if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

/*
 * ipcmsg.h - common definitions for the IPC message tests.
 */

#ifndef __IPCMSG_H
#define __IPCMSG_H	1

#include <errno.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/types.h>

#include "test.h"

void cleanup(void);
void setup(void);

#define MSG_RD  0400            /* read permission for the queue */
#define MSG_WR  0200            /* write permission for the queue */
#define MSG_RW	MSG_RD | MSG_WR

#define MSGSIZE	1024		/* a resonable size for a message */
#define MSGTYPE 1		/* a type ID for a message */

#define NR_MSGQUEUES	16	/* MSGMNI as defined in linux/msg.h */

#define min(a, b)	(((a) < (b)) ? (a) : (b))

typedef struct mbuf {		/* a generic message structure */
	long mtype;
	char mtext[MSGSIZE + 1];  /* add 1 here so the message can be 1024   */
} MSGBUF;			  /* characters long with a '\0' termination */

#ifdef LIBIPC
key_t msgkey;                   /* the ftok() generated message key */
#else
extern key_t msgkey;                   /* the ftok() generated message key */
#endif

void init_buf(MSGBUF *, int, int);
void rm_queue(int);

key_t getipckey();
int getuserid(char *);

int get_max_msgqueues(void);
int get_used_msgqueues(void);

#endif /* ipcmsg.h */