From 6f36b466f3008eb6aef6696c86ff678e181a5a9a Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Mon, 29 Feb 2016 20:43:07 +0530 Subject: [PATCH] minix: Prepare for message queue support to Minix kernel This commit adds preparatory support for forthcoming message queue implementation to the Minix kernel. The core implementation will be added with the next commit. --- minix/commands/service/parse.c | 4 ++++ minix/include/minix/com.h | 7 ++++++- minix/kernel/config.h | 1 + minix/kernel/system.c | 6 ++++++ minix/kernel/system.h | 20 ++++++++++++++++++++ minix/kernel/system/Makefile.inc | 6 +++++- 6 files changed, 42 insertions(+), 2 deletions(-) diff --git a/minix/commands/service/parse.c b/minix/commands/service/parse.c index 593c2ae75..f4eeab39f 100644 --- a/minix/commands/service/parse.c +++ b/minix/commands/service/parse.c @@ -849,6 +849,10 @@ struct { "VMCTL", SYS_VMCTL }, { "MEMSET", SYS_MEMSET }, { "PADCONF", SYS_PADCONF }, + { "MQ_OPEN", SYS_MQ_OPEN}, + { "MQ_CLOSE", SYS_MQ_CLOSE}, + { "MQ_SEND", SYS_MQ_SEND}, + { "MQ_REC", SYS_MQ_REC}, { NULL, 0 } }; diff --git a/minix/include/minix/com.h b/minix/include/minix/com.h index ffd909946..3ea2ba3b5 100644 --- a/minix/include/minix/com.h +++ b/minix/include/minix/com.h @@ -262,8 +262,13 @@ # define SYS_PADCONF (KERNEL_CALL + 57) /* sys_padconf() */ +# define SYS_MQ_OPEN (KERNEL_CALL + 58) /* sys_mq_open */ +# define SYS_MQ_CLOSE (KERNEL_CALL + 59) /* sys_mq_close */ +# define SYS_MQ_SEND (KERNEL_CALL + 60) /* sys_mq_send */ +# define SYS_MQ_REC (KERNEL_CALL + 61) /* sys_mq_rec */ + /* Total */ -#define NR_SYS_CALLS 58 /* number of kernel calls */ +#define NR_SYS_CALLS 62 /* number of kernel calls */ #define SYS_CALL_MASK_SIZE BITMAP_CHUNKS(NR_SYS_CALLS) diff --git a/minix/kernel/config.h b/minix/kernel/config.h index a99b2990a..b610af24c 100644 --- a/minix/kernel/config.h +++ b/minix/kernel/config.h @@ -45,6 +45,7 @@ #define USE_RUNCTL 1 /* control stop flags of a process */ #define USE_STATECTL 1 /* let a process control its state */ #define USE_MCONTEXT 1 /* enable getting/setting of machine context */ +#define USE_MQ_IPC 1 /* enable user space message queues IPC */ #if defined(__arm__) #define USE_PADCONF 1 /* configure pinmux */ diff --git a/minix/kernel/system.c b/minix/kernel/system.c index 78724262e..50edbfccd 100644 --- a/minix/kernel/system.c +++ b/minix/kernel/system.c @@ -268,6 +268,12 @@ void system_init(void) map(SYS_SCHEDULE, do_schedule); /* reschedule a process */ map(SYS_SCHEDCTL, do_schedctl); /* change process scheduler */ + /* User space IPC */ + map(SYS_MQ_OPEN, do_mq_open); /* open a message queue */ + map(SYS_MQ_CLOSE, do_mq_close); /* close a message queue */ + map(SYS_MQ_SEND, do_mq_send); /* send to a message queue */ + map(SYS_MQ_REC, do_mq_rec); /* receive from a message queue */ + } /*===========================================================================* * get_priv * diff --git a/minix/kernel/system.h b/minix/kernel/system.h index 2adf3954c..31224d897 100644 --- a/minix/kernel/system.h +++ b/minix/kernel/system.h @@ -206,5 +206,25 @@ int do_padconf(struct proc * caller, message *m_ptr); #define do_padconf NULL #endif +int do_mq_open(struct proc * caller, message *m_ptr); +#if ! USE_MQ_IPC +#define do_mq_open NULL +#endif + +int do_mq_close(struct proc * caller, message *m_ptr); +#if ! USE_MQ_IPC +#define do_mq_close NULL +#endif + +int do_mq_send(struct proc * caller, message *m_ptr); +#if ! USE_MQ_IPC +#define do_mq_send NULL +#endif + +int do_mq_rec(struct proc * caller, message *m_ptr); +#if ! USE_MQ_IPC +#define do_mq_rec NULL +#endif + #endif /* SYSTEM_H */ diff --git a/minix/kernel/system/Makefile.inc b/minix/kernel/system/Makefile.inc index 8c188a2e4..8a31c94d2 100644 --- a/minix/kernel/system/Makefile.inc +++ b/minix/kernel/system/Makefile.inc @@ -37,7 +37,11 @@ SRCS+= \ do_mcontext.c \ do_schedule.c \ do_schedctl.c \ - do_statectl.c + do_statectl.c \ + do_mq_open.c \ + do_mq_close.c \ + do_mq_send.c \ + do_mq_rec.c .if ${MACHINE_ARCH} == "i386" SRCS+= \