Source-Changes-HG archive

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

[src/trunk]: src/sys/sys provide a macro to symbolically print an ioctl number.



details:   https://anonhg.NetBSD.org/src/rev/2c7f1900e1fc
branches:  trunk
changeset: 334837:2c7f1900e1fc
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Dec 10 00:16:05 2014 +0000

description:
provide a macro to symbolically print an ioctl number.

diffstat:

 sys/sys/ioccom.h |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (21 lines):

diff -r 52bd7cd3003e -r 2c7f1900e1fc sys/sys/ioccom.h
--- a/sys/sys/ioccom.h  Wed Dec 10 00:15:26 2014 +0000
+++ b/sys/sys/ioccom.h  Wed Dec 10 00:16:05 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ioccom.h,v 1.11 2011/10/19 10:53:12 yamt Exp $ */
+/*     $NetBSD: ioccom.h,v 1.12 2014/12/10 00:16:05 christos Exp $     */
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1993, 1994
@@ -72,4 +72,11 @@
 /* this should be _IORW, but stdio got there first */
 #define        _IOWR(g,n,t)    _IOC(IOC_INOUT, (g), (n), sizeof(t))
 
+#define IOCSNPRINTF(buf, len, cmd) \
+    snprintf((buf), (len), "_IO%s%s('%c', %hhu)", \
+       (((cmd) >> 30) & 1) ? "W" : "", \
+       (((cmd) >> 30) & 2) ? "R" : "", \
+       (char)IOCGROUP(cmd), (unsigned char)(cmd))
+               
+
 #endif /* !_SYS_IOCCOM_H_ */



Home | Main Index | Thread Index | Old Index