uipc_mqueue.c (5ee2d4ac5aff2e6ce8ab0f49b969a7f781b7a3d8) | uipc_mqueue.c (9947b45978e8ec4c110704f0d970b38ecb1c2e70) |
---|---|
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 --- 174 unchanged lines hidden (view full) --- 183}; 184 185SYSCTL_NODE(_kern, OID_AUTO, mqueue, CTLFLAG_RW, 0, 186 "POSIX real time message queue"); 187 188static int default_maxmsg = 10; 189static int default_msgsize = 1024; 190 | 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 --- 174 unchanged lines hidden (view full) --- 183}; 184 185SYSCTL_NODE(_kern, OID_AUTO, mqueue, CTLFLAG_RW, 0, 186 "POSIX real time message queue"); 187 188static int default_maxmsg = 10; 189static int default_msgsize = 1024; 190 |
191static int maxmsg = 20; | 191static int maxmsg = 100; |
192SYSCTL_INT(_kern_mqueue, OID_AUTO, maxmsg, CTLFLAG_RW, 193 &maxmsg, 0, "Default maximum messages in queue"); 194static int maxmsgsize = 16384; 195SYSCTL_INT(_kern_mqueue, OID_AUTO, maxmsgsize, CTLFLAG_RW, 196 &maxmsgsize, 0, "Default maximum message size"); 197static int maxmq = 100; 198SYSCTL_INT(_kern_mqueue, OID_AUTO, maxmq, CTLFLAG_RW, 199 &maxmq, 0, "maximum message queues"); --- 1963 unchanged lines hidden (view full) --- 2163 2164 p = td->td_proc; 2165 fdp = td->td_proc->p_fd; 2166 if (uap->sigev) { 2167 error = copyin(uap->sigev, &ev, sizeof(ev)); 2168 if (error) 2169 return (error); 2170 if (ev.sigev_notify != SIGEV_SIGNAL && | 192SYSCTL_INT(_kern_mqueue, OID_AUTO, maxmsg, CTLFLAG_RW, 193 &maxmsg, 0, "Default maximum messages in queue"); 194static int maxmsgsize = 16384; 195SYSCTL_INT(_kern_mqueue, OID_AUTO, maxmsgsize, CTLFLAG_RW, 196 &maxmsgsize, 0, "Default maximum message size"); 197static int maxmq = 100; 198SYSCTL_INT(_kern_mqueue, OID_AUTO, maxmq, CTLFLAG_RW, 199 &maxmq, 0, "maximum message queues"); --- 1963 unchanged lines hidden (view full) --- 2163 2164 p = td->td_proc; 2165 fdp = td->td_proc->p_fd; 2166 if (uap->sigev) { 2167 error = copyin(uap->sigev, &ev, sizeof(ev)); 2168 if (error) 2169 return (error); 2170 if (ev.sigev_notify != SIGEV_SIGNAL && |
2171 ev.sigev_notify != SIGEV_THREAD_ID) | 2171 ev.sigev_notify != SIGEV_THREAD_ID && 2172 ev.sigev_notify != SIGEV_NONE) |
2172 return (EINVAL); 2173 if ((ev.sigev_notify == SIGEV_SIGNAL || 2174 ev.sigev_notify == SIGEV_THREAD_ID) && 2175 !_SIG_VALID(ev.sigev_signo)) 2176 return (EINVAL); 2177 } 2178 error = getmq(td, uap->mqd, &fp, NULL, &mq); 2179 if (error) --- 5 unchanged lines hidden (view full) --- 2185 error = EBADF; 2186 goto out; 2187 } 2188 mtx_lock(&mq->mq_mutex); 2189 FILEDESC_UNLOCK_FAST(fdp); 2190 if (uap->sigev != NULL) { 2191 if (mq->mq_notifier != NULL) { 2192 error = EBUSY; | 2173 return (EINVAL); 2174 if ((ev.sigev_notify == SIGEV_SIGNAL || 2175 ev.sigev_notify == SIGEV_THREAD_ID) && 2176 !_SIG_VALID(ev.sigev_signo)) 2177 return (EINVAL); 2178 } 2179 error = getmq(td, uap->mqd, &fp, NULL, &mq); 2180 if (error) --- 5 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; |
2193 } else { | 2194 } else if (ev.sigev_notify != SIGEV_NONE) { |
2194 PROC_LOCK(p); 2195 nt = notifier_search(p, uap->mqd); 2196 if (nt == NULL) { 2197 if (newnt == NULL) { 2198 PROC_UNLOCK(p); 2199 mtx_unlock(&mq->mq_mutex); 2200 newnt = notifier_alloc(); 2201 goto again; --- 270 unchanged lines hidden --- | 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 --- |