unified SysV and POSIX mqueues - complete rewrite
PATCH 1/1 unified SysV and POSIX mqueues - complete rewrite
I completely rewrote the unified SysV and Posix mqueue patch from Jakub Jelinek.
It adds a new msgfs filesystem that's also mountable to lookup the names and to unlink() them.
The size of the fifo shows the number of msgs in the queue. The interface boils down to 7 new syscalls (for now just i386):
- sys_mq_open
- sys_mq_unlink
- sys_mq_timedsend
- sys_mq_timedreceive
- sys_mq_notify
- sys_mq_getattr
- sys_mq_setattr
mq_close is a simple sys_close - the FD is pollable (enhancement)
The change to ipc/msg.c is minimal - just make
- load_msg
- store_msg
- free_msg
accessible (not static).
Now that I've missed the feature freeze - I want to argue that it's not a new feature - it's a new interface just using already available features :-)
userspace lib and test progs are on
http://homepage.mac.com/pwaechtler/linux/mqueue/
I'll pipe some code to Ulrich Drepper for inclusion to glibc. (Linux interface and userspace impl. for all other platforms).
ipc/msg.c +3 -3
@@ -127,7 +127,7 @@return msg_buildid (id,msq->q_perm.seq); } -static void free_msg (struct msg_msg * msg) +void free_msg (struct msg_msg * msg) {struct msg_msgseg * seg; seg = msg->next;
@@ -139,7 +139,7 @@ } } -static struct msg_msg *load_msg (void * src,int len) +struct msg_msg *load_msg (void * src,int len) {struct msg_msg * msg;struct msg_msgseg ** pseg;
@@ -191,7 +191,7 @@return ERR_PTR (err); } -static int store_msg (void * dest,struct msg_msg * msg,int len) +int store_msg (void * dest,struct msg_msg * msg,int len) {int alen;struct msg_msgseg *seg;
arch/i386/kernel/entry.S +8 -1
@@ -740,7 +740,14 @@ .long sys_epoll_create .long sys_epoll_ctl /* 255 */ .long sys_epoll_wait - .long sys_remap_file_pages + .long sys_remap_file_pages + .long sys_mq_open + .long sys_mq_unlink + .long sys_mq_timedsend /* 260 */ + .long sys_mq_timedreceive + .long sys_mq_notify + .long sys_mq_getattr + .long sys_mq_setattr .rept NR_syscalls-(.-sys_call_table)/4
include/asm-i386/unistd.h +9 -2
@@ -261,8 +261,15 @@#define __NR_sys_epoll_create 254#define __NR_sys_epoll_ctl 255#define __NR_sys_epoll_wait 256 -#define __NR_remap_file_pages 257 - +#define __NR_remap_file_pages 257 +#define __NR_mq_open 258 +#define __NR_mq_unlink 259 +#define __NR_mq_timedsend 260 +#define __NR_mq_timedreceive 261 +#define __NR_mq_notify 262 +#define __NR_mq_getattr 263 +#define __NR_mq_setattr 264 +/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
include/linux/mqueue.h +46 -0
46 lines not on this page · raw message
include/linux/sys.h +1 -1
@@ -4,7 +4,7 @@/* * system call entry points ... but not all are defined */ -#define NR_syscalls 260 +#define NR_syscalls 270/* * These are system calls that will be removed at some time
init/Kconfig +7 -0
@@ -69,6 +69,13 @@ section 6.4 of the Linux Programmer's Guide, available from <http://www.linuxdoc.org/docs.html#guide>. +config POSIXMSG + bool "POSIX message queues" + depends on SYSVIPC + ---help--- + This gives you POSIX compliant interfaces for message queues. + + config BSD_PROCESS_ACCT bool "BSD Process Accounting" help
ipc/Makefile +4 -0
@@ -6,4 +6,8 @@ obj-$(CONFIG_SYSVIPC) += msg.o sem.o shm.o +ifeq ($(CONFIG_POSIXMSG),y) +obj-$(CONFIG_SYSVIPC) += posixmsg.o +endif + include $(TOPDIR)/Rules.make
ipc/posixmsg.c +814 -0
814 lines not on this page · raw message
ipc/util.c +55 -0
64 lines not on this page · raw message