diff options
Diffstat (limited to 'ipc/msgutil.c')
| -rw-r--r-- | ipc/msgutil.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/ipc/msgutil.c b/ipc/msgutil.c index 26143d377c95..ebfcbfa8b7f2 100644 --- a/ipc/msgutil.c +++ b/ipc/msgutil.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/msg.h> | 16 | #include <linux/msg.h> |
| 17 | #include <linux/ipc_namespace.h> | 17 | #include <linux/ipc_namespace.h> |
| 18 | #include <linux/utsname.h> | 18 | #include <linux/utsname.h> |
| 19 | #include <linux/proc_fs.h> | ||
| 19 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
| 20 | 21 | ||
| 21 | #include "util.h" | 22 | #include "util.h" |
| @@ -30,6 +31,7 @@ DEFINE_SPINLOCK(mq_lock); | |||
| 30 | struct ipc_namespace init_ipc_ns = { | 31 | struct ipc_namespace init_ipc_ns = { |
| 31 | .count = ATOMIC_INIT(1), | 32 | .count = ATOMIC_INIT(1), |
| 32 | .user_ns = &init_user_ns, | 33 | .user_ns = &init_user_ns, |
| 34 | .proc_inum = PROC_IPC_INIT_INO, | ||
| 33 | }; | 35 | }; |
| 34 | 36 | ||
| 35 | atomic_t nr_ipc_ns = ATOMIC_INIT(1); | 37 | atomic_t nr_ipc_ns = ATOMIC_INIT(1); |
| @@ -100,7 +102,50 @@ out_err: | |||
| 100 | free_msg(msg); | 102 | free_msg(msg); |
| 101 | return ERR_PTR(err); | 103 | return ERR_PTR(err); |
| 102 | } | 104 | } |
| 105 | #ifdef CONFIG_CHECKPOINT_RESTORE | ||
| 106 | struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst) | ||
| 107 | { | ||
| 108 | struct msg_msgseg *dst_pseg, *src_pseg; | ||
| 109 | int len = src->m_ts; | ||
| 110 | int alen; | ||
| 111 | |||
| 112 | BUG_ON(dst == NULL); | ||
| 113 | if (src->m_ts > dst->m_ts) | ||
| 114 | return ERR_PTR(-EINVAL); | ||
| 103 | 115 | ||
| 116 | alen = len; | ||
| 117 | if (alen > DATALEN_MSG) | ||
| 118 | alen = DATALEN_MSG; | ||
| 119 | |||
| 120 | dst->next = NULL; | ||
| 121 | dst->security = NULL; | ||
| 122 | |||
| 123 | memcpy(dst + 1, src + 1, alen); | ||
| 124 | |||
| 125 | len -= alen; | ||
| 126 | dst_pseg = dst->next; | ||
| 127 | src_pseg = src->next; | ||
| 128 | while (len > 0) { | ||
| 129 | alen = len; | ||
| 130 | if (alen > DATALEN_SEG) | ||
| 131 | alen = DATALEN_SEG; | ||
| 132 | memcpy(dst_pseg + 1, src_pseg + 1, alen); | ||
| 133 | dst_pseg = dst_pseg->next; | ||
| 134 | len -= alen; | ||
| 135 | src_pseg = src_pseg->next; | ||
| 136 | } | ||
| 137 | |||
| 138 | dst->m_type = src->m_type; | ||
| 139 | dst->m_ts = src->m_ts; | ||
| 140 | |||
| 141 | return dst; | ||
| 142 | } | ||
| 143 | #else | ||
| 144 | struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst) | ||
| 145 | { | ||
| 146 | return ERR_PTR(-ENOSYS); | ||
| 147 | } | ||
| 148 | #endif | ||
| 104 | int store_msg(void __user *dest, struct msg_msg *msg, int len) | 149 | int store_msg(void __user *dest, struct msg_msg *msg, int len) |
| 105 | { | 150 | { |
| 106 | int alen; | 151 | int alen; |
