From nobody Fri Sep 12 16:29:00 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cNfy46tC7z67dcd; Fri, 12 Sep 2025 16:29:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cNfy45YGZz3R0W; Fri, 12 Sep 2025 16:29:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757694540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mVyZELvblDyUpyhcbf5WVzq7X1ymUjV9/LxmlzozTGI=; b=bplHxuccA1BmF3ufGfWbeiJk2GBCjNwZmG8cbSKYWf4HyQLTQggFPafB/gVg8FzJXONpKx 35jkt1ZTNg/qZpF0Dk/qrMiG0EiAe2gqEA0RiUcYQPLGVKAkZg9EE9P4MX7GFyldXQzA0Q 2gVx3CqhFlMFDwCq09GVTsLTxjfMs+AqPI5VQ1n1A9iyAg0iLfcjr/bs2nLrlbVoYP1u26 cn16TDocVU2XzgNr/spi3jycsXRjDkPbci5CCTSuPgpwZTpvyBy0eMvuHLPn5+gw8jV09d mIpAu1qAmtXM1IFhg0ZucP7pxk6yj57DpQH+9bFittnIQurLnIR846XG03NuEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757694540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mVyZELvblDyUpyhcbf5WVzq7X1ymUjV9/LxmlzozTGI=; b=wHHHTqI4H4W3+MRhWwdR88oUFezCHE9qFQa+/e5Lq3Qwe1lNVFwSDv97UuzNhreA9QXoHz QFve6Q3iP6Rw3OowDMzAe4a+pU50DNyDWodL2cJ3WjYgkmtGw1kXhZ1rmC/Rl/JRDE3wEU DEXC3a1jAWVm1Ic7cwQO6oYrlpTXowqOM5vlMDpfWdasULHLqoZqcCJ3mtdQPVg7EyzdF9 JB/l2I1Snl1tGEqsk+/c66/fUOke9NTaWSBBYvr4PxKp2Uc1sv4+R5owJz5iNvJ9CWfj8b NRjBOvSsVBdgLRrjFqsoj6VKbngybRp3HbgYi3Aq9OniGkmK1JixmQQGoV9eNw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757694540; a=rsa-sha256; cv=none; b=QRKNM5EZVr0LHFxcP0WSB49OBr1qYrI5X1+J0xw56cmZAi7L6WAe3RsXo8iAVN/b9NjvkC BwcBKUsmQLB0otKqC3ojn1zlwQT1jgIFueOcPIy3e6qBJeal042ScCw9MIb/nan0Hfu3oj w1tUmaZXtXI/ybRawAJbIyNNAZBbIgjis+tBFr1TautAk7iBZMEEjYoEgvbyPynLfR3DOF p8RZSDcXByU2k7RZ9zPx99wsDq8ioCx60P+NVfIlRwYTPaDE1bdIyFs1o3km6iBGe2qha4 VtA84OBy+JyN/8QGyTh2pbWV3H0ED9h9R0jH+Fo3SxPMqyRxnX75He8oixYxog== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cNfy457Xgz10LX; Fri, 12 Sep 2025 16:29:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58CGT0qA019426; Fri, 12 Sep 2025 16:29:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58CGT0Yl019423; Fri, 12 Sep 2025 16:29:00 GMT (envelope-from git) Date: Fri, 12 Sep 2025 16:29:00 GMT Message-Id: <202509121629.58CGT0Yl019423@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9fadaee7ecce - main - ng_device: enable setting the device to non-blocking mode List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9fadaee7ecce02ab11cfbb18ea63b9bf1fb11bfc Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9fadaee7ecce02ab11cfbb18ea63b9bf1fb11bfc commit 9fadaee7ecce02ab11cfbb18ea63b9bf1fb11bfc Author: Quentin Thébault AuthorDate: 2025-08-28 08:19:41 +0000 Commit: Warner Losh CommitDate: 2025-09-12 16:24:38 +0000 ng_device: enable setting the device to non-blocking mode Return success when FIONBIO or FIOASYNC ioctl are received in order to support being set to non-blocking through fcntl(2). We return an error on FIOASYNC with non-zero data argument since we do not support O_ASYNC. Signed-off-by: Quentin Thébault Reviewed by: imp, jhb Pull Request: https://github.com/freebsd/freebsd-src/pull/1827 --- sys/netgraph/ng_device.c | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/sys/netgraph/ng_device.c b/sys/netgraph/ng_device.c index 79cae9933a5a..eca3a916a59f 100644 --- a/sys/netgraph/ng_device.c +++ b/sys/netgraph/ng_device.c @@ -38,20 +38,21 @@ #endif #include +#include #include +#include +#include +#include #include #include #include #include #include #include -#include #include #include #include -#include #include -#include #include #include @@ -135,9 +136,7 @@ static d_close_t ngdclose; static d_open_t ngdopen; static d_read_t ngdread; static d_write_t ngdwrite; -#if 0 static d_ioctl_t ngdioctl; -#endif static d_poll_t ngdpoll; static struct cdevsw ngd_cdevsw = { @@ -146,9 +145,7 @@ static struct cdevsw ngd_cdevsw = { .d_close = ngdclose, .d_read = ngdread, .d_write = ngdwrite, -#if 0 .d_ioctl = ngdioctl, -#endif .d_poll = ngdpoll, .d_name = NG_DEVICE_DEVNAME, }; @@ -397,6 +394,36 @@ ngdclose(struct cdev *dev, int flag, int mode, struct thread *td) return(0); } +/* + * Process IOCTLs + * + * At this stage we only return success on FIONBIO to allow setting the device + * as non-blocking. + * + */ +static int +ngdioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, + struct thread *td) +{ + int error; + + switch (cmd) { + case FIONBIO: + error = 0; + break; + case FIOASYNC: + if (*(int *)data != 0) + error = EINVAL; + else + error = 0; + break; + default: + error = ENOTTY; + } + + return (error); +} + #if 0 /* * The ioctl is transformed into netgraph control message. * We do not process them, yet.