Commit Graph

39 Commits

Author SHA1 Message Date
thorpej 12ae65d98c 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
2021-09-26 01:16:07 +00:00
thorpej 69ed6f1cd6 Use sel{record,remove}_knote(). 2020-12-18 02:54:34 +00:00
christos ea05286d92 add fo_name so we can identify the fileops in a simple way. 2017-11-30 20:25:54 +00:00
maya 18b796d442 Use C99 initializer for filterops
Mostly done with spatch with touchups for indentation

@@
expression a;
identifier b,c,d;
identifier p;
@@
const struct filterops p =
- 	{ a, b, c, d
+ 	{
+ 	.f_isfd = a,
+ 	.f_attach = b,
+ 	.f_detach = c,
+ 	.f_event = d,
};
2017-10-25 08:12:37 +00:00
dholland f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
dholland a68f9396b6 Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
2014-03-16 05:20:22 +00:00
yamt e574760fc9 fix request leak. 2012-07-26 10:13:33 +00:00
hannken 1db98a4a6d putter_fop_stat(): set st_mode to S_IFCHR.
Fixes PR #44807: something broken in stat(2).
2011-07-23 14:28:28 +00:00
haad a8805143c7 Revert my fix. 2011-02-06 14:29:25 +00:00
haad 46aad63040 Putter depends on puffs add missing dependience. 2011-02-06 01:28:16 +00:00
pooka 7ab82f967d waiters gonna wait, so call seldestroy to wake them up when we go south 2010-08-27 07:40:01 +00:00
pooka b8fa8ac521 Call putterattach in modcmd init. Fixes lockdebug panic. Disable
unload, since putterdetach() is not implemented (i.e. current
implementation of modcmd fini is flawed), and I don't plan to fix
that now.
2010-04-11 09:36:47 +00:00
pooka b89c02f1d2 Adjust some comments which were written when this was still a part of puffs. 2010-01-28 18:12:55 +00:00
dsl 2a54322c7b If a multithreaded app closes an fd while another thread is blocked in
read/write/accept, then the expectation is that the blocked thread will
exit and the close complete.
Since only one fd is affected, but many fd can refer to the same file,
the close code can only request the fs code unblock with ERESTART.
Fixed for pipes and sockets, ERESTART will only be generated after such
a close - so there should be no change for other programs.
Also rename fo_abort() to fo_restart() (this used to be fo_drain()).
Fixes PR/26567
2009-12-20 09:36:05 +00:00
dsl 7a42c833db Rename fo_drain() to fo_abort(), 'drain' is used to mean 'wait for output
do drain' in many places, whereas fo_drain() was called in order to force
blocking read()/write() etc calls to return to userspace so that a close()
call from a different thread can complete.
In the sockets code comment out the broken code in the inner function,
it was being called from compat code.
2009-12-09 21:32:58 +00:00
pooka 20f444ae36 Mark putter as MODULE_CLASS_DRIVER to make it autoloadable. This
fixes autoloading of puffs upon mount.
2009-12-07 13:41:44 +00:00
christos 86ba58fd64 Fix locking as Andy explained. Also fill in uid and gid like sys_pipe did. 2009-04-11 23:05:26 +00:00
christos b859fbe7cb Fix PR/37878 and PR/37550: Provide stat(2) for all devices and don't use
fbadop_stat.
2009-04-11 15:47:33 +00:00
ad c6367674d6 Add fileops::fo_drain(), to be called from fd_close() when there is more
than one active reference to a file descriptor. It should dislodge threads
sleeping while holding a reference to the descriptor. Implemented only for
sockets but should be extended to pipes, fifos, etc.

Fixes the case of a multithreaded process doing something like the
following, which would have hung until the process got a signal.

thr0	accept(fd, ...)
thr1	close(fd)
2009-04-04 10:12:51 +00:00
cegger df7f595ecd Ansify function definitions w/o arguments. Generated with sed. 2009-03-18 10:22:21 +00:00
drochner d767912be3 Change major()/minor() to return 32-bit types again, called
devmajor_t/devminor_t, as proposed on tech-kern.
This avoids 64-bit arithmetics and 64-bit printf formats in parts
of the kernel where it is not really useful, and helps clarity.
2009-01-20 18:20:47 +00:00
pooka 13de128f76 Actually, revert previous - I doubt it would work with a non-rump kernel.
The filthy #ifdef _MODULE lives to stink another day.
2008-12-29 17:52:43 +00:00
pooka 7b9ae626a8 die filthy #ifdef _MODULE, die! 2008-12-29 17:47:08 +00:00
pooka 3ad5d8db21 KASSERT works better with == instead of = 2008-08-08 13:02:10 +00:00
pooka 4a0d2098e7 Repeat after me: do not pollute sys with #ifdef _RUMPKERNEL 2008-07-21 10:40:37 +00:00
jmcneill 5d0bd997c2 Don't call devsw_attach/detach if _MODULE is not defined. 2008-05-30 11:24:57 +00:00
ad 48dad50527 Acquire kernel_lock in putter's fileops. 2008-05-21 14:03:31 +00:00
jmcneill f26579137a Don't build as module if _RUMPKERNEL is defined. 2008-05-19 19:52:09 +00:00
ad f767e4c920 Return result of devsw_detach(). 2008-05-19 17:15:34 +00:00
jmcneill 382e2c82b5 Support building putter as a module. 2008-05-19 16:59:55 +00:00
ad a9ca7a3734 Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
2008-03-21 21:54:58 +00:00
rmind c6186face4 Welcome to 4.99.55:
- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call.  It will
  indicate which event (POLL_IN, POLL_OUT, etc) happen.  If unknown,
  zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>
2008-03-01 14:16:49 +00:00
pooka b0e1200d26 unstaticate putterdebug 2008-01-02 05:27:21 +00:00
pooka af3b65635e Allow EVFILT_WRITE kqfilters to be registered and map them to
seltrue_filtops.
2007-12-03 15:24:06 +00:00
pooka b6cf4ea195 Allow to register configuration routines to putter. Once a
configuration routine has been attached to the putter device minor
number, the configuration routine will be called when the device
is opened.  This is required for subsystems which enter the kernel
only through the file descriptor and cannot configure themselves
via another route (like puffs does via the mount() syscall).  Keep
the minor number 0 for "wildcard" uses where we do not require a
hardwired config routine (e.g. the puffs case).
2007-11-20 18:35:22 +00:00
pooka 4e9d847cff Don't specialcase minor device, treat all minors the same. 2007-11-13 13:11:51 +00:00
pooka ca28ea4509 Bounds-check responses from userspace. 2007-11-12 17:42:13 +00:00
pooka 9ac65ee1fe * split the putter header into a kernel version and a userland version
+ install latter to /usr/include/dev/putter
* remove last dependencies to puffs from putter, it's completely
  independent now
2007-11-12 16:39:32 +00:00
pooka 70981e62b1 Move putter code from directly under dev/ to dev/putter/
no functional change
2007-11-12 14:30:55 +00:00