kern_event.c (a9d2f8d84f69e98100b5746816b35666bcf992ac) | kern_event.c (d1b6899e83a28eedca46b95bb090e3e476642166) |
---|---|
1/*- 2 * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> 3 * Copyright 2004 John-Mark Gurney <jmg@FreeBSD.org> 4 * Copyright (c) 2009 Apple, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 803 unchanged lines hidden (view full) --- 812 struct kevent_copyops *k_ops, const struct timespec *timeout) 813{ 814 struct kevent keva[KQ_NEVENTS]; 815 struct kevent *kevp, *changes; 816 struct kqueue *kq; 817 struct file *fp; 818 int i, n, nerrors, error; 819 | 1/*- 2 * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> 3 * Copyright 2004 John-Mark Gurney <jmg@FreeBSD.org> 4 * Copyright (c) 2009 Apple, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 803 unchanged lines hidden (view full) --- 812 struct kevent_copyops *k_ops, const struct timespec *timeout) 813{ 814 struct kevent keva[KQ_NEVENTS]; 815 struct kevent *kevp, *changes; 816 struct kqueue *kq; 817 struct file *fp; 818 int i, n, nerrors, error; 819 |
820 if ((error = fget(td, fd, CAP_POST_KEVENT, &fp)) != 0) | 820 if ((error = fget(td, fd, CAP_POST_EVENT, &fp)) != 0) |
821 return (error); 822 if ((error = kqueue_acquire(fp, &kq)) != 0) 823 goto done_norel; 824 825 nerrors = 0; 826 827 while (nchanges > 0) { 828 n = nchanges > KQ_NEVENTS ? KQ_NEVENTS : nchanges; --- 139 unchanged lines hidden (view full) --- 968 if (fops == NULL) 969 return EINVAL; 970 971 tkn = knote_alloc(waitok); /* prevent waiting with locks */ 972 973findkn: 974 if (fops->f_isfd) { 975 KASSERT(td != NULL, ("td is NULL")); | 821 return (error); 822 if ((error = kqueue_acquire(fp, &kq)) != 0) 823 goto done_norel; 824 825 nerrors = 0; 826 827 while (nchanges > 0) { 828 n = nchanges > KQ_NEVENTS ? KQ_NEVENTS : nchanges; --- 139 unchanged lines hidden (view full) --- 968 if (fops == NULL) 969 return EINVAL; 970 971 tkn = knote_alloc(waitok); /* prevent waiting with locks */ 972 973findkn: 974 if (fops->f_isfd) { 975 KASSERT(td != NULL, ("td is NULL")); |
976 error = fget(td, kev->ident, CAP_POLL_KEVENT, &fp); | 976 error = fget(td, kev->ident, CAP_POLL_EVENT, &fp); |
977 if (error) 978 goto done; 979 980 if ((kev->flags & EV_ADD) == EV_ADD && kqueue_expand(kq, fops, 981 kev->ident, 0) != 0) { 982 /* try again */ 983 fdrop(fp, td); 984 fp = NULL; --- 1192 unchanged lines hidden (view full) --- 2177 */ 2178int 2179kqfd_register(int fd, struct kevent *kev, struct thread *td, int waitok) 2180{ 2181 struct kqueue *kq; 2182 struct file *fp; 2183 int error; 2184 | 977 if (error) 978 goto done; 979 980 if ((kev->flags & EV_ADD) == EV_ADD && kqueue_expand(kq, fops, 981 kev->ident, 0) != 0) { 982 /* try again */ 983 fdrop(fp, td); 984 fp = NULL; --- 1192 unchanged lines hidden (view full) --- 2177 */ 2178int 2179kqfd_register(int fd, struct kevent *kev, struct thread *td, int waitok) 2180{ 2181 struct kqueue *kq; 2182 struct file *fp; 2183 int error; 2184 |
2185 if ((error = fget(td, fd, CAP_POST_KEVENT, &fp)) != 0) | 2185 if ((error = fget(td, fd, CAP_POST_EVENT, &fp)) != 0) |
2186 return (error); 2187 if ((error = kqueue_acquire(fp, &kq)) != 0) 2188 goto noacquire; 2189 2190 error = kqueue_register(kq, kev, td, waitok); 2191 2192 kqueue_release(kq, 0); 2193 2194noacquire: 2195 fdrop(fp, td); 2196 2197 return error; 2198} | 2186 return (error); 2187 if ((error = kqueue_acquire(fp, &kq)) != 0) 2188 goto noacquire; 2189 2190 error = kqueue_register(kq, kev, td, waitok); 2191 2192 kqueue_release(kq, 0); 2193 2194noacquire: 2195 fdrop(fp, td); 2196 2197 return error; 2198} |