• Home
  • Raw
  • Download

Lines Matching refs:ns

75 #define msg_ids(ns)	((ns)->ids[IPC_MSG_IDS])  argument
77 static inline struct msg_queue *msq_obtain_object(struct ipc_namespace *ns, int id) in msq_obtain_object() argument
79 struct kern_ipc_perm *ipcp = ipc_obtain_object(&msg_ids(ns), id); in msq_obtain_object()
87 static inline struct msg_queue *msq_obtain_object_check(struct ipc_namespace *ns, in msq_obtain_object_check() argument
90 struct kern_ipc_perm *ipcp = ipc_obtain_object_check(&msg_ids(ns), id); in msq_obtain_object_check()
98 static inline void msg_rmid(struct ipc_namespace *ns, struct msg_queue *s) in msg_rmid() argument
100 ipc_rmid(&msg_ids(ns), &s->q_perm); in msg_rmid()
119 static int newque(struct ipc_namespace *ns, struct ipc_params *params) in newque() argument
143 msq->q_qbytes = ns->msg_ctlmnb; in newque()
150 id = ipc_addid(&msg_ids(ns), &msq->q_perm, ns->msg_ctlmni); in newque()
212 static void freeque(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp) in freeque() argument
219 msg_rmid(ns, msq); in freeque()
224 atomic_dec(&ns->msg_hdrs); in freeque()
227 atomic_sub(msq->q_cbytes, &ns->msg_bytes); in freeque()
243 struct ipc_namespace *ns; in SYSCALL_DEFINE2() local
250 ns = current->nsproxy->ipc_ns; in SYSCALL_DEFINE2()
255 return ipcget(ns, &msg_ids(ns), &msg_ops, &msg_params); in SYSCALL_DEFINE2()
339 static int msgctl_down(struct ipc_namespace *ns, int msqid, int cmd, in msgctl_down() argument
352 down_write(&msg_ids(ns).rwsem); in msgctl_down()
355 ipcp = ipcctl_pre_down_nolock(ns, &msg_ids(ns), msqid, cmd, in msgctl_down()
372 freeque(ns, ipcp); in msgctl_down()
375 if (msqid64.msg_qbytes > ns->msg_ctlmnb && in msgctl_down()
408 up_write(&msg_ids(ns).rwsem); in msgctl_down()
412 static int msgctl_nolock(struct ipc_namespace *ns, int msqid, in msgctl_nolock() argument
438 msginfo.msgmni = ns->msg_ctlmni; in msgctl_nolock()
439 msginfo.msgmax = ns->msg_ctlmax; in msgctl_nolock()
440 msginfo.msgmnb = ns->msg_ctlmnb; in msgctl_nolock()
443 down_read(&msg_ids(ns).rwsem); in msgctl_nolock()
445 msginfo.msgpool = msg_ids(ns).in_use; in msgctl_nolock()
446 msginfo.msgmap = atomic_read(&ns->msg_hdrs); in msgctl_nolock()
447 msginfo.msgtql = atomic_read(&ns->msg_bytes); in msgctl_nolock()
453 max_id = ipc_get_maxid(&msg_ids(ns)); in msgctl_nolock()
454 up_read(&msg_ids(ns).rwsem); in msgctl_nolock()
473 msq = msq_obtain_object(ns, msqid); in msgctl_nolock()
480 msq = msq_obtain_object_check(ns, msqid); in msgctl_nolock()
489 if (ipcperms(ns, &msq->q_perm, S_IRUGO)) in msgctl_nolock()
525 struct ipc_namespace *ns; in SYSCALL_DEFINE3() local
531 ns = current->nsproxy->ipc_ns; in SYSCALL_DEFINE3()
538 return msgctl_nolock(ns, msqid, cmd, version, buf); in SYSCALL_DEFINE3()
541 return msgctl_down(ns, msqid, cmd, buf, version); in SYSCALL_DEFINE3()
613 struct ipc_namespace *ns; in do_msgsnd() local
615 ns = current->nsproxy->ipc_ns; in do_msgsnd()
617 if (msgsz > ns->msg_ctlmax || (long) msgsz < 0 || msqid < 0) in do_msgsnd()
630 msq = msq_obtain_object_check(ns, msqid); in do_msgsnd()
642 if (ipcperms(ns, &msq->q_perm, S_IWUGO)) in do_msgsnd()
704 atomic_add(msgsz, &ns->msg_bytes); in do_msgsnd()
705 atomic_inc(&ns->msg_hdrs); in do_msgsnd()
831 struct ipc_namespace *ns; in do_msgrcv() local
834 ns = current->nsproxy->ipc_ns; in do_msgrcv()
842 copy = prepare_copy(buf, min_t(size_t, bufsz, ns->msg_ctlmax)); in do_msgrcv()
849 msq = msq_obtain_object_check(ns, msqid); in do_msgrcv()
860 if (ipcperms(ns, &msq->q_perm, S_IRUGO)) in do_msgrcv()
895 atomic_sub(msg->m_ts, &ns->msg_bytes); in do_msgrcv()
896 atomic_dec(&ns->msg_hdrs); in do_msgrcv()
1001 void recompute_msgmni(struct ipc_namespace *ns) in recompute_msgmni() argument
1014 ns->msg_ctlmni = MSGMNI; in recompute_msgmni()
1019 ns->msg_ctlmni = IPCMNI / nb_ns; in recompute_msgmni()
1023 ns->msg_ctlmni = allowed; in recompute_msgmni()
1026 void msg_init_ns(struct ipc_namespace *ns) in msg_init_ns() argument
1028 ns->msg_ctlmax = MSGMAX; in msg_init_ns()
1029 ns->msg_ctlmnb = MSGMNB; in msg_init_ns()
1031 recompute_msgmni(ns); in msg_init_ns()
1033 atomic_set(&ns->msg_bytes, 0); in msg_init_ns()
1034 atomic_set(&ns->msg_hdrs, 0); in msg_init_ns()
1035 ipc_init_ids(&ns->ids[IPC_MSG_IDS]); in msg_init_ns()
1039 void msg_exit_ns(struct ipc_namespace *ns) in msg_exit_ns() argument
1041 free_ipcs(ns, &msg_ids(ns), freeque); in msg_exit_ns()
1042 idr_destroy(&ns->ids[IPC_MSG_IDS].ipcs_idr); in msg_exit_ns()