Lines Matching +full:5 +full:ns
98 #define SEARCH_NUMBER 5
100 #define msg_ids(ns) ((ns)->ids[IPC_MSG_IDS]) argument
102 static inline struct msg_queue *msq_obtain_object(struct ipc_namespace *ns, int id) in msq_obtain_object() argument
104 struct kern_ipc_perm *ipcp = ipc_obtain_object_idr(&msg_ids(ns), id); in msq_obtain_object()
112 static inline struct msg_queue *msq_obtain_object_check(struct ipc_namespace *ns, in msq_obtain_object_check() argument
115 struct kern_ipc_perm *ipcp = ipc_obtain_object_check(&msg_ids(ns), id); in msq_obtain_object_check()
123 static inline void msg_rmid(struct ipc_namespace *ns, struct msg_queue *s) in msg_rmid() argument
125 ipc_rmid(&msg_ids(ns), &s->q_perm); in msg_rmid()
139 * @ns: namespace
144 static int newque(struct ipc_namespace *ns, struct ipc_params *params) in newque() argument
168 msq->q_qbytes = ns->msg_ctlmnb; in newque()
175 retval = ipc_addid(&msg_ids(ns), &msq->q_perm, ns->msg_ctlmni); in newque()
273 static void freeque(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp) in freeque() argument
283 msg_rmid(ns, msq); in freeque()
289 percpu_counter_sub_local(&ns->percpu_msg_hdrs, 1); in freeque()
292 percpu_counter_sub_local(&ns->percpu_msg_bytes, msq->q_cbytes); in freeque()
300 struct ipc_namespace *ns; in ksys_msgget() local
307 ns = current->nsproxy->ipc_ns; in ksys_msgget()
312 return ipcget(ns, &msg_ids(ns), &msg_ops, &msg_params); in ksys_msgget()
401 static int msgctl_down(struct ipc_namespace *ns, int msqid, int cmd, in msgctl_down() argument
408 down_write(&msg_ids(ns).rwsem); in msgctl_down()
411 ipcp = ipcctl_obtain_check(ns, &msg_ids(ns), msqid, cmd, in msgctl_down()
428 freeque(ns, ipcp); in msgctl_down()
434 if (msg_qbytes > ns->msg_ctlmnb && in msgctl_down()
473 up_write(&msg_ids(ns).rwsem); in msgctl_down()
477 static int msgctl_info(struct ipc_namespace *ns, int msqid, in msgctl_info() argument
493 msginfo->msgmni = ns->msg_ctlmni; in msgctl_info()
494 msginfo->msgmax = ns->msg_ctlmax; in msgctl_info()
495 msginfo->msgmnb = ns->msg_ctlmnb; in msgctl_info()
498 down_read(&msg_ids(ns).rwsem); in msgctl_info()
500 msginfo->msgpool = msg_ids(ns).in_use; in msgctl_info()
501 max_idx = ipc_get_maxidx(&msg_ids(ns)); in msgctl_info()
502 up_read(&msg_ids(ns).rwsem); in msgctl_info()
505 percpu_counter_sum(&ns->percpu_msg_hdrs), in msgctl_info()
508 percpu_counter_sum(&ns->percpu_msg_bytes), in msgctl_info()
518 static int msgctl_stat(struct ipc_namespace *ns, int msqid, in msgctl_stat() argument
528 msq = msq_obtain_object(ns, msqid); in msgctl_stat()
534 msq = msq_obtain_object_check(ns, msqid); in msgctl_stat()
546 if (ipcperms(ns, &msq->q_perm, S_IRUGO)) in msgctl_stat()
599 struct ipc_namespace *ns; in ksys_msgctl() local
606 ns = current->nsproxy->ipc_ns; in ksys_msgctl()
612 err = msgctl_info(ns, msqid, cmd, &msginfo); in ksys_msgctl()
622 err = msgctl_stat(ns, msqid, cmd, &msqid64); in ksys_msgctl()
631 return msgctl_down(ns, msqid, cmd, &msqid64.msg_perm, in ksys_msgctl()
634 return msgctl_down(ns, msqid, cmd, NULL, 0); in ksys_msgctl()
734 struct ipc_namespace *ns; in compat_ksys_msgctl() local
738 ns = current->nsproxy->ipc_ns; in compat_ksys_msgctl()
747 err = msgctl_info(ns, msqid, cmd, &msginfo); in compat_ksys_msgctl()
757 err = msgctl_stat(ns, msqid, cmd, &msqid64); in compat_ksys_msgctl()
766 return msgctl_down(ns, msqid, cmd, &msqid64.msg_perm, msqid64.msg_qbytes); in compat_ksys_msgctl()
768 return msgctl_down(ns, msqid, cmd, NULL, 0); in compat_ksys_msgctl()
854 struct ipc_namespace *ns; in do_msgsnd() local
857 ns = current->nsproxy->ipc_ns; in do_msgsnd()
859 if (msgsz > ns->msg_ctlmax || (long) msgsz < 0 || msqid < 0) in do_msgsnd()
872 msq = msq_obtain_object_check(ns, msqid); in do_msgsnd()
884 if (ipcperms(ns, &msq->q_perm, S_IWUGO)) in do_msgsnd()
944 percpu_counter_add_local(&ns->percpu_msg_bytes, msgsz); in do_msgsnd()
945 percpu_counter_add_local(&ns->percpu_msg_hdrs, 1); in do_msgsnd()
1103 struct ipc_namespace *ns; in do_msgrcv() local
1107 ns = current->nsproxy->ipc_ns; in do_msgrcv()
1115 copy = prepare_copy(buf, min_t(size_t, bufsz, ns->msg_ctlmax)); in do_msgrcv()
1122 msq = msq_obtain_object_check(ns, msqid); in do_msgrcv()
1133 if (ipcperms(ns, &msq->q_perm, S_IRUGO)) in do_msgrcv()
1168 percpu_counter_sub_local(&ns->percpu_msg_bytes, msg->m_ts); in do_msgrcv()
1169 percpu_counter_sub_local(&ns->percpu_msg_hdrs, 1); in do_msgrcv()
1306 int msg_init_ns(struct ipc_namespace *ns) in msg_init_ns() argument
1310 ns->msg_ctlmax = MSGMAX; in msg_init_ns()
1311 ns->msg_ctlmnb = MSGMNB; in msg_init_ns()
1312 ns->msg_ctlmni = MSGMNI; in msg_init_ns()
1314 ret = percpu_counter_init(&ns->percpu_msg_bytes, 0, GFP_KERNEL); in msg_init_ns()
1317 ret = percpu_counter_init(&ns->percpu_msg_hdrs, 0, GFP_KERNEL); in msg_init_ns()
1320 ipc_init_ids(&ns->ids[IPC_MSG_IDS]); in msg_init_ns()
1324 percpu_counter_destroy(&ns->percpu_msg_bytes); in msg_init_ns()
1330 void msg_exit_ns(struct ipc_namespace *ns) in msg_exit_ns() argument
1332 free_ipcs(ns, &msg_ids(ns), freeque); in msg_exit_ns()
1333 idr_destroy(&ns->ids[IPC_MSG_IDS].ipcs_idr); in msg_exit_ns()
1334 rhashtable_destroy(&ns->ids[IPC_MSG_IDS].key_ht); in msg_exit_ns()
1335 percpu_counter_destroy(&ns->percpu_msg_bytes); in msg_exit_ns()
1336 percpu_counter_destroy(&ns->percpu_msg_hdrs); in msg_exit_ns()
1349 "%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10llu %10llu %10llu\n", in sysvipc_msg_proc_show()