]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ipc: introduce message queue copy feature
authorStanislav Kinsbursky <skinsbursky@parallels.com>
Thu, 15 Nov 2012 02:38:42 +0000 (13:38 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 15 Nov 2012 06:32:16 +0000 (17:32 +1100)
commit59e6a569b2d3159d6f03f2e6439e32efb39e6f88
treee477bb48b1a2dd59bf33d9453eb1fab4962774a8
parent1a7969af3f9e29e0757c5f4c9dd091e82970b06a
ipc: introduce message queue copy feature

This patch is required for checkpoint/restore in userspace.

c/r requires some way to get all pending IPC messages without deleting
them from the queue (checkpoint can fail and in this case tasks will be
resumed, so queue have to be valid).

To achive this, new operation flag MSG_COPY for sys_msgrcv() system call
was introduced.  If this flag was specified, then mtype is interpreted as
number of the message to copy.

If MSG_COPY is set, then kernel will allocate dummy message with passed
size, and then use new copy_msg() helper function to copy desired message
(instead of unlinking it from the queue).

Notes:

1) Return -ENOSYS if MSG_COPY is specified, but
   CONFIG_CHECKPOINT_RESTORE is not set.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/uapi/linux/msg.h
ipc/msg.c
ipc/msgutil.c
ipc/util.h