2/6 POSIX message queues
RFC PATCH 1/1 2/6 POSIX message queues
// $Header$
// Kernel Version:
// VERSION = 2 // PATCHLEVEL = 6 // SUBLEVEL = 2 // EXTRAVERSION =
ipc/util.c +1 -0
@@ -24,6 +24,7 @@#include <linux/security.h> #include <linux/rcupdate.h> #include <linux/workqueue.h> +#include <linux/mqueue.h> #if defined(CONFIG_SYSVIPC )
arch/i386/kernel/entry.S +6 -0
@@ -882,5 +882,11 @@ .long sys_utimes .long sys_fadvise64_64 .long sys_ni_syscall /* sys_vserver */ + .long sys_mq_open + .long sys_mq_unlink /* 275 */ + .long sys_mq_timedsend + .long sys_mq_timedreceive + .long sys_mq_notify + .long sys_mq_getsetattr syscall_table_size=(.-sys_call_table)
include/asm-i386/unistd.h +7 -1
@@ -279,8 +279,14 @@#define __NR_utimes 271#define __NR_fadvise64_64 272#define __NR_vserver 273 +#define __NR_mq_open 274 +#define __NR_mq_unlink (__NR_mq_open+1) +#define __NR_mq_timedsend (__NR_mq_open+2) +#define __NR_mq_timedreceive (__NR_mq_open+3) +#define __NR_mq_notify (__NR_mq_open+4) +#define __NR_mq_getsetattr (__NR_mq_open+5) -#define NR_syscalls 274 +#define NR_syscalls 280/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
include/linux/mqueue.h +50 -0
50 lines not on this page · raw message
kernel/sys.c +6 -0
@@ -249,6 +249,12 @@ cond_syscall(sys_epoll_create) cond_syscall(sys_epoll_ctl) cond_syscall(sys_epoll_wait) +cond_syscall(sys_mq_open) +cond_syscall(sys_mq_unlink) +cond_syscall(sys_mq_timedsend) +cond_syscall(sys_mq_timedreceive) +cond_syscall(sys_mq_notify) +cond_syscall(sys_mq_getsetattr) /* arch-specific weak syscall entries */ cond_syscall(sys_pciconfig_read)
Quoted 11 lines
include/linux/mqueue.h +11
-0+#ifndef _LINUX_MQUEUE_H +#define _LINUX_MQUEUE_H + +#define MQ_PRIO_MAX 32768 + +typedef int mqd_t; + +struct mq_attr { + long mq_flags; /* message queue flags */ + long mq_maxmsg; /* maximum number of messages */ + long mq_msgsize; /* maximum message size */
include/linux/mqueue.h line 38
Quoted 10 lines
include/linux/mqueue.h +10
-0+long mq_curmsgs;/* number of messages currently queued */ +}; + +#define NOTIFY_NONE 0 +#define NOTIFY_WOKENUP 1 +#define NOTIFY_REMOVED 2 + +#ifdef __KERNEL__ +#include <linux/types.h> +#include <linux/time.h>
This looks like you want glibc to include it, please don't - add a copy without the kernel part to glibc instead.
include/linux/mqueue.h line 47
Quoted 6 lines
include/linux/mqueue.h +6
-0+asmlinkage long sys_mq_open (const char __user *name,int oflag,mode_t mode,struct mq_attr __user *attr); +asmlinkage long sys_mq_unlink (const char __user *name); +asmlinkage long mq_timedsend (mqd_t mqdes,const char __user *msg_ptr,size_t msg_len,unsigned int msg_prio,const struct timespec __user *abs_timeout); +asmlinkage ssize_t mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout); +asmlinkage long mq_notify (mqd_t mqdes,const struct sigevent __user *notification); +asmlinkage long mq_getsetattr (mqd_t mqdes,const struct mq_attr __user *mqstat,struct mq_attr __user *omqstat);
this probably fits better into randy's new syscall.h now in -mm. Also what do you need the prototypes for?
Quoted 16 lines · Christoph Hellwig
Quoted 16 lines
include/linux/mqueue.h +16
-0+#ifndef _LINUX_MQUEUE_H +#define _LINUX_MQUEUE_H + +#define MQ_PRIO_MAX 32768 + +typedef int mqd_t ; + +struct mq_attr { +long mq_flags;/* message queue flags */ +long mq_maxmsg;/* maximum number of messages */ +long mq_msgsize;/* maximum message size */ +long mq_curmsgs;/* number of messages currently queued */ +}; + +#define NOTIFY_NONE 0 +#define NOTIFY_WOKENUP 1
Quoted 8 lines
include/linux/mqueue.h line 38
Quoted 5 lines
include/linux/mqueue.h +5
-0+#define NOTIFY_REMOVED 2 + +#ifdef __KERNEL__ +#include <linux/types.h> +#include <linux/time.h> This looks like you want glibc to include it, please don't - add a copy without the kernel part to glibc instead.
In the previous threads about this the concept of kernel-only and shared user and kernel headers has been seen as a good solution.
So a split in a kernel-only part, and another kernel+user part seems more worth-while. And less error-prone.
Maybe something like:mqueue.h for kernel-onlymqueue_abi.h for kernel+user
Sam
Quoted 5 lines · Sam Ravnborg
Maybe something like:
mqueue.hfor kernel-onlymqueue_abi.hfor kernel+user
I don't think that this is necessary. Everything in <linux/> is kernel only. user space should copy the headers and remove the kernel only parts. kernel+user files mean that it's not possible rename structures or move them around. Perhaps someone wants to move all 16-bit uid structures into a <linux/compat/> directly - shared headers make that impossible.
I agree that the placement of the #ifdef is a bit arbitrary - it's a hint that the structures outside are visible to user space and must remain unchanged.
Christoph: I'm sure there will be users that must call the message queue functions directly from C code. E.g. the 32-bit emulation layers on 64/32 bit archs. And they need the prototypes.
--
Manfred