1
0
mirror of https://github.com/golang/go synced 2024-11-21 21:04:41 -07:00

syscall: add netlink support for linux/386, linux/amd64, linux/arm

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4535078
This commit is contained in:
Mikio Hara 2011-05-18 16:33:41 -07:00 committed by Brad Fitzpatrick
parent 0a2650f398
commit 1d550bdedf
9 changed files with 1145 additions and 190 deletions

View File

@ -21,17 +21,21 @@ includes_Linux='
#define _FILE_OFFSET_BITS 64
#define _GNU_SOURCE
#include <sys/types.h>
#include <bits/sockaddr.h>
#include <sys/epoll.h>
#include <sys/inotify.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <linux/if_addr.h>
#include <linux/if_tun.h>
#include <linux/netlink.h>
#include <linux/reboot.h>
#include <linux/rtnetlink.h>
#include <linux/ptrace.h>
#include <linux/wait.h>
#include <linux/if_tun.h>
#include <linux/reboot.h>
#include <net/if.h>
#include <netpacket/packet.h>
'
@ -132,6 +136,8 @@ done
$2 ~ /^(O|F|FD|NAME|S|PTRACE)_/ ||
$2 ~ /^LINUX_REBOOT_CMD_/ ||
$2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
$2 !~ "NLA_TYPE_MASK" &&
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|RTM)_/ ||
$2 ~ /^SIOC/ ||
$2 ~ /^(IFF|NET_RT|RTM|RTF|RTV|RTA|RTAX)_/ ||
$2 ~ /^BIOC/ ||

View File

