OpenVZ Forum


Home » Mailing lists » Devel » [PATCH v3 00/10] IPC: checkpoint/restore in userspace enhancements
[PATCH v3 09/10] ipc: add new MSG_SET_COPY command for sys_msgctl() call [message #47418 is a reply to message #47409] Fri, 10 August 2012 14:26 Go to previous messageGo to previous message
Stanislav Kinsbursky is currently offline  Stanislav Kinsbursky
Messages: 683
Registered: October 2011
Senior Member
New MSG_SET_COPY allows to set specified queue copy counter to passed value.
Passed "struct msqid_ds *buf" interpreted as pointer to unsigned int in this
case.
---
include/linux/msg.h | 1 +
ipc/compat.c | 3 +++
ipc/msg.c | 18 ++++++++++++++++++
3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/include/linux/msg.h b/include/linux/msg.h
index 07a5e1e..4e9ddf4 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -7,6 +7,7 @@
#define MSG_STAT 11
#define MSG_INFO 12
#define MSG_SET 13
+#define MSG_SET_COPY 14

/* msgrcv options */
#define MSG_NOERROR 010000 /* no error if message is too big */
diff --git a/ipc/compat.c b/ipc/compat.c
index 6b07f5c..9e5acc7 100644
--- a/ipc/compat.c
+++ b/ipc/compat.c
@@ -481,6 +481,9 @@ long compat_sys_msgctl(int first, int second, void __user *uptr)
case IPC_INFO:
case IPC_RMID:
case MSG_INFO:
+#ifdef CONFIG_CHECKPOINT_RESTORE
+ case MSG_SET_COPY:
+#endif
err = sys_msgctl(first, second, uptr);
break;

diff --git a/ipc/msg.c b/ipc/msg.c
index 44ba0ce..c63b22e 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -579,6 +579,24 @@ SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, struct msqid_ds __user *, buf)
case MSG_SET:
err = msgctl_down(ns, msqid, cmd, buf, version);
return err;
+#ifdef CONFIG_CHECKPOINT_RESTORE
+ case MSG_SET_COPY:
+ {
+ int copy_cnt;
+
+ if (!buf)
+ return -EFAULT;
+ if (get_user(copy_cnt, (unsigned int *)buf))
+ return -EFAULT;
+
+ msq = msg_lock(ns, msqid);
+ if (IS_ERR(msq))
+ return PTR_ERR(msq);
+ msq->q_copy_cnt = copy_cnt;
+ err = 0;
+ break;
+ }
+#endif
default:
return -EINVAL;
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [RFC PATCH 1/2] unix sockets: add ability for search for peer from passed root
Next Topic: [PATCH] SUNRPC: check current nsproxy before set of node name on client creation
Goto Forum:
  


Current Time: Mon Oct 13 08:02:50 GMT 2025

Total time taken to generate the page: 0.25207 seconds