uipc_mqueue.c (cbd92ce62e92bd17871c9668c2c2bebac3e2ac2e) uipc_mqueue.c (4949ad72643a493203e625000682982a38cc9777)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2005 David Xu <davidxu@freebsd.org>
5 * Copyright (c) 2016-2017 Robert N. M. Watson
6 * All rights reserved.
7 *
8 * Portions of this software were developed by BAE Systems, the University of

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

1338 * Read from a file
1339 */
1340static int
1341mqfs_read(struct vop_read_args *ap)
1342{
1343 char buf[80];
1344 struct vnode *vp = ap->a_vp;
1345 struct uio *uio = ap->a_uio;
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2005 David Xu <davidxu@freebsd.org>
5 * Copyright (c) 2016-2017 Robert N. M. Watson
6 * All rights reserved.
7 *
8 * Portions of this software were developed by BAE Systems, the University of

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

1338 * Read from a file
1339 */
1340static int
1341mqfs_read(struct vop_read_args *ap)
1342{
1343 char buf[80];
1344 struct vnode *vp = ap->a_vp;
1345 struct uio *uio = ap->a_uio;
1346 struct mqfs_node *pn;
1347 struct mqueue *mq;
1348 int len, error;
1349
1350 if (vp->v_type != VREG)
1351 return (EINVAL);
1352
1346 struct mqueue *mq;
1347 int len, error;
1348
1349 if (vp->v_type != VREG)
1350 return (EINVAL);
1351
1353 pn = VTON(vp);
1354 mq = VTOMQ(vp);
1355 snprintf(buf, sizeof(buf),
1356 "QSIZE:%-10ld MAXMSG:%-10ld CURMSG:%-10ld MSGSIZE:%-10ld\n",
1357 mq->mq_totalbytes,
1358 mq->mq_maxmsg,
1359 mq->mq_curmsgs,
1360 mq->mq_msgsize);
1361 buf[sizeof(buf)-1] = '\0';

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

2434 evp = &ev;
2435 }
2436 return (kern_kmq_notify(td, uap->mqd, evp));
2437}
2438
2439static void
2440mqueue_fdclose(struct thread *td, int fd, struct file *fp)
2441{
1352 mq = VTOMQ(vp);
1353 snprintf(buf, sizeof(buf),
1354 "QSIZE:%-10ld MAXMSG:%-10ld CURMSG:%-10ld MSGSIZE:%-10ld\n",
1355 mq->mq_totalbytes,
1356 mq->mq_maxmsg,
1357 mq->mq_curmsgs,
1358 mq->mq_msgsize);
1359 buf[sizeof(buf)-1] = '\0';

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

2432 evp = &ev;
2433 }
2434 return (kern_kmq_notify(td, uap->mqd, evp));
2435}
2436
2437static void
2438mqueue_fdclose(struct thread *td, int fd, struct file *fp)
2439{
2442 struct filedesc *fdp;
2443 struct mqueue *mq;
2440 struct mqueue *mq;
2441#ifdef INVARIANTS
2442 struct filedesc *fdp;
2444
2445 fdp = td->td_proc->p_fd;
2446 FILEDESC_LOCK_ASSERT(fdp);
2443
2444 fdp = td->td_proc->p_fd;
2445 FILEDESC_LOCK_ASSERT(fdp);
2446#endif
2447
2448 if (fp->f_ops == &mqueueops) {
2449 mq = FPTOMQ(fp);
2450 mtx_lock(&mq->mq_mutex);
2451 notifier_remove(td->td_proc, mq, fd);
2452
2453 /* have to wakeup thread in same process */
2454 if (mq->mq_flags & MQ_RSEL) {

--- 479 unchanged lines hidden ---
2447
2448 if (fp->f_ops == &mqueueops) {
2449 mq = FPTOMQ(fp);
2450 mtx_lock(&mq->mq_mutex);
2451 notifier_remove(td->td_proc, mq, fd);
2452
2453 /* have to wakeup thread in same process */
2454 if (mq->mq_flags & MQ_RSEL) {

--- 479 unchanged lines hidden ---