uipc_mqueue.c (6cec9cad762b6476313fb1f8e931a1647822db6b) uipc_mqueue.c (2d69d0dcc2bb94d874dd0fa77d53b08112b9d530)
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

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

2413 mtx_unlock(&mq->mq_mutex);
2414 }
2415 }
2416 FILEDESC_SUNLOCK(fdp);
2417 KASSERT(LIST_EMPTY(&p->p_mqnotifier), ("mq notifiers left"));
2418}
2419
2420static int
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

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

2413 mtx_unlock(&mq->mq_mutex);
2414 }
2415 }
2416 FILEDESC_SUNLOCK(fdp);
2417 KASSERT(LIST_EMPTY(&p->p_mqnotifier), ("mq notifiers left"));
2418}
2419
2420static int
2421mqf_read(struct file *fp, struct uio *uio, struct ucred *active_cred,
2422 int flags, struct thread *td)
2423{
2424 return (EOPNOTSUPP);
2425}
2426
2427static int
2428mqf_write(struct file *fp, struct uio *uio, struct ucred *active_cred,
2429 int flags, struct thread *td)
2430{
2431 return (EOPNOTSUPP);
2432}
2433
2434static int
2435mqf_truncate(struct file *fp, off_t length, struct ucred *active_cred,
2436 struct thread *td)
2437{
2438
2439 return (EINVAL);
2440}
2441
2442static int
2443mqf_ioctl(struct file *fp, u_long cmd, void *data,
2444 struct ucred *active_cred, struct thread *td)
2445{
2446 return (ENOTTY);
2447}
2448
2449static int
2450mqf_poll(struct file *fp, int events, struct ucred *active_cred,
2451 struct thread *td)
2452{
2453 struct mqueue *mq = FPTOMQ(fp);
2454 int revents = 0;
2455
2456 mtx_lock(&mq->mq_mutex);
2457 if (events & (POLLIN | POLLRDNORM)) {

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

2596{
2597 struct mqueue *mq = FPTOMQ(kn->kn_fp);
2598
2599 mtx_assert(&mq->mq_mutex, MA_OWNED);
2600 return (mq->mq_curmsgs < mq->mq_maxmsg);
2601}
2602
2603static struct fileops mqueueops = {
2421mqf_poll(struct file *fp, int events, struct ucred *active_cred,
2422 struct thread *td)
2423{
2424 struct mqueue *mq = FPTOMQ(fp);
2425 int revents = 0;
2426
2427 mtx_lock(&mq->mq_mutex);
2428 if (events & (POLLIN | POLLRDNORM)) {

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

2567{
2568 struct mqueue *mq = FPTOMQ(kn->kn_fp);
2569
2570 mtx_assert(&mq->mq_mutex, MA_OWNED);
2571 return (mq->mq_curmsgs < mq->mq_maxmsg);
2572}
2573
2574static struct fileops mqueueops = {
2604 .fo_read = mqf_read,
2605 .fo_write = mqf_write,
2606 .fo_truncate = mqf_truncate,
2607 .fo_ioctl = mqf_ioctl,
2575 .fo_read = invfo_rdwr,
2576 .fo_write = invfo_rdwr,
2577 .fo_truncate = invfo_truncate,
2578 .fo_ioctl = invfo_ioctl,
2608 .fo_poll = mqf_poll,
2609 .fo_kqfilter = mqf_kqfilter,
2610 .fo_stat = mqf_stat,
2579 .fo_poll = mqf_poll,
2580 .fo_kqfilter = mqf_kqfilter,
2581 .fo_stat = mqf_stat,
2582 .fo_close = mqf_close,
2611 .fo_chmod = mqf_chmod,
2612 .fo_chown = mqf_chown,
2583 .fo_chmod = mqf_chmod,
2584 .fo_chown = mqf_chown,
2613 .fo_close = mqf_close,
2614 .fo_sendfile = invfo_sendfile,
2615};
2616
2617static struct vop_vector mqfs_vnodeops = {
2618 .vop_default = &default_vnodeops,
2619 .vop_access = mqfs_access,
2620 .vop_cachedlookup = mqfs_lookup,
2621 .vop_lookup = vfs_cache_lookup,

--- 262 unchanged lines hidden ---
2585 .fo_sendfile = invfo_sendfile,
2586};
2587
2588static struct vop_vector mqfs_vnodeops = {
2589 .vop_default = &default_vnodeops,
2590 .vop_access = mqfs_access,
2591 .vop_cachedlookup = mqfs_lookup,
2592 .vop_lookup = vfs_cache_lookup,

--- 262 unchanged lines hidden ---