unified SysV and POSIX mqueues - complete rewrite
PATCH 1/1 unified SysV and POSIX mqueues - complete rewrite
[part to lkml]
Alan, feel invited to add it to your -ac tree :-)
There are at least 3 attempts to provide POSIX mqueues for Linux:
a) early attempt of Jakub Jelinek based on 2.4-test based on a filesystem with read/write/ioctl interface - very intrusive to ipc/msg.c
b) http://www.mat.uni.torun.pl/~wrona/posix_ipc
complicated standalone version (against recent 2.4), with multiplexed syscall - and great effort to keep track of resources which is far easier accomplished by vfs
c) based on a filesystem with its own syscalls and clean separation (but dependence ) on SysV ipc/msg.c
why separate syscalls? you cannot specify the priority of a sent message without ioctl/fcntl, also problems with timed versions - and yes there is an outstanding issue with priority aware waitqueues
interface stub and userspace implementation is on
http://homepage.mac.com/pwaechtler/linux/mqueue.tgz
The userspace implementation is not complete. There we have the problems with the locks on crashing apps (we could use flock), signal safety but what about the timed versions? Performance is not as good as kernel version!?
following patch is against 2.5.49
arch/i386/kernel/entry.S +13 -2
@@ -741,8 +741,19 @@ .long sys_epoll_create .long sys_epoll_ctl /* 255 */ .long sys_epoll_wait - .long sys_remap_file_pages - .long sys_set_tid_address + .long sys_remap_file_pages + .long sys_set_tid_address + .long sys_ni_syscall + .long sys_ni_syscall /* 260 */ + .long sys_ni_syscall + .long sys_ni_syscall + .long sys_mq_open + .long sys_mq_unlink + .long sys_mq_timedsend /* 265 */ + .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,9 +261,16 @@#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_set_tid_address 258 - +#define __NR_sys_mq_open 263 +#define __NR_sys_mq_unlink 264 +#define __NR_mq_timedsend 265 +#define __NR_mq_timedreceive 266 +#define __NR_mq_notify 267 +#define __NR_mq_getattr 268 +#define __NR_mq_setattr 269 +/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
include/linux/mqueue.h +49 -0
49 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/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;
ipc/posixmsg.c +829 -0
829 lines not on this page · raw message
ipc/util.c +50 -0
59 lines not on this page · raw message
A message that is not in the archive (sent off-list or not yet received): [email protected]
Am Montag, 25. November 2002 00:24 schrieb Andrew Morton:
Quoted 6 lines
Quoted 2 lines · Peter Waechtler
...
kernel.patch Type: text/x-diffIt's not legal to call copy_*_user inside spinlock. You sem to dothin in several places.
Yes, I know.
here a fixed version - there was also an error in putting the mqflags together in setattr/getattr
arch/i386/kernel/entry.S +13 -2
@@ -741,8 +741,19 @@ .long sys_epoll_create .long sys_epoll_ctl /* 255 */ .long sys_epoll_wait - .long sys_remap_file_pages - .long sys_set_tid_address + .long sys_remap_file_pages + .long sys_set_tid_address + .long sys_ni_syscall + .long sys_ni_syscall /* 260 */ + .long sys_ni_syscall + .long sys_ni_syscall + .long sys_mq_open + .long sys_mq_unlink + .long sys_mq_timedsend /* 265 */ + .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,9 +261,16 @@#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_set_tid_address 258 - +#define __NR_sys_mq_open 263 +#define __NR_sys_mq_unlink 264 +#define __NR_mq_timedsend 265 +#define __NR_mq_timedreceive 266 +#define __NR_mq_notify 267 +#define __NR_mq_getattr 268 +#define __NR_mq_setattr 269 +/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
include/linux/mqueue.h +49 -0
49 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/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;
ipc/posixmsg.c +828 -0
828 lines not on this page · raw message
ipc/util.c +50 -0
59 lines not on this page · raw message