mqueue filesystem
Subsystems (2)
PATCH 1/1 mqueue filesystem
Michal & Krzysztof,
I was trying out your mqueue filesystem patch, and found that a couple of changes in 2.6.0-test4 caused your patch to no longer build. Here is a patch against the latest bk tree (2.6.0-test5+) that:
* no longer uses the now non-existent kdev_t system by no long setting
inode->i_rdev = NODEV;
* removing the use of _IOW(something, something, void) since this is now caught by the build system with a forced error
Since the two ioctls that used this only called dummy functions, it seemed to me like the right thing to do was just remove them seeing as the didn't really do anything. I'm refering to the original ==>
+#define MQ_IOC_CLOSE _IOW(0xB2, 5, void)
+#define MQ_IOC_SETATTR _IOW(0xB2, 6, void)
* since I was hammering on the system, and because wanting to tune some of the hard coded values in your patch, I also added proc support for controlling the maximum number of queues, the maximum memory usage, and also added a proc entry for getting the current amount of memory used by all message queues.
For what it is worth, I have been hammering the hell out of this filesystem without exposing any problems.
--rustyl
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1276 -> 1.1277
# ipc/Makefile 1.3 -> 1.4
# Documentation/filesystems/proc.txt 1.16 -> 1.17
# fs/Kconfig 1.29 -> 1.30
# CREDITS 1.97 -> 1.98
# Documentation/ioctl-number.txt 1.10 -> 1.11
# (new) -> 1.1 include/linux/mqueue.h # (new) -> 1.1 ipc/mqueue.c
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/09/10 [email protected] 1.1217.8.1
# Adding the POSIX Message Queue Filesystem implemented by Krzysztof Benedyczak
# and Michal Wronski, along with proc support for a couple of tunables. # -------------------------------------------- # 03/09/10 [email protected] 1.1277 # Merge http://linux.bkbits.net:8080/linux-2.5 # into penguin.co.intel.com:/src/linux/linus # -------------------------------------------- # diff -Nru a/CREDITS b/CREDITS --- a/CREDITS Wed Sep 10 12:54:48 2003 +++ b/CREDITS Wed Sep 10 12:54:48 2003 @@ -289,6 +289,15 @@ S: Terni 05100 S: Italy
+N: Krzysztof Benedyczak
+E: [email protected]
+W: http://www.mat.uni.torun.pl/~golbi
+D: POSIX message queues fs (with M. Wronski)
+S: ul. Podmiejska 52
+S: Radunica
+S: 83-000 Pruszcz Gdanski
+S: Poland
+
N: Randolph Bentson
E: [email protected]
W: http://www.aa.net/~bentson/
@@ -3466,6 +3475,14 @@
S: 920 SW 3rd, Ste. 100
S: Portland, OR 97204
S: USA
+
+N: Michal Wronski
+E: [email protected]
+W: http://www.mat.uni.torun.pl/~wrona
+D: POSIX message queues fs (with K. Benedyczak)
+S: ul. Teczowa 23/12
+S: 80-680 Gdansk-Sobieszewo
+S: Poland
N: Frank Xia
E: [email protected]
Documentation/filesystems/proc.txt +20 -0
@@ -38,6 +38,7 @@ 2.8 /proc/sys/net/ipv4 - IPV4 settings 2.9 Appletalk 2.10 IPX + 2.11 POSIX Message Queues Filesystem ------------------------------------------------------------------------------ Preface
@@ -1804,6 +1805,25 @@ The /proc/net/ipx_route table holds a list of IPX routes. For each route it gives the destination network, the router node (or Directly) and the network address of the router (or Connected) for internal networks. + +2.11 POSIX Message Queues Filesystem + +The "mqueue" filesystem provides the nessicary kernel features to enable the +creation of a user space library that implements the POSIX message queues +API (as noted by the MSG tag in the POSIX 1003.1-2001 version of the System +Interfaces specification.) + +The "mqueue" filesystem contains both tunable values as well as informative +values for determining the amount of resources used by the file system. + +/proc/fs/mqueue/max_queues is a read/write file for setting/getting the +maximum number of message queues allowed on the system. + +/proc/fs/mqueue/max_sys_size is a read/write file for setting/getting the +maximum bytes of memory utilited by the entire system for storing messages. + +/proc/fs/mqueue/msgs_size is a read-only file for getting the total amount +of memory currently being used to store all messages on the system. ------------------------------------------------------------------------------ Summary
Documentation/ioctl-number.txt +1 -0
@@ -189,5 +189,6 @@ 0xB0 all RATIO devices in development: <mailto:[email protected]> 0xB1 00-1F PPPoX <mailto:[email protected]> +0xB2 00-0F POSIX Message Queues <http://www.mat.uni.torun.pl/~wrona/posix_ipc> 0xCB 00-1F CBM serial IEC bus in development: <mailto:[email protected]>
fs/Kconfig +36 -0
@@ -882,6 +882,42 @@ say M here and read <file:Documentation/modules.txt>. The module will be called ramfs. +config POSIX_MQUEUE_FS + tristate "POSIX Message Queues" + ---help--- + POSIX variant of message queues is a part of IPC. In POSIX message + queues every message has a priority which decides about succession + of receiving it by a process. If you want to compile and run + programs written e.g. for Solaris with use of its POSIX message + queues (functions mq_*) say Y here. To use this feature you will + also need mqueue library, available from + <http://www.mat.uni.torun.pl/~wrona/posix_ipc/> + + POSIX message queues are visible as a filesystem called 'mqueue' + and should be mounted in /dev/mqueue in order to work with standard + library. + + If you want to compile this as a module ( = code which can be + inserted in and removed from the running kernel whenever you want), + say M here and read <file:Documentation/modules.txt>. The module + will be called mqueue.o. + + If unsure, say N. + +config POSIX_MQUEUE_FS_PROC + bool "/proc/fs/mqueue support" + depends on POSIX_MQUEUE_FS + ---help--- + Enabling this opion will add various files to the /proc/fs/mqueue + directory providing the ability to tune the mqueue filesystem, and + also query resource usage. + + For more information on the specific tunables, see + Documentation/filesystems/proc.txt. + + There is a small amount of overhead to be paid for adding proc + support, but other then that it should be safe to enable this option. + endmenu menu "Miscellaneous filesystems"
include/linux/mqueue.h new file +39 -0
@@ -0,0 +1,39 @@ +#ifndef _LINUX_MQUEUE_H +#define _LINUX_MQUEUE_H + +#include <asm/types.h> + +#define MQ_MAX 64/* max number of message queues */ +#define MQ_MAXMSG 40/* max number of messages in each queue */ +#define MQ_MSGSIZE 16384/* max message size */ +#define MQ_MAXSYSSIZE 1048576/* max size that all m.q. can have together */ +#define MQ_PRIO_MAX 32768/* max priority */ + +typedef int mqd_t ; + +struct kern_mq_attr { +__u32 mq_flags;/* message queue flags */ +__u32 mq_maxmsg;/* maximum number of messages */ +__u32 mq_msgsize;/* maximum message size */ +__u32 mq_curmsgs;/* number of messages currently queued */ +}; + +/* +* struct for passing data via ioctl calls +*/ + +/* the same for send & receive */ +struct ioctl_mq_sndrcv { +__u64 msg_ptr; +__u32 msg_len; +__u64 msg_prio;/* it is long or long* */ +__u64 timeout; +}; + +#define MQ_IOC_CREATE _IOW(0xB2, 0, struct kern_mq_attr) +#define MQ_IOC_GETATTR _IOR(0xB2, 1, struct kern_mq_attr) +#define MQ_IOC_SEND _IOW(0xB2, 2, struct ioctl_mq_sndrcv) +#define MQ_IOC_RECEIVE _IOR(0xB2, 3, struct ioctl_mq_sndrcv) +#define MQ_IOC_NOTIFY _IOW(0xB2, 4, struct sigevent) + +#endif
ipc/Makefile +1 -0
@@ -5,3 +5,4 @@ obj-y := util.o obj-$(CONFIG_SYSVIPC) += msg.o sem.o shm.o +obj-$(CONFIG_POSIX_MQUEUE_FS) += mqueue.o
ipc/mqueue.c new file +1181 -0
1,181 lines not on this page · raw message