NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/57468: kevent(2)'s EVFILT_WRITE description is wrong/unclear



>Number:         57468
>Category:       kern
>Synopsis:       kevent(2)'s EVFILT_WRITE description is wrong/unclear
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 15 00:00:00 +0000 2023
>Originator:     Theodore Preduta
>Release:        NetBSD 10.99.4
>Organization:
>Environment:
NetBSD 10.99.4 NetBSD 10.99.4 (GENERIC) #13: Wed Jun 14 17:29:57 EDT 2023 theo@:/usr/obj/sys/arch/amd64/compile/GENERIC amd64
>Description:
Under the section for EVFILT_WRITE, the kevent(2) man page contains the text "Note that this filter is not supported for vnodes.", however the code

#include <assert.h>
#include <fcntl.h>
#include <sys/event.h>

int main() {
	int kq, fd;
	struct kevent kev, buf;
	assert((fd = open(".", O_RDONLY)) > 0);
	assert((kq = kqueue()) > 0);
	EV_SET(&kev, fd, EVFILT_WRITE, EV_ADD|EV_ENABLE, 0, 0, 0);
	assert(kevent(kq, &kev, 1, NULL, 0, NULL) == 0);
	return 0;
}

runs successfully (including if you replace "." with a regular file).  Moreover, adding any number of calls of the form

	kevent(kq, NULL, 0, &buf, 1, NULL);

after the first call to kevent succeed (returning 1 and not setting EV_ERROR).

Note: this language is also unclear as the same paragraph explicitly describes behavior for "sockets, pipes, fifos, and ttys" which are represented by vnodes.

Note 2: this behavior is the same on FreeBSD (13.2), which has the same "not supported for vnodes" line in their man page.
>How-To-Repeat:
man kevent
>Fix:
Remove "Note that this filter is not supported for vnodes." from the man page.



Home | Main Index | Thread Index | Old Index