#
1.55 |
|
28-Jul-2023 |
christos |
Add epoll(2) from Theodore Preduta as part of GSoC 2023
|
Revision tags: netbsd-10-base bouyer-sunxi-drm-base
|
#
1.54 |
|
19-Jul-2022 |
thorpej |
Make some knote implementation details private to kern_event.c. NFC, and no ABI change for kevent providers.
|
#
1.53 |
|
13-Jul-2022 |
thorpej |
Move klist_{init,fini,insert,remove}() into kern_event.c. NFC.
|
#
1.52 |
|
12-Feb-2022 |
thorpej |
Add inline functions to manipulate the klists that link up knotes via kn_selnext:
- klist_init() - klist_fini() - klist_insert() - klist_remove()
These provide some API insulation from the implementation details of these lists (but not completely; see vn_knote_attach() and vn_knote_detach()). Currently just a wrapper around SLIST(9).
This will make it significantly easier to switch kn_selnext linkage to a different kind of list.
|
#
1.51 |
|
23-Oct-2021 |
thorpej |
Add support for the EVFILT_EMPTY filter, which is activated when the write buffer associated with the file descriptor is empty. This is currently implemented only for sockets, and is intended primarily to provide visibility to applications that all previously written data has been acknowledged by the TCP layer on the receiver. Compatible with the same filter in FreeBSD.
|
#
1.50 |
|
21-Oct-2021 |
thorpej |
Allow the f_touch() filter op to return an error, specifically in the EVENT_REGISTER case.
|
#
1.49 |
|
20-Oct-2021 |
thorpej |
Overhaul of the EVFILT_VNODE kevent(2) filter:
- Centralize vnode kevent handling in the VOP_*() wrappers, rather than forcing each individual file system to deal with it (except VOP_RENAME(), because VOP_RENAME() is a mess and we currently have 2 different ways of handling it; at least it's reasonably well-centralized in the "new" way). - Add support for NOTE_OPEN, NOTE_CLOSE, NOTE_CLOSE_WRITE, and NOTE_READ, compatible with the same events in FreeBSD. - Track which kevent notifications clients are interested in receiving to avoid doing work for events no one cares about (avoiding, e.g. taking locks and traversing the klist to send a NOTE_WRITE when someone is merely watching for a file to be deleted, for example).
In support of the above:
- Add support in vnode_if.sh for specifying PRE- and POST-op handlers, to be invoked before and after vop_pre() and vop_post(), respectively. Basic idea from FreeBSD, but implemented differently. - Add support in vnode_if.sh for specifying CONTEXT fields in the vop_*_args structures. These context fields are used to convey information between the file system VOP function and the VOP wrapper, but do not occupy an argument slot in the VOP_*() call itself. These context fields are initialized and subsequently interpreted by PRE- and POST-op handlers. - Version VOP_REMOVE(), uses the a context field for the file system to report back the resulting link count of the target vnode. Return this in tmpfs, udf, nfs, chfs, ext2fs, lfs, and ufs.
NetBSD 9.99.92.
|
#
1.48 |
|
13-Oct-2021 |
thorpej |
Add support for the NOTE_SECONDS, NOTE_MSECONDS, NOTE_USECONDS, NOTE_NSECONDS, and NOTE_ABSTIME filter flags to EVFILT_TIMER, API-compatible with the same in FreeBSD.
|
#
1.47 |
|
11-Oct-2021 |
thorpej |
Add a clarifying comment about it being safe to modify knote::kn_flags without synchronization in the filter attach routine. This is safe because the knote has not yet been published, and is typically used to force EV_CLEAR and/or EV_ONESHOT on that filter's knotes.
|
#
1.46 |
|
11-Oct-2021 |
thorpej |
Setting EV_EOF requires modifying kn->kn_flags. However, that relies on holding the kq_lock of that note's kq. Rather than exposing this directly, add new knote_set_eof() and knote_clear_eof() functions that handle the necessary locking and don't leak as many implementation details to modules.
NetBSD 9.99.91
|
#
1.45 |
|
10-Oct-2021 |
thorpej |
Document the locking rules for the fields of the kevent that's embedded in a knote.
|
#
1.44 |
|
10-Oct-2021 |
thorpej |
Changes to make EVFILT_PROC MP-safe:
Because the locking protocol around processes is somewhat complex compared to other events that can be posted on kqueues, introduce new functions for posting NOTE_EXEC, NOTE_EXIT, and NOTE_FORK, rather than just using the generic knote() function. These functions KASSERT() their locking expectations, and deal with other complexities for each situation.
knote_proc_fork(), in particiular, needs to handle NOTE_TRACK, which requires allocation of a new knote to attach to the child process. We don't want to be allocating memory while holding the parent's p_lock. Furthermore, we also have to attach the tracking note to the child process, which means we have to acquire the child's p_lock.
So, to handle all this, we introduce some additional synchronization infrastructure around the 'knote' structure:
- Add the ability to mark a knote as being in a state of flux. Knotes in this state are guaranteed not to be detached/deleted, thus allowing a code path drop other locks after putting a knote in this state.
- Code paths that wish to detach/delete a knote must first check if the knote is in-flux. If so, they must wait for it to quiesce. Because multiple threads of execution may attempt this concurrently, a mechanism exists for a single LWP to claim the detach responsibility; all other threads simply wait for the knote to disappear before they can make further progress.
- When kqueue_scan() encounters an in-flux knote, it simply treats the situation just like encountering another thread's queue marker -- wait for the flux to settle and continue on.
(The "in-flux knote" idea was inspired by FreeBSD, but this works differently from their implementation, as the two kqueue implementations have diverged quite a bit.)
knote_proc_fork() uses this infrastructure to implement NOTE_TRACK like so:
- Attempt to put the original tracking knote into a state of flux; if this fails (because the note has a detach pending), we skip all processing (the original process has lost interest, and we simply won the race).
- Once the note is in-flux, drop the kq and forking process's locks, and allocate 2 knotes: one to post the NOTE_CHILD event, and one to attach a new NOTE_TRACK to the child process. Notably, we do NOT go through kqueue_register() to do this, but rather do all of the work directly and KASSERT() our assumptions; this allows us to directly control our interaction with locks. All memory allocations here are performed with KM_NOSLEEP, in order to prevent holding the original knote in-flux indefinitely.
- Because the NOTE_TRACK use case adds knotes to kqueues through a sort of back-door mechanism, we must serialize with the closing of the destination kqueue's file descriptor, so steal another bit from the kq_count field to notify other threads that a kqueue is on its way out to prevent new knotes from being enqueued while the close path detaches them.
In addition to fixing EVFILT_PROC's reliance on KERNEL_LOCK, this also fixes a long-standing bug whereby a NOTE_CHILD event could be dropped if the child process exited before the interested process received the NOTE_CHILD event (the same knote would be used to deliver the NOTE_EXIT event, and would clobber the NOTE_CHILD's 'data' field).
Add a bunch of comments to explain what's going on in various critical sections, and sprinkle additional KASSERT()s to validate assumptions in several more locations.
|
#
1.43 |
|
26-Sep-2021 |
thorpej |
Fix the locking around EVFILT_FS. Previously, the code would walk the fs_klist and take the kqueue_misc_lock inside the event callback. However, that list can be modified by the attach and detach callbacks, which could result in the walker stepping right off a cliff.
Instead, we give the fs_klist it's own lock, and hold it while we call knote(), using the NOTE_SUBMIT protocol. Also, fs_filtops into vfs_syscalls.c so all of the locking logic is contained in one file (there is precedence with sig_filtops). fs_filtops is now marked MPSAFE.
|
#
1.42 |
|
26-Sep-2021 |
thorpej |
- Define a new filterops flag FILTEROP_MPSAFE, which states that the kqueue filter does not require the KERNEL_LOCK to be held. - Add wrappers around the calls into the filterops that take care of the locking requirements.
No functional change, since no filterops yet define FILTEROP_MPSAFE.
|
#
1.41 |
|
26-Sep-2021 |
thorpej |
Change the kqueue filterops::f_isfd field to filterops::f_flags, and define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd. Field and flag name aligned with OpenBSD.
This does not constitute a functional or ABI change, as the field location and size, and the value placed in that field, are the same as the previous code, but we're bumping __NetBSD_Version__ so 3rd-party module source code can adapt, as needed.
NetBSD 9.99.89
|
Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
|
#
1.40 |
|
31-Oct-2020 |
christos |
Add an array of filter names.
|
#
1.39 |
|
31-Oct-2020 |
christos |
PR/55663: Ruslan Nikolaev: Add support for EVFILT_USER in kqueue(2)
|
Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
|
#
1.38 |
|
03-Oct-2019 |
kamil |
Switch kevent udata from intptr_t void*
Synchromize the struct field format with other BSDs and Darwin.
No ABI change between older and newer struct form on the ports.
The change will require no changes to most C users during the transition period as the header keeps a caller cast.
Discussed with core@ and there were no objections for this move.
|
#
1.37 |
|
10-Aug-2019 |
kamil |
Fix typo in pragma in sys/event.h
Reenable -Wconversion-null.
|
#
1.36 |
|
10-Aug-2019 |
kamil |
Use common macro for _EV_SET() for integer types
Deduplicate code.
No functional change change intended.
|
#
1.35 |
|
10-Aug-2019 |
kamil |
Handle more corner cases in sys/event.h for C++ EV_SET()
Handle the udata argument as Plain-Old-Data types separately.
- int, long int, long long int - unsigned int, unsigned long int, unsigned long long int - void *
This approach handles each of the POD types separately on purpose as intermediate types such as intptr_t can be either int or long (even long long) and handling them is not portable.
This approach is compatibile with C++98 and newer.
Fixes i386 usage.
|
#
1.34 |
|
10-Aug-2019 |
kamil |
Add fallback defintion for C++ of _EV_SET with the last argument of type 0
Converting 0 to intptr and void* is ambiguous according to a C++ compiler. New _EV_SET() accepts int type and casts it with static_cast<int>() to intptr_t.
Reported and fix tested by <John D. Baker>
|
#
1.33 |
|
06-Aug-2019 |
kamil |
Make EV_SET() casts compatible with the C++ code
EV_SET() handles cast that are expected to work with alternative kqueue/kevent implementations that take arguments in different types.
Unfortunately void* -> intptr_t cast cannot be done with static_cast<intptr_t>() as it needs reinterpret_cast<intptr_t>().
Just switching to reinterpret_cast<intptr_t>() is still not sufficient as it does not handle NULL argument without a compiler error/warning.
Add a compatibility function for the C++ case of _EV_SET() that accepts the udata argument in the form of void* and performs clean reinterpret_cast<>() internally.
There is no change for C users.
Tested by <nia>
Proposed on tech-userlevel@.
|
Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.32 |
|
09-Jan-2018 |
christos |
branches: 1.32.4; 1.32.8; Merge autofs support from: Tomohiro Kusumi XXX: Does not work yet
|
Revision tags: tls-maxphys-base-20171202
|
#
1.31 |
|
16-Sep-2017 |
christos |
Add flags bits print
|
Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
branches: 1.28.2; Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.12; 1.23.28; 1.23.30; 1.23.32; 1.23.36; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.54 |
|
19-Jul-2022 |
thorpej |
Make some knote implementation details private to kern_event.c. NFC, and no ABI change for kevent providers.
|
#
1.53 |
|
13-Jul-2022 |
thorpej |
Move klist_{init,fini,insert,remove}() into kern_event.c. NFC.
|
#
1.52 |
|
12-Feb-2022 |
thorpej |
Add inline functions to manipulate the klists that link up knotes via kn_selnext:
- klist_init() - klist_fini() - klist_insert() - klist_remove()
These provide some API insulation from the implementation details of these lists (but not completely; see vn_knote_attach() and vn_knote_detach()). Currently just a wrapper around SLIST(9).
This will make it significantly easier to switch kn_selnext linkage to a different kind of list.
|
#
1.51 |
|
23-Oct-2021 |
thorpej |
Add support for the EVFILT_EMPTY filter, which is activated when the write buffer associated with the file descriptor is empty. This is currently implemented only for sockets, and is intended primarily to provide visibility to applications that all previously written data has been acknowledged by the TCP layer on the receiver. Compatible with the same filter in FreeBSD.
|
#
1.50 |
|
21-Oct-2021 |
thorpej |
Allow the f_touch() filter op to return an error, specifically in the EVENT_REGISTER case.
|
#
1.49 |
|
20-Oct-2021 |
thorpej |
Overhaul of the EVFILT_VNODE kevent(2) filter:
- Centralize vnode kevent handling in the VOP_*() wrappers, rather than forcing each individual file system to deal with it (except VOP_RENAME(), because VOP_RENAME() is a mess and we currently have 2 different ways of handling it; at least it's reasonably well-centralized in the "new" way). - Add support for NOTE_OPEN, NOTE_CLOSE, NOTE_CLOSE_WRITE, and NOTE_READ, compatible with the same events in FreeBSD. - Track which kevent notifications clients are interested in receiving to avoid doing work for events no one cares about (avoiding, e.g. taking locks and traversing the klist to send a NOTE_WRITE when someone is merely watching for a file to be deleted, for example).
In support of the above:
- Add support in vnode_if.sh for specifying PRE- and POST-op handlers, to be invoked before and after vop_pre() and vop_post(), respectively. Basic idea from FreeBSD, but implemented differently. - Add support in vnode_if.sh for specifying CONTEXT fields in the vop_*_args structures. These context fields are used to convey information between the file system VOP function and the VOP wrapper, but do not occupy an argument slot in the VOP_*() call itself. These context fields are initialized and subsequently interpreted by PRE- and POST-op handlers. - Version VOP_REMOVE(), uses the a context field for the file system to report back the resulting link count of the target vnode. Return this in tmpfs, udf, nfs, chfs, ext2fs, lfs, and ufs.
NetBSD 9.99.92.
|
#
1.48 |
|
13-Oct-2021 |
thorpej |
Add support for the NOTE_SECONDS, NOTE_MSECONDS, NOTE_USECONDS, NOTE_NSECONDS, and NOTE_ABSTIME filter flags to EVFILT_TIMER, API-compatible with the same in FreeBSD.
|
#
1.47 |
|
11-Oct-2021 |
thorpej |
Add a clarifying comment about it being safe to modify knote::kn_flags without synchronization in the filter attach routine. This is safe because the knote has not yet been published, and is typically used to force EV_CLEAR and/or EV_ONESHOT on that filter's knotes.
|
#
1.46 |
|
11-Oct-2021 |
thorpej |
Setting EV_EOF requires modifying kn->kn_flags. However, that relies on holding the kq_lock of that note's kq. Rather than exposing this directly, add new knote_set_eof() and knote_clear_eof() functions that handle the necessary locking and don't leak as many implementation details to modules.
NetBSD 9.99.91
|
#
1.45 |
|
10-Oct-2021 |
thorpej |
Document the locking rules for the fields of the kevent that's embedded in a knote.
|
#
1.44 |
|
10-Oct-2021 |
thorpej |
Changes to make EVFILT_PROC MP-safe:
Because the locking protocol around processes is somewhat complex compared to other events that can be posted on kqueues, introduce new functions for posting NOTE_EXEC, NOTE_EXIT, and NOTE_FORK, rather than just using the generic knote() function. These functions KASSERT() their locking expectations, and deal with other complexities for each situation.
knote_proc_fork(), in particiular, needs to handle NOTE_TRACK, which requires allocation of a new knote to attach to the child process. We don't want to be allocating memory while holding the parent's p_lock. Furthermore, we also have to attach the tracking note to the child process, which means we have to acquire the child's p_lock.
So, to handle all this, we introduce some additional synchronization infrastructure around the 'knote' structure:
- Add the ability to mark a knote as being in a state of flux. Knotes in this state are guaranteed not to be detached/deleted, thus allowing a code path drop other locks after putting a knote in this state.
- Code paths that wish to detach/delete a knote must first check if the knote is in-flux. If so, they must wait for it to quiesce. Because multiple threads of execution may attempt this concurrently, a mechanism exists for a single LWP to claim the detach responsibility; all other threads simply wait for the knote to disappear before they can make further progress.
- When kqueue_scan() encounters an in-flux knote, it simply treats the situation just like encountering another thread's queue marker -- wait for the flux to settle and continue on.
(The "in-flux knote" idea was inspired by FreeBSD, but this works differently from their implementation, as the two kqueue implementations have diverged quite a bit.)
knote_proc_fork() uses this infrastructure to implement NOTE_TRACK like so:
- Attempt to put the original tracking knote into a state of flux; if this fails (because the note has a detach pending), we skip all processing (the original process has lost interest, and we simply won the race).
- Once the note is in-flux, drop the kq and forking process's locks, and allocate 2 knotes: one to post the NOTE_CHILD event, and one to attach a new NOTE_TRACK to the child process. Notably, we do NOT go through kqueue_register() to do this, but rather do all of the work directly and KASSERT() our assumptions; this allows us to directly control our interaction with locks. All memory allocations here are performed with KM_NOSLEEP, in order to prevent holding the original knote in-flux indefinitely.
- Because the NOTE_TRACK use case adds knotes to kqueues through a sort of back-door mechanism, we must serialize with the closing of the destination kqueue's file descriptor, so steal another bit from the kq_count field to notify other threads that a kqueue is on its way out to prevent new knotes from being enqueued while the close path detaches them.
In addition to fixing EVFILT_PROC's reliance on KERNEL_LOCK, this also fixes a long-standing bug whereby a NOTE_CHILD event could be dropped if the child process exited before the interested process received the NOTE_CHILD event (the same knote would be used to deliver the NOTE_EXIT event, and would clobber the NOTE_CHILD's 'data' field).
Add a bunch of comments to explain what's going on in various critical sections, and sprinkle additional KASSERT()s to validate assumptions in several more locations.
|
#
1.43 |
|
26-Sep-2021 |
thorpej |
Fix the locking around EVFILT_FS. Previously, the code would walk the fs_klist and take the kqueue_misc_lock inside the event callback. However, that list can be modified by the attach and detach callbacks, which could result in the walker stepping right off a cliff.
Instead, we give the fs_klist it's own lock, and hold it while we call knote(), using the NOTE_SUBMIT protocol. Also, fs_filtops into vfs_syscalls.c so all of the locking logic is contained in one file (there is precedence with sig_filtops). fs_filtops is now marked MPSAFE.
|
#
1.42 |
|
26-Sep-2021 |
thorpej |
- Define a new filterops flag FILTEROP_MPSAFE, which states that the kqueue filter does not require the KERNEL_LOCK to be held. - Add wrappers around the calls into the filterops that take care of the locking requirements.
No functional change, since no filterops yet define FILTEROP_MPSAFE.
|
#
1.41 |
|
26-Sep-2021 |
thorpej |
Change the kqueue filterops::f_isfd field to filterops::f_flags, and define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd. Field and flag name aligned with OpenBSD.
This does not constitute a functional or ABI change, as the field location and size, and the value placed in that field, are the same as the previous code, but we're bumping __NetBSD_Version__ so 3rd-party module source code can adapt, as needed.
NetBSD 9.99.89
|
Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
|
#
1.40 |
|
31-Oct-2020 |
christos |
Add an array of filter names.
|
#
1.39 |
|
31-Oct-2020 |
christos |
PR/55663: Ruslan Nikolaev: Add support for EVFILT_USER in kqueue(2)
|
Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
|
#
1.38 |
|
03-Oct-2019 |
kamil |
Switch kevent udata from intptr_t void*
Synchromize the struct field format with other BSDs and Darwin.
No ABI change between older and newer struct form on the ports.
The change will require no changes to most C users during the transition period as the header keeps a caller cast.
Discussed with core@ and there were no objections for this move.
|
#
1.37 |
|
10-Aug-2019 |
kamil |
Fix typo in pragma in sys/event.h
Reenable -Wconversion-null.
|
#
1.36 |
|
10-Aug-2019 |
kamil |
Use common macro for _EV_SET() for integer types
Deduplicate code.
No functional change change intended.
|
#
1.35 |
|
10-Aug-2019 |
kamil |
Handle more corner cases in sys/event.h for C++ EV_SET()
Handle the udata argument as Plain-Old-Data types separately.
- int, long int, long long int - unsigned int, unsigned long int, unsigned long long int - void *
This approach handles each of the POD types separately on purpose as intermediate types such as intptr_t can be either int or long (even long long) and handling them is not portable.
This approach is compatibile with C++98 and newer.
Fixes i386 usage.
|
#
1.34 |
|
10-Aug-2019 |
kamil |
Add fallback defintion for C++ of _EV_SET with the last argument of type 0
Converting 0 to intptr and void* is ambiguous according to a C++ compiler. New _EV_SET() accepts int type and casts it with static_cast<int>() to intptr_t.
Reported and fix tested by <John D. Baker>
|
#
1.33 |
|
06-Aug-2019 |
kamil |
Make EV_SET() casts compatible with the C++ code
EV_SET() handles cast that are expected to work with alternative kqueue/kevent implementations that take arguments in different types.
Unfortunately void* -> intptr_t cast cannot be done with static_cast<intptr_t>() as it needs reinterpret_cast<intptr_t>().
Just switching to reinterpret_cast<intptr_t>() is still not sufficient as it does not handle NULL argument without a compiler error/warning.
Add a compatibility function for the C++ case of _EV_SET() that accepts the udata argument in the form of void* and performs clean reinterpret_cast<>() internally.
There is no change for C users.
Tested by <nia>
Proposed on tech-userlevel@.
|
Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.32 |
|
09-Jan-2018 |
christos |
branches: 1.32.4; 1.32.8; Merge autofs support from: Tomohiro Kusumi XXX: Does not work yet
|
Revision tags: tls-maxphys-base-20171202
|
#
1.31 |
|
16-Sep-2017 |
christos |
Add flags bits print
|
Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
branches: 1.28.2; Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.12; 1.23.28; 1.23.30; 1.23.32; 1.23.36; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.53 |
|
13-Jul-2022 |
thorpej |
Move klist_{init,fini,insert,remove}() into kern_event.c. NFC.
|
#
1.52 |
|
12-Feb-2022 |
thorpej |
Add inline functions to manipulate the klists that link up knotes via kn_selnext:
- klist_init() - klist_fini() - klist_insert() - klist_remove()
These provide some API insulation from the implementation details of these lists (but not completely; see vn_knote_attach() and vn_knote_detach()). Currently just a wrapper around SLIST(9).
This will make it significantly easier to switch kn_selnext linkage to a different kind of list.
|
#
1.51 |
|
23-Oct-2021 |
thorpej |
Add support for the EVFILT_EMPTY filter, which is activated when the write buffer associated with the file descriptor is empty. This is currently implemented only for sockets, and is intended primarily to provide visibility to applications that all previously written data has been acknowledged by the TCP layer on the receiver. Compatible with the same filter in FreeBSD.
|
#
1.50 |
|
21-Oct-2021 |
thorpej |
Allow the f_touch() filter op to return an error, specifically in the EVENT_REGISTER case.
|
#
1.49 |
|
20-Oct-2021 |
thorpej |
Overhaul of the EVFILT_VNODE kevent(2) filter:
- Centralize vnode kevent handling in the VOP_*() wrappers, rather than forcing each individual file system to deal with it (except VOP_RENAME(), because VOP_RENAME() is a mess and we currently have 2 different ways of handling it; at least it's reasonably well-centralized in the "new" way). - Add support for NOTE_OPEN, NOTE_CLOSE, NOTE_CLOSE_WRITE, and NOTE_READ, compatible with the same events in FreeBSD. - Track which kevent notifications clients are interested in receiving to avoid doing work for events no one cares about (avoiding, e.g. taking locks and traversing the klist to send a NOTE_WRITE when someone is merely watching for a file to be deleted, for example).
In support of the above:
- Add support in vnode_if.sh for specifying PRE- and POST-op handlers, to be invoked before and after vop_pre() and vop_post(), respectively. Basic idea from FreeBSD, but implemented differently. - Add support in vnode_if.sh for specifying CONTEXT fields in the vop_*_args structures. These context fields are used to convey information between the file system VOP function and the VOP wrapper, but do not occupy an argument slot in the VOP_*() call itself. These context fields are initialized and subsequently interpreted by PRE- and POST-op handlers. - Version VOP_REMOVE(), uses the a context field for the file system to report back the resulting link count of the target vnode. Return this in tmpfs, udf, nfs, chfs, ext2fs, lfs, and ufs.
NetBSD 9.99.92.
|
#
1.48 |
|
13-Oct-2021 |
thorpej |
Add support for the NOTE_SECONDS, NOTE_MSECONDS, NOTE_USECONDS, NOTE_NSECONDS, and NOTE_ABSTIME filter flags to EVFILT_TIMER, API-compatible with the same in FreeBSD.
|
#
1.47 |
|
11-Oct-2021 |
thorpej |
Add a clarifying comment about it being safe to modify knote::kn_flags without synchronization in the filter attach routine. This is safe because the knote has not yet been published, and is typically used to force EV_CLEAR and/or EV_ONESHOT on that filter's knotes.
|
#
1.46 |
|
11-Oct-2021 |
thorpej |
Setting EV_EOF requires modifying kn->kn_flags. However, that relies on holding the kq_lock of that note's kq. Rather than exposing this directly, add new knote_set_eof() and knote_clear_eof() functions that handle the necessary locking and don't leak as many implementation details to modules.
NetBSD 9.99.91
|
#
1.45 |
|
10-Oct-2021 |
thorpej |
Document the locking rules for the fields of the kevent that's embedded in a knote.
|
#
1.44 |
|
10-Oct-2021 |
thorpej |
Changes to make EVFILT_PROC MP-safe:
Because the locking protocol around processes is somewhat complex compared to other events that can be posted on kqueues, introduce new functions for posting NOTE_EXEC, NOTE_EXIT, and NOTE_FORK, rather than just using the generic knote() function. These functions KASSERT() their locking expectations, and deal with other complexities for each situation.
knote_proc_fork(), in particiular, needs to handle NOTE_TRACK, which requires allocation of a new knote to attach to the child process. We don't want to be allocating memory while holding the parent's p_lock. Furthermore, we also have to attach the tracking note to the child process, which means we have to acquire the child's p_lock.
So, to handle all this, we introduce some additional synchronization infrastructure around the 'knote' structure:
- Add the ability to mark a knote as being in a state of flux. Knotes in this state are guaranteed not to be detached/deleted, thus allowing a code path drop other locks after putting a knote in this state.
- Code paths that wish to detach/delete a knote must first check if the knote is in-flux. If so, they must wait for it to quiesce. Because multiple threads of execution may attempt this concurrently, a mechanism exists for a single LWP to claim the detach responsibility; all other threads simply wait for the knote to disappear before they can make further progress.
- When kqueue_scan() encounters an in-flux knote, it simply treats the situation just like encountering another thread's queue marker -- wait for the flux to settle and continue on.
(The "in-flux knote" idea was inspired by FreeBSD, but this works differently from their implementation, as the two kqueue implementations have diverged quite a bit.)
knote_proc_fork() uses this infrastructure to implement NOTE_TRACK like so:
- Attempt to put the original tracking knote into a state of flux; if this fails (because the note has a detach pending), we skip all processing (the original process has lost interest, and we simply won the race).
- Once the note is in-flux, drop the kq and forking process's locks, and allocate 2 knotes: one to post the NOTE_CHILD event, and one to attach a new NOTE_TRACK to the child process. Notably, we do NOT go through kqueue_register() to do this, but rather do all of the work directly and KASSERT() our assumptions; this allows us to directly control our interaction with locks. All memory allocations here are performed with KM_NOSLEEP, in order to prevent holding the original knote in-flux indefinitely.
- Because the NOTE_TRACK use case adds knotes to kqueues through a sort of back-door mechanism, we must serialize with the closing of the destination kqueue's file descriptor, so steal another bit from the kq_count field to notify other threads that a kqueue is on its way out to prevent new knotes from being enqueued while the close path detaches them.
In addition to fixing EVFILT_PROC's reliance on KERNEL_LOCK, this also fixes a long-standing bug whereby a NOTE_CHILD event could be dropped if the child process exited before the interested process received the NOTE_CHILD event (the same knote would be used to deliver the NOTE_EXIT event, and would clobber the NOTE_CHILD's 'data' field).
Add a bunch of comments to explain what's going on in various critical sections, and sprinkle additional KASSERT()s to validate assumptions in several more locations.
|
#
1.43 |
|
26-Sep-2021 |
thorpej |
Fix the locking around EVFILT_FS. Previously, the code would walk the fs_klist and take the kqueue_misc_lock inside the event callback. However, that list can be modified by the attach and detach callbacks, which could result in the walker stepping right off a cliff.
Instead, we give the fs_klist it's own lock, and hold it while we call knote(), using the NOTE_SUBMIT protocol. Also, fs_filtops into vfs_syscalls.c so all of the locking logic is contained in one file (there is precedence with sig_filtops). fs_filtops is now marked MPSAFE.
|
#
1.42 |
|
26-Sep-2021 |
thorpej |
- Define a new filterops flag FILTEROP_MPSAFE, which states that the kqueue filter does not require the KERNEL_LOCK to be held. - Add wrappers around the calls into the filterops that take care of the locking requirements.
No functional change, since no filterops yet define FILTEROP_MPSAFE.
|
#
1.41 |
|
26-Sep-2021 |
thorpej |
Change the kqueue filterops::f_isfd field to filterops::f_flags, and define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd. Field and flag name aligned with OpenBSD.
This does not constitute a functional or ABI change, as the field location and size, and the value placed in that field, are the same as the previous code, but we're bumping __NetBSD_Version__ so 3rd-party module source code can adapt, as needed.
NetBSD 9.99.89
|
Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
|
#
1.40 |
|
31-Oct-2020 |
christos |
Add an array of filter names.
|
#
1.39 |
|
31-Oct-2020 |
christos |
PR/55663: Ruslan Nikolaev: Add support for EVFILT_USER in kqueue(2)
|
Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
|
#
1.38 |
|
03-Oct-2019 |
kamil |
Switch kevent udata from intptr_t void*
Synchromize the struct field format with other BSDs and Darwin.
No ABI change between older and newer struct form on the ports.
The change will require no changes to most C users during the transition period as the header keeps a caller cast.
Discussed with core@ and there were no objections for this move.
|
#
1.37 |
|
10-Aug-2019 |
kamil |
Fix typo in pragma in sys/event.h
Reenable -Wconversion-null.
|
#
1.36 |
|
10-Aug-2019 |
kamil |
Use common macro for _EV_SET() for integer types
Deduplicate code.
No functional change change intended.
|
#
1.35 |
|
10-Aug-2019 |
kamil |
Handle more corner cases in sys/event.h for C++ EV_SET()
Handle the udata argument as Plain-Old-Data types separately.
- int, long int, long long int - unsigned int, unsigned long int, unsigned long long int - void *
This approach handles each of the POD types separately on purpose as intermediate types such as intptr_t can be either int or long (even long long) and handling them is not portable.
This approach is compatibile with C++98 and newer.
Fixes i386 usage.
|
#
1.34 |
|
10-Aug-2019 |
kamil |
Add fallback defintion for C++ of _EV_SET with the last argument of type 0
Converting 0 to intptr and void* is ambiguous according to a C++ compiler. New _EV_SET() accepts int type and casts it with static_cast<int>() to intptr_t.
Reported and fix tested by <John D. Baker>
|
#
1.33 |
|
06-Aug-2019 |
kamil |
Make EV_SET() casts compatible with the C++ code
EV_SET() handles cast that are expected to work with alternative kqueue/kevent implementations that take arguments in different types.
Unfortunately void* -> intptr_t cast cannot be done with static_cast<intptr_t>() as it needs reinterpret_cast<intptr_t>().
Just switching to reinterpret_cast<intptr_t>() is still not sufficient as it does not handle NULL argument without a compiler error/warning.
Add a compatibility function for the C++ case of _EV_SET() that accepts the udata argument in the form of void* and performs clean reinterpret_cast<>() internally.
There is no change for C users.
Tested by <nia>
Proposed on tech-userlevel@.
|
Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.32 |
|
09-Jan-2018 |
christos |
branches: 1.32.4; 1.32.8; Merge autofs support from: Tomohiro Kusumi XXX: Does not work yet
|
Revision tags: tls-maxphys-base-20171202
|
#
1.31 |
|
16-Sep-2017 |
christos |
Add flags bits print
|
Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
branches: 1.28.2; Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.12; 1.23.28; 1.23.30; 1.23.32; 1.23.36; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.52 |
|
12-Feb-2022 |
thorpej |
Add inline functions to manipulate the klists that link up knotes via kn_selnext:
- klist_init() - klist_fini() - klist_insert() - klist_remove()
These provide some API insulation from the implementation details of these lists (but not completely; see vn_knote_attach() and vn_knote_detach()). Currently just a wrapper around SLIST(9).
This will make it significantly easier to switch kn_selnext linkage to a different kind of list.
|
#
1.51 |
|
23-Oct-2021 |
thorpej |
Add support for the EVFILT_EMPTY filter, which is activated when the write buffer associated with the file descriptor is empty. This is currently implemented only for sockets, and is intended primarily to provide visibility to applications that all previously written data has been acknowledged by the TCP layer on the receiver. Compatible with the same filter in FreeBSD.
|
#
1.50 |
|
21-Oct-2021 |
thorpej |
Allow the f_touch() filter op to return an error, specifically in the EVENT_REGISTER case.
|
#
1.49 |
|
20-Oct-2021 |
thorpej |
Overhaul of the EVFILT_VNODE kevent(2) filter:
- Centralize vnode kevent handling in the VOP_*() wrappers, rather than forcing each individual file system to deal with it (except VOP_RENAME(), because VOP_RENAME() is a mess and we currently have 2 different ways of handling it; at least it's reasonably well-centralized in the "new" way). - Add support for NOTE_OPEN, NOTE_CLOSE, NOTE_CLOSE_WRITE, and NOTE_READ, compatible with the same events in FreeBSD. - Track which kevent notifications clients are interested in receiving to avoid doing work for events no one cares about (avoiding, e.g. taking locks and traversing the klist to send a NOTE_WRITE when someone is merely watching for a file to be deleted, for example).
In support of the above:
- Add support in vnode_if.sh for specifying PRE- and POST-op handlers, to be invoked before and after vop_pre() and vop_post(), respectively. Basic idea from FreeBSD, but implemented differently. - Add support in vnode_if.sh for specifying CONTEXT fields in the vop_*_args structures. These context fields are used to convey information between the file system VOP function and the VOP wrapper, but do not occupy an argument slot in the VOP_*() call itself. These context fields are initialized and subsequently interpreted by PRE- and POST-op handlers. - Version VOP_REMOVE(), uses the a context field for the file system to report back the resulting link count of the target vnode. Return this in tmpfs, udf, nfs, chfs, ext2fs, lfs, and ufs.
NetBSD 9.99.92.
|
#
1.48 |
|
13-Oct-2021 |
thorpej |
Add support for the NOTE_SECONDS, NOTE_MSECONDS, NOTE_USECONDS, NOTE_NSECONDS, and NOTE_ABSTIME filter flags to EVFILT_TIMER, API-compatible with the same in FreeBSD.
|
#
1.47 |
|
11-Oct-2021 |
thorpej |
Add a clarifying comment about it being safe to modify knote::kn_flags without synchronization in the filter attach routine. This is safe because the knote has not yet been published, and is typically used to force EV_CLEAR and/or EV_ONESHOT on that filter's knotes.
|
#
1.46 |
|
11-Oct-2021 |
thorpej |
Setting EV_EOF requires modifying kn->kn_flags. However, that relies on holding the kq_lock of that note's kq. Rather than exposing this directly, add new knote_set_eof() and knote_clear_eof() functions that handle the necessary locking and don't leak as many implementation details to modules.
NetBSD 9.99.91
|
#
1.45 |
|
10-Oct-2021 |
thorpej |
Document the locking rules for the fields of the kevent that's embedded in a knote.
|
#
1.44 |
|
10-Oct-2021 |
thorpej |
Changes to make EVFILT_PROC MP-safe:
Because the locking protocol around processes is somewhat complex compared to other events that can be posted on kqueues, introduce new functions for posting NOTE_EXEC, NOTE_EXIT, and NOTE_FORK, rather than just using the generic knote() function. These functions KASSERT() their locking expectations, and deal with other complexities for each situation.
knote_proc_fork(), in particiular, needs to handle NOTE_TRACK, which requires allocation of a new knote to attach to the child process. We don't want to be allocating memory while holding the parent's p_lock. Furthermore, we also have to attach the tracking note to the child process, which means we have to acquire the child's p_lock.
So, to handle all this, we introduce some additional synchronization infrastructure around the 'knote' structure:
- Add the ability to mark a knote as being in a state of flux. Knotes in this state are guaranteed not to be detached/deleted, thus allowing a code path drop other locks after putting a knote in this state.
- Code paths that wish to detach/delete a knote must first check if the knote is in-flux. If so, they must wait for it to quiesce. Because multiple threads of execution may attempt this concurrently, a mechanism exists for a single LWP to claim the detach responsibility; all other threads simply wait for the knote to disappear before they can make further progress.
- When kqueue_scan() encounters an in-flux knote, it simply treats the situation just like encountering another thread's queue marker -- wait for the flux to settle and continue on.
(The "in-flux knote" idea was inspired by FreeBSD, but this works differently from their implementation, as the two kqueue implementations have diverged quite a bit.)
knote_proc_fork() uses this infrastructure to implement NOTE_TRACK like so:
- Attempt to put the original tracking knote into a state of flux; if this fails (because the note has a detach pending), we skip all processing (the original process has lost interest, and we simply won the race).
- Once the note is in-flux, drop the kq and forking process's locks, and allocate 2 knotes: one to post the NOTE_CHILD event, and one to attach a new NOTE_TRACK to the child process. Notably, we do NOT go through kqueue_register() to do this, but rather do all of the work directly and KASSERT() our assumptions; this allows us to directly control our interaction with locks. All memory allocations here are performed with KM_NOSLEEP, in order to prevent holding the original knote in-flux indefinitely.
- Because the NOTE_TRACK use case adds knotes to kqueues through a sort of back-door mechanism, we must serialize with the closing of the destination kqueue's file descriptor, so steal another bit from the kq_count field to notify other threads that a kqueue is on its way out to prevent new knotes from being enqueued while the close path detaches them.
In addition to fixing EVFILT_PROC's reliance on KERNEL_LOCK, this also fixes a long-standing bug whereby a NOTE_CHILD event could be dropped if the child process exited before the interested process received the NOTE_CHILD event (the same knote would be used to deliver the NOTE_EXIT event, and would clobber the NOTE_CHILD's 'data' field).
Add a bunch of comments to explain what's going on in various critical sections, and sprinkle additional KASSERT()s to validate assumptions in several more locations.
|
#
1.43 |
|
26-Sep-2021 |
thorpej |
Fix the locking around EVFILT_FS. Previously, the code would walk the fs_klist and take the kqueue_misc_lock inside the event callback. However, that list can be modified by the attach and detach callbacks, which could result in the walker stepping right off a cliff.
Instead, we give the fs_klist it's own lock, and hold it while we call knote(), using the NOTE_SUBMIT protocol. Also, fs_filtops into vfs_syscalls.c so all of the locking logic is contained in one file (there is precedence with sig_filtops). fs_filtops is now marked MPSAFE.
|
#
1.42 |
|
26-Sep-2021 |
thorpej |
- Define a new filterops flag FILTEROP_MPSAFE, which states that the kqueue filter does not require the KERNEL_LOCK to be held. - Add wrappers around the calls into the filterops that take care of the locking requirements.
No functional change, since no filterops yet define FILTEROP_MPSAFE.
|
#
1.41 |
|
26-Sep-2021 |
thorpej |
Change the kqueue filterops::f_isfd field to filterops::f_flags, and define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd. Field and flag name aligned with OpenBSD.
This does not constitute a functional or ABI change, as the field location and size, and the value placed in that field, are the same as the previous code, but we're bumping __NetBSD_Version__ so 3rd-party module source code can adapt, as needed.
NetBSD 9.99.89
|
Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
|
#
1.40 |
|
31-Oct-2020 |
christos |
Add an array of filter names.
|
#
1.39 |
|
31-Oct-2020 |
christos |
PR/55663: Ruslan Nikolaev: Add support for EVFILT_USER in kqueue(2)
|
Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
|
#
1.38 |
|
03-Oct-2019 |
kamil |
Switch kevent udata from intptr_t void*
Synchromize the struct field format with other BSDs and Darwin.
No ABI change between older and newer struct form on the ports.
The change will require no changes to most C users during the transition period as the header keeps a caller cast.
Discussed with core@ and there were no objections for this move.
|
#
1.37 |
|
10-Aug-2019 |
kamil |
Fix typo in pragma in sys/event.h
Reenable -Wconversion-null.
|
#
1.36 |
|
10-Aug-2019 |
kamil |
Use common macro for _EV_SET() for integer types
Deduplicate code.
No functional change change intended.
|
#
1.35 |
|
10-Aug-2019 |
kamil |
Handle more corner cases in sys/event.h for C++ EV_SET()
Handle the udata argument as Plain-Old-Data types separately.
- int, long int, long long int - unsigned int, unsigned long int, unsigned long long int - void *
This approach handles each of the POD types separately on purpose as intermediate types such as intptr_t can be either int or long (even long long) and handling them is not portable.
This approach is compatibile with C++98 and newer.
Fixes i386 usage.
|
#
1.34 |
|
10-Aug-2019 |
kamil |
Add fallback defintion for C++ of _EV_SET with the last argument of type 0
Converting 0 to intptr and void* is ambiguous according to a C++ compiler. New _EV_SET() accepts int type and casts it with static_cast<int>() to intptr_t.
Reported and fix tested by <John D. Baker>
|
#
1.33 |
|
06-Aug-2019 |
kamil |
Make EV_SET() casts compatible with the C++ code
EV_SET() handles cast that are expected to work with alternative kqueue/kevent implementations that take arguments in different types.
Unfortunately void* -> intptr_t cast cannot be done with static_cast<intptr_t>() as it needs reinterpret_cast<intptr_t>().
Just switching to reinterpret_cast<intptr_t>() is still not sufficient as it does not handle NULL argument without a compiler error/warning.
Add a compatibility function for the C++ case of _EV_SET() that accepts the udata argument in the form of void* and performs clean reinterpret_cast<>() internally.
There is no change for C users.
Tested by <nia>
Proposed on tech-userlevel@.
|
Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.32 |
|
09-Jan-2018 |
christos |
branches: 1.32.4; 1.32.8; Merge autofs support from: Tomohiro Kusumi XXX: Does not work yet
|
Revision tags: tls-maxphys-base-20171202
|
#
1.31 |
|
16-Sep-2017 |
christos |
Add flags bits print
|
Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
branches: 1.28.2; Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.12; 1.23.28; 1.23.30; 1.23.32; 1.23.36; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.51 |
|
23-Oct-2021 |
thorpej |
Add support for the EVFILT_EMPTY filter, which is activated when the write buffer associated with the file descriptor is empty. This is currently implemented only for sockets, and is intended primarily to provide visibility to applications that all previously written data has been acknowledged by the TCP layer on the receiver. Compatible with the same filter in FreeBSD.
|
#
1.50 |
|
21-Oct-2021 |
thorpej |
Allow the f_touch() filter op to return an error, specifically in the EVENT_REGISTER case.
|
#
1.49 |
|
20-Oct-2021 |
thorpej |
Overhaul of the EVFILT_VNODE kevent(2) filter:
- Centralize vnode kevent handling in the VOP_*() wrappers, rather than forcing each individual file system to deal with it (except VOP_RENAME(), because VOP_RENAME() is a mess and we currently have 2 different ways of handling it; at least it's reasonably well-centralized in the "new" way). - Add support for NOTE_OPEN, NOTE_CLOSE, NOTE_CLOSE_WRITE, and NOTE_READ, compatible with the same events in FreeBSD. - Track which kevent notifications clients are interested in receiving to avoid doing work for events no one cares about (avoiding, e.g. taking locks and traversing the klist to send a NOTE_WRITE when someone is merely watching for a file to be deleted, for example).
In support of the above:
- Add support in vnode_if.sh for specifying PRE- and POST-op handlers, to be invoked before and after vop_pre() and vop_post(), respectively. Basic idea from FreeBSD, but implemented differently. - Add support in vnode_if.sh for specifying CONTEXT fields in the vop_*_args structures. These context fields are used to convey information between the file system VOP function and the VOP wrapper, but do not occupy an argument slot in the VOP_*() call itself. These context fields are initialized and subsequently interpreted by PRE- and POST-op handlers. - Version VOP_REMOVE(), uses the a context field for the file system to report back the resulting link count of the target vnode. Return this in tmpfs, udf, nfs, chfs, ext2fs, lfs, and ufs.
NetBSD 9.99.92.
|
#
1.48 |
|
13-Oct-2021 |
thorpej |
Add support for the NOTE_SECONDS, NOTE_MSECONDS, NOTE_USECONDS, NOTE_NSECONDS, and NOTE_ABSTIME filter flags to EVFILT_TIMER, API-compatible with the same in FreeBSD.
|
#
1.47 |
|
11-Oct-2021 |
thorpej |
Add a clarifying comment about it being safe to modify knote::kn_flags without synchronization in the filter attach routine. This is safe because the knote has not yet been published, and is typically used to force EV_CLEAR and/or EV_ONESHOT on that filter's knotes.
|
#
1.46 |
|
11-Oct-2021 |
thorpej |
Setting EV_EOF requires modifying kn->kn_flags. However, that relies on holding the kq_lock of that note's kq. Rather than exposing this directly, add new knote_set_eof() and knote_clear_eof() functions that handle the necessary locking and don't leak as many implementation details to modules.
NetBSD 9.99.91
|
#
1.45 |
|
10-Oct-2021 |
thorpej |
Document the locking rules for the fields of the kevent that's embedded in a knote.
|
#
1.44 |
|
10-Oct-2021 |
thorpej |
Changes to make EVFILT_PROC MP-safe:
Because the locking protocol around processes is somewhat complex compared to other events that can be posted on kqueues, introduce new functions for posting NOTE_EXEC, NOTE_EXIT, and NOTE_FORK, rather than just using the generic knote() function. These functions KASSERT() their locking expectations, and deal with other complexities for each situation.
knote_proc_fork(), in particiular, needs to handle NOTE_TRACK, which requires allocation of a new knote to attach to the child process. We don't want to be allocating memory while holding the parent's p_lock. Furthermore, we also have to attach the tracking note to the child process, which means we have to acquire the child's p_lock.
So, to handle all this, we introduce some additional synchronization infrastructure around the 'knote' structure:
- Add the ability to mark a knote as being in a state of flux. Knotes in this state are guaranteed not to be detached/deleted, thus allowing a code path drop other locks after putting a knote in this state.
- Code paths that wish to detach/delete a knote must first check if the knote is in-flux. If so, they must wait for it to quiesce. Because multiple threads of execution may attempt this concurrently, a mechanism exists for a single LWP to claim the detach responsibility; all other threads simply wait for the knote to disappear before they can make further progress.
- When kqueue_scan() encounters an in-flux knote, it simply treats the situation just like encountering another thread's queue marker -- wait for the flux to settle and continue on.
(The "in-flux knote" idea was inspired by FreeBSD, but this works differently from their implementation, as the two kqueue implementations have diverged quite a bit.)
knote_proc_fork() uses this infrastructure to implement NOTE_TRACK like so:
- Attempt to put the original tracking knote into a state of flux; if this fails (because the note has a detach pending), we skip all processing (the original process has lost interest, and we simply won the race).
- Once the note is in-flux, drop the kq and forking process's locks, and allocate 2 knotes: one to post the NOTE_CHILD event, and one to attach a new NOTE_TRACK to the child process. Notably, we do NOT go through kqueue_register() to do this, but rather do all of the work directly and KASSERT() our assumptions; this allows us to directly control our interaction with locks. All memory allocations here are performed with KM_NOSLEEP, in order to prevent holding the original knote in-flux indefinitely.
- Because the NOTE_TRACK use case adds knotes to kqueues through a sort of back-door mechanism, we must serialize with the closing of the destination kqueue's file descriptor, so steal another bit from the kq_count field to notify other threads that a kqueue is on its way out to prevent new knotes from being enqueued while the close path detaches them.
In addition to fixing EVFILT_PROC's reliance on KERNEL_LOCK, this also fixes a long-standing bug whereby a NOTE_CHILD event could be dropped if the child process exited before the interested process received the NOTE_CHILD event (the same knote would be used to deliver the NOTE_EXIT event, and would clobber the NOTE_CHILD's 'data' field).
Add a bunch of comments to explain what's going on in various critical sections, and sprinkle additional KASSERT()s to validate assumptions in several more locations.
|
#
1.43 |
|
26-Sep-2021 |
thorpej |
Fix the locking around EVFILT_FS. Previously, the code would walk the fs_klist and take the kqueue_misc_lock inside the event callback. However, that list can be modified by the attach and detach callbacks, which could result in the walker stepping right off a cliff.
Instead, we give the fs_klist it's own lock, and hold it while we call knote(), using the NOTE_SUBMIT protocol. Also, fs_filtops into vfs_syscalls.c so all of the locking logic is contained in one file (there is precedence with sig_filtops). fs_filtops is now marked MPSAFE.
|
#
1.42 |
|
26-Sep-2021 |
thorpej |
- Define a new filterops flag FILTEROP_MPSAFE, which states that the kqueue filter does not require the KERNEL_LOCK to be held. - Add wrappers around the calls into the filterops that take care of the locking requirements.
No functional change, since no filterops yet define FILTEROP_MPSAFE.
|
#
1.41 |
|
26-Sep-2021 |
thorpej |
Change the kqueue filterops::f_isfd field to filterops::f_flags, and define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd. Field and flag name aligned with OpenBSD.
This does not constitute a functional or ABI change, as the field location and size, and the value placed in that field, are the same as the previous code, but we're bumping __NetBSD_Version__ so 3rd-party module source code can adapt, as needed.
NetBSD 9.99.89
|
Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
|
#
1.40 |
|
31-Oct-2020 |
christos |
Add an array of filter names.
|
#
1.39 |
|
31-Oct-2020 |
christos |
PR/55663: Ruslan Nikolaev: Add support for EVFILT_USER in kqueue(2)
|
Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
|
#
1.38 |
|
03-Oct-2019 |
kamil |
Switch kevent udata from intptr_t void*
Synchromize the struct field format with other BSDs and Darwin.
No ABI change between older and newer struct form on the ports.
The change will require no changes to most C users during the transition period as the header keeps a caller cast.
Discussed with core@ and there were no objections for this move.
|
#
1.37 |
|
10-Aug-2019 |
kamil |
Fix typo in pragma in sys/event.h
Reenable -Wconversion-null.
|
#
1.36 |
|
10-Aug-2019 |
kamil |
Use common macro for _EV_SET() for integer types
Deduplicate code.
No functional change change intended.
|
#
1.35 |
|
10-Aug-2019 |
kamil |
Handle more corner cases in sys/event.h for C++ EV_SET()
Handle the udata argument as Plain-Old-Data types separately.
- int, long int, long long int - unsigned int, unsigned long int, unsigned long long int - void *
This approach handles each of the POD types separately on purpose as intermediate types such as intptr_t can be either int or long (even long long) and handling them is not portable.
This approach is compatibile with C++98 and newer.
Fixes i386 usage.
|
#
1.34 |
|
10-Aug-2019 |
kamil |
Add fallback defintion for C++ of _EV_SET with the last argument of type 0
Converting 0 to intptr and void* is ambiguous according to a C++ compiler. New _EV_SET() accepts int type and casts it with static_cast<int>() to intptr_t.
Reported and fix tested by <John D. Baker>
|
#
1.33 |
|
06-Aug-2019 |
kamil |
Make EV_SET() casts compatible with the C++ code
EV_SET() handles cast that are expected to work with alternative kqueue/kevent implementations that take arguments in different types.
Unfortunately void* -> intptr_t cast cannot be done with static_cast<intptr_t>() as it needs reinterpret_cast<intptr_t>().
Just switching to reinterpret_cast<intptr_t>() is still not sufficient as it does not handle NULL argument without a compiler error/warning.
Add a compatibility function for the C++ case of _EV_SET() that accepts the udata argument in the form of void* and performs clean reinterpret_cast<>() internally.
There is no change for C users.
Tested by <nia>
Proposed on tech-userlevel@.
|
Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.32 |
|
09-Jan-2018 |
christos |
branches: 1.32.4; 1.32.8; Merge autofs support from: Tomohiro Kusumi XXX: Does not work yet
|
Revision tags: tls-maxphys-base-20171202
|
#
1.31 |
|
16-Sep-2017 |
christos |
Add flags bits print
|
Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
branches: 1.28.2; Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.12; 1.23.28; 1.23.30; 1.23.32; 1.23.36; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.50 |
|
21-Oct-2021 |
thorpej |
Allow the f_touch() filter op to return an error, specifically in the EVENT_REGISTER case.
|
#
1.49 |
|
20-Oct-2021 |
thorpej |
Overhaul of the EVFILT_VNODE kevent(2) filter:
- Centralize vnode kevent handling in the VOP_*() wrappers, rather than forcing each individual file system to deal with it (except VOP_RENAME(), because VOP_RENAME() is a mess and we currently have 2 different ways of handling it; at least it's reasonably well-centralized in the "new" way). - Add support for NOTE_OPEN, NOTE_CLOSE, NOTE_CLOSE_WRITE, and NOTE_READ, compatible with the same events in FreeBSD. - Track which kevent notifications clients are interested in receiving to avoid doing work for events no one cares about (avoiding, e.g. taking locks and traversing the klist to send a NOTE_WRITE when someone is merely watching for a file to be deleted, for example).
In support of the above:
- Add support in vnode_if.sh for specifying PRE- and POST-op handlers, to be invoked before and after vop_pre() and vop_post(), respectively. Basic idea from FreeBSD, but implemented differently. - Add support in vnode_if.sh for specifying CONTEXT fields in the vop_*_args structures. These context fields are used to convey information between the file system VOP function and the VOP wrapper, but do not occupy an argument slot in the VOP_*() call itself. These context fields are initialized and subsequently interpreted by PRE- and POST-op handlers. - Version VOP_REMOVE(), uses the a context field for the file system to report back the resulting link count of the target vnode. Return this in tmpfs, udf, nfs, chfs, ext2fs, lfs, and ufs.
NetBSD 9.99.92.
|
#
1.48 |
|
13-Oct-2021 |
thorpej |
Add support for the NOTE_SECONDS, NOTE_MSECONDS, NOTE_USECONDS, NOTE_NSECONDS, and NOTE_ABSTIME filter flags to EVFILT_TIMER, API-compatible with the same in FreeBSD.
|
#
1.47 |
|
11-Oct-2021 |
thorpej |
Add a clarifying comment about it being safe to modify knote::kn_flags without synchronization in the filter attach routine. This is safe because the knote has not yet been published, and is typically used to force EV_CLEAR and/or EV_ONESHOT on that filter's knotes.
|
#
1.46 |
|
11-Oct-2021 |
thorpej |
Setting EV_EOF requires modifying kn->kn_flags. However, that relies on holding the kq_lock of that note's kq. Rather than exposing this directly, add new knote_set_eof() and knote_clear_eof() functions that handle the necessary locking and don't leak as many implementation details to modules.
NetBSD 9.99.91
|
#
1.45 |
|
10-Oct-2021 |
thorpej |
Document the locking rules for the fields of the kevent that's embedded in a knote.
|
#
1.44 |
|
10-Oct-2021 |
thorpej |
Changes to make EVFILT_PROC MP-safe:
Because the locking protocol around processes is somewhat complex compared to other events that can be posted on kqueues, introduce new functions for posting NOTE_EXEC, NOTE_EXIT, and NOTE_FORK, rather than just using the generic knote() function. These functions KASSERT() their locking expectations, and deal with other complexities for each situation.
knote_proc_fork(), in particiular, needs to handle NOTE_TRACK, which requires allocation of a new knote to attach to the child process. We don't want to be allocating memory while holding the parent's p_lock. Furthermore, we also have to attach the tracking note to the child process, which means we have to acquire the child's p_lock.
So, to handle all this, we introduce some additional synchronization infrastructure around the 'knote' structure:
- Add the ability to mark a knote as being in a state of flux. Knotes in this state are guaranteed not to be detached/deleted, thus allowing a code path drop other locks after putting a knote in this state.
- Code paths that wish to detach/delete a knote must first check if the knote is in-flux. If so, they must wait for it to quiesce. Because multiple threads of execution may attempt this concurrently, a mechanism exists for a single LWP to claim the detach responsibility; all other threads simply wait for the knote to disappear before they can make further progress.
- When kqueue_scan() encounters an in-flux knote, it simply treats the situation just like encountering another thread's queue marker -- wait for the flux to settle and continue on.
(The "in-flux knote" idea was inspired by FreeBSD, but this works differently from their implementation, as the two kqueue implementations have diverged quite a bit.)
knote_proc_fork() uses this infrastructure to implement NOTE_TRACK like so:
- Attempt to put the original tracking knote into a state of flux; if this fails (because the note has a detach pending), we skip all processing (the original process has lost interest, and we simply won the race).
- Once the note is in-flux, drop the kq and forking process's locks, and allocate 2 knotes: one to post the NOTE_CHILD event, and one to attach a new NOTE_TRACK to the child process. Notably, we do NOT go through kqueue_register() to do this, but rather do all of the work directly and KASSERT() our assumptions; this allows us to directly control our interaction with locks. All memory allocations here are performed with KM_NOSLEEP, in order to prevent holding the original knote in-flux indefinitely.
- Because the NOTE_TRACK use case adds knotes to kqueues through a sort of back-door mechanism, we must serialize with the closing of the destination kqueue's file descriptor, so steal another bit from the kq_count field to notify other threads that a kqueue is on its way out to prevent new knotes from being enqueued while the close path detaches them.
In addition to fixing EVFILT_PROC's reliance on KERNEL_LOCK, this also fixes a long-standing bug whereby a NOTE_CHILD event could be dropped if the child process exited before the interested process received the NOTE_CHILD event (the same knote would be used to deliver the NOTE_EXIT event, and would clobber the NOTE_CHILD's 'data' field).
Add a bunch of comments to explain what's going on in various critical sections, and sprinkle additional KASSERT()s to validate assumptions in several more locations.
|
#
1.43 |
|
26-Sep-2021 |
thorpej |
Fix the locking around EVFILT_FS. Previously, the code would walk the fs_klist and take the kqueue_misc_lock inside the event callback. However, that list can be modified by the attach and detach callbacks, which could result in the walker stepping right off a cliff.
Instead, we give the fs_klist it's own lock, and hold it while we call knote(), using the NOTE_SUBMIT protocol. Also, fs_filtops into vfs_syscalls.c so all of the locking logic is contained in one file (there is precedence with sig_filtops). fs_filtops is now marked MPSAFE.
|
#
1.42 |
|
26-Sep-2021 |
thorpej |
- Define a new filterops flag FILTEROP_MPSAFE, which states that the kqueue filter does not require the KERNEL_LOCK to be held. - Add wrappers around the calls into the filterops that take care of the locking requirements.
No functional change, since no filterops yet define FILTEROP_MPSAFE.
|
#
1.41 |
|
26-Sep-2021 |
thorpej |
Change the kqueue filterops::f_isfd field to filterops::f_flags, and define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd. Field and flag name aligned with OpenBSD.
This does not constitute a functional or ABI change, as the field location and size, and the value placed in that field, are the same as the previous code, but we're bumping __NetBSD_Version__ so 3rd-party module source code can adapt, as needed.
NetBSD 9.99.89
|
Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
|
#
1.40 |
|
31-Oct-2020 |
christos |
Add an array of filter names.
|
#
1.39 |
|
31-Oct-2020 |
christos |
PR/55663: Ruslan Nikolaev: Add support for EVFILT_USER in kqueue(2)
|
Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
|
#
1.38 |
|
03-Oct-2019 |
kamil |
Switch kevent udata from intptr_t void*
Synchromize the struct field format with other BSDs and Darwin.
No ABI change between older and newer struct form on the ports.
The change will require no changes to most C users during the transition period as the header keeps a caller cast.
Discussed with core@ and there were no objections for this move.
|
#
1.37 |
|
10-Aug-2019 |
kamil |
Fix typo in pragma in sys/event.h
Reenable -Wconversion-null.
|
#
1.36 |
|
10-Aug-2019 |
kamil |
Use common macro for _EV_SET() for integer types
Deduplicate code.
No functional change change intended.
|
#
1.35 |
|
10-Aug-2019 |
kamil |
Handle more corner cases in sys/event.h for C++ EV_SET()
Handle the udata argument as Plain-Old-Data types separately.
- int, long int, long long int - unsigned int, unsigned long int, unsigned long long int - void *
This approach handles each of the POD types separately on purpose as intermediate types such as intptr_t can be either int or long (even long long) and handling them is not portable.
This approach is compatibile with C++98 and newer.
Fixes i386 usage.
|
#
1.34 |
|
10-Aug-2019 |
kamil |
Add fallback defintion for C++ of _EV_SET with the last argument of type 0
Converting 0 to intptr and void* is ambiguous according to a C++ compiler. New _EV_SET() accepts int type and casts it with static_cast<int>() to intptr_t.
Reported and fix tested by <John D. Baker>
|
#
1.33 |
|
06-Aug-2019 |
kamil |
Make EV_SET() casts compatible with the C++ code
EV_SET() handles cast that are expected to work with alternative kqueue/kevent implementations that take arguments in different types.
Unfortunately void* -> intptr_t cast cannot be done with static_cast<intptr_t>() as it needs reinterpret_cast<intptr_t>().
Just switching to reinterpret_cast<intptr_t>() is still not sufficient as it does not handle NULL argument without a compiler error/warning.
Add a compatibility function for the C++ case of _EV_SET() that accepts the udata argument in the form of void* and performs clean reinterpret_cast<>() internally.
There is no change for C users.
Tested by <nia>
Proposed on tech-userlevel@.
|
Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.32 |
|
09-Jan-2018 |
christos |
branches: 1.32.4; 1.32.8; Merge autofs support from: Tomohiro Kusumi XXX: Does not work yet
|
Revision tags: tls-maxphys-base-20171202
|
#
1.31 |
|
16-Sep-2017 |
christos |
Add flags bits print
|
Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
branches: 1.28.2; Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.12; 1.23.28; 1.23.30; 1.23.32; 1.23.36; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.49 |
|
20-Oct-2021 |
thorpej |
Overhaul of the EVFILT_VNODE kevent(2) filter:
- Centralize vnode kevent handling in the VOP_*() wrappers, rather than forcing each individual file system to deal with it (except VOP_RENAME(), because VOP_RENAME() is a mess and we currently have 2 different ways of handling it; at least it's reasonably well-centralized in the "new" way). - Add support for NOTE_OPEN, NOTE_CLOSE, NOTE_CLOSE_WRITE, and NOTE_READ, compatible with the same events in FreeBSD. - Track which kevent notifications clients are interested in receiving to avoid doing work for events no one cares about (avoiding, e.g. taking locks and traversing the klist to send a NOTE_WRITE when someone is merely watching for a file to be deleted, for example).
In support of the above:
- Add support in vnode_if.sh for specifying PRE- and POST-op handlers, to be invoked before and after vop_pre() and vop_post(), respectively. Basic idea from FreeBSD, but implemented differently. - Add support in vnode_if.sh for specifying CONTEXT fields in the vop_*_args structures. These context fields are used to convey information between the file system VOP function and the VOP wrapper, but do not occupy an argument slot in the VOP_*() call itself. These context fields are initialized and subsequently interpreted by PRE- and POST-op handlers. - Version VOP_REMOVE(), uses the a context field for the file system to report back the resulting link count of the target vnode. Return this in tmpfs, udf, nfs, chfs, ext2fs, lfs, and ufs.
NetBSD 9.99.92.
|
#
1.48 |
|
13-Oct-2021 |
thorpej |
Add support for the NOTE_SECONDS, NOTE_MSECONDS, NOTE_USECONDS, NOTE_NSECONDS, and NOTE_ABSTIME filter flags to EVFILT_TIMER, API-compatible with the same in FreeBSD.
|
#
1.47 |
|
11-Oct-2021 |
thorpej |
Add a clarifying comment about it being safe to modify knote::kn_flags without synchronization in the filter attach routine. This is safe because the knote has not yet been published, and is typically used to force EV_CLEAR and/or EV_ONESHOT on that filter's knotes.
|
#
1.46 |
|
11-Oct-2021 |
thorpej |
Setting EV_EOF requires modifying kn->kn_flags. However, that relies on holding the kq_lock of that note's kq. Rather than exposing this directly, add new knote_set_eof() and knote_clear_eof() functions that handle the necessary locking and don't leak as many implementation details to modules.
NetBSD 9.99.91
|
#
1.45 |
|
10-Oct-2021 |
thorpej |
Document the locking rules for the fields of the kevent that's embedded in a knote.
|
#
1.44 |
|
10-Oct-2021 |
thorpej |
Changes to make EVFILT_PROC MP-safe:
Because the locking protocol around processes is somewhat complex compared to other events that can be posted on kqueues, introduce new functions for posting NOTE_EXEC, NOTE_EXIT, and NOTE_FORK, rather than just using the generic knote() function. These functions KASSERT() their locking expectations, and deal with other complexities for each situation.
knote_proc_fork(), in particiular, needs to handle NOTE_TRACK, which requires allocation of a new knote to attach to the child process. We don't want to be allocating memory while holding the parent's p_lock. Furthermore, we also have to attach the tracking note to the child process, which means we have to acquire the child's p_lock.
So, to handle all this, we introduce some additional synchronization infrastructure around the 'knote' structure:
- Add the ability to mark a knote as being in a state of flux. Knotes in this state are guaranteed not to be detached/deleted, thus allowing a code path drop other locks after putting a knote in this state.
- Code paths that wish to detach/delete a knote must first check if the knote is in-flux. If so, they must wait for it to quiesce. Because multiple threads of execution may attempt this concurrently, a mechanism exists for a single LWP to claim the detach responsibility; all other threads simply wait for the knote to disappear before they can make further progress.
- When kqueue_scan() encounters an in-flux knote, it simply treats the situation just like encountering another thread's queue marker -- wait for the flux to settle and continue on.
(The "in-flux knote" idea was inspired by FreeBSD, but this works differently from their implementation, as the two kqueue implementations have diverged quite a bit.)
knote_proc_fork() uses this infrastructure to implement NOTE_TRACK like so:
- Attempt to put the original tracking knote into a state of flux; if this fails (because the note has a detach pending), we skip all processing (the original process has lost interest, and we simply won the race).
- Once the note is in-flux, drop the kq and forking process's locks, and allocate 2 knotes: one to post the NOTE_CHILD event, and one to attach a new NOTE_TRACK to the child process. Notably, we do NOT go through kqueue_register() to do this, but rather do all of the work directly and KASSERT() our assumptions; this allows us to directly control our interaction with locks. All memory allocations here are performed with KM_NOSLEEP, in order to prevent holding the original knote in-flux indefinitely.
- Because the NOTE_TRACK use case adds knotes to kqueues through a sort of back-door mechanism, we must serialize with the closing of the destination kqueue's file descriptor, so steal another bit from the kq_count field to notify other threads that a kqueue is on its way out to prevent new knotes from being enqueued while the close path detaches them.
In addition to fixing EVFILT_PROC's reliance on KERNEL_LOCK, this also fixes a long-standing bug whereby a NOTE_CHILD event could be dropped if the child process exited before the interested process received the NOTE_CHILD event (the same knote would be used to deliver the NOTE_EXIT event, and would clobber the NOTE_CHILD's 'data' field).
Add a bunch of comments to explain what's going on in various critical sections, and sprinkle additional KASSERT()s to validate assumptions in several more locations.
|
#
1.43 |
|
26-Sep-2021 |
thorpej |
Fix the locking around EVFILT_FS. Previously, the code would walk the fs_klist and take the kqueue_misc_lock inside the event callback. However, that list can be modified by the attach and detach callbacks, which could result in the walker stepping right off a cliff.
Instead, we give the fs_klist it's own lock, and hold it while we call knote(), using the NOTE_SUBMIT protocol. Also, fs_filtops into vfs_syscalls.c so all of the locking logic is contained in one file (there is precedence with sig_filtops). fs_filtops is now marked MPSAFE.
|
#
1.42 |
|
26-Sep-2021 |
thorpej |
- Define a new filterops flag FILTEROP_MPSAFE, which states that the kqueue filter does not require the KERNEL_LOCK to be held. - Add wrappers around the calls into the filterops that take care of the locking requirements.
No functional change, since no filterops yet define FILTEROP_MPSAFE.
|
#
1.41 |
|
26-Sep-2021 |
thorpej |
Change the kqueue filterops::f_isfd field to filterops::f_flags, and define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd. Field and flag name aligned with OpenBSD.
This does not constitute a functional or ABI change, as the field location and size, and the value placed in that field, are the same as the previous code, but we're bumping __NetBSD_Version__ so 3rd-party module source code can adapt, as needed.
NetBSD 9.99.89
|
Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
|
#
1.40 |
|
31-Oct-2020 |
christos |
Add an array of filter names.
|
#
1.39 |
|
31-Oct-2020 |
christos |
PR/55663: Ruslan Nikolaev: Add support for EVFILT_USER in kqueue(2)
|
Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
|
#
1.38 |
|
03-Oct-2019 |
kamil |
Switch kevent udata from intptr_t void*
Synchromize the struct field format with other BSDs and Darwin.
No ABI change between older and newer struct form on the ports.
The change will require no changes to most C users during the transition period as the header keeps a caller cast.
Discussed with core@ and there were no objections for this move.
|
#
1.37 |
|
10-Aug-2019 |
kamil |
Fix typo in pragma in sys/event.h
Reenable -Wconversion-null.
|
#
1.36 |
|
10-Aug-2019 |
kamil |
Use common macro for _EV_SET() for integer types
Deduplicate code.
No functional change change intended.
|
#
1.35 |
|
10-Aug-2019 |
kamil |
Handle more corner cases in sys/event.h for C++ EV_SET()
Handle the udata argument as Plain-Old-Data types separately.
- int, long int, long long int - unsigned int, unsigned long int, unsigned long long int - void *
This approach handles each of the POD types separately on purpose as intermediate types such as intptr_t can be either int or long (even long long) and handling them is not portable.
This approach is compatibile with C++98 and newer.
Fixes i386 usage.
|
#
1.34 |
|
10-Aug-2019 |
kamil |
Add fallback defintion for C++ of _EV_SET with the last argument of type 0
Converting 0 to intptr and void* is ambiguous according to a C++ compiler. New _EV_SET() accepts int type and casts it with static_cast<int>() to intptr_t.
Reported and fix tested by <John D. Baker>
|
#
1.33 |
|
06-Aug-2019 |
kamil |
Make EV_SET() casts compatible with the C++ code
EV_SET() handles cast that are expected to work with alternative kqueue/kevent implementations that take arguments in different types.
Unfortunately void* -> intptr_t cast cannot be done with static_cast<intptr_t>() as it needs reinterpret_cast<intptr_t>().
Just switching to reinterpret_cast<intptr_t>() is still not sufficient as it does not handle NULL argument without a compiler error/warning.
Add a compatibility function for the C++ case of _EV_SET() that accepts the udata argument in the form of void* and performs clean reinterpret_cast<>() internally.
There is no change for C users.
Tested by <nia>
Proposed on tech-userlevel@.
|
Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.32 |
|
09-Jan-2018 |
christos |
branches: 1.32.4; 1.32.8; Merge autofs support from: Tomohiro Kusumi XXX: Does not work yet
|
Revision tags: tls-maxphys-base-20171202
|
#
1.31 |
|
16-Sep-2017 |
christos |
Add flags bits print
|
Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
branches: 1.28.2; Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.12; 1.23.28; 1.23.30; 1.23.32; 1.23.36; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.48 |
|
13-Oct-2021 |
thorpej |
Add support for the NOTE_SECONDS, NOTE_MSECONDS, NOTE_USECONDS, NOTE_NSECONDS, and NOTE_ABSTIME filter flags to EVFILT_TIMER, API-compatible with the same in FreeBSD.
|
#
1.47 |
|
11-Oct-2021 |
thorpej |
Add a clarifying comment about it being safe to modify knote::kn_flags without synchronization in the filter attach routine. This is safe because the knote has not yet been published, and is typically used to force EV_CLEAR and/or EV_ONESHOT on that filter's knotes.
|
#
1.46 |
|
11-Oct-2021 |
thorpej |
Setting EV_EOF requires modifying kn->kn_flags. However, that relies on holding the kq_lock of that note's kq. Rather than exposing this directly, add new knote_set_eof() and knote_clear_eof() functions that handle the necessary locking and don't leak as many implementation details to modules.
NetBSD 9.99.91
|
#
1.45 |
|
10-Oct-2021 |
thorpej |
Document the locking rules for the fields of the kevent that's embedded in a knote.
|
#
1.44 |
|
10-Oct-2021 |
thorpej |
Changes to make EVFILT_PROC MP-safe:
Because the locking protocol around processes is somewhat complex compared to other events that can be posted on kqueues, introduce new functions for posting NOTE_EXEC, NOTE_EXIT, and NOTE_FORK, rather than just using the generic knote() function. These functions KASSERT() their locking expectations, and deal with other complexities for each situation.
knote_proc_fork(), in particiular, needs to handle NOTE_TRACK, which requires allocation of a new knote to attach to the child process. We don't want to be allocating memory while holding the parent's p_lock. Furthermore, we also have to attach the tracking note to the child process, which means we have to acquire the child's p_lock.
So, to handle all this, we introduce some additional synchronization infrastructure around the 'knote' structure:
- Add the ability to mark a knote as being in a state of flux. Knotes in this state are guaranteed not to be detached/deleted, thus allowing a code path drop other locks after putting a knote in this state.
- Code paths that wish to detach/delete a knote must first check if the knote is in-flux. If so, they must wait for it to quiesce. Because multiple threads of execution may attempt this concurrently, a mechanism exists for a single LWP to claim the detach responsibility; all other threads simply wait for the knote to disappear before they can make further progress.
- When kqueue_scan() encounters an in-flux knote, it simply treats the situation just like encountering another thread's queue marker -- wait for the flux to settle and continue on.
(The "in-flux knote" idea was inspired by FreeBSD, but this works differently from their implementation, as the two kqueue implementations have diverged quite a bit.)
knote_proc_fork() uses this infrastructure to implement NOTE_TRACK like so:
- Attempt to put the original tracking knote into a state of flux; if this fails (because the note has a detach pending), we skip all processing (the original process has lost interest, and we simply won the race).
- Once the note is in-flux, drop the kq and forking process's locks, and allocate 2 knotes: one to post the NOTE_CHILD event, and one to attach a new NOTE_TRACK to the child process. Notably, we do NOT go through kqueue_register() to do this, but rather do all of the work directly and KASSERT() our assumptions; this allows us to directly control our interaction with locks. All memory allocations here are performed with KM_NOSLEEP, in order to prevent holding the original knote in-flux indefinitely.
- Because the NOTE_TRACK use case adds knotes to kqueues through a sort of back-door mechanism, we must serialize with the closing of the destination kqueue's file descriptor, so steal another bit from the kq_count field to notify other threads that a kqueue is on its way out to prevent new knotes from being enqueued while the close path detaches them.
In addition to fixing EVFILT_PROC's reliance on KERNEL_LOCK, this also fixes a long-standing bug whereby a NOTE_CHILD event could be dropped if the child process exited before the interested process received the NOTE_CHILD event (the same knote would be used to deliver the NOTE_EXIT event, and would clobber the NOTE_CHILD's 'data' field).
Add a bunch of comments to explain what's going on in various critical sections, and sprinkle additional KASSERT()s to validate assumptions in several more locations.
|
#
1.43 |
|
26-Sep-2021 |
thorpej |
Fix the locking around EVFILT_FS. Previously, the code would walk the fs_klist and take the kqueue_misc_lock inside the event callback. However, that list can be modified by the attach and detach callbacks, which could result in the walker stepping right off a cliff.
Instead, we give the fs_klist it's own lock, and hold it while we call knote(), using the NOTE_SUBMIT protocol. Also, fs_filtops into vfs_syscalls.c so all of the locking logic is contained in one file (there is precedence with sig_filtops). fs_filtops is now marked MPSAFE.
|
#
1.42 |
|
26-Sep-2021 |
thorpej |
- Define a new filterops flag FILTEROP_MPSAFE, which states that the kqueue filter does not require the KERNEL_LOCK to be held. - Add wrappers around the calls into the filterops that take care of the locking requirements.
No functional change, since no filterops yet define FILTEROP_MPSAFE.
|
#
1.41 |
|
26-Sep-2021 |
thorpej |
Change the kqueue filterops::f_isfd field to filterops::f_flags, and define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd. Field and flag name aligned with OpenBSD.
This does not constitute a functional or ABI change, as the field location and size, and the value placed in that field, are the same as the previous code, but we're bumping __NetBSD_Version__ so 3rd-party module source code can adapt, as needed.
NetBSD 9.99.89
|
Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
|
#
1.40 |
|
31-Oct-2020 |
christos |
Add an array of filter names.
|
#
1.39 |
|
31-Oct-2020 |
christos |
PR/55663: Ruslan Nikolaev: Add support for EVFILT_USER in kqueue(2)
|
Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
|
#
1.38 |
|
03-Oct-2019 |
kamil |
Switch kevent udata from intptr_t void*
Synchromize the struct field format with other BSDs and Darwin.
No ABI change between older and newer struct form on the ports.
The change will require no changes to most C users during the transition period as the header keeps a caller cast.
Discussed with core@ and there were no objections for this move.
|
#
1.37 |
|
10-Aug-2019 |
kamil |
Fix typo in pragma in sys/event.h
Reenable -Wconversion-null.
|
#
1.36 |
|
10-Aug-2019 |
kamil |
Use common macro for _EV_SET() for integer types
Deduplicate code.
No functional change change intended.
|
#
1.35 |
|
10-Aug-2019 |
kamil |
Handle more corner cases in sys/event.h for C++ EV_SET()
Handle the udata argument as Plain-Old-Data types separately.
- int, long int, long long int - unsigned int, unsigned long int, unsigned long long int - void *
This approach handles each of the POD types separately on purpose as intermediate types such as intptr_t can be either int or long (even long long) and handling them is not portable.
This approach is compatibile with C++98 and newer.
Fixes i386 usage.
|
#
1.34 |
|
10-Aug-2019 |
kamil |
Add fallback defintion for C++ of _EV_SET with the last argument of type 0
Converting 0 to intptr and void* is ambiguous according to a C++ compiler. New _EV_SET() accepts int type and casts it with static_cast<int>() to intptr_t.
Reported and fix tested by <John D. Baker>
|
#
1.33 |
|
06-Aug-2019 |
kamil |
Make EV_SET() casts compatible with the C++ code
EV_SET() handles cast that are expected to work with alternative kqueue/kevent implementations that take arguments in different types.
Unfortunately void* -> intptr_t cast cannot be done with static_cast<intptr_t>() as it needs reinterpret_cast<intptr_t>().
Just switching to reinterpret_cast<intptr_t>() is still not sufficient as it does not handle NULL argument without a compiler error/warning.
Add a compatibility function for the C++ case of _EV_SET() that accepts the udata argument in the form of void* and performs clean reinterpret_cast<>() internally.
There is no change for C users.
Tested by <nia>
Proposed on tech-userlevel@.
|
Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.32 |
|
09-Jan-2018 |
christos |
branches: 1.32.4; 1.32.8; Merge autofs support from: Tomohiro Kusumi XXX: Does not work yet
|
Revision tags: tls-maxphys-base-20171202
|
#
1.31 |
|
16-Sep-2017 |
christos |
Add flags bits print
|
Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
branches: 1.28.2; Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.12; 1.23.28; 1.23.30; 1.23.32; 1.23.36; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.43 |
|
26-Sep-2021 |
thorpej |
Fix the locking around EVFILT_FS. Previously, the code would walk the fs_klist and take the kqueue_misc_lock inside the event callback. However, that list can be modified by the attach and detach callbacks, which could result in the walker stepping right off a cliff.
Instead, we give the fs_klist it's own lock, and hold it while we call knote(), using the NOTE_SUBMIT protocol. Also, fs_filtops into vfs_syscalls.c so all of the locking logic is contained in one file (there is precedence with sig_filtops). fs_filtops is now marked MPSAFE.
|
#
1.42 |
|
26-Sep-2021 |
thorpej |
- Define a new filterops flag FILTEROP_MPSAFE, which states that the kqueue filter does not require the KERNEL_LOCK to be held. - Add wrappers around the calls into the filterops that take care of the locking requirements.
No functional change, since no filterops yet define FILTEROP_MPSAFE.
|
#
1.41 |
|
26-Sep-2021 |
thorpej |
Change the kqueue filterops::f_isfd field to filterops::f_flags, and define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd. Field and flag name aligned with OpenBSD.
This does not constitute a functional or ABI change, as the field location and size, and the value placed in that field, are the same as the previous code, but we're bumping __NetBSD_Version__ so 3rd-party module source code can adapt, as needed.
NetBSD 9.99.89
|
Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
|
#
1.40 |
|
31-Oct-2020 |
christos |
Add an array of filter names.
|
#
1.39 |
|
31-Oct-2020 |
christos |
PR/55663: Ruslan Nikolaev: Add support for EVFILT_USER in kqueue(2)
|
Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
|
#
1.38 |
|
03-Oct-2019 |
kamil |
Switch kevent udata from intptr_t void*
Synchromize the struct field format with other BSDs and Darwin.
No ABI change between older and newer struct form on the ports.
The change will require no changes to most C users during the transition period as the header keeps a caller cast.
Discussed with core@ and there were no objections for this move.
|
#
1.37 |
|
10-Aug-2019 |
kamil |
Fix typo in pragma in sys/event.h
Reenable -Wconversion-null.
|
#
1.36 |
|
10-Aug-2019 |
kamil |
Use common macro for _EV_SET() for integer types
Deduplicate code.
No functional change change intended.
|
#
1.35 |
|
10-Aug-2019 |
kamil |
Handle more corner cases in sys/event.h for C++ EV_SET()
Handle the udata argument as Plain-Old-Data types separately.
- int, long int, long long int - unsigned int, unsigned long int, unsigned long long int - void *
This approach handles each of the POD types separately on purpose as intermediate types such as intptr_t can be either int or long (even long long) and handling them is not portable.
This approach is compatibile with C++98 and newer.
Fixes i386 usage.
|
#
1.34 |
|
10-Aug-2019 |
kamil |
Add fallback defintion for C++ of _EV_SET with the last argument of type 0
Converting 0 to intptr and void* is ambiguous according to a C++ compiler. New _EV_SET() accepts int type and casts it with static_cast<int>() to intptr_t.
Reported and fix tested by <John D. Baker>
|
#
1.33 |
|
06-Aug-2019 |
kamil |
Make EV_SET() casts compatible with the C++ code
EV_SET() handles cast that are expected to work with alternative kqueue/kevent implementations that take arguments in different types.
Unfortunately void* -> intptr_t cast cannot be done with static_cast<intptr_t>() as it needs reinterpret_cast<intptr_t>().
Just switching to reinterpret_cast<intptr_t>() is still not sufficient as it does not handle NULL argument without a compiler error/warning.
Add a compatibility function for the C++ case of _EV_SET() that accepts the udata argument in the form of void* and performs clean reinterpret_cast<>() internally.
There is no change for C users.
Tested by <nia>
Proposed on tech-userlevel@.
|
Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.32 |
|
09-Jan-2018 |
christos |
branches: 1.32.4; 1.32.8; Merge autofs support from: Tomohiro Kusumi XXX: Does not work yet
|
Revision tags: tls-maxphys-base-20171202
|
#
1.31 |
|
16-Sep-2017 |
christos |
Add flags bits print
|
Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
branches: 1.28.2; Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.12; 1.23.28; 1.23.30; 1.23.32; 1.23.36; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.42 |
|
26-Sep-2021 |
thorpej |
- Define a new filterops flag FILTEROP_MPSAFE, which states that the kqueue filter does not require the KERNEL_LOCK to be held. - Add wrappers around the calls into the filterops that take care of the locking requirements.
No functional change, since no filterops yet define FILTEROP_MPSAFE.
|
#
1.41 |
|
26-Sep-2021 |
thorpej |
Change the kqueue filterops::f_isfd field to filterops::f_flags, and define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd. Field and flag name aligned with OpenBSD.
This does not constitute a functional or ABI change, as the field location and size, and the value placed in that field, are the same as the previous code, but we're bumping __NetBSD_Version__ so 3rd-party module source code can adapt, as needed.
NetBSD 9.99.89
|
Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
|
#
1.40 |
|
31-Oct-2020 |
christos |
Add an array of filter names.
|
#
1.39 |
|
31-Oct-2020 |
christos |
PR/55663: Ruslan Nikolaev: Add support for EVFILT_USER in kqueue(2)
|
Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
|
#
1.38 |
|
03-Oct-2019 |
kamil |
Switch kevent udata from intptr_t void*
Synchromize the struct field format with other BSDs and Darwin.
No ABI change between older and newer struct form on the ports.
The change will require no changes to most C users during the transition period as the header keeps a caller cast.
Discussed with core@ and there were no objections for this move.
|
#
1.37 |
|
10-Aug-2019 |
kamil |
Fix typo in pragma in sys/event.h
Reenable -Wconversion-null.
|
#
1.36 |
|
10-Aug-2019 |
kamil |
Use common macro for _EV_SET() for integer types
Deduplicate code.
No functional change change intended.
|
#
1.35 |
|
10-Aug-2019 |
kamil |
Handle more corner cases in sys/event.h for C++ EV_SET()
Handle the udata argument as Plain-Old-Data types separately.
- int, long int, long long int - unsigned int, unsigned long int, unsigned long long int - void *
This approach handles each of the POD types separately on purpose as intermediate types such as intptr_t can be either int or long (even long long) and handling them is not portable.
This approach is compatibile with C++98 and newer.
Fixes i386 usage.
|
#
1.34 |
|
10-Aug-2019 |
kamil |
Add fallback defintion for C++ of _EV_SET with the last argument of type 0
Converting 0 to intptr and void* is ambiguous according to a C++ compiler. New _EV_SET() accepts int type and casts it with static_cast<int>() to intptr_t.
Reported and fix tested by <John D. Baker>
|
#
1.33 |
|
06-Aug-2019 |
kamil |
Make EV_SET() casts compatible with the C++ code
EV_SET() handles cast that are expected to work with alternative kqueue/kevent implementations that take arguments in different types.
Unfortunately void* -> intptr_t cast cannot be done with static_cast<intptr_t>() as it needs reinterpret_cast<intptr_t>().
Just switching to reinterpret_cast<intptr_t>() is still not sufficient as it does not handle NULL argument without a compiler error/warning.
Add a compatibility function for the C++ case of _EV_SET() that accepts the udata argument in the form of void* and performs clean reinterpret_cast<>() internally.
There is no change for C users.
Tested by <nia>
Proposed on tech-userlevel@.
|
Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.32 |
|
09-Jan-2018 |
christos |
branches: 1.32.4; 1.32.8; Merge autofs support from: Tomohiro Kusumi XXX: Does not work yet
|
Revision tags: tls-maxphys-base-20171202
|
#
1.31 |
|
16-Sep-2017 |
christos |
Add flags bits print
|
Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
branches: 1.28.2; Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.12; 1.23.28; 1.23.30; 1.23.32; 1.23.36; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
Revision tags: thorpej-futex-base
|
#
1.40 |
|
31-Oct-2020 |
christos |
Add an array of filter names.
|
#
1.39 |
|
31-Oct-2020 |
christos |
PR/55663: Ruslan Nikolaev: Add support for EVFILT_USER in kqueue(2)
|
Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
|
#
1.38 |
|
03-Oct-2019 |
kamil |
Switch kevent udata from intptr_t void*
Synchromize the struct field format with other BSDs and Darwin.
No ABI change between older and newer struct form on the ports.
The change will require no changes to most C users during the transition period as the header keeps a caller cast.
Discussed with core@ and there were no objections for this move.
|
#
1.37 |
|
10-Aug-2019 |
kamil |
Fix typo in pragma in sys/event.h
Reenable -Wconversion-null.
|
#
1.36 |
|
10-Aug-2019 |
kamil |
Use common macro for _EV_SET() for integer types
Deduplicate code.
No functional change change intended.
|
#
1.35 |
|
10-Aug-2019 |
kamil |
Handle more corner cases in sys/event.h for C++ EV_SET()
Handle the udata argument as Plain-Old-Data types separately.
- int, long int, long long int - unsigned int, unsigned long int, unsigned long long int - void *
This approach handles each of the POD types separately on purpose as intermediate types such as intptr_t can be either int or long (even long long) and handling them is not portable.
This approach is compatibile with C++98 and newer.
Fixes i386 usage.
|
#
1.34 |
|
10-Aug-2019 |
kamil |
Add fallback defintion for C++ of _EV_SET with the last argument of type 0
Converting 0 to intptr and void* is ambiguous according to a C++ compiler. New _EV_SET() accepts int type and casts it with static_cast<int>() to intptr_t.
Reported and fix tested by <John D. Baker>
|
#
1.33 |
|
06-Aug-2019 |
kamil |
Make EV_SET() casts compatible with the C++ code
EV_SET() handles cast that are expected to work with alternative kqueue/kevent implementations that take arguments in different types.
Unfortunately void* -> intptr_t cast cannot be done with static_cast<intptr_t>() as it needs reinterpret_cast<intptr_t>().
Just switching to reinterpret_cast<intptr_t>() is still not sufficient as it does not handle NULL argument without a compiler error/warning.
Add a compatibility function for the C++ case of _EV_SET() that accepts the udata argument in the form of void* and performs clean reinterpret_cast<>() internally.
There is no change for C users.
Tested by <nia>
Proposed on tech-userlevel@.
|
Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.32 |
|
09-Jan-2018 |
christos |
branches: 1.32.4; 1.32.8; Merge autofs support from: Tomohiro Kusumi XXX: Does not work yet
|
Revision tags: tls-maxphys-base-20171202
|
#
1.31 |
|
16-Sep-2017 |
christos |
Add flags bits print
|
Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
branches: 1.28.2; Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.12; 1.23.28; 1.23.30; 1.23.32; 1.23.36; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.38 |
|
03-Oct-2019 |
kamil |
Switch kevent udata from intptr_t void*
Synchromize the struct field format with other BSDs and Darwin.
No ABI change between older and newer struct form on the ports.
The change will require no changes to most C users during the transition period as the header keeps a caller cast.
Discussed with core@ and there were no objections for this move.
|
#
1.37 |
|
10-Aug-2019 |
kamil |
Fix typo in pragma in sys/event.h
Reenable -Wconversion-null.
|
#
1.36 |
|
10-Aug-2019 |
kamil |
Use common macro for _EV_SET() for integer types
Deduplicate code.
No functional change change intended.
|
#
1.35 |
|
10-Aug-2019 |
kamil |
Handle more corner cases in sys/event.h for C++ EV_SET()
Handle the udata argument as Plain-Old-Data types separately.
- int, long int, long long int - unsigned int, unsigned long int, unsigned long long int - void *
This approach handles each of the POD types separately on purpose as intermediate types such as intptr_t can be either int or long (even long long) and handling them is not portable.
This approach is compatibile with C++98 and newer.
Fixes i386 usage.
|
#
1.34 |
|
10-Aug-2019 |
kamil |
Add fallback defintion for C++ of _EV_SET with the last argument of type 0
Converting 0 to intptr and void* is ambiguous according to a C++ compiler. New _EV_SET() accepts int type and casts it with static_cast<int>() to intptr_t.
Reported and fix tested by <John D. Baker>
|
#
1.33 |
|
06-Aug-2019 |
kamil |
Make EV_SET() casts compatible with the C++ code
EV_SET() handles cast that are expected to work with alternative kqueue/kevent implementations that take arguments in different types.
Unfortunately void* -> intptr_t cast cannot be done with static_cast<intptr_t>() as it needs reinterpret_cast<intptr_t>().
Just switching to reinterpret_cast<intptr_t>() is still not sufficient as it does not handle NULL argument without a compiler error/warning.
Add a compatibility function for the C++ case of _EV_SET() that accepts the udata argument in the form of void* and performs clean reinterpret_cast<>() internally.
There is no change for C users.
Tested by <nia>
Proposed on tech-userlevel@.
|
Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.32 |
|
09-Jan-2018 |
christos |
branches: 1.32.8; Merge autofs support from: Tomohiro Kusumi XXX: Does not work yet
|
Revision tags: tls-maxphys-base-20171202
|
#
1.31 |
|
16-Sep-2017 |
christos |
Add flags bits print
|
Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
branches: 1.28.2; Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.12; 1.23.28; 1.23.30; 1.23.32; 1.23.36; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.37 |
|
10-Aug-2019 |
kamil |
Fix typo in pragma in sys/event.h
Reenable -Wconversion-null.
|
#
1.36 |
|
10-Aug-2019 |
kamil |
Use common macro for _EV_SET() for integer types
Deduplicate code.
No functional change change intended.
|
#
1.35 |
|
10-Aug-2019 |
kamil |
Handle more corner cases in sys/event.h for C++ EV_SET()
Handle the udata argument as Plain-Old-Data types separately.
- int, long int, long long int - unsigned int, unsigned long int, unsigned long long int - void *
This approach handles each of the POD types separately on purpose as intermediate types such as intptr_t can be either int or long (even long long) and handling them is not portable.
This approach is compatibile with C++98 and newer.
Fixes i386 usage.
|
#
1.34 |
|
10-Aug-2019 |
kamil |
Add fallback defintion for C++ of _EV_SET with the last argument of type 0
Converting 0 to intptr and void* is ambiguous according to a C++ compiler. New _EV_SET() accepts int type and casts it with static_cast<int>() to intptr_t.
Reported and fix tested by <John D. Baker>
|
#
1.33 |
|
06-Aug-2019 |
kamil |
Make EV_SET() casts compatible with the C++ code
EV_SET() handles cast that are expected to work with alternative kqueue/kevent implementations that take arguments in different types.
Unfortunately void* -> intptr_t cast cannot be done with static_cast<intptr_t>() as it needs reinterpret_cast<intptr_t>().
Just switching to reinterpret_cast<intptr_t>() is still not sufficient as it does not handle NULL argument without a compiler error/warning.
Add a compatibility function for the C++ case of _EV_SET() that accepts the udata argument in the form of void* and performs clean reinterpret_cast<>() internally.
There is no change for C users.
Tested by <nia>
Proposed on tech-userlevel@.
|
Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.32 |
|
09-Jan-2018 |
christos |
branches: 1.32.8; Merge autofs support from: Tomohiro Kusumi XXX: Does not work yet
|
Revision tags: tls-maxphys-base-20171202
|
#
1.31 |
|
16-Sep-2017 |
christos |
Add flags bits print
|
Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
branches: 1.28.2; Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.12; 1.23.28; 1.23.30; 1.23.32; 1.23.36; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.32 |
|
09-Jan-2018 |
christos |
Merge autofs support from: Tomohiro Kusumi XXX: Does not work yet
|
Revision tags: tls-maxphys-base-20171202
|
#
1.31 |
|
16-Sep-2017 |
christos |
Add flags bits print
|
Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
branches: 1.28.2; Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.12; 1.23.28; 1.23.30; 1.23.32; 1.23.36; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.31 |
|
16-Sep-2017 |
christos |
Add flags bits print
|
Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
branches: 1.28.2; Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.28; 1.23.30; 1.23.32; 1.23.36; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.30 |
|
01-Jul-2017 |
christos |
fix file descriptor locking (from joerg). fixes kernel crashes by running go XXX: pullup-7
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.30; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.29 |
|
14-Jun-2017 |
christos |
- cast ident argument because it is usually an fd (signed) and generates conversion to unsigned warnings. While here: - name the macro parameters with meaningful names - rename the internal inline function as _FOO instead of FOO_ because there is no other FOO_ name in the system headers.
|
Revision tags: netbsd-8-base
|
#
1.28 |
|
02-Jun-2017 |
kamil |
Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.30; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.28 |
|
02-Jun-2017 |
kamil |
Convert EV_SET(2) back into macro again
This retains compatibility with other moder BSDs if someone uses: "#ifdef EV_SET".
This code also casts the last parameter to intptr_t, as other BSDs keep this argument with a different type void*.
This change renames function EV_SET to EV_SET_, and calls it from EV_SET().
Credit to <christos> and <kre> for feedback.
Sponsored by <The NetBSD Foundation>
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.30; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
#
1.27 |
|
31-May-2017 |
kamil |
Convert EV_SET from macro to static __inline function
LLDB introduced support for kevent(2) and it contains the following function:
Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); }
It works on FreeBSD and MacOSX, however it broke on NetBSD.
Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while(0)
NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do { \ (kevp)->ident = (a); \ (kevp)->filter = (b); \ (kevp)->flags = (c); \ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f); \ } while (/* CONSTCOND */ 0)
This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->.
As suggested by Joerg, convert this macro on NetBSD to static __inline function.
Credit to <coypu> for asan+ubsan research wiki entry that helped to narrow down the bug. Credit to <joerg> for peer-review
Sponsored by <The NetBSD Foundation>
|
Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.30; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|
Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
|
#
1.26 |
|
31-Jan-2016 |
christos |
PR/50730: Benny Siegert: Go kqueue test panics kernel. - use a marker knote from the stack instead of allocating and freeing on each scan. - add more KASSERTS - introduce a KN_BUSY bit that indicates that the knote is currently being scanned, so that knote_detach does not end up deleting it when the file descriptor gets closed and we don't end up using/trashing free memory from the scan.
|
Revision tags: nick-nhusb-base-20151226
|
#
1.25 |
|
08-Dec-2015 |
christos |
PR/50506: Tobias Nygren: kqueue(2) lacks EV_DISPATCH/EV_RECEIPT support
|
Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
|
#
1.24 |
|
14-Jan-2015 |
christos |
make unsigned constants that.
|
Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.23 |
|
26-Jun-2011 |
christos |
branches: 1.23.30; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
|
#
1.22 |
|
24-Apr-2011 |
rmind |
- Replace few malloc(9) uses with kmem(9). - Rename buf_malloc() to buf_alloc(), fix comments. - Remove some unnecessary inclusions.
|
Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base mjf-devfs2-base
|
#
1.21 |
|
11-Jan-2009 |
christos |
branches: 1.21.6; 1.21.8; merge christos-time_t
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base christos-time_t-nbase netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base christos-time_t-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
|
#
1.20 |
|
21-Mar-2008 |
ad |
branches: 1.20.2; 1.20.6; 1.20.14; File descriptor changes, discussed on tech-kern:
- Redo reference counting to be sane. LWPs accessing files take a short term reference on the local file descriptor. This is the most common case. While a file is in a process descriptor table, a reference is held to the file. The file reference count only changes during control operations like open() or close(). Code that comes at files from an unusual direction (i.e. foreign to the process) like procfs or sysctl takes a reference on the file (f_count), and not on a descriptor.
- Remove knowledge of reference counting and locking from most code that deals with files.
- Make the usual case of file descriptor lookup lockless.
- Make kqueue MP and MT safe. PR kern/38098, PR kern/38137.
- Fix numerous file handling bugs, and bugs in the descriptor code that affected multithreaded processes.
- Split descriptor system calls out into sys_descrip.c.
- A few stylistic changes: KNF, remove unused casts now that caddr_t is gone. Replace dumb gotos with loop control in a few places.
- Don't do redundant pointer passing (struct proc, lwp, filedesc *) unless the routine is likely to be inlined. Most of the time it's about the current process.
|
Revision tags: keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 matt-armv6-nbase mjf-devfs-base vmlocking-nbase matt-armv6-base jmcneill-pm-base hpcarm-cleanup-base reinoud-bufcleanup-base
|
#
1.19 |
|
03-Dec-2007 |
pooka |
branches: 1.19.14; Some boys take a beautiful seltrue_filtops and hide her away from the rest of the world - but let's not.
|
Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base vmlocking-base
|
#
1.18 |
|
21-Jul-2007 |
ad |
branches: 1.18.4; 1.18.6; 1.18.12; 1.18.14; Move declaration of seltrue_kqfilter() to conf.h, where it's needed.
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base rpaulo-netinet-merge-pcb-base
|
#
1.17 |
|
11-Dec-2005 |
christos |
branches: 1.17.30; 1.17.40; merge ktrace-lwp.
|
Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base ktrace-lwp-base
|
#
1.16 |
|
23-Oct-2005 |
cube |
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32 code.
- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to kevent1 that points to functions that do the actual copyin/copyout operations. This is similar to what was done in FreeBSD by Paul Saab.
- Add the COMPAT_NETBSD32 definitions and hooks.
|
Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
|
#
1.15 |
|
26-Feb-2005 |
perry |
branches: 1.15.4; 1.15.6; nuke trailing whitespace
|
Revision tags: yamt-km-base2
|
#
1.14 |
|
03-Feb-2005 |
perry |
de-__P
|
Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
|
#
1.13 |
|
25-Apr-2004 |
simonb |
branches: 1.13.4; 1.13.6; Initialise (most) pools from a link set instead of explicit calls to pool_init. Untouched pools are ones that either in arch-specific code, or aren't initialiased during initial system startup.
Convert struct session, ucred and lockf to pools.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.12 |
|
22-Feb-2004 |
jdolecek |
add internal kernel NOTE_SUBMIT; this will be used by some kqueue code to skip some steps on initial knote submission
|
#
1.11 |
|
08-Jul-2003 |
itojun |
prototype must not have variable name
|
#
1.10 |
|
29-Jun-2003 |
fvdl |
branches: 1.10.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
#
1.9 |
|
28-Jun-2003 |
darrenr |
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
#
1.8 |
|
28-Apr-2003 |
bjh21 |
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined by the application, all NetBSD interfaces are made visible, even if some other feature-test macro (like _POSIX_C_SOURCE) is defined. <sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE, _POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve existing behaviour.
This has two major advantages: + Programs that require non-POSIX facilities but define _POSIX_C_SOURCE can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS. + It makes most of the #ifs simpler, in that they're all now ORs of the various macros, rather than having checks for (!defined(_ANSI_SOURCE) || !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where _NETBSD_SOURCE wasn't defined, but there were some places where the current semantics were clearly mad, and retaining them was harder than correcting them. In particular, I've mostly normalised things so that _ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE, _XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in tech-userlevel for a week.
|
#
1.7 |
|
16-Feb-2003 |
tron |
Include "sys/types.h" to get the definition of "size_t".
|
#
1.6 |
|
04-Feb-2003 |
jdolecek |
Introduce EVFILT_TIMER, which allows a process to establish an arbitrary number of timers, both oneshot and periodic.
from FreeBSD, only adapted to NetBSD kernel API - mstohz() instead of tvtohz(), and takes advantage of callout_schedule() in filt_timerexpire()
|
#
1.5 |
|
02-Feb-2003 |
christos |
only include mallocvar.h if _KERNEL is defined [hi thorpej]
|
#
1.4 |
|
01-Feb-2003 |
thorpej |
Add extensible malloc types, adapted from FreeBSD. This turns malloc types into a structure, a pointer to which is passed around, instead of an int constant. Allow the limit to be adjusted when the malloc type is defined, or with a function call, as suggested by Jonathan Stone.
|
Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge
|
#
1.3 |
|
23-Oct-2002 |
jdolecek |
branches: 1.3.2; merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree (with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD initial NetBSD port done by Luke Mewburn and Jason Thorpe
|
Revision tags: gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base thorpej-devvp-base kqueue-base
|
#
1.2 |
|
10-Jul-2001 |
lukem |
move to kqueue branch for now
|
#
1.1 |
|
24-Feb-2001 |
lukem |
branches: 1.1.1; Initial revision
|