[CRIU] [PATCH 2/2] ipc: add new MSG_SET_COPY command for
sys_msgctl() call
Stanislav Kinsbursky
skinsbursky at parallels.com
Thu Aug 9 05:27:22 EDT 2012
09.08.2012 12:44, Pavel Emelyanov пишет:
> On 08/09/2012 12:40 PM, Stanislav Kinsbursky wrote:
>> 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 | 4 ++++
>> ipc/compat.c | 3 +++
>> ipc/msg.c | 18 ++++++++++++++++++
>> 3 files changed, 25 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/linux/msg.h b/include/linux/msg.h
>> index de739d1..b63d6a4 100644
>> --- a/include/linux/msg.h
>> +++ b/include/linux/msg.h
>> @@ -8,6 +8,10 @@
>> #define MSG_INFO 12
>> #define MSG_SET 13
>>
>> +#ifdef CONFIG_CHECKPOINT_RESTORE
>> +#define MSG_SET_COPY 14
>> +#endif
>> +
>> /* msgrcv options */
>> #define MSG_NOERROR 010000 /* no error if message is too big */
>> #define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/
>> diff --git a/ipc/compat.c b/ipc/compat.c
>> index 6b07f5c..0d211f7 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_PEEK:
>
> PEEK?
>
Thanks. Will fix.
>> +#endif
>> err = sys_msgctl(first, second, uptr);
>> break;
>>
>> diff --git a/ipc/msg.c b/ipc/msg.c
>> index d4ca06f..44a2153 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 peek_cnt;
>> +
>> + if (!buf)
>> + return -EFAULT;
>> + if (get_user(peek_cnt, (unsigned int *)buf))
>> + return -EFAULT;
>> +
>> + msq = msg_lock(ns, msqid);
>> + if (IS_ERR(msq))
>> + return PTR_ERR(msq);
>> + msq->q_peek_cnt = peek_cnt;
>> + err = 0;
>
> msg_unlock missed?
>
No. It's done before return from the function.
>> + break;
>> + }
>> +#endif
>> default:
>> return -EINVAL;
>> }
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://openvz.org/mailman/listinfo/criu
>
--
Best regards,
Stanislav Kinsbursky
More information about the CRIU
mailing list