sock: provide socket ioctl command ID definitions

* xlat/sock_ioctls.in: New file.
* sock.c: Include "xlat/sock_ioctls.h". Remove #ifdef conditions for
ioctl commands.
This commit is contained in:
Eugene Syromyatnikov 2018-10-20 04:13:20 +02:00
parent 016178ec9b
commit 231658be6b
2 changed files with 122 additions and 16 deletions

17
sock.c
View File

@ -64,6 +64,7 @@ typedef struct ifreq struct_ifreq;
# include "xlat/arp_hardware_types.h"
# include "xlat/route_nexthop_flags.h"
# include "xlat/routing_types.h"
# include "xlat/sock_ioctls.h"
#undef XLAT_MACROS_ONLY
static void
@ -547,45 +548,29 @@ MPERS_PRINTER_DECL(int, sock_ioctl,
case SIOCGIFCONF:
return decode_ifconf(tcp, fd, code, arg);
#ifdef SIOCBRADDBR
case SIOCBRADDBR:
case SIOCBRDELBR:
tprints(", ");
printstr(tcp, arg);
break;
#endif
#ifdef FIOSETOWN
case FIOSETOWN:
#endif
#ifdef SIOCSPGRP
case SIOCSPGRP:
#endif
tprints(", ");
printnum_int(tcp, arg, "%d");
break;
#ifdef FIOGETOWN
case FIOGETOWN:
#endif
#ifdef SIOCGPGRP
case SIOCGPGRP:
#endif
#ifdef SIOCATMARK
case SIOCATMARK:
#endif
if (entering(tcp))
return 0;
tprints(", ");
printnum_int(tcp, arg, "%d");
break;
#ifdef SIOCBRADDIF
case SIOCBRADDIF:
#endif
#ifdef SIOCBRDELIF
case SIOCBRDELIF:
#endif
/* no arguments */
break;

121
xlat/sock_ioctls.in Normal file
View File

@ -0,0 +1,121 @@
/* arch-specific */
#if defined __alpha__ || defined __mips__ || defined __sh__ || defined __sh64__ || defined __xtensa__
FIOGETOWN _IOW('f', 123, int)
FIOSETOWN _IOW('f', 124, int)
SIOCATMARK _IOW('s', 7, int)
SIOCSPGRP _IOW('s', 8, int /* pid_t */)
SIOCGPGRP _IOW('s', 9, int /* pid_t */)
#else
FIOSETOWN 0x8901
SIOCSPGRP 0x8902
FIOGETOWN 0x8903
SIOCGPGRP 0x8904
SIOCATMARK 0x8905
#endif
#if defined __sh__ || defined __sh64__
SIOCGSTAMP _IOR('s', 100, struct timeval)
SIOCGSTAMPNS _IOR('s', 100, struct timeval)
#else
SIOCGSTAMP 0x8906
SIOCGSTAMPNS 0x8907
#endif
/* arch-independent */
SIOCADDRT 0x890b
SIOCDELRT 0x890c
SIOCRTMSG 0x890d
SIOCGIFNAME 0x8910
SIOCSIFLINK 0x8911
SIOCGIFCONF 0x8912
SIOCGIFFLAGS 0x8913
SIOCSIFFLAGS 0x8914
SIOCGIFADDR 0x8915
SIOCSIFADDR 0x8916
SIOCGIFDSTADDR 0x8917
SIOCSIFDSTADDR 0x8918
SIOCGIFBRDADDR 0x8919
SIOCSIFBRDADDR 0x891a
SIOCGIFNETMASK 0x891b
SIOCSIFNETMASK 0x891c
SIOCGIFMETRIC 0x891d
SIOCSIFMETRIC 0x891e
SIOCGIFMEM 0x891f
SIOCSIFMEM 0x8920
SIOCGIFMTU 0x8921
SIOCSIFMTU 0x8922
SIOCSIFNAME 0x8923
SIOCSIFHWADDR 0x8924
SIOCGIFENCAP 0x8925
SIOCSIFENCAP 0x8926
SIOCGIFHWADDR 0x8927
SIOCGIFSLAVE 0x8929
SIOCSIFSLAVE 0x8930
SIOCADDMULTI 0x8931
SIOCDELMULTI 0x8932
SIOCGIFINDEX 0x8933
SIOCSIFPFLAGS 0x8934
SIOCGIFPFLAGS 0x8935
SIOCDIFADDR 0x8936
SIOCSIFHWBROADCAST 0x8937
SIOCGIFCOUNT 0x8938
SIOCGIFBR 0x8940
SIOCSIFBR 0x8941
SIOCGIFTXQLEN 0x8942
SIOCSIFTXQLEN 0x8943
SIOCGIFDIVERT 0x8944 /* Removed in v2.6.20-rc1~15^2~9^2~386 */
SIOCSIFDIVERT 0x8945 /* Removed in v2.6.20-rc1~15^2~9^2~386 */
SIOCETHTOOL 0x8946
SIOCGMIIPHY 0x8947
SIOCGMIIREG 0x8948
SIOCSMIIREG 0x8949
SIOCWANDEV 0x894A
SIOCOUTQNSD 0x894B
SIOCGSKNS 0x894C
/* ARP cache control calls. */
/* OLD_SIOCDARP 0x8950 - removed in 2.1.68 */
/* OLD_SIOCGARP 0x8951 - removed in 2.1.68 */
/* OLD_SIOCSARP 0x8952 - removed in 2.1.68 */
SIOCDARP 0x8953
SIOCGARP 0x8954
SIOCSARP 0x8955
/* RARP cache control calls. */
SIOCDRARP 0x8960
SIOCGRARP 0x8961
SIOCSRARP 0x8962
/* Driver configuration calls */
SIOCGIFMAP 0x8970
SIOCSIFMAP 0x8971
/* DLCI configuration calls */
SIOCADDDLCI 0x8980
SIOCDELDLCI 0x8981
SIOCGIFVLAN 0x8982
SIOCSIFVLAN 0x8983
/* bonding calls */
SIOCBONDENSLAVE 0x8990
SIOCBONDRELEASE 0x8991
SIOCBONDSETHWADDR 0x8992
SIOCBONDSLAVEINFOQUERY 0x8993
SIOCBONDINFOQUERY 0x8994
SIOCBONDCHANGEACTIVE 0x8995
/* bridge calls */
SIOCBRADDBR 0x89a0
SIOCBRDELBR 0x89a1
SIOCBRADDIF 0x89a2
SIOCBRDELIF 0x89a3
/* hardware time stamping: parameters in linux/net_tstamp.h */
SIOCSHWTSTAMP 0x89b0
SIOCGHWTSTAMP 0x89b1
/* SIOCPROTOPRIVATE == 0x89e0..0x89ef - protocol-private ioctls */
/* SIOCDEVPRIVATE == 0x89f0..0x89ff - device-private ioctls */