Lines Matching +full:foo +full:- +full:queue

69  * Accesses to a message queue are synchronized by acquiring info->lock.
72 * - The actual wakeup of a sleeping task is performed using the wake_q
73 * framework. info->lock is already released when wake_up_q is called.
74 * - The exit codepaths after sleeping check ext_wait_queue->state without
76 * acquiring info->lock.
93 * ->state = STATE_READY (reordered)
101 * the smp_store_release() that does ->state = STATE_READY.
115 * receiver->msg = message; (reordered)
119 * 3) There is intentionally no barrier when setting current->state
120 * to TASK_INTERRUPTIBLE: spin_unlock(&info->lock) provides the
122 * info->lock, i.e. spin_lock(&info->lock) provided a pairing
126 struct ext_wait_queue { /* queue of sleeping tasks */
154 unsigned long qsize; /* size of queue in memory (sum of all msgs) */
178 return get_ipc_ns(inode->i_sb->s_fs_info); in __get_ns_from_inode()
198 p = &info->msg_tree.rb_node; in msg_insert()
203 if (likely(leaf->priority == msg->m_type)) in msg_insert()
205 else if (msg->m_type < leaf->priority) { in msg_insert()
206 p = &(*p)->rb_left; in msg_insert()
209 p = &(*p)->rb_right; in msg_insert()
211 if (info->node_cache) { in msg_insert()
212 leaf = info->node_cache; in msg_insert()
213 info->node_cache = NULL; in msg_insert()
217 return -ENOMEM; in msg_insert()
218 INIT_LIST_HEAD(&leaf->msg_list); in msg_insert()
220 leaf->priority = msg->m_type; in msg_insert()
223 info->msg_tree_rightmost = &leaf->rb_node; in msg_insert()
225 rb_link_node(&leaf->rb_node, parent, p); in msg_insert()
226 rb_insert_color(&leaf->rb_node, &info->msg_tree); in msg_insert()
228 info->attr.mq_curmsgs++; in msg_insert()
229 info->qsize += msg->m_ts; in msg_insert()
230 list_add_tail(&msg->m_list, &leaf->msg_list); in msg_insert()
237 struct rb_node *node = &leaf->rb_node; in msg_tree_erase()
239 if (info->msg_tree_rightmost == node) in msg_tree_erase()
240 info->msg_tree_rightmost = rb_prev(node); in msg_tree_erase()
242 rb_erase(node, &info->msg_tree); in msg_tree_erase()
243 if (info->node_cache) in msg_tree_erase()
246 info->node_cache = leaf; in msg_tree_erase()
261 parent = info->msg_tree_rightmost; in msg_get()
263 if (info->attr.mq_curmsgs) { in msg_get()
264 pr_warn_once("Inconsistency in POSIX message queue, " in msg_get()
267 info->attr.mq_curmsgs = 0; in msg_get()
272 if (unlikely(list_empty(&leaf->msg_list))) { in msg_get()
273 pr_warn_once("Inconsistency in POSIX message queue, " in msg_get()
279 msg = list_first_entry(&leaf->msg_list, in msg_get()
281 list_del(&msg->m_list); in msg_get()
282 if (list_empty(&leaf->msg_list)) { in msg_get()
286 info->attr.mq_curmsgs--; in msg_get()
287 info->qsize -= msg->m_ts; in msg_get()
297 int ret = -ENOMEM; in mqueue_get_inode()
303 inode->i_ino = get_next_ino(); in mqueue_get_inode()
304 inode->i_mode = mode; in mqueue_get_inode()
305 inode->i_uid = current_fsuid(); in mqueue_get_inode()
306 inode->i_gid = current_fsgid(); in mqueue_get_inode()
307 inode->i_mtime = inode->i_ctime = inode->i_atime = current_time(inode); in mqueue_get_inode()
313 inode->i_fop = &mqueue_file_operations; in mqueue_get_inode()
314 inode->i_size = FILENT_SIZE; in mqueue_get_inode()
317 spin_lock_init(&info->lock); in mqueue_get_inode()
318 init_waitqueue_head(&info->wait_q); in mqueue_get_inode()
319 INIT_LIST_HEAD(&info->e_wait_q[0].list); in mqueue_get_inode()
320 INIT_LIST_HEAD(&info->e_wait_q[1].list); in mqueue_get_inode()
321 info->notify_owner = NULL; in mqueue_get_inode()
322 info->notify_user_ns = NULL; in mqueue_get_inode()
323 info->qsize = 0; in mqueue_get_inode()
324 info->user = NULL; /* set when all is ok */ in mqueue_get_inode()
325 info->msg_tree = RB_ROOT; in mqueue_get_inode()
326 info->msg_tree_rightmost = NULL; in mqueue_get_inode()
327 info->node_cache = NULL; in mqueue_get_inode()
328 memset(&info->attr, 0, sizeof(info->attr)); in mqueue_get_inode()
329 info->attr.mq_maxmsg = min(ipc_ns->mq_msg_max, in mqueue_get_inode()
330 ipc_ns->mq_msg_default); in mqueue_get_inode()
331 info->attr.mq_msgsize = min(ipc_ns->mq_msgsize_max, in mqueue_get_inode()
332 ipc_ns->mq_msgsize_default); in mqueue_get_inode()
334 info->attr.mq_maxmsg = attr->mq_maxmsg; in mqueue_get_inode()
335 info->attr.mq_msgsize = attr->mq_msgsize; in mqueue_get_inode()
340 * possible message into the queue size. That's no longer in mqueue_get_inode()
341 * accurate as the queue is now an rbtree and will grow and in mqueue_get_inode()
351 ret = -EINVAL; in mqueue_get_inode()
352 if (info->attr.mq_maxmsg <= 0 || info->attr.mq_msgsize <= 0) in mqueue_get_inode()
355 if (info->attr.mq_maxmsg > HARD_MSGMAX || in mqueue_get_inode()
356 info->attr.mq_msgsize > HARD_MSGSIZEMAX) in mqueue_get_inode()
359 if (info->attr.mq_maxmsg > ipc_ns->mq_msg_max || in mqueue_get_inode()
360 info->attr.mq_msgsize > ipc_ns->mq_msgsize_max) in mqueue_get_inode()
363 ret = -EOVERFLOW; in mqueue_get_inode()
365 if (info->attr.mq_msgsize > ULONG_MAX/info->attr.mq_maxmsg) in mqueue_get_inode()
367 mq_treesize = info->attr.mq_maxmsg * sizeof(struct msg_msg) + in mqueue_get_inode()
368 min_t(unsigned int, info->attr.mq_maxmsg, MQ_PRIO_MAX) * in mqueue_get_inode()
370 mq_bytes = info->attr.mq_maxmsg * info->attr.mq_msgsize; in mqueue_get_inode()
375 if (u->mq_bytes + mq_bytes < u->mq_bytes || in mqueue_get_inode()
376 u->mq_bytes + mq_bytes > rlimit(RLIMIT_MSGQUEUE)) { in mqueue_get_inode()
378 /* mqueue_evict_inode() releases info->messages */ in mqueue_get_inode()
379 ret = -EMFILE; in mqueue_get_inode()
382 u->mq_bytes += mq_bytes; in mqueue_get_inode()
386 info->user = get_uid(u); in mqueue_get_inode()
390 inode->i_size = 2 * DIRENT_SIZE; in mqueue_get_inode()
391 inode->i_op = &mqueue_dir_inode_operations; in mqueue_get_inode()
392 inode->i_fop = &simple_dir_operations; in mqueue_get_inode()
405 struct ipc_namespace *ns = sb->s_fs_info; in mqueue_fill_super()
407 sb->s_iflags |= SB_I_NOEXEC | SB_I_NODEV; in mqueue_fill_super()
408 sb->s_blocksize = PAGE_SIZE; in mqueue_fill_super()
409 sb->s_blocksize_bits = PAGE_SHIFT; in mqueue_fill_super()
410 sb->s_magic = MQUEUE_MAGIC; in mqueue_fill_super()
411 sb->s_op = &mqueue_super_ops; in mqueue_fill_super()
417 sb->s_root = d_make_root(inode); in mqueue_fill_super()
418 if (!sb->s_root) in mqueue_fill_super()
419 return -ENOMEM; in mqueue_fill_super()
425 struct mqueue_fs_context *ctx = fc->fs_private; in mqueue_get_tree()
427 return get_tree_keyed(fc, mqueue_fill_super, ctx->ipc_ns); in mqueue_get_tree()
432 struct mqueue_fs_context *ctx = fc->fs_private; in mqueue_fs_context_free()
434 put_ipc_ns(ctx->ipc_ns); in mqueue_fs_context_free()
444 return -ENOMEM; in mqueue_init_fs_context()
446 ctx->ipc_ns = get_ipc_ns(current->nsproxy->ipc_ns); in mqueue_init_fs_context()
447 put_user_ns(fc->user_ns); in mqueue_init_fs_context()
448 fc->user_ns = get_user_ns(ctx->ipc_ns->user_ns); in mqueue_init_fs_context()
449 fc->fs_private = ctx; in mqueue_init_fs_context()
450 fc->ops = &mqueue_fs_context_ops; in mqueue_init_fs_context()
464 ctx = fc->fs_private; in mq_create_mount()
465 put_ipc_ns(ctx->ipc_ns); in mq_create_mount()
466 ctx->ipc_ns = get_ipc_ns(ns); in mq_create_mount()
467 put_user_ns(fc->user_ns); in mq_create_mount()
468 fc->user_ns = get_user_ns(ctx->ipc_ns->user_ns); in mq_create_mount()
475 static void init_once(void *foo) in init_once() argument
477 struct mqueue_inode_info *p = (struct mqueue_inode_info *) foo; in init_once()
479 inode_init_once(&p->vfs_inode); in init_once()
489 return &ei->vfs_inode; in mqueue_alloc_inode()
507 if (S_ISDIR(inode->i_mode)) in mqueue_evict_inode()
512 spin_lock(&info->lock); in mqueue_evict_inode()
514 list_add_tail(&msg->m_list, &tmp_msg); in mqueue_evict_inode()
515 kfree(info->node_cache); in mqueue_evict_inode()
516 spin_unlock(&info->lock); in mqueue_evict_inode()
519 list_del(&msg->m_list); in mqueue_evict_inode()
523 user = info->user; in mqueue_evict_inode()
528 mq_treesize = info->attr.mq_maxmsg * sizeof(struct msg_msg) + in mqueue_evict_inode()
529 min_t(unsigned int, info->attr.mq_maxmsg, MQ_PRIO_MAX) * in mqueue_evict_inode()
532 mq_bytes = mq_treesize + (info->attr.mq_maxmsg * in mqueue_evict_inode()
533 info->attr.mq_msgsize); in mqueue_evict_inode()
536 user->mq_bytes -= mq_bytes; in mqueue_evict_inode()
539 * (ipc_ns = sb->s_fs_info) is either a valid ipc_ns in mqueue_evict_inode()
544 ipc_ns->mq_queues_count--; in mqueue_evict_inode()
554 struct inode *dir = dentry->d_parent->d_inode; in mqueue_create_attr()
563 error = -EACCES; in mqueue_create_attr()
567 if (ipc_ns->mq_queues_count >= ipc_ns->mq_queues_max && in mqueue_create_attr()
569 error = -ENOSPC; in mqueue_create_attr()
572 ipc_ns->mq_queues_count++; in mqueue_create_attr()
575 inode = mqueue_get_inode(dir->i_sb, ipc_ns, mode, attr); in mqueue_create_attr()
579 ipc_ns->mq_queues_count--; in mqueue_create_attr()
584 dir->i_size += DIRENT_SIZE; in mqueue_create_attr()
585 dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir); in mqueue_create_attr()
607 dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir); in mqueue_unlink()
608 dir->i_size -= DIRENT_SIZE; in mqueue_unlink()
615 * This is routine for system read from queue file.
617 * to read only queue size & notification info (the only values
628 spin_lock(&info->lock); in mqueue_read_file()
630 "QSIZE:%-10lu NOTIFY:%-5d SIGNO:%-5d NOTIFY_PID:%-6d\n", in mqueue_read_file()
631 info->qsize, in mqueue_read_file()
632 info->notify_owner ? info->notify.sigev_notify : 0, in mqueue_read_file()
633 (info->notify_owner && in mqueue_read_file()
634 info->notify.sigev_notify == SIGEV_SIGNAL) ? in mqueue_read_file()
635 info->notify.sigev_signo : 0, in mqueue_read_file()
636 pid_vnr(info->notify_owner)); in mqueue_read_file()
637 spin_unlock(&info->lock); in mqueue_read_file()
638 buffer[sizeof(buffer)-1] = '\0'; in mqueue_read_file()
645 file_inode(filp)->i_atime = file_inode(filp)->i_ctime = current_time(file_inode(filp)); in mqueue_read_file()
653 spin_lock(&info->lock); in mqueue_flush_file()
654 if (task_tgid(current) == info->notify_owner) in mqueue_flush_file()
657 spin_unlock(&info->lock); in mqueue_flush_file()
666 poll_wait(filp, &info->wait_q, poll_tab); in mqueue_poll_file()
668 spin_lock(&info->lock); in mqueue_poll_file()
669 if (info->attr.mq_curmsgs) in mqueue_poll_file()
672 if (info->attr.mq_curmsgs < info->attr.mq_maxmsg) in mqueue_poll_file()
674 spin_unlock(&info->lock); in mqueue_poll_file()
679 /* Adds current to info->e_wait_q[sr] before element with smaller prio */
685 list_for_each_entry(walk, &info->e_wait_q[sr].list, list) { in wq_add()
686 if (walk->task->prio <= current->prio) { in wq_add()
687 list_add_tail(&ewp->list, &walk->list); in wq_add()
691 list_add_tail(&ewp->list, &info->e_wait_q[sr].list); in wq_add()
695 * Puts current task to sleep. Caller must hold queue lock. After return
701 __releases(&info->lock) in wq_sleep()
709 /* memory barrier not required, we hold info->lock */ in wq_sleep()
712 spin_unlock(&info->lock); in wq_sleep()
716 if (READ_ONCE(ewp->state) == STATE_READY) { in wq_sleep()
722 spin_lock(&info->lock); in wq_sleep()
724 /* we hold info->lock, so no memory barrier required */ in wq_sleep()
725 if (READ_ONCE(ewp->state) == STATE_READY) { in wq_sleep()
730 retval = -ERESTARTSYS; in wq_sleep()
734 retval = -ETIMEDOUT; in wq_sleep()
738 list_del(&ewp->list); in wq_sleep()
740 spin_unlock(&info->lock); in wq_sleep()
753 ptr = info->e_wait_q[sr].list.prev; in wq_get_first_waiter()
754 if (ptr == &info->e_wait_q[sr].list) in wq_get_first_waiter()
762 ((char *)skb->data)[NOTIFY_COOKIE_LEN-1] = code; in set_cookie()
772 * waiting synchronously for message AND state of queue changed from in __do_notify()
775 if (info->notify_owner && in __do_notify()
776 info->attr.mq_curmsgs == 1) { in __do_notify()
777 switch (info->notify.sigev_notify) { in __do_notify()
785 if (!info->notify.sigev_signo) in __do_notify()
789 sig_i.si_signo = info->notify.sigev_signo; in __do_notify()
792 sig_i.si_value = info->notify.sigev_value; in __do_notify()
794 /* map current pid/uid into info->owner's namespaces */ in __do_notify()
796 ns_of_pid(info->notify_owner)); in __do_notify()
797 sig_i.si_uid = from_kuid_munged(info->notify_user_ns, in __do_notify()
806 task = pid_task(info->notify_owner, PIDTYPE_TGID); in __do_notify()
807 if (task && task->self_exec_id == in __do_notify()
808 info->notify_self_exec_id) { in __do_notify()
809 do_send_sig_info(info->notify.sigev_signo, in __do_notify()
816 set_cookie(info->notify_cookie, NOTIFY_WOKENUP); in __do_notify()
817 netlink_sendskb(info->notify_sock, info->notify_cookie); in __do_notify()
821 put_pid(info->notify_owner); in __do_notify()
822 put_user_ns(info->notify_user_ns); in __do_notify()
823 info->notify_owner = NULL; in __do_notify()
824 info->notify_user_ns = NULL; in __do_notify()
826 wake_up(&info->wait_q); in __do_notify()
833 return -EFAULT; in prepare_timeout()
835 return -EINVAL; in prepare_timeout()
841 if (info->notify_owner != NULL && in remove_notification()
842 info->notify.sigev_notify == SIGEV_THREAD) { in remove_notification()
843 set_cookie(info->notify_cookie, NOTIFY_REMOVED); in remove_notification()
844 netlink_sendskb(info->notify_sock, info->notify_cookie); in remove_notification()
846 put_pid(info->notify_owner); in remove_notification()
847 put_user_ns(info->notify_user_ns); in remove_notification()
848 info->notify_owner = NULL; in remove_notification()
849 info->notify_user_ns = NULL; in remove_notification()
862 return -ENOENT; in prepare_open()
865 audit_inode_parent_hidden(name, dentry->d_parent); in prepare_open()
872 return -EEXIST; in prepare_open()
874 return -EINVAL; in prepare_open()
882 struct vfsmount *mnt = current->nsproxy->ipc_ns->mq_mnt; in do_mq_open()
883 struct dentry *root = mnt->mnt_root; in do_mq_open()
900 path.dentry = lookup_one_len(name->name, root, strlen(name->name)); in do_mq_open()
933 return -EFAULT; in SYSCALL_DEFINE4()
944 struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns; in SYSCALL_DEFINE1()
945 struct vfsmount *mnt = ipc_ns->mq_mnt; in SYSCALL_DEFINE1()
951 audit_inode_parent_hidden(name, mnt->mnt_root); in SYSCALL_DEFINE1()
955 inode_lock_nested(d_inode(mnt->mnt_root), I_MUTEX_PARENT); in SYSCALL_DEFINE1()
956 dentry = lookup_one_len(name->name, mnt->mnt_root, in SYSCALL_DEFINE1()
957 strlen(name->name)); in SYSCALL_DEFINE1()
965 err = -ENOENT; in SYSCALL_DEFINE1()
968 err = vfs_unlink(d_inode(dentry->d_parent), dentry, NULL); in SYSCALL_DEFINE1()
973 inode_unlock(d_inode(mnt->mnt_root)); in SYSCALL_DEFINE1()
990 * queue spinlock:
992 * - Set pointer to message.
993 * - Queue the receiver task for later wakeup (without the info->lock).
994 * - Update its state to STATE_READY. Now the receiver can continue.
995 * - Wake up the process after the lock is dropped. Should the process wake up
1006 list_del(&this->list); in __pipelined_op()
1007 get_task_struct(this->task); in __pipelined_op()
1010 smp_store_release(&this->state, STATE_READY); in __pipelined_op()
1011 wake_q_add_safe(wake_q, this->task); in __pipelined_op()
1014 /* pipelined_send() - send a message directly to the task waiting in
1015 * sys_mq_timedreceive() (without inserting message into a queue).
1022 receiver->msg = message; in pipelined_send()
1026 /* pipelined_receive() - if there is task waiting in sys_mq_timedsend()
1027 * gets its message and put to the queue (we have one free place for sure). */
1035 wake_up_interruptible(&info->wait_q); in pipelined_receive()
1038 if (msg_insert(sender->msg, info)) in pipelined_receive()
1060 return -EINVAL; in do_mq_timedsend()
1071 ret = -EBADF; in do_mq_timedsend()
1076 if (unlikely(f.file->f_op != &mqueue_file_operations)) { in do_mq_timedsend()
1077 ret = -EBADF; in do_mq_timedsend()
1083 if (unlikely(!(f.file->f_mode & FMODE_WRITE))) { in do_mq_timedsend()
1084 ret = -EBADF; in do_mq_timedsend()
1088 if (unlikely(msg_len > info->attr.mq_msgsize)) { in do_mq_timedsend()
1089 ret = -EMSGSIZE; in do_mq_timedsend()
1100 msg_ptr->m_ts = msg_len; in do_mq_timedsend()
1101 msg_ptr->m_type = msg_prio; in do_mq_timedsend()
1108 if (!info->node_cache) in do_mq_timedsend()
1111 spin_lock(&info->lock); in do_mq_timedsend()
1113 if (!info->node_cache && new_leaf) { in do_mq_timedsend()
1115 INIT_LIST_HEAD(&new_leaf->msg_list); in do_mq_timedsend()
1116 info->node_cache = new_leaf; in do_mq_timedsend()
1122 if (info->attr.mq_curmsgs == info->attr.mq_maxmsg) { in do_mq_timedsend()
1123 if (f.file->f_flags & O_NONBLOCK) { in do_mq_timedsend()
1124 ret = -EAGAIN; in do_mq_timedsend()
1129 /* memory barrier not required, we hold info->lock */ in do_mq_timedsend()
1133 * wq_sleep must be called with info->lock held, and in do_mq_timedsend()
1143 /* adds message to the queue */ in do_mq_timedsend()
1149 inode->i_atime = inode->i_mtime = inode->i_ctime = in do_mq_timedsend()
1153 spin_unlock(&info->lock); in do_mq_timedsend()
1186 ret = -EBADF; in do_mq_timedreceive()
1191 if (unlikely(f.file->f_op != &mqueue_file_operations)) { in do_mq_timedreceive()
1192 ret = -EBADF; in do_mq_timedreceive()
1198 if (unlikely(!(f.file->f_mode & FMODE_READ))) { in do_mq_timedreceive()
1199 ret = -EBADF; in do_mq_timedreceive()
1204 if (unlikely(msg_len < info->attr.mq_msgsize)) { in do_mq_timedreceive()
1205 ret = -EMSGSIZE; in do_mq_timedreceive()
1214 if (!info->node_cache) in do_mq_timedreceive()
1217 spin_lock(&info->lock); in do_mq_timedreceive()
1219 if (!info->node_cache && new_leaf) { in do_mq_timedreceive()
1221 INIT_LIST_HEAD(&new_leaf->msg_list); in do_mq_timedreceive()
1222 info->node_cache = new_leaf; in do_mq_timedreceive()
1227 if (info->attr.mq_curmsgs == 0) { in do_mq_timedreceive()
1228 if (f.file->f_flags & O_NONBLOCK) { in do_mq_timedreceive()
1229 spin_unlock(&info->lock); in do_mq_timedreceive()
1230 ret = -EAGAIN; in do_mq_timedreceive()
1234 /* memory barrier not required, we hold info->lock */ in do_mq_timedreceive()
1244 inode->i_atime = inode->i_mtime = inode->i_ctime = in do_mq_timedreceive()
1247 /* There is now free space in queue. */ in do_mq_timedreceive()
1249 spin_unlock(&info->lock); in do_mq_timedreceive()
1254 ret = msg_ptr->m_ts; in do_mq_timedreceive()
1256 if ((u_msg_prio && put_user(msg_ptr->m_type, u_msg_prio)) || in do_mq_timedreceive()
1257 store_msg(u_msg_ptr, msg_ptr, msg_ptr->m_ts)) { in do_mq_timedreceive()
1258 ret = -EFAULT; in do_mq_timedreceive()
1315 if (unlikely(notification->sigev_notify != SIGEV_NONE && in do_mq_notify()
1316 notification->sigev_notify != SIGEV_SIGNAL && in do_mq_notify()
1317 notification->sigev_notify != SIGEV_THREAD)) in do_mq_notify()
1318 return -EINVAL; in do_mq_notify()
1319 if (notification->sigev_notify == SIGEV_SIGNAL && in do_mq_notify()
1320 !valid_signal(notification->sigev_signo)) { in do_mq_notify()
1321 return -EINVAL; in do_mq_notify()
1323 if (notification->sigev_notify == SIGEV_THREAD) { in do_mq_notify()
1329 return -ENOMEM; in do_mq_notify()
1331 if (copy_from_user(nc->data, in do_mq_notify()
1332 notification->sigev_value.sival_ptr, in do_mq_notify()
1334 ret = -EFAULT; in do_mq_notify()
1342 f = fdget(notification->sigev_signo); in do_mq_notify()
1344 ret = -EBADF; in do_mq_notify()
1367 ret = -EBADF; in do_mq_notify()
1372 if (unlikely(f.file->f_op != &mqueue_file_operations)) { in do_mq_notify()
1373 ret = -EBADF; in do_mq_notify()
1379 spin_lock(&info->lock); in do_mq_notify()
1381 if (info->notify_owner == task_tgid(current)) { in do_mq_notify()
1383 inode->i_atime = inode->i_ctime = current_time(inode); in do_mq_notify()
1385 } else if (info->notify_owner != NULL) { in do_mq_notify()
1386 ret = -EBUSY; in do_mq_notify()
1388 switch (notification->sigev_notify) { in do_mq_notify()
1390 info->notify.sigev_notify = SIGEV_NONE; in do_mq_notify()
1393 info->notify_sock = sock; in do_mq_notify()
1394 info->notify_cookie = nc; in do_mq_notify()
1397 info->notify.sigev_notify = SIGEV_THREAD; in do_mq_notify()
1400 info->notify.sigev_signo = notification->sigev_signo; in do_mq_notify()
1401 info->notify.sigev_value = notification->sigev_value; in do_mq_notify()
1402 info->notify.sigev_notify = SIGEV_SIGNAL; in do_mq_notify()
1403 info->notify_self_exec_id = current->self_exec_id; in do_mq_notify()
1407 info->notify_owner = get_pid(task_tgid(current)); in do_mq_notify()
1408 info->notify_user_ns = get_user_ns(current_user_ns()); in do_mq_notify()
1409 inode->i_atime = inode->i_ctime = current_time(inode); in do_mq_notify()
1411 spin_unlock(&info->lock); in do_mq_notify()
1430 return -EFAULT; in SYSCALL_DEFINE2()
1442 if (new && (new->mq_flags & (~O_NONBLOCK))) in do_mq_getsetattr()
1443 return -EINVAL; in do_mq_getsetattr()
1447 return -EBADF; in do_mq_getsetattr()
1449 if (unlikely(f.file->f_op != &mqueue_file_operations)) { in do_mq_getsetattr()
1451 return -EBADF; in do_mq_getsetattr()
1457 spin_lock(&info->lock); in do_mq_getsetattr()
1460 *old = info->attr; in do_mq_getsetattr()
1461 old->mq_flags = f.file->f_flags & O_NONBLOCK; in do_mq_getsetattr()
1465 spin_lock(&f.file->f_lock); in do_mq_getsetattr()
1466 if (new->mq_flags & O_NONBLOCK) in do_mq_getsetattr()
1467 f.file->f_flags |= O_NONBLOCK; in do_mq_getsetattr()
1469 f.file->f_flags &= ~O_NONBLOCK; in do_mq_getsetattr()
1470 spin_unlock(&f.file->f_lock); in do_mq_getsetattr()
1472 inode->i_atime = inode->i_ctime = current_time(inode); in do_mq_getsetattr()
1475 spin_unlock(&info->lock); in do_mq_getsetattr()
1491 return -EFAULT; in SYSCALL_DEFINE3()
1501 return -EFAULT; in SYSCALL_DEFINE3()
1508 compat_long_t mq_flags; /* message queue flags */
1521 return -EFAULT; in get_compat_mq_attr()
1524 attr->mq_flags = v.mq_flags; in get_compat_mq_attr()
1525 attr->mq_maxmsg = v.mq_maxmsg; in get_compat_mq_attr()
1526 attr->mq_msgsize = v.mq_msgsize; in get_compat_mq_attr()
1527 attr->mq_curmsgs = v.mq_curmsgs; in get_compat_mq_attr()
1537 v.mq_flags = attr->mq_flags; in put_compat_mq_attr()
1538 v.mq_maxmsg = attr->mq_maxmsg; in put_compat_mq_attr()
1539 v.mq_msgsize = attr->mq_msgsize; in put_compat_mq_attr()
1540 v.mq_curmsgs = attr->mq_curmsgs; in put_compat_mq_attr()
1542 return -EFAULT; in put_compat_mq_attr()
1554 return -EFAULT; in COMPAT_SYSCALL_DEFINE4()
1565 return -EFAULT; in COMPAT_SYSCALL_DEFINE2()
1584 return -EFAULT; in COMPAT_SYSCALL_DEFINE3()
1594 return -EFAULT; in COMPAT_SYSCALL_DEFINE3()
1604 return -EFAULT; in compat_prepare_timeout()
1606 return -EINVAL; in compat_prepare_timeout()
1677 ns->mq_queues_count = 0; in mq_init_ns()
1678 ns->mq_queues_max = DFLT_QUEUESMAX; in mq_init_ns()
1679 ns->mq_msg_max = DFLT_MSGMAX; in mq_init_ns()
1680 ns->mq_msgsize_max = DFLT_MSGSIZEMAX; in mq_init_ns()
1681 ns->mq_msg_default = DFLT_MSG; in mq_init_ns()
1682 ns->mq_msgsize_default = DFLT_MSGSIZE; in mq_init_ns()
1687 ns->mq_mnt = m; in mq_init_ns()
1693 ns->mq_mnt->mnt_sb->s_fs_info = NULL; in mq_clear_sbinfo()
1698 kern_unmount(ns->mq_mnt); in mq_put_mnt()
1709 return -ENOMEM; in init_mqueue_fs()
1711 /* ignore failures - they are not fatal */ in init_mqueue_fs()