public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Sebastian Huber <sh@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] Integrate 4.4BSD-Lite2 changes to IOC_* definitions
Date: Mon, 11 Jul 2022 11:53:14 +0000 (GMT)	[thread overview]
Message-ID: <20220711115314.A008A385C320@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=1cb590ab48ae2c12e2eb15e1f6c5541c2039743e

commit 1cb590ab48ae2c12e2eb15e1f6c5541c2039743e
Author: Warner Losh <imp@FreeBSD.org>
Date:   Fri Oct 30 22:00:35 2020 +0000

    Integrate 4.4BSD-Lite2 changes to IOC_* definitions
    
    Bring in the long-overdue 4.4BSD-Lite2 rev 8.3 by cgd of
    sys/ioccom.h. This uses UL suffix for the IOC_* constants so they
    don't sign extend. Also bring in the handy diagram from NetBSD's
    version of this file. This alters the 4.4BSD-Lite2 code slightly
    in a way that's semantically the same but more compact.
    
    This should stop the warnings from Chrome for bogus sign extension.
    
    Reviewed by: kib@, jhb@
    Differential Revision: https://reviews.freebsd.org/D26423

Diff:
---
 newlib/libc/sys/rtems/include/sys/ioccom.h | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/sys/ioccom.h b/newlib/libc/sys/rtems/include/sys/ioccom.h
index a0117245b..adaa30797 100644
--- a/newlib/libc/sys/rtems/include/sys/ioccom.h
+++ b/newlib/libc/sys/rtems/include/sys/ioccom.h
@@ -28,7 +28,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)ioccom.h	8.2 (Berkeley) 3/28/94
+ *	@(#)ioccom.h	8.3 (Berkeley) 1/9/95
  * $FreeBSD$
  */
 
@@ -43,6 +43,11 @@ typedef unsigned long ioctl_command_t;
  * Ioctl's have the command encoded in the lower word, and the size of
  * any in or out parameters in the upper word.  The high 3 bits of the
  * upper word are used to encode the in/out status of the parameter.
+ *
+ *	 31 29 28                     16 15            8 7             0
+ *	+---------------------------------------------------------------+
+ *	| I/O | Parameter Length        | Command Group | Command       |
+ *	+---------------------------------------------------------------+
  */
 #define	IOCPARM_SHIFT	13		/* number of bits for ioctl size */
 #define	IOCPARM_MASK	((1 << IOCPARM_SHIFT) - 1) /* parameter length mask */
@@ -51,11 +56,11 @@ typedef unsigned long ioctl_command_t;
 #define	IOCGROUP(x)	(((x) >> 8) & 0xff)
 
 #define	IOCPARM_MAX	(1 << IOCPARM_SHIFT) /* max size of ioctl */
-#define	IOC_VOID	0x20000000	/* no parameters */
-#define	IOC_OUT		0x40000000	/* copy out parameters */
-#define	IOC_IN		0x80000000	/* copy in parameters */
-#define	IOC_INOUT	(IOC_IN|IOC_OUT)
-#define	IOC_DIRMASK	(IOC_VOID|IOC_OUT|IOC_IN)
+#define	IOC_VOID	0x20000000UL	/* no parameters */
+#define	IOC_OUT		0x40000000UL	/* copy out parameters */
+#define	IOC_IN		0x80000000UL	/* copy in parameters */
+#define	IOC_INOUT	(IOC_IN|IOC_OUT)/* copy parameters in and out */
+#define	IOC_DIRMASK	(IOC_VOID|IOC_OUT|IOC_IN)/* mask for IN/OUT/VOID */
 
 #define	_IOC(inout,group,num,len)					\
     ((ioctl_command_t)((ioctl_command_t)(inout) | (((ioctl_command_t)(len) & \


                 reply	other threads:[~2022-07-11 11:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220711115314.A008A385C320@sourceware.org \
    --to=sh@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).