Age | Commit message (Collapse) | Author |
|
ok mpi@ miod@
|
|
OK jsg@
|
|
OK mpi@
|
|
Recommit the reverted change selectively so that only pipes are
affected. Leave sockets untouched for now.
|
|
The commit caused hangs with NFS.
Reported by ajacoutot@ and naddy@
|
|
OK mpi@
|
|
|
|
This avoids verb overlap with f_modify.
|
|
Use the f_event callback for checking event state within the pipe
event filters. This enables the same f_modify and f_process functions
to handle the different filter types.
OK anton@
|
|
Restrict the circumstances where EVFILT_EXCEPT filters trigger:
* when out-of-band data is present and NOTE_OOB is requested.
* when the channel is fully closed and consumer is poll(2).
This should clarify the logic and suppress events that kqueue-based
poll(2) does not except.
OK mpi@
|
|
Currently, the only intended direct usage of the EVFILT_EXCEPT filter
is with NOTE_OOB to detect out-of-band data in ptys and sockets.
NOTE_OOB does not apply to FIFOs or pipes. Prevent the user from
registering the filter with these file types. The filter code is for
the kernel's internal use.
OK mpi@
|
|
Prevent select(2) from indicating an exceptional condition when the
other end of a FIFO or pipe is closed.
Originally, select(2) returned an exceptfds event only with a pty or
socket that has out-of-band data pending. millert@ says that OpenBSD
diverged from this by accident when poll(2) and select(2) were changed
to use the same backend code in year 2003.
OK millert@
|
|
The kqueue-based select(2) needs the filter to replicate the old
exceptfds behaviour. The upcoming new poll(2) code will use the filter
for POLLHUP condition checking when the events bitmap is clear of
read/write events.
OK anton@
|
|
Add the missing f_modify and f_process callbacks so that pipe_lock
serializes pipe knote handling. As pipe klist locking is already in
place, pipe event filters should now be MP-safe.
This uses write locking everywhere in the callbacks for simplicity.
There is not much multiple-readers parallelism to utilize.
OK mpi@ anton@
|
|
The logic to emulate the current poll/select behavior is better implemented
at the syscall layer and not in the kqueue backend.
Discussed with deraadt@, ok anton@
|
|
In preparation for implementing select(2) on top of kqueue.
ok mpi@
|
|
OK anton@, mpi@
|
|
Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.
Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.
OK mpi@
|
|
By storing pipe pointer in kn_hook, filt_pipedetach() does not need
extra logic to find the correct pipe instance. This also lets the kernel
clear the knote lists fully.
OK anton@, mpi@
|
|
serializing calls to pipe_buffer_free(). Repeating the previous commit
message:
Instead of performing three distinct allocations per created pipe,
reduce it to a single one. Not only should this be more performant, it
also solves a kqueue related issue found by visa@ who also requested
this change: if you attach an EVFILT_WRITE filter to a pipe fd, the
knote gets added to the peer's klist. This is a problem for kqueue
because if you close the peer's fd, the knote is left in the list whose
head is about to be freed. knote_fdclose() is not able to clear the
knote because it is not registered with the peer's fd.
FreeBSD also takes a similar approach to pipe allocations.
once again ok mpi@ visa@
|
|
|
|
reduce it to a single one. Not only should this be more performant, it
also solves a kqueue related issue found by visa@ who also requested
this change: if you attach an EVFILT_WRITE filter to a pipe fd, the
knote gets added to the peer's klist. This is a problem for kqueue
because if you close the peer's fd, the knote is left in the list whose
head is about to be freed. knote_fdclose() is not able to clear the
knote because it is not registered with the peer's fd.
FreeBSD also takes a similar approach to pipe allocations.
ok mpi@ visa@
|
|
This is only done in poll-compatibility mode, when __EV_POLL is set.
ok visa@, millert@
|
|
for example, with locking assertions.
OK mpi@, anton@
|
|
adding more filter properties without cluttering the struct.
OK mpi@, anton@
|
|
excessive as only one command actually modifies the pipe. The sigio
subsystem is already internally protected using its own lock. This is
similar to what soo_ioctl() already does.
ok mpi@ visa@
|
|
The 3 subsystems: signal, poll/select and kqueue can now be addressed
separatly.
Note that bpf(4) and audio(4) currently delay the wakeups to a separate
context in order to respect the KERNEL_LOCK() requirement. Sockets (UDP,
TCP) and pipes spin to grab the lock for the sames reasons.
ok anton@, visa@
|
|
asked for more oks; my bad!
|
|
operating on the process structure and issuing signals. This is similar
to what sigio_setown() already does.
With this in place, the pipe subsystem is no longer required to grab the
kernel lock before calling pgsigio().
ok visa@
|
|
|
|
ok millert@ ratchov@ visa@
|
|
pair. One lock per pipe pair is used to guarantee exclusive access to
both ends of a pipe.
Thanks to millert@ and tedu@ for the feedback and ok visa@
|
|
FIOGETOWN/SIOCGPGRP/TIOCGPGRP. Do this by determining the meaning of
the ID parameter inside the sigio code. Also add cases for FIOSETOWN
and FIOGETOWN where there have been TIOCSPGRP and TIOCGPGRP before.
These changes allow removing the ID translation from sys_fcntl() and
sys_ioctl().
Idea from NetBSD
OK mpi@, claudio@
|
|
OK anton@, mpi@, bluhm@
|
|
* Sort local variables by size, name
* No need to initialize error in pipe_write()
ok millert@ visa@
|
|
mere preparation for introducing a dedicated lock per pipe pair.
ok mpi@ visa@
|
|
make the structs const so that the data are put in .rodata.
OK mpi@, deraadt@, anton@, bluhm@
|
|
is serialized by the pipe_lock by now. The kernel lock is however still
needed when interacting with kqueue in order to prevent a race and when
potentially issuing SIGIO signals.
ok visa@
|
|
turn them into proper sentences. Gets rid of 27 lines in total.
|
|
to simplify the locking pattern, revert back to using a hand-rolled I/O
lock just like FreeBSD and NetBSD does. The state of pipes is quite
different compared to when I made use of a rwlock for the I/O lock in
revision 1.96. Most notably, the pipe_lock can now be used while
sleeping. This does imply that witness(4) tracking of the I/O lock is
lost but the implementation ends up being simpler.
ok visa@
|
|
pipe_lock. This add a potential sleeping point in the kqueue filter
routines which should be fine by now thanks to changes made to the
kqueue subsystem by visa.
ok visa@
|
|
|
|
rwlock. This lock is shared among all pipes for simplicity. In the
future, the lock will probably be replaced with one lock per pipe pair,
just like FreeBSD and NetBSD does.
While here, extract the common rundown wakeup logic into a dedicated
function.
Thanks to cheloha@ for testing and feedback.
ok mpi@ visa@
|
|
rwsleep(). All made possible by the recent switch to using a rwlock as
the exclusive pipe lock.
ok visa@
|
|
pattern more similar to pipe_read(). This also eliminates two races
caused by relocking.
ok visa@
|
|
preparation for further refactoring.
ok cheloha@ mpi@ visa@
|
|
towards unlocking pipes.
ok cheloha@ mpi@ visa@
|
|
rename pipclose() to pipe_destroy(), and return early instead of having the whole code in if-body.
ok claudio@ anton@ visa@ mpi@
|
|
- in dopipe(), get an already zeroed struct (PR_ZERO) instead of manually initialize each member (in pipe_create)
- rename pipespace() and pipe_free_kmem() to pipe_buffer_realloc() and pipe_buffer_free(): it is more evident that the functions works on the same thing
- in pipe_buffer_free(), return early and move the if-body as function body
No functional change intented.
ok anton@ visa@ mpi@
|
|
in the common case.
OK mpi@
|