uipc_mqueue.c (156134) | uipc_mqueue.c (157815) |
---|---|
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 --- 29 unchanged lines hidden (view full) --- 38 * times at different mount points but shows same contents. 39 * 40 * 2) Standard POSIX message queue API. The syscalls do not use vfs layer, 41 * but directly operate on internal data structure, this allows user to 42 * use the IPC facility without having to mount mqueue file system. 43 */ 44 45#include <sys/cdefs.h> | 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 --- 29 unchanged lines hidden (view full) --- 38 * times at different mount points but shows same contents. 39 * 40 * 2) Standard POSIX message queue API. The syscalls do not use vfs layer, 41 * but directly operate on internal data structure, this allows user to 42 * use the IPC facility without having to mount mqueue file system. 43 */ 44 45#include <sys/cdefs.h> |
46__FBSDID("$FreeBSD: head/sys/kern/uipc_mqueue.c 156134 2006-03-01 06:29:34Z davidxu $"); | 46__FBSDID("$FreeBSD: head/sys/kern/uipc_mqueue.c 157815 2006-04-17 18:20:38Z jhb $"); |
47 48#include <sys/param.h> 49#include <sys/kernel.h> 50#include <sys/systm.h> 51#include <sys/limits.h> 52#include <sys/buf.h> 53#include <sys/dirent.h> 54#include <sys/event.h> --- 1597 unchanged lines hidden (view full) --- 1652 mtx_lock(&mq->mq_mutex); 1653 while (mq->mq_curmsgs >= mq->mq_maxmsg && error == 0) { 1654 if (timo < 0) { 1655 mtx_unlock(&mq->mq_mutex); 1656 return (EAGAIN); 1657 } 1658 mq->mq_senders++; 1659 error = msleep(&mq->mq_senders, &mq->mq_mutex, | 47 48#include <sys/param.h> 49#include <sys/kernel.h> 50#include <sys/systm.h> 51#include <sys/limits.h> 52#include <sys/buf.h> 53#include <sys/dirent.h> 54#include <sys/event.h> --- 1597 unchanged lines hidden (view full) --- 1652 mtx_lock(&mq->mq_mutex); 1653 while (mq->mq_curmsgs >= mq->mq_maxmsg && error == 0) { 1654 if (timo < 0) { 1655 mtx_unlock(&mq->mq_mutex); 1656 return (EAGAIN); 1657 } 1658 mq->mq_senders++; 1659 error = msleep(&mq->mq_senders, &mq->mq_mutex, |
1660 curthread->td_priority | PCATCH, "mqsend", timo); | 1660 PCATCH, "mqsend", timo); |
1661 mq->mq_senders--; 1662 if (error == EAGAIN) 1663 error = ETIMEDOUT; 1664 } 1665 if (mq->mq_curmsgs >= mq->mq_maxmsg) { 1666 mtx_unlock(&mq->mq_mutex); 1667 return (error); 1668 } --- 135 unchanged lines hidden (view full) --- 1804 mtx_lock(&mq->mq_mutex); 1805 while ((*msg = TAILQ_FIRST(&mq->mq_msgq)) == NULL && error == 0) { 1806 if (timo < 0) { 1807 mtx_unlock(&mq->mq_mutex); 1808 return (EAGAIN); 1809 } 1810 mq->mq_receivers++; 1811 error = msleep(&mq->mq_receivers, &mq->mq_mutex, | 1661 mq->mq_senders--; 1662 if (error == EAGAIN) 1663 error = ETIMEDOUT; 1664 } 1665 if (mq->mq_curmsgs >= mq->mq_maxmsg) { 1666 mtx_unlock(&mq->mq_mutex); 1667 return (error); 1668 } --- 135 unchanged lines hidden (view full) --- 1804 mtx_lock(&mq->mq_mutex); 1805 while ((*msg = TAILQ_FIRST(&mq->mq_msgq)) == NULL && error == 0) { 1806 if (timo < 0) { 1807 mtx_unlock(&mq->mq_mutex); 1808 return (EAGAIN); 1809 } 1810 mq->mq_receivers++; 1811 error = msleep(&mq->mq_receivers, &mq->mq_mutex, |
1812 curthread->td_priority | PCATCH, "mqrecv", timo); | 1812 PCATCH, "mqrecv", timo); |
1813 mq->mq_receivers--; 1814 if (error == EAGAIN) 1815 error = ETIMEDOUT; 1816 } 1817 if (*msg != NULL) { 1818 error = 0; 1819 TAILQ_REMOVE(&mq->mq_msgq, *msg, msg_link); 1820 mq->mq_curmsgs--; --- 662 unchanged lines hidden --- | 1813 mq->mq_receivers--; 1814 if (error == EAGAIN) 1815 error = ETIMEDOUT; 1816 } 1817 if (*msg != NULL) { 1818 error = 0; 1819 TAILQ_REMOVE(&mq->mq_msgq, *msg, msg_link); 1820 mq->mq_curmsgs--; --- 662 unchanged lines hidden --- |