uipc_mqueue.c (9947b45978e8ec4c110704f0d970b38ecb1c2e70) uipc_mqueue.c (052ea11c7187506bbf6086eeceec03aaf57e4ff8)
1/*-
2 * Copyright (c) 2005 David Xu <davidxu@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 1680 unchanged lines hidden (view full) ---

1689static void
1690mqueue_send_notification(struct mqueue *mq)
1691{
1692 struct mqueue_notifier *nt;
1693 struct proc *p;
1694
1695 mtx_assert(&mq->mq_mutex, MA_OWNED);
1696 nt = mq->mq_notifier;
1/*-
2 * Copyright (c) 2005 David Xu <davidxu@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 1680 unchanged lines hidden (view full) ---

1689static void
1690mqueue_send_notification(struct mqueue *mq)
1691{
1692 struct mqueue_notifier *nt;
1693 struct proc *p;
1694
1695 mtx_assert(&mq->mq_mutex, MA_OWNED);
1696 nt = mq->mq_notifier;
1697 p = nt->nt_proc;
1698 PROC_LOCK(p);
1699 if (!KSI_ONQ(&nt->nt_ksi))
1700 psignal_event(p, &nt->nt_sigev, &nt->nt_ksi);
1701 PROC_UNLOCK(p);
1697 if (nt->nt_sigev.sigev_notify != SIGEV_NONE) {
1698 p = nt->nt_proc;
1699 PROC_LOCK(p);
1700 if (!KSI_ONQ(&nt->nt_ksi))
1701 psignal_event(p, &nt->nt_sigev, &nt->nt_ksi);
1702 PROC_UNLOCK(p);
1703 }
1702 mq->mq_notifier = NULL;
1703}
1704
1705/*
1706 * Get a message. if waitok is false, thread will not be
1707 * blocked if there is no data in queue, otherwise, absolute
1708 * time will be checked.
1709 */

--- 476 unchanged lines hidden (view full) ---

2186 error = EBADF;
2187 goto out;
2188 }
2189 mtx_lock(&mq->mq_mutex);
2190 FILEDESC_UNLOCK_FAST(fdp);
2191 if (uap->sigev != NULL) {
2192 if (mq->mq_notifier != NULL) {
2193 error = EBUSY;
1704 mq->mq_notifier = NULL;
1705}
1706
1707/*
1708 * Get a message. if waitok is false, thread will not be
1709 * blocked if there is no data in queue, otherwise, absolute
1710 * time will be checked.
1711 */

--- 476 unchanged lines hidden (view full) ---

2188 error = EBADF;
2189 goto out;
2190 }
2191 mtx_lock(&mq->mq_mutex);
2192 FILEDESC_UNLOCK_FAST(fdp);
2193 if (uap->sigev != NULL) {
2194 if (mq->mq_notifier != NULL) {
2195 error = EBUSY;
2194 } else if (ev.sigev_notify != SIGEV_NONE) {
2196 } else {
2195 PROC_LOCK(p);
2196 nt = notifier_search(p, uap->mqd);
2197 if (nt == NULL) {
2198 if (newnt == NULL) {
2199 PROC_UNLOCK(p);
2200 mtx_unlock(&mq->mq_mutex);
2201 newnt = notifier_alloc();
2202 goto again;

--- 270 unchanged lines hidden ---
2197 PROC_LOCK(p);
2198 nt = notifier_search(p, uap->mqd);
2199 if (nt == NULL) {
2200 if (newnt == NULL) {
2201 PROC_UNLOCK(p);
2202 mtx_unlock(&mq->mq_mutex);
2203 newnt = notifier_alloc();
2204 goto again;

--- 270 unchanged lines hidden ---