summaryrefslogtreecommitdiff
path: root/sys/miscfs
AgeCommit message (Collapse)Author
2023-03-08Delete obsolete /* ARGSUSED */ lint comments.Philip Guenther
ok miod@ millert@
2023-01-27Replace selinfo structure by klist in sockbuf. No reason to keep it,Vitaliy Makkoveev
selinfo is just wrapper to klist. netstat(1) and libkvm use socket structure, but don't touch so_{snd,rcv}.sb_sel. ok visa@
2023-01-22Move SS_CANTRCVMORE and SS_RCVATMARK bits from `so_state' to `sb_state' ofVitaliy Makkoveev
receive buffer. As it was done for SS_CANTSENDMORE bit, the definition kept as is, but now these bits belongs to the `sb_state' of receive buffer. `sb_state' ored with `so_state' when socket data exporting to the userland. ok bluhm@
2023-01-21Introduce per-sockbuf `sb_state' to use it with SS_CANTSENDMORE.Vitaliy Makkoveev
This time, socket's buffer lock requires solock() to be held. As a part of socket buffers standalone locking work, move socket state bits which represent its buffers state to per buffer state. Opposing the previous reverted diff, the SS_CANTSENDMORE definition left as is, but it used only with `sb_state'. `sb_state' ored with original `so_state' when socket's data exported to the userland, so the ABI kept as it was. Inputs from deraadt@. ok bluhm@
2022-12-12Revert sb_state changes to unbreak tree.Theo Buehler
2022-12-11This time, socket's buffer lock requires solock() to be held. As a part ofVitaliy Makkoveev
socket buffers standalone locking work, move socket state bits which represent its buffers state to per buffer state. Introduce `sb_state' and turn SS_CANTSENDMORE to SBS_CANTSENDMORE. This bit will be processed on `so_snd' buffer only. Move SS_CANTRCVMORE and SS_RCVATMARK bits with separate diff to make review easier and exclude possible so_rcv/so_snd mistypes. Also, don't adjust the remaining SS_* bits right now. ok millert@
2022-08-29static const, not const staticJonathan Gray
c99 6.11.5: "The placement of a storage-class specifier other than at the beginning of the declaration specifiers in a declaration is an obsolescent feature." ok miod@ tb@
2022-07-02Remove unused device poll functions.Visa Hankala
Also remove unneeded includes of <sys/poll.h> and <sys/select.h>. Some addenda from jsg@. OK miod@ mpi@
2022-07-01Make fine grained unix(4) domain sockets locking. Use the per-socketVitaliy Makkoveev
`so_lock' rwlock(9) instead of global `unp_lock' which locks the whole layer. The PCB of unix(4) sockets are linked to each other and we need to lock them both. This introduces the lock ordering problem, because when the thread (1) keeps lock on `so1' and trying to lock `so2', the thread (2) could hold lock on `so2' and trying to lock `so1'. To solve this we always lock sockets in the strict order. For the sockets which are already accessible from userland, we always lock socket with the smallest memory address first. Sometimes we need to unlock socket before lock it's peer and lock it again. We use reference counters for prevent the connected peer destruction during to relock. We also handle the case where the peer socket was replaced by another socket. For the newly connected sockets, which are not yet exported to the userland by accept(2), we always lock the listening socket `head' first. This allows us to avoid unwanted relock within accept(2) syscall. ok claudio@
2022-06-26Remove unused VOP_POLL().Visa Hankala
OK mpi@
2022-06-06Simplify solock() and sounlock(). There is no reason to return a valueClaudio Jeker
for the lock operation and to pass a value to the unlock operation. sofree() still needs an extra flag to know if sounlock() should be called or not. But sofree() is called less often and mostly without keeping the lock. OK mpi@ mvs@
2022-02-16Add missing FILTEROP_MPSAFE flag to fifoexcept_filtops.Visa Hankala
OK mpi@
2022-02-16Reduce code duplication in FIFO event filters.Visa Hankala
OK mpi@
2022-02-13Rename knote_modify() to knote_assign()Visa Hankala
This avoids verb overlap with f_modify.
2021-12-20Let poll(2) register EVFILT_EXCEPT filter with dead vnodesVisa Hankala
This enables the system deliver POLLHUP when pollfd.events == 0.
2021-12-14Remember to clear __EV_HUP when the other end of the FIFO has re-opened.Visa Hankala
2021-12-13Revise EVFILT_EXCEPT filtersVisa Hankala
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@
2021-12-13Prevent kevent(2) use of EVFILT_EXCEPT with FIFOs and pipesVisa Hankala
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@
2021-12-12Add vnode parameter to VOP_STRATEGY()Visa Hankala
Pass the device vnode as a parameter to VOP_STRATEGY() to allow calling the correct vop_strategy callback. Now the vnode is also available in the callback. OK mpi@
2021-12-11Clarify usage of __EV_POLL and __EV_SELECTVisa Hankala
Make __EV_POLL specific to kqueue-based poll(2), to remove overlap with __EV_SELECT that only select(2) uses. OK millert@ mpi@
2021-12-08Fix select(2) exceptfds handling of FIFOs and pipesVisa Hankala
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@
2021-10-24Implement poll(2), select(2), ppoll(2) & pselect(2) on top of kqueue.Martin Pieuchot
The given set of fds are converted to equivalent kevents using EV_SET(2) and passed to the scanning internals of kevent(2): kqueue_scan(). ktrace(1) will now output the converted kevents on top of the usuals set bits to be able to find possible error in the convertion. This switch implies that poll(2) and select(2) will now query underlying kqfilters instead of the *_poll() routines. An increase in latency is visible, especially with UDP sockets and NET_LOCK()-contended subsystems and will be addressed in next steps. Based on similar work done on MacOS and DragonFlyBSD with inputs from visa@, millert@, anton@, cheloha@, thanks! Tested by many, thanks! ok claudio@, bluhm@
2021-10-24Set klist lock for sockets to make socket event filters MP-safeVisa Hankala
The filterops instances already provide f_modify and f_process callbacks with proper internal locking. Locking of socket klists has been the missing detail for MP-safety. OK mpi@
2021-10-22Make EVFILT_EXCEPT handling separate from the read filter.Martin Pieuchot
This is a change of behavior and events wont be generated if there is something to read on the fd. Only EV_EOF or NOTE_OOB will now be reported. While here a new filter for FIFOs supporting EV_EOF and __EV_HUP. ok visa@
2021-10-19vnode: deadfs: do not call v_op->vop_lock directly, use VOP_LOCK() wrapperSebastien Marie
ok mpi@ visa@ (as part of larger diff)
2021-10-15vnode: remove vop_generic_{,is,un}lock stub functionsSebastien Marie
These functions are only stubs (returning 0). Replace them with nullop function (same behaviour). There is no intented behaviour changes. While here, reorder some vop_islocked member in structs to be next others vop_{,un}lock members. ok visa@
2021-10-02fuse: avoid namei_pool leaks in several functionsSebastien Marie
when calling namei(), cn_pnbuf is kept allocated when fs implementation is setting SAVENAME flag. In such cases, it is expected the fs implementation to also release memory when work is done. fuse(4) didn't put back the memory to the pool. correct it. ok mpi@
2021-10-02vfs: merge *_badop to vop_generic_badopSebastien Marie
It replaces spec_badop, fifo_badop, dead_badop and mfs_badop, which are only calls to panic(9), to one unique function vop_generic_badop(). No intented behaviour changes (outside the panic message which isn't the same). ok mpi@
2021-07-13Add f_modify and f_process callbacks to FIFO filterops.Visa Hankala
OK millert@ mpi@
2021-05-01Update the remaining SYSCTL_INT_READONLY casesgnezdo
OK mvs@
2021-04-28Introduce a global vnode_mtx and use it to make vn_lock() safe to be calledClaudio Jeker
without the KERNEL_LOCK. This moves VXLOCK and VXWANT to a mutex protected v_lflag field and also v_lockcount is protected by this mutex. The vn_lock() dance is overly complex and all of this should probably replaced by a proper lock on the vnode but such a diff is a lot more complex. This is an intermediate step so that at least some calls can be modified to grab the KERNEL_LOCK later or not at all. OK mpi@
2021-03-24make some `struct vops' members explicitly NULL instead of implicitly NULLSebastien Marie
ok mpi@
2021-03-11spellingJonathan Gray
2021-01-17Replace SB_KNOTE and sb_flagsintr with direct checking of klist.Visa Hankala
OK mpi@ as part of a larger diff
2020-12-25Refactor klist insertion and removalVisa Hankala
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@
2020-11-17Convert fusefs_sysctl to sysctl_bounded_argsgnezdo
OK millert@
2020-06-15Implement a simple kqfilter for deadfs matching its poll handler.Martin Pieuchot
ok visa@, millert@
2020-06-15Set __EV_HUP when the conditions matching poll(2)'s POLLUP are found.Martin Pieuchot
This is only done in poll-compatibility mode, when __EV_POLL is set. ok visa@, millert@
2020-06-11Rename poll-compatibility flag to better reflect what it is.Martin Pieuchot
While here prefix kernel-only EV flags with two underbars. Suggested by kettenis@, ok visa@
2020-06-08Use a new EV_OLDAPI flag to match the behavior of poll(2) and select(2).Martin Pieuchot
Adapt FS kqfilters to always return true when the flag is set and bypass the polling mechanism of the NFS thread. While here implement a write filter for NFS. ok visa@
2020-05-13Use seltrue_kqfilter() instead of hand-rolling it in multiple drivers.Martin Pieuchot
ok visa@
2020-04-08Make fifo_kqfilter() honor FREAD|FWRITE just like fifo_poll() does.Martin Pieuchot
Prevent generating events that do not correspond to how the fifo has been opened. ok visa@, millert@
2020-04-08Pass correct socket to the write kqueue filter.Martin Pieuchot
Make EVFILT_WRITE notifications on fifo work. ok visa@, millert@
2020-04-07Abstract the head of knote lists. This allows extending the lists,Visa Hankala
for example, with locking assertions. OK mpi@, anton@
2020-04-03Return POLLERR instead of EINVAL in fusepoll().Martin Pieuchot
ok kettenis@
2020-02-20Replace field f_isfd with field f_flags in struct filterops to allowVisa Hankala
adding more filter properties without cluttering the struct. OK mpi@, anton@
2020-01-20struct vops is not modified during runtime so use const which moves eachClaudio Jeker
into read-only data segment. OK deraadt@ tedu@
2020-01-08Convert infinite sleeps to tsleep_nsec(9).Martin Pieuchot
ok bluhm@
2019-12-31Use C99 designated initializers with struct filterops. In addition,Visa Hankala
make the structs const so that the data are put in .rodata. OK mpi@, deraadt@, anton@, bluhm@
2019-12-26Convert struct vfsops initializer to C99 style.Alexander Bluhm
OK visa@