X-Git-Url: http://ftp.safe.ca/?p=safe%2Fjmp%2Flinux-2.6;a=blobdiff_plain;f=ipc%2Fmsgutil.c;h=f095ee26883333fcc69d7c32e907a8f1949e2f3f;hp=0992616eeed6fee540337d595800667db4bf838d;hb=4434ade8c9334a3ab975d8993de456f06841899e;hpb=f30c2269544bffc7bf1b0d7c0abe5be1be83b8cb diff --git a/ipc/msgutil.c b/ipc/msgutil.c index 0992616..f095ee2 100644 --- a/ipc/msgutil.c +++ b/ipc/msgutil.c @@ -13,10 +13,29 @@ #include #include #include +#include #include #include "util.h" +DEFINE_SPINLOCK(mq_lock); + +/* + * The next 2 defines are here bc this is the only file + * compiled when either CONFIG_SYSVIPC and CONFIG_POSIX_MQUEUE + * and not CONFIG_IPC_NS. + */ +struct ipc_namespace init_ipc_ns = { + .count = ATOMIC_INIT(1), +#ifdef CONFIG_POSIX_MQUEUE + .mq_queues_max = DFLT_QUEUESMAX, + .mq_msg_max = DFLT_MSGMAX, + .mq_msgsize_max = DFLT_MSGSIZEMAX, +#endif +}; + +atomic_t nr_ipc_ns = ATOMIC_INIT(1); + struct msg_msgseg { struct msg_msgseg* next; /* the next part of the message follows immediately */ @@ -36,7 +55,7 @@ struct msg_msg *load_msg(const void __user *src, int len) if (alen > DATALEN_MSG) alen = DATALEN_MSG; - msg = (struct msg_msg *)kmalloc(sizeof(*msg) + alen, GFP_KERNEL); + msg = kmalloc(sizeof(*msg) + alen, GFP_KERNEL); if (msg == NULL) return ERR_PTR(-ENOMEM); @@ -56,7 +75,7 @@ struct msg_msg *load_msg(const void __user *src, int len) alen = len; if (alen > DATALEN_SEG) alen = DATALEN_SEG; - seg = (struct msg_msgseg *)kmalloc(sizeof(*seg) + alen, + seg = kmalloc(sizeof(*seg) + alen, GFP_KERNEL); if (seg == NULL) { err = -ENOMEM;