NetBSD Problem Report #57468

From www@netbsd.org  Wed Jun 14 23:59:19 2023
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 6B4D21A9239
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 14 Jun 2023 23:59:19 +0000 (UTC)
Message-Id: <20230614235918.847C31A923D@mollari.NetBSD.org>
Date: Wed, 14 Jun 2023 23:59:18 +0000 (UTC)
From: theo@pta.gg
Reply-To: theo@pta.gg
To: gnats-bugs@NetBSD.org
Subject: kevent(2)'s EVFILT_WRITE description is wrong/unclear
X-Send-Pr-Version: www-1.0

>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.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.