@ -290,8 +290,33 @@ func (sa *SockaddrLinklayer) sockaddr() (uintptr, _Socklen, int) {
return uintptr(unsafe.Pointer(&sa.raw)), SizeofSockaddrLinklayer, 0
}
type SockaddrNetlink struct {
Family uint16
Pad uint16
Pid uint32
Groups uint32
raw RawSockaddrNetlink
}
func (sa *SockaddrNetlink) sockaddr() (uintptr, _Socklen, int) {
sa.raw.Family = AF_NETLINK
sa.raw.Pad = sa.Pad
sa.raw.Pid = sa.Pid
sa.raw.Groups = sa.Groups
return uintptr(unsafe.Pointer(&sa.raw)), SizeofSockaddrNetlink, 0
}
func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, int) {
switch rsa.Addr.Family {
case AF_NETLINK:
pp := (*RawSockaddrNetlink)(unsafe.Pointer(rsa))
sa := new(SockaddrNetlink)
sa.Family = pp.Family
sa.Pad = pp.Pad
sa.Pid = pp.Pid
sa.Groups = pp.Groups
return sa, 0
case AF_PACKET:
pp := (*RawSockaddrLinklayer)(unsafe.Pointer(rsa))
sa := new(SockaddrLinklayer)
@ -489,7 +514,7 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
oobn = int(msg.Controllen)
recvflags = int(msg.Flags)
// source address is only specified if the socket is unconnected
if rsa.Addr.Family != 0 {
if rsa.Addr.Family != AF_UNSPEC {
from, errno = anyToSockaddr(&rsa)
}
return

View File

@ -38,6 +38,8 @@ Input to godefs. See also mkerrors.sh and mkall.sh
#include <sys/user.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <time.h>
#include <unistd.h>
#include <ustat.h>
@ -93,6 +95,7 @@ union sockaddr_all {
struct sockaddr_in6 s3;
struct sockaddr_un s4;
struct sockaddr_ll s5;
struct sockaddr_nl s6;
};
struct sockaddr_any {
@ -104,6 +107,7 @@ typedef struct sockaddr_in $RawSockaddrInet4;
typedef struct sockaddr_in6 $RawSockaddrInet6;
typedef struct sockaddr_un $RawSockaddrUnix;
typedef struct sockaddr_ll $RawSockaddrLinklayer;
typedef struct sockaddr_nl $RawSockaddrNetlink;
typedef struct sockaddr $RawSockaddr;
typedef struct sockaddr_any $RawSockaddrAny;
typedef socklen_t $_Socklen;
@ -120,6 +124,7 @@ enum {
$SizeofSockaddrAny = sizeof(struct sockaddr_any),
$SizeofSockaddrUnix = sizeof(struct sockaddr_un),
$SizeofSockaddrLinklayer = sizeof(struct sockaddr_ll),
$SizeofSockaddrNetlink = sizeof(struct sockaddr_nl),
$SizeofLinger = sizeof(struct linger),
$SizeofIpMreq = sizeof(struct ip_mreq),
$SizeofMsghdr = sizeof(struct msghdr),
@ -127,15 +132,66 @@ enum {
$SizeofUcred = sizeof(struct ucred),
};
// Netlink routing and interface messages
enum {
$IFA_UNSPEC = IFA_UNSPEC,
$IFA_ADDRESS = IFA_ADDRESS,
$IFA_LOCAL = IFA_LOCAL,
$IFA_LABEL = IFA_LABEL,
$IFA_BROADCAST = IFA_BROADCAST,
$IFA_ANYCAST = IFA_ANYCAST,
$IFA_CACHEINFO = IFA_CACHEINFO,
$IFA_MULTICAST = IFA_MULTICAST,
$IFLA_UNSPEC = IFLA_UNSPEC,
$IFLA_ADDRESS = IFLA_ADDRESS,
$IFLA_BROADCAST = IFLA_BROADCAST,
$IFLA_IFNAME = IFLA_IFNAME,
$IFLA_MTU = IFLA_MTU,
$IFLA_LINK = IFLA_LINK,
$IFLA_QDISC = IFLA_QDISC,
$IFLA_STATS = IFLA_STATS,
$IFLA_COST = IFLA_COST,
$IFLA_PRIORITY = IFLA_PRIORITY,
$IFLA_MASTER = IFLA_MASTER,
$IFLA_WIRELESS = IFLA_WIRELESS,
$IFLA_PROTINFO = IFLA_PROTINFO,
$IFLA_TXQLEN = IFLA_TXQLEN,
$IFLA_MAP = IFLA_MAP,
$IFLA_WEIGHT = IFLA_WEIGHT,
$IFLA_OPERSTATE = IFLA_OPERSTATE,
$IFLA_LINKMODE = IFLA_LINKMODE,
$IFLA_LINKINFO = IFLA_LINKINFO,
$IFLA_NET_NS_PID = IFLA_NET_NS_PID,
$IFLA_IFALIAS = IFLA_IFALIAS,
$IFLA_MAX = IFLA_MAX,
$SizeofNlMsghdr = sizeof(struct nlmsghdr),
$SizeofNlMsgerr = sizeof(struct nlmsgerr),
$SizeofRtGenmsg = sizeof(struct rtgenmsg),
$SizeofNlAttr = sizeof(struct nlattr),
$SizeofRtAttr = sizeof(struct rtattr),
$SizeofIfInfomsg = sizeof(struct ifinfomsg),
$SizeofIfAddrmsg = sizeof(struct ifaddrmsg),
$SizeofRtmsg = sizeof(struct rtmsg),
};
typedef struct nlmsghdr $NlMsghdr;
typedef struct nlmsgerr $NlMsgerr;
typedef struct rtgenmsg $RtGenmsg;
typedef struct nlattr $NlAttr;
typedef struct rtattr $RtAttr;
typedef struct ifinfomsg $IfInfomsg;
typedef struct ifaddrmsg $IfAddrmsg;
typedef struct rtmsg $RtMsg;
// Inotify
typedef struct inotify_event $InotifyEvent;
enum {
$SizeofInotifyEvent = sizeof(struct inotify_event)
};
// Ptrace
// Register structures

View File

@ -241,6 +241,16 @@ const (
F_ULOCK = 0
F_UNLCK = 0x2
F_WRLCK = 0x1
IFA_F_DADFAILED = 0x8
IFA_F_DEPRECATED = 0x20
IFA_F_HOMEADDRESS = 0x10
IFA_F_NODAD = 0x2
IFA_F_OPTIMISTIC = 0x4
IFA_F_PERMANENT = 0x80
IFA_F_SECONDARY = 0x1
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0x7
IFF_ALLMULTI = 0x200
IFF_AUTOMEDIA = 0x4000
IFF_BROADCAST = 0x2
@ -494,6 +504,53 @@ const (
MS_SYNC = 0x4
MS_SYNCHRONOUS = 0x10
NAME_MAX = 0xff
NETLINK_ADD_MEMBERSHIP = 0x1
NETLINK_AUDIT = 0x9
NETLINK_BROADCAST_ERROR = 0x4
NETLINK_CONNECTOR = 0xb
NETLINK_DNRTMSG = 0xe
NETLINK_DROP_MEMBERSHIP = 0x2
NETLINK_ECRYPTFS = 0x13
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
NETLINK_KOBJECT_UEVENT = 0xf
NETLINK_NETFILTER = 0xc
NETLINK_NFLOG = 0x5
NETLINK_NO_ENOBUFS = 0x5
NETLINK_PKTINFO = 0x3
NETLINK_ROUTE = 0
NETLINK_SCSITRANSPORT = 0x12
NETLINK_SELINUX = 0x7
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NLA_ALIGNTO = 0x4
NLA_F_NESTED = 0x8000
NLA_F_NET_BYTEORDER = 0x4000
NLA_HDRLEN = 0x4
NLMSG_ALIGNTO = 0x4
NLMSG_DONE = 0x3
NLMSG_ERROR = 0x2
NLMSG_HDRLEN = 0x10
NLMSG_MIN_TYPE = 0x10
NLMSG_NOOP = 0x1
NLMSG_OVERRUN = 0x4
NLM_F_ACK = 0x4
NLM_F_APPEND = 0x800
NLM_F_ATOMIC = 0x400
NLM_F_CREATE = 0x400
NLM_F_DUMP = 0x300
NLM_F_ECHO = 0x8
NLM_F_EXCL = 0x200
NLM_F_MATCH = 0x200
NLM_F_MULTI = 0x2
NLM_F_REPLACE = 0x100
NLM_F_REQUEST = 0x1
NLM_F_ROOT = 0x100
O_ACCMODE = 0x3
O_APPEND = 0x400
O_ASYNC = 0x2000
@ -590,6 +647,75 @@ const (
PTRACE_SYSEMU = 0x1f
PTRACE_SYSEMU_SINGLESTEP = 0x20
PTRACE_TRACEME = 0
RTAX_ADVMSS = 0x8
RTAX_CWND = 0x7
RTAX_FEATURES = 0xc
RTAX_FEATURE_ALLFRAG = 0x8
RTAX_FEATURE_ECN = 0x1
RTAX_FEATURE_SACK = 0x2
RTAX_FEATURE_TIMESTAMP = 0x4
RTAX_HOPLIMIT = 0xa
RTAX_INITCWND = 0xb
RTAX_LOCK = 0x1
RTAX_MAX = 0xd
RTAX_MTU = 0x2
RTAX_REORDERING = 0x9
RTAX_RTO_MIN = 0xd
RTAX_RTT = 0x4
RTAX_RTTVAR = 0x5
RTAX_SSTHRESH = 0x6
RTAX_UNSPEC = 0
RTAX_WINDOW = 0x3
RTA_ALIGNTO = 0x4
RTA_MAX = 0xf
RTM_BASE = 0x10
RTM_DELACTION = 0x31
RTM_DELADDR = 0x15
RTM_DELADDRLABEL = 0x49
RTM_DELLINK = 0x11
RTM_DELNEIGH = 0x1d
RTM_DELQDISC = 0x25
RTM_DELROUTE = 0x19
RTM_DELRULE = 0x21
RTM_DELTCLASS = 0x29
RTM_DELTFILTER = 0x2d
RTM_F_CLONED = 0x200
RTM_F_EQUALIZE = 0x400
RTM_F_NOTIFY = 0x100
RTM_F_PREFIX = 0x800
RTM_GETACTION = 0x32
RTM_GETADDR = 0x16
RTM_GETADDRLABEL = 0x4a
RTM_GETANYCAST = 0x3e
RTM_GETDCB = 0x4e
RTM_GETLINK = 0x12
RTM_GETMULTICAST = 0x3a
RTM_GETNEIGH = 0x1e
RTM_GETNEIGHTBL = 0x42
RTM_GETQDISC = 0x26
RTM_GETROUTE = 0x1a
RTM_GETRULE = 0x22
RTM_GETTCLASS = 0x2a
RTM_GETTFILTER = 0x2e
RTM_MAX = 0x4f
RTM_NEWACTION = 0x30
RTM_NEWADDR = 0x14
RTM_NEWADDRLABEL = 0x48
RTM_NEWLINK = 0x10
RTM_NEWNDUSEROPT = 0x44
RTM_NEWNEIGH = 0x1c
RTM_NEWNEIGHTBL = 0x40
RTM_NEWPREFIX = 0x34
RTM_NEWQDISC = 0x24
RTM_NEWROUTE = 0x18
RTM_NEWRULE = 0x20
RTM_NEWTCLASS = 0x28
RTM_NEWTFILTER = 0x2c
RTM_NR_FAMILIES = 0x10
RTM_NR_MSGTYPES = 0x40
RTM_SETDCB = 0x4f
RTM_SETLINK = 0x13
RTM_SETNEIGHTBL = 0x43
SCM_CREDENTIALS = 0x2
SCM_RIGHTS = 0x1
SCM_TIMESTAMP = 0x1d

View File

@ -241,6 +241,16 @@ const (
F_ULOCK = 0
F_UNLCK = 0x2
F_WRLCK = 0x1
IFA_F_DADFAILED = 0x8
IFA_F_DEPRECATED = 0x20
IFA_F_HOMEADDRESS = 0x10
IFA_F_NODAD = 0x2
IFA_F_OPTIMISTIC = 0x4
IFA_F_PERMANENT = 0x80
IFA_F_SECONDARY = 0x1
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0x7
IFF_ALLMULTI = 0x200
IFF_AUTOMEDIA = 0x4000
IFF_BROADCAST = 0x2
@ -494,6 +504,53 @@ const (
MS_SYNC = 0x4
MS_SYNCHRONOUS = 0x10
NAME_MAX = 0xff
NETLINK_ADD_MEMBERSHIP = 0x1
NETLINK_AUDIT = 0x9
NETLINK_BROADCAST_ERROR = 0x4
NETLINK_CONNECTOR = 0xb
NETLINK_DNRTMSG = 0xe
NETLINK_DROP_MEMBERSHIP = 0x2
NETLINK_ECRYPTFS = 0x13
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
NETLINK_KOBJECT_UEVENT = 0xf
NETLINK_NETFILTER = 0xc
NETLINK_NFLOG = 0x5
NETLINK_NO_ENOBUFS = 0x5
NETLINK_PKTINFO = 0x3
NETLINK_ROUTE = 0
NETLINK_SCSITRANSPORT = 0x12
NETLINK_SELINUX = 0x7
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NLA_ALIGNTO = 0x4
NLA_F_NESTED = 0x8000
NLA_F_NET_BYTEORDER = 0x4000
NLA_HDRLEN = 0x4
NLMSG_ALIGNTO = 0x4
NLMSG_DONE = 0x3
NLMSG_ERROR = 0x2
NLMSG_HDRLEN = 0x10
NLMSG_MIN_TYPE = 0x10
NLMSG_NOOP = 0x1
NLMSG_OVERRUN = 0x4
NLM_F_ACK = 0x4
NLM_F_APPEND = 0x800
NLM_F_ATOMIC = 0x400
NLM_F_CREATE = 0x400
NLM_F_DUMP = 0x300
NLM_F_ECHO = 0x8
NLM_F_EXCL = 0x200
NLM_F_MATCH = 0x200
NLM_F_MULTI = 0x2
NLM_F_REPLACE = 0x100
NLM_F_REQUEST = 0x1
NLM_F_ROOT = 0x100
O_ACCMODE = 0x3
O_APPEND = 0x400
O_ASYNC = 0x2000
@ -591,6 +648,75 @@ const (
PTRACE_SYSEMU = 0x1f
PTRACE_SYSEMU_SINGLESTEP = 0x20
PTRACE_TRACEME = 0
RTAX_ADVMSS = 0x8
RTAX_CWND = 0x7
RTAX_FEATURES = 0xc
RTAX_FEATURE_ALLFRAG = 0x8
RTAX_FEATURE_ECN = 0x1
RTAX_FEATURE_SACK = 0x2
RTAX_FEATURE_TIMESTAMP = 0x4
RTAX_HOPLIMIT = 0xa
RTAX_INITCWND = 0xb
RTAX_LOCK = 0x1
RTAX_MAX = 0xd
RTAX_MTU = 0x2
RTAX_REORDERING = 0x9
RTAX_RTO_MIN = 0xd
RTAX_RTT = 0x4
RTAX_RTTVAR = 0x5
RTAX_SSTHRESH = 0x6
RTAX_UNSPEC = 0
RTAX_WINDOW = 0x3
RTA_ALIGNTO = 0x4
RTA_MAX = 0xf
RTM_BASE = 0x10
RTM_DELACTION = 0x31
RTM_DELADDR = 0x15
RTM_DELADDRLABEL = 0x49
RTM_DELLINK = 0x11
RTM_DELNEIGH = 0x1d
RTM_DELQDISC = 0x25
RTM_DELROUTE = 0x19
RTM_DELRULE = 0x21
RTM_DELTCLASS = 0x29
RTM_DELTFILTER = 0x2d
RTM_F_CLONED = 0x200
RTM_F_EQUALIZE = 0x400
RTM_F_NOTIFY = 0x100
RTM_F_PREFIX = 0x800
RTM_GETACTION = 0x32
RTM_GETADDR = 0x16
RTM_GETADDRLABEL = 0x4a
RTM_GETANYCAST = 0x3e
RTM_GETDCB = 0x4e
RTM_GETLINK = 0x12
RTM_GETMULTICAST = 0x3a
RTM_GETNEIGH = 0x1e
RTM_GETNEIGHTBL = 0x42
RTM_GETQDISC = 0x26
RTM_GETROUTE = 0x1a
RTM_GETRULE = 0x22
RTM_GETTCLASS = 0x2a
RTM_GETTFILTER = 0x2e
RTM_MAX = 0x4f
RTM_NEWACTION = 0x30
RTM_NEWADDR = 0x14
RTM_NEWADDRLABEL = 0x48
RTM_NEWLINK = 0x10
RTM_NEWNDUSEROPT = 0x44
RTM_NEWNEIGH = 0x1c
RTM_NEWNEIGHTBL = 0x40
RTM_NEWPREFIX = 0x34
RTM_NEWQDISC = 0x24
RTM_NEWROUTE = 0x18
RTM_NEWRULE = 0x20
RTM_NEWTCLASS = 0x28
RTM_NEWTFILTER = 0x2c
RTM_NR_FAMILIES = 0x10
RTM_NR_MSGTYPES = 0x40
RTM_SETDCB = 0x4f
RTM_SETLINK = 0x13
RTM_SETNEIGHTBL = 0x43
SCM_CREDENTIALS = 0x2
SCM_RIGHTS = 0x1
SCM_TIMESTAMP = 0x1d

View File

@ -16,9 +16,11 @@ const (
AF_AX25 = 0x3
AF_BLUETOOTH = 0x1f
AF_BRIDGE = 0x7
AF_CAN = 0x1d
AF_DECnet = 0xc
AF_ECONET = 0x13
AF_FILE = 0x1
AF_IEEE802154 = 0x24
AF_INET = 0x2
AF_INET6 = 0xa
AF_IPX = 0x4
@ -26,22 +28,35 @@ const (
AF_ISDN = 0x22
AF_IUCV = 0x20
AF_KEY = 0xf
AF_LLC = 0x1a
AF_LOCAL = 0x1
AF_MAX = 0x23
AF_MAX = 0x25
AF_NETBEUI = 0xd
AF_NETLINK = 0x10
AF_NETROM = 0x6
AF_PACKET = 0x11
AF_PHONET = 0x23
AF_PPPOX = 0x18
AF_RDS = 0x15
AF_ROSE = 0xb
AF_ROUTE = 0x10
AF_RXRPC = 0x21
AF_SECURITY = 0xe
AF_SNA = 0x16
AF_TIPC = 0x1e
AF_UNIX = 0x1
AF_UNSPEC = 0
AF_WANPIPE = 0x19
AF_X25 = 0x9
DT_BLK = 0x6
DT_CHR = 0x2
DT_DIR = 0x4
DT_FIFO = 0x1
DT_LNK = 0xa
DT_REG = 0x8
DT_SOCK = 0xc
DT_UNKNOWN = 0
DT_WHT = 0xe
E2BIG = 0x7
EACCES = 0xd
EADDRINUSE = 0x62
@ -206,6 +221,7 @@ const (
F_GETLK = 0xc
F_GETLK64 = 0xc
F_GETOWN = 0x9
F_GETOWN_EX = 0x10
F_GETSIG = 0xb
F_LOCK = 0x1
F_NOTIFY = 0x402
@ -219,6 +235,7 @@ const (
F_SETLKW = 0xe
F_SETLKW64 = 0xe
F_SETOWN = 0x8
F_SETOWN_EX = 0xf
F_SETSIG = 0xa
F_SHLCK = 0x8
F_TEST = 0x3
@ -226,6 +243,39 @@ const (
F_ULOCK = 0
F_UNLCK = 0x2
F_WRLCK = 0x1
IFA_F_DADFAILED = 0x8
IFA_F_DEPRECATED = 0x20
IFA_F_HOMEADDRESS = 0x10
IFA_F_NODAD = 0x2
IFA_F_OPTIMISTIC = 0x4
IFA_F_PERMANENT = 0x80
IFA_F_SECONDARY = 0x1
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0x7
IFF_ALLMULTI = 0x200
IFF_AUTOMEDIA = 0x4000
IFF_BROADCAST = 0x2
IFF_DEBUG = 0x4
IFF_DYNAMIC = 0x8000
IFF_LOOPBACK = 0x8
IFF_MASTER = 0x400
IFF_MULTICAST = 0x1000
IFF_NOARP = 0x80
IFF_NOTRAILERS = 0x20
IFF_NO_PI = 0x1000
IFF_ONE_QUEUE = 0x2000
IFF_POINTOPOINT = 0x10
IFF_PORTSEL = 0x2000
IFF_PROMISC = 0x100
IFF_RUNNING = 0x40
IFF_SLAVE = 0x800
IFF_TAP = 0x2
IFF_TUN = 0x1
IFF_TUN_EXCL = 0x8000
IFF_UP = 0x1
IFF_VNET_HDR = 0x4000
IFNAMSIZ = 0x10
IN_ACCESS = 0x1
IN_ALL_EVENTS = 0xfff
IN_ATTRIB = 0x4
@ -389,9 +439,54 @@ const (
LINUX_REBOOT_CMD_SW_SUSPEND = 0xd000fce2
LINUX_REBOOT_MAGIC1 = 0xfee1dead
LINUX_REBOOT_MAGIC2 = 0x28121969
MADV_DOFORK = 0xb
MADV_DONTFORK = 0xa
MADV_DONTNEED = 0x4
MADV_HWPOISON = 0x64
MADV_MERGEABLE = 0xc
MADV_NORMAL = 0
MADV_RANDOM = 0x1
MADV_REMOVE = 0x9
MADV_SEQUENTIAL = 0x2
MADV_UNMERGEABLE = 0xd
MADV_WILLNEED = 0x3
MAP_ANON = 0x20
MAP_ANONYMOUS = 0x20
MAP_DENYWRITE = 0x800
MAP_EXECUTABLE = 0x1000
MAP_FILE = 0
MAP_FIXED = 0x10
MAP_GROWSDOWN = 0x100
MAP_LOCKED = 0x2000
MAP_NONBLOCK = 0x10000
MAP_NORESERVE = 0x4000
MAP_POPULATE = 0x8000
MAP_PRIVATE = 0x2
MAP_SHARED = 0x1
MAP_TYPE = 0xf
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MNT_DETACH = 0x2
MNT_EXPIRE = 0x4
MNT_FORCE = 0x1
MSG_CMSG_CLOEXEC = 0x40000000
MSG_CONFIRM = 0x800
MSG_CTRUNC = 0x8
MSG_DONTROUTE = 0x4
MSG_DONTWAIT = 0x40
MSG_EOR = 0x80
MSG_ERRQUEUE = 0x2000
MSG_FIN = 0x200
MSG_MORE = 0x8000
MSG_NOSIGNAL = 0x4000
MSG_OOB = 0x1
MSG_PEEK = 0x2
MSG_PROXY = 0x10
MSG_RST = 0x1000
MSG_SYN = 0x400
MSG_TRUNC = 0x20
MSG_TRYHARD = 0x4
MSG_WAITALL = 0x100
MS_ASYNC = 0x1
MS_BIND = 0x1000
MS_INVALIDATE = 0x2
@ -409,6 +504,53 @@ const (
MS_SYNC = 0x4
MS_SYNCHRONOUS = 0x10
NAME_MAX = 0xff
NETLINK_ADD_MEMBERSHIP = 0x1
NETLINK_AUDIT = 0x9
NETLINK_BROADCAST_ERROR = 0x4
NETLINK_CONNECTOR = 0xb
NETLINK_DNRTMSG = 0xe
NETLINK_DROP_MEMBERSHIP = 0x2
NETLINK_ECRYPTFS = 0x13
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
NETLINK_KOBJECT_UEVENT = 0xf
NETLINK_NETFILTER = 0xc
NETLINK_NFLOG = 0x5
NETLINK_NO_ENOBUFS = 0x5
NETLINK_PKTINFO = 0x3
NETLINK_ROUTE = 0
NETLINK_SCSITRANSPORT = 0x12
NETLINK_SELINUX = 0x7
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NLA_ALIGNTO = 0x4
NLA_F_NESTED = 0x8000
NLA_F_NET_BYTEORDER = 0x4000
NLA_HDRLEN = 0x4
NLMSG_ALIGNTO = 0x4
NLMSG_DONE = 0x3
NLMSG_ERROR = 0x2
NLMSG_HDRLEN = 0x10
NLMSG_MIN_TYPE = 0x10
NLMSG_NOOP = 0x1
NLMSG_OVERRUN = 0x4
NLM_F_ACK = 0x4
NLM_F_APPEND = 0x800
NLM_F_ATOMIC = 0x400
NLM_F_CREATE = 0x400
NLM_F_DUMP = 0x300
NLM_F_ECHO = 0x8
NLM_F_EXCL = 0x200
NLM_F_MATCH = 0x200
NLM_F_MULTI = 0x2
NLM_F_REPLACE = 0x100
NLM_F_REQUEST = 0x1
NLM_F_ROOT = 0x100
O_ACCMODE = 0x3
O_APPEND = 0x400
O_ASYNC = 0x2000
@ -431,6 +573,27 @@ const (
O_SYNC = 0x1000
O_TRUNC = 0x200
O_WRONLY = 0x1
PACKET_ADD_MEMBERSHIP = 0x1
PACKET_BROADCAST = 0x1
PACKET_DROP_MEMBERSHIP = 0x2
PACKET_FASTROUTE = 0x6
PACKET_HOST = 0
PACKET_LOOPBACK = 0x5
PACKET_MR_ALLMULTI = 0x2
PACKET_MR_MULTICAST = 0
PACKET_MR_PROMISC = 0x1
PACKET_MULTICAST = 0x2
PACKET_OTHERHOST = 0x3
PACKET_OUTGOING = 0x4
PACKET_RECV_OUTPUT = 0x3
PACKET_RX_RING = 0x5
PACKET_STATISTICS = 0x6
PROT_EXEC = 0x4
PROT_GROWSDOWN = 0x1000000
PROT_GROWSUP = 0x2000000
PROT_NONE = 0
PROT_READ = 0x1
PROT_WRITE = 0x2
PTRACE_ATTACH = 0x10
PTRACE_CONT = 0x7
PTRACE_DETACH = 0x11
@ -475,6 +638,80 @@ const (
PTRACE_SINGLESTEP = 0x9
PTRACE_SYSCALL = 0x18
PTRACE_TRACEME = 0
RTAX_ADVMSS = 0x8
RTAX_CWND = 0x7
RTAX_FEATURES = 0xc
RTAX_FEATURE_ALLFRAG = 0x8
RTAX_FEATURE_ECN = 0x1
RTAX_FEATURE_SACK = 0x2
RTAX_FEATURE_TIMESTAMP = 0x4
RTAX_HOPLIMIT = 0xa
RTAX_INITCWND = 0xb
RTAX_LOCK = 0x1
RTAX_MAX = 0xd
RTAX_MTU = 0x2
RTAX_REORDERING = 0x9
RTAX_RTO_MIN = 0xd
RTAX_RTT = 0x4
RTAX_RTTVAR = 0x5
RTAX_SSTHRESH = 0x6
RTAX_UNSPEC = 0
RTAX_WINDOW = 0x3
RTA_ALIGNTO = 0x4
RTA_MAX = 0xf
RTM_BASE = 0x10
RTM_DELACTION = 0x31
RTM_DELADDR = 0x15
RTM_DELADDRLABEL = 0x49
RTM_DELLINK = 0x11
RTM_DELNEIGH = 0x1d
RTM_DELQDISC = 0x25
RTM_DELROUTE = 0x19
RTM_DELRULE = 0x21
RTM_DELTCLASS = 0x29
RTM_DELTFILTER = 0x2d
RTM_F_CLONED = 0x200
RTM_F_EQUALIZE = 0x400
RTM_F_NOTIFY = 0x100
RTM_F_PREFIX = 0x800
RTM_GETACTION = 0x32
RTM_GETADDR = 0x16
RTM_GETADDRLABEL = 0x4a
RTM_GETANYCAST = 0x3e
RTM_GETDCB = 0x4e
RTM_GETLINK = 0x12
RTM_GETMULTICAST = 0x3a
RTM_GETNEIGH = 0x1e
RTM_GETNEIGHTBL = 0x42
RTM_GETQDISC = 0x26
RTM_GETROUTE = 0x1a
RTM_GETRULE = 0x22
RTM_GETTCLASS = 0x2a
RTM_GETTFILTER = 0x2e
RTM_MAX = 0x4f
RTM_NEWACTION = 0x30
RTM_NEWADDR = 0x14
RTM_NEWADDRLABEL = 0x48
RTM_NEWLINK = 0x10
RTM_NEWNDUSEROPT = 0x44
RTM_NEWNEIGH = 0x1c
RTM_NEWNEIGHTBL = 0x40
RTM_NEWPREFIX = 0x34
RTM_NEWQDISC = 0x24
RTM_NEWROUTE = 0x18
RTM_NEWRULE = 0x20
RTM_NEWTCLASS = 0x28
RTM_NEWTFILTER = 0x2c
RTM_NR_FAMILIES = 0x10
RTM_NR_MSGTYPES = 0x40
RTM_SETDCB = 0x4f
RTM_SETLINK = 0x13
RTM_SETNEIGHTBL = 0x43
SCM_CREDENTIALS = 0x2
SCM_RIGHTS = 0x1
SCM_TIMESTAMP = 0x1d
SCM_TIMESTAMPING = 0x25
SCM_TIMESTAMPNS = 0x23
SHUT_RD = 0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -513,6 +750,64 @@ const (
SIGWINCH = 0x1c
SIGXCPU = 0x18
SIGXFSZ = 0x19
SIOCADDDLCI = 0x8980
SIOCADDMULTI = 0x8931
SIOCADDRT = 0x890b
SIOCATMARK = 0x8905
SIOCDARP = 0x8953
SIOCDELDLCI = 0x8981
SIOCDELMULTI = 0x8932
SIOCDELRT = 0x890c
SIOCDEVPRIVATE = 0x89f0
SIOCDIFADDR = 0x8936
SIOCDRARP = 0x8960
SIOCGARP = 0x8954
SIOCGIFADDR = 0x8915
SIOCGIFBR = 0x8940
SIOCGIFBRDADDR = 0x8919
SIOCGIFCONF = 0x8912
SIOCGIFCOUNT = 0x8938
SIOCGIFDSTADDR = 0x8917
SIOCGIFENCAP = 0x8925
SIOCGIFFLAGS = 0x8913
SIOCGIFHWADDR = 0x8927
SIOCGIFINDEX = 0x8933
SIOCGIFMAP = 0x8970
SIOCGIFMEM = 0x891f
SIOCGIFMETRIC = 0x891d
SIOCGIFMTU = 0x8921
SIOCGIFNAME = 0x8910
SIOCGIFNETMASK = 0x891b
SIOCGIFPFLAGS = 0x8935
SIOCGIFSLAVE = 0x8929
SIOCGIFTXQLEN = 0x8942
SIOCGPGRP = 0x8904
SIOCGRARP = 0x8961
SIOCGSTAMP = 0x8906
SIOCGSTAMPNS = 0x8907
SIOCPROTOPRIVATE = 0x89e0
SIOCRTMSG = 0x890d
SIOCSARP = 0x8955
SIOCSIFADDR = 0x8916
SIOCSIFBR = 0x8941
SIOCSIFBRDADDR = 0x891a
SIOCSIFDSTADDR = 0x8918
SIOCSIFENCAP = 0x8926
SIOCSIFFLAGS = 0x8914
SIOCSIFHWADDR = 0x8924
SIOCSIFHWBROADCAST = 0x8937
SIOCSIFLINK = 0x8911
SIOCSIFMAP = 0x8971
SIOCSIFMEM = 0x8920
SIOCSIFMETRIC = 0x891e
SIOCSIFMTU = 0x8922
SIOCSIFNAME = 0x8923
SIOCSIFNETMASK = 0x891c
SIOCSIFPFLAGS = 0x8934
SIOCSIFSLAVE = 0x8930
SIOCSIFTXQLEN = 0x8943
SIOCSPGRP = 0x8902
SIOCSRARP = 0x8962
SOCK_CLOEXEC = 0x80000
SOCK_DCCP = 0x6
SOCK_DGRAM = 0x2
@ -542,6 +837,7 @@ const (
SO_BSDCOMPAT = 0xe
SO_DEBUG = 0x1
SO_DETACH_FILTER = 0x1b
SO_DOMAIN = 0x27
SO_DONTROUTE = 0x5
SO_ERROR = 0x4
SO_KEEPALIVE = 0x9
@ -555,6 +851,7 @@ const (
SO_PEERNAME = 0x1c
SO_PEERSEC = 0x1f
SO_PRIORITY = 0xc
SO_PROTOCOL = 0x26
SO_RCVBUF = 0x8
SO_RCVBUFFORCE = 0x21
SO_RCVLOWAT = 0x12
@ -619,6 +916,19 @@ const (
TCP_QUICKACK = 0xc
TCP_SYNCNT = 0x7
TCP_WINDOW_CLAMP = 0xa
TUNGETFEATURES = 0x800454cf
TUNGETIFF = 0x800454d2
TUNGETSNDBUF = 0x800454d3
TUNSETDEBUG = 0x400454c9
TUNSETGROUP = 0x400454ce
TUNSETIFF = 0x400454ca
TUNSETLINK = 0x400454cd
TUNSETNOCSUM = 0x400454c8
TUNSETOFFLOAD = 0x400454d0
TUNSETOWNER = 0x400454cc
TUNSETPERSIST = 0x400454cb
TUNSETSNDBUF = 0x400454d4
TUNSETTXFILTER = 0x400454d1
WALL = 0x40000000
WCLONE = 0x80000000
WCONTINUED = 0x8
@ -636,134 +946,134 @@ const (
// Error table
var errors = [...]string{
7: "argument list too long",
13: "permission denied",
98: "address already in use",
99: "cannot assign requested address",
68: "advertise error",
97: "address family not supported by protocol",
11: "resource temporarily unavailable",
114: "operation already in progress",
52: "invalid exchange",
9: "bad file descriptor",
77: "file descriptor in bad state",
74: "bad message",
53: "invalid request descriptor",
56: "invalid request code",
57: "invalid slot",
59: "bad font file format",
16: "device or resource busy",
125: "operation canceled",
10: "no child processes",
44: "channel number out of range",
70: "communication error on send",
103: "software caused connection abort",
111: "connection refused",
104: "connection reset by peer",
35: "resource deadlock avoided",
89: "destination address required",
33: "numerical argument out of domain",
73: "RFS specific error",
122: "disk quota exceeded",
17: "file exists",
14: "bad address",
27: "file too large",
112: "host is down",
113: "no route to host",
43: "identifier removed",
84: "invalid or incomplete multibyte or wide character",
115: "operation now in progress",
1: "operation not permitted",
2: "no such file or directory",
3: "no such process",
4: "interrupted system call",
22: "invalid argument",
5: "input/output error",
106: "transport endpoint is already connected",
6: "no such device or address",
7: "argument list too long",
8: "exec format error",
9: "bad file descriptor",
10: "no child processes",
11: "resource temporarily unavailable",
12: "cannot allocate memory",
13: "permission denied",
14: "bad address",
15: "block device required",
16: "device or resource busy",
17: "file exists",
18: "invalid cross-device link",
19: "no such device",
20: "not a directory",
21: "is a directory",
120: "is a named type file",
127: "key has expired",
129: "key was rejected by service",
128: "key has been revoked",
51: "level 2 halted",
22: "invalid argument",
23: "too many open files in system",
24: "too many open files",
25: "inappropriate ioctl for device",
26: "text file busy",
27: "file too large",
28: "no space left on device",
29: "illegal seek",
30: "read-only file system",
31: "too many links",
32: "broken pipe",
33: "numerical argument out of domain",
34: "numerical result out of range",
35: "resource deadlock avoided",
36: "file name too long",
37: "no locks available",
38: "function not implemented",
39: "directory not empty",
40: "too many levels of symbolic links",
42: "no message of desired type",
43: "identifier removed",
44: "channel number out of range",
45: "level 2 not synchronized",
46: "level 3 halted",
47: "level 3 reset",
79: "can not access a needed shared library",
80: "accessing a corrupted shared library",
83: "cannot exec a shared library directly",
82: "attempting to link in too many shared libraries",
81: ".lib section in a.out corrupted",
48: "link number out of range",
40: "too many levels of symbolic links",
124: "wrong medium type",
24: "too many open files",
31: "too many links",
90: "message too long",
72: "multihop attempted",
36: "file name too long",
119: "no XENIX semaphores available",
100: "network is down",
102: "network dropped connection on reset",
101: "network is unreachable",
23: "too many open files in system",
55: "no anode",
105: "no buffer space available",
49: "protocol driver not attached",
50: "no CSI structure available",
51: "level 2 halted",
52: "invalid exchange",
53: "invalid request descriptor",
54: "exchange full",
55: "no anode",
56: "invalid request code",
57: "invalid slot",
59: "bad font file format",
60: "device not a stream",
61: "no data available",
19: "no such device",
2: "no such file or directory",
8: "exec format error",
126: "required key not available",
37: "no locks available",
67: "link has been severed",
123: "no medium found",
12: "cannot allocate memory",
42: "no message of desired type",
62: "timer expired",
63: "out of streams resources",
64: "machine is not on the network",
65: "package not installed",
92: "protocol not available",
28: "no space left on device",
63: "out of streams resources",
60: "device not a stream",
38: "function not implemented",
15: "block device required",
107: "transport endpoint is not connected",
20: "not a directory",
39: "directory not empty",
118: "not a XENIX named type file",
131: "state not recoverable",
88: "socket operation on non-socket",
95: "operation not supported",
25: "inappropriate ioctl for device",
76: "name not unique on network",
6: "no such device or address",
75: "value too large for defined data type",
130: "owner died",
1: "operation not permitted",
96: "protocol family not supported",
32: "broken pipe",
71: "protocol error",
93: "protocol not supported",
91: "protocol wrong type for socket",
34: "numerical result out of range",
78: "remote address changed",
66: "object is remote",
121: "remote I/O error",
85: "interrupted system call should be restarted",
132: "unknown error 132",
30: "read-only file system",
108: "cannot send after transport endpoint shutdown",
94: "socket type not supported",
29: "illegal seek",
3: "no such process",
67: "link has been severed",
68: "advertise error",
69: "srmount error",
116: "stale NFS file handle",
70: "communication error on send",
71: "protocol error",
72: "multihop attempted",
73: "RFS specific error",
74: "bad message",
75: "value too large for defined data type",
76: "name not unique on network",
77: "file descriptor in bad state",
78: "remote address changed",
79: "can not access a needed shared library",
80: "accessing a corrupted shared library",
81: ".lib section in a.out corrupted",
82: "attempting to link in too many shared libraries",
83: "cannot exec a shared library directly",
84: "invalid or incomplete multibyte or wide character",
85: "interrupted system call should be restarted",
86: "streams pipe error",
62: "timer expired",
110: "connection timed out",
109: "too many references: cannot splice",
26: "text file busy",
117: "structure needs cleaning",
49: "protocol driver not attached",
87: "too many users",
18: "invalid cross-device link",
54: "exchange full",
88: "socket operation on non-socket",
89: "destination address required",
90: "message too long",
91: "protocol wrong type for socket",
92: "protocol not available",
93: "protocol not supported",
94: "socket type not supported",
95: "operation not supported",
96: "protocol family not supported",
97: "address family not supported by protocol",
98: "address already in use",
99: "cannot assign requested address",
100: "network is down",
101: "network is unreachable",
102: "network dropped connection on reset",
103: "software caused connection abort",
104: "connection reset by peer",
105: "no buffer space available",
106: "transport endpoint is already connected",
107: "transport endpoint is not connected",
108: "cannot send after transport endpoint shutdown",
109: "too many references: cannot splice",
110: "connection timed out",
111: "connection refused",
112: "host is down",
113: "no route to host",
114: "operation already in progress",
115: "operation now in progress",
116: "stale NFS file handle",
117: "structure needs cleaning",
118: "not a XENIX named type file",
119: "no XENIX semaphores available",
120: "is a named type file",
121: "remote I/O error",
122: "disk quota exceeded",
123: "no medium found",
124: "wrong medium type",
125: "operation canceled",
126: "required key not available",
127: "key has expired",
128: "key has been revoked",
129: "key was rejected by service",
130: "owner died",
131: "state not recoverable",
132: "unknown error 132",
}

View File

@ -17,11 +17,50 @@ const (
SizeofSockaddrAny = 0x70
SizeofSockaddrUnix = 0x6e
SizeofSockaddrLinklayer = 0x14
SizeofSockaddrNetlink = 0xc
SizeofLinger = 0x8
SizeofIpMreq = 0x8
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
SizeofUcred = 0xc
IFA_UNSPEC = 0
IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2
IFA_LABEL = 0x3
IFA_BROADCAST = 0x4
IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7
IFLA_UNSPEC = 0
IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3
IFLA_MTU = 0x4
IFLA_LINK = 0x5
IFLA_QDISC = 0x6
IFLA_STATS = 0x7
IFLA_COST = 0x8
IFLA_PRIORITY = 0x9
IFLA_MASTER = 0xa
IFLA_WIRELESS = 0xb
IFLA_PROTINFO = 0xc
IFLA_TXQLEN = 0xd
IFLA_MAP = 0xe
IFLA_WEIGHT = 0xf
IFLA_OPERSTATE = 0x10
IFLA_LINKMODE = 0x11
IFLA_LINKINFO = 0x12
IFLA_NET_NS_PID = 0x13
IFLA_IFALIAS = 0x14
IFLA_MAX = 0x14
SizeofNlMsghdr = 0x10
SizeofNlMsgerr = 0x14
SizeofRtGenmsg = 0x1
SizeofNlAttr = 0x4
SizeofRtAttr = 0x4
SizeofIfInfomsg = 0x10
SizeofIfAddrmsg = 0x8
SizeofRtmsg = 0xc
SizeofInotifyEvent = 0x10
)
@ -193,6 +232,13 @@ type RawSockaddrLinklayer struct {
Addr [8]uint8
}
type RawSockaddrNetlink struct {
Family uint16
Pad uint16
Pid uint32
Groups uint32
}
type RawSockaddr struct {
Family uint16
Data [14]int8
@ -242,6 +288,62 @@ type Ucred struct {
Gid uint32
}
type NlMsghdr struct {
Len uint32
Type uint16
Flags uint16
Seq uint32
Pid uint32
}
type NlMsgerr struct {
Error int32
Msg NlMsghdr
}
type RtGenmsg struct {
Family uint8
}
type NlAttr struct {
Len uint16
Type uint16
}
type RtAttr struct {
Len uint16
Type uint16
}
type IfInfomsg struct {
Family uint8
X__ifi_pad uint8
Type uint16
Index int32
Flags uint32
Change uint32
}
type IfAddrmsg struct {
Family uint8
Prefixlen uint8
Flags uint8
Scope uint8
Index uint32
}
type RtMsg struct {
Family uint8
Dst_len uint8
Src_len uint8
Tos uint8
Table uint8
Protocol uint8
Scope uint8
Type uint8
Flags uint32
}
type InotifyEvent struct {
Wd int32
Mask uint32

View File

@ -17,11 +17,50 @@ const (
SizeofSockaddrAny = 0x70
SizeofSockaddrUnix = 0x6e
SizeofSockaddrLinklayer = 0x14
SizeofSockaddrNetlink = 0xc
SizeofLinger = 0x8
SizeofIpMreq = 0x8
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofUcred = 0xc
IFA_UNSPEC = 0
IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2
IFA_LABEL = 0x3
IFA_BROADCAST = 0x4
IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7
IFLA_UNSPEC = 0
IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3
IFLA_MTU = 0x4
IFLA_LINK = 0x5
IFLA_QDISC = 0x6
IFLA_STATS = 0x7
IFLA_COST = 0x8
IFLA_PRIORITY = 0x9
IFLA_MASTER = 0xa
IFLA_WIRELESS = 0xb
IFLA_PROTINFO = 0xc
IFLA_TXQLEN = 0xd
IFLA_MAP = 0xe
IFLA_WEIGHT = 0xf
IFLA_OPERSTATE = 0x10
IFLA_LINKMODE = 0x11
IFLA_LINKINFO = 0x12
IFLA_NET_NS_PID = 0x13
IFLA_IFALIAS = 0x14
IFLA_MAX = 0x14
SizeofNlMsghdr = 0x10
SizeofNlMsgerr = 0x14
SizeofRtGenmsg = 0x1
SizeofNlAttr = 0x4
SizeofRtAttr = 0x4
SizeofIfInfomsg = 0x10
SizeofIfAddrmsg = 0x8
SizeofRtmsg = 0xc
SizeofInotifyEvent = 0x10
)
@ -193,6 +232,13 @@ type RawSockaddrLinklayer struct {
Addr [8]uint8
}
type RawSockaddrNetlink struct {
Family uint16
Pad uint16
Pid uint32
Groups uint32
}
type RawSockaddr struct {
Family uint16
Data [14]int8
@ -244,6 +290,62 @@ type Ucred struct {
Gid uint32
}
type NlMsghdr struct {
Len uint32
Type uint16
Flags uint16
Seq uint32
Pid uint32
}
type NlMsgerr struct {
Error int32
Msg NlMsghdr
}
type RtGenmsg struct {
Family uint8
}
type NlAttr struct {
Len uint16
Type uint16
}
type RtAttr struct {
Len uint16
Type uint16
}
type IfInfomsg struct {
Family uint8
X__ifi_pad uint8
Type uint16
Index int32
Flags uint32
Change uint32
}
type IfAddrmsg struct {
Family uint8
Prefixlen uint8
Flags uint8
Scope uint8
Index uint32
}
type RtMsg struct {
Family uint8
Dst_len uint8
Src_len uint8
Tos uint8
Table uint8
Protocol uint8
Scope uint8
Type uint8
Flags uint32
}
type InotifyEvent struct {
Wd int32
Mask uint32

View File

@ -5,7 +5,7 @@
// Manual corrections: TODO(rsc): need to fix godefs
// remove duplicate PtraceRegs type
// change RawSockaddrUnix field to Path [108]int8 (was uint8)
// add padding to EpollEvent
// add padding to EpollEvent
package syscall
@ -22,11 +22,50 @@ const (
SizeofSockaddrAny = 0x70
SizeofSockaddrUnix = 0x6e
SizeofSockaddrLinklayer = 0x14
SizeofSockaddrNetlink = 0xc
SizeofLinger = 0x8
SizeofIpMreq = 0x8
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
SizeofUcred = 0xc
IFA_UNSPEC = 0
IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2
IFA_LABEL = 0x3
IFA_BROADCAST = 0x4
IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7
IFLA_UNSPEC = 0
IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3
IFLA_MTU = 0x4
IFLA_LINK = 0x5
IFLA_QDISC = 0x6
IFLA_STATS = 0x7
IFLA_COST = 0x8
IFLA_PRIORITY = 0x9
IFLA_MASTER = 0xa
IFLA_WIRELESS = 0xb
IFLA_PROTINFO = 0xc
IFLA_TXQLEN = 0xd
IFLA_MAP = 0xe
IFLA_WEIGHT = 0xf
IFLA_OPERSTATE = 0x10
IFLA_LINKMODE = 0x11
IFLA_LINKINFO = 0x12
IFLA_NET_NS_PID = 0x13
IFLA_IFALIAS = 0x14
IFLA_MAX = 0x14
SizeofNlMsghdr = 0x10
SizeofNlMsgerr = 0x14
SizeofRtGenmsg = 0x1
SizeofNlAttr = 0x4
SizeofRtAttr = 0x4
SizeofIfInfomsg = 0x10
SizeofIfAddrmsg = 0x8
SizeofRtmsg = 0xc
SizeofInotifyEvent = 0x10
)
@ -51,37 +90,37 @@ type Timeval struct {
}
type Timex struct {
Modes uint32
Offset int32
Freq int32
Maxerror int32
Esterror int32
Status int32
Constant int32
Precision int32
Tolerance int32
Time Timeval
Tick int32
Ppsfreq int32
Jitter int32
Shift int32
Stabil int32
Jitcnt int32
Calcnt int32
Errcnt int32
Stbcnt int32
Tai int32
Pad0 int32
Pad1 int32
Pad2 int32
Pad3 int32
Pad4 int32
Pad5 int32
Pad6 int32
Pad7 int32
Pad8 int32
Pad9 int32
Pad10 int32
Modes uint32
Offset int32
Freq int32
Maxerror int32
Esterror int32
Status int32
Constant int32
Precision int32
Tolerance int32
Time Timeval
Tick int32
Ppsfreq int32
Jitter int32
Shift int32
Stabil int32
Jitcnt int32
Calcnt int32
Errcnt int32
Stbcnt int32
Tai int32
Pad_godefs_0 int32
Pad_godefs_1 int32
Pad_godefs_2 int32
Pad_godefs_3 int32
Pad_godefs_4 int32
Pad_godefs_5 int32
Pad_godefs_6 int32
Pad_godefs_7 int32
Pad_godefs_8 int32
Pad_godefs_9 int32
Pad_godefs_10 int32
}
type Time_t int32
@ -125,49 +164,49 @@ type Rlimit struct {
type _Gid_t uint32
type Stat_t struct {
Dev uint64
X__pad1 uint16
Pad0 [2]byte
X__st_ino uint32
Mode uint32
Nlink uint32
Uid uint32
Gid uint32
Rdev uint64
X__pad2 uint16
Pad1 [6]byte
Size int64
Blksize int32
Pad2 [4]byte
Blocks int64
Atim Timespec
Mtim Timespec
Ctim Timespec
Ino uint64
Dev uint64
X__pad1 uint16
Pad_godefs_0 [2]byte
X__st_ino uint32
Mode uint32
Nlink uint32
Uid uint32
Gid uint32
Rdev uint64
X__pad2 uint16
Pad_godefs_1 [6]byte
Size int64
Blksize int32
Pad_godefs_2 [4]byte
Blocks int64
Atim Timespec
Mtim Timespec
Ctim Timespec
Ino uint64
}
type Statfs_t struct {
Type int32
Bsize int32
Blocks uint64
Bfree uint64
Bavail uint64
Files uint64
Ffree uint64
Fsid [8]byte /* __fsid_t */
Namelen int32
Frsize int32
Spare [5]int32
Pad0 [4]byte
Type int32
Bsize int32
Blocks uint64
Bfree uint64
Bavail uint64
Files uint64
Ffree uint64
Fsid [8]byte /* __fsid_t */
Namelen int32
Frsize int32
Spare [5]int32
Pad_godefs_0 [4]byte
}
type Dirent struct {
Ino uint64
Off int64
Reclen uint16
Type uint8
Name [256]uint8
Pad0 [5]byte
Ino uint64
Off int64
Reclen uint16
Type uint8
Name [256]uint8
Pad_godefs_0 [5]byte
}
type RawSockaddrInet4 struct {
@ -200,6 +239,13 @@ type RawSockaddrLinklayer struct {
Addr [8]uint8
}
type RawSockaddrNetlink struct {
Family uint16
Pad uint16
Pid uint32
Groups uint32
}
type RawSockaddr struct {
Family uint16
Data [14]uint8
@ -249,6 +295,62 @@ type Ucred struct {
Gid uint32
}
type NlMsghdr struct {
Len uint32
Type uint16
Flags uint16
Seq uint32
Pid uint32
}
type NlMsgerr struct {
Error int32
Msg NlMsghdr
}
type RtGenmsg struct {
Family uint8
}
type NlAttr struct {
Len uint16
Type uint16
}
type RtAttr struct {
Len uint16
Type uint16
}
type IfInfomsg struct {
Family uint8
X__ifi_pad uint8
Type uint16
Index int32
Flags uint32
Change uint32
}
type IfAddrmsg struct {
Family uint8
Prefixlen uint8
Flags uint8
Scope uint8
Index uint32
}
type RtMsg struct {
Family uint8
Dst_len uint8
Src_len uint8
Tos uint8
Table uint8
Protocol uint8
Scope uint8
Type uint8
Flags uint32
}
type InotifyEvent struct {
Wd int32
Mask uint32