From dbb41ce2b7f309d394054a6bd1e33afd578798a5 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Fri, 23 Oct 2020 15:18:01 +0200 Subject: Move the source code of all xloop components to the common 'src' directory --- src/kernel/tests/include/ipcmsg.h | 68 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/kernel/tests/include/ipcmsg.h (limited to 'src/kernel/tests/include/ipcmsg.h') diff --git a/src/kernel/tests/include/ipcmsg.h b/src/kernel/tests/include/ipcmsg.h new file mode 100644 index 0000000..d89894b --- /dev/null +++ b/src/kernel/tests/include/ipcmsg.h @@ -0,0 +1,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 +#include +#include +#include + +#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 */ -- cgit v1.2.3-55-g7522