Commit 61060acd authored by Francisco Souza's avatar Francisco Souza Committed by Russ Cox

syscall: add Termios support on darwin

Update #3316.

R=dave, kevlar, devon.odell, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6063053
parent 890be5ce
......@@ -174,7 +174,22 @@ ccflags="$@"
$2 !~ /^EQUIV_/ &&
$2 !~ /^EXPR_/ &&
$2 ~ /^E[A-Z0-9_]+$/ ||
$2 ~ /^B[0-9_]+$/ ||
$2 ~ /^V[A-Z0-9]+$/ ||
$2 ~ /^CS[A-Z0-9]/ ||
$2 ~ /^I(SIG|CANON|CRNL|EXTEN|MAXBEL|STRIP|UTF8)$/ ||
$2 ~ /^IGN/ ||
$2 ~ /^IX(ON|ANY|OFF)$/ ||
$2 ~ /^IN(LCR|PCK)$/ ||
$2 ~ /(^FLU?SH)|(FLU?SH$)/ ||
$2 ~ /^C(LOCAL|READ)$/ ||
$2 == "BRKINT" ||
$2 == "HUPCL" ||
$2 == "PENDIN" ||
$2 == "TOSTOP" ||
$2 ~ /^PAR/ ||
$2 ~ /^SIG[^_]/ ||
$2 ~ /^O[CNPFP][A-Z]+[^_][A-Z]+$/ ||
$2 ~ /^IN_/ ||
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
......
......@@ -20,6 +20,7 @@ package syscall
#include <dirent.h>
#include <fcntl.h>
#include <signal.h>
#include <termios.h>
#include <unistd.h>
#include <mach/mach.h>
#include <mach/message.h>
......@@ -226,3 +227,5 @@ type BpfProgram C.struct_bpf_program
type BpfInsn C.struct_bpf_insn
type BpfHdr C.struct_bpf_hdr
type Termios C.struct_termios
......@@ -43,6 +43,29 @@ const (
AF_SYSTEM = 0x20
AF_UNIX = 0x1
AF_UNSPEC = 0x0
B0 = 0x0
B110 = 0x6e
B115200 = 0x1c200
B1200 = 0x4b0
B134 = 0x86
B14400 = 0x3840
B150 = 0x96
B1800 = 0x708
B19200 = 0x4b00
B200 = 0xc8
B230400 = 0x38400
B2400 = 0x960
B28800 = 0x7080
B300 = 0x12c
B38400 = 0x9600
B4800 = 0x12c0
B50 = 0x32
B57600 = 0xe100
B600 = 0x258
B7200 = 0x1c20
B75 = 0x4b
B76800 = 0x12c00
B9600 = 0x2580
BIOCFLUSH = 0x20004268
BIOCGBLEN = 0x40044266
BIOCGDLT = 0x4004426a
......@@ -108,6 +131,20 @@ const (
BPF_TXA = 0x80
BPF_W = 0x0
BPF_X = 0x8
BRKINT = 0x2
CFLUSH = 0xf
CLOCAL = 0x8000
CREAD = 0x800
CS5 = 0x0
CS6 = 0x100
CS7 = 0x200
CS8 = 0x300
CSIZE = 0x300
CSTART = 0x11
CSTATUS = 0x14
CSTOP = 0x13
CSTOPB = 0x400
CSUSP = 0x1a
CTL_MAXNAME = 0xc
CTL_NET = 0x4
DLT_APPLE_IP_OVER_IEEE1394 = 0x8a
......@@ -186,6 +223,7 @@ const (
EXTPROC = 0x800
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FLUSHO = 0x800000
F_ADDFILESIGS = 0x3d
F_ADDSIGS = 0x3b
F_ALLOCATEALL = 0x4
......@@ -233,6 +271,10 @@ const (
F_VOLPOSMODE = 0x4
F_WRITEBOOTSTRAP = 0x2f
F_WRLCK = 0x3
HUPCL = 0x4000
ICANON = 0x100
ICRNL = 0x100
IEXTEN = 0x400
IFF_ALLMULTI = 0x200
IFF_ALTPHYS = 0x4000
IFF_BROADCAST = 0x2
......@@ -318,6 +360,12 @@ const (
IFT_X25DDN = 0x4
IFT_X25PLE = 0x28
IFT_XETHER = 0x1a
IGNBRK = 0x1
IGNCR = 0x80
IGNPAR = 0x4
IMAXBEL = 0x2000
INLCR = 0x40
INPCK = 0x10
IN_CLASSA_HOST = 0xffffff
IN_CLASSA_MAX = 0x80
IN_CLASSA_NET = 0xff000000
......@@ -560,6 +608,12 @@ const (
IP_TRAFFIC_MGT_BACKGROUND = 0x41
IP_TTL = 0x4
IP_UNBLOCK_SOURCE = 0x49
ISIG = 0x80
ISTRIP = 0x20
IUTF8 = 0x4000
IXANY = 0x800
IXOFF = 0x400
IXON = 0x200
LOCK_EX = 0x2
LOCK_NB = 0x4
LOCK_SH = 0x1
......@@ -619,6 +673,7 @@ const (
NET_RT_MAXID = 0xa
NET_RT_STAT = 0x4
NET_RT_TRASH = 0x5
NOFLSH = 0x80000000
NOTE_ABSOLUTE = 0x8
NOTE_ATTRIB = 0x8
NOTE_CHILD = 0x4
......@@ -655,6 +710,14 @@ const (
NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000
NOTE_VM_PRESSURE_TERMINATE = 0x40000000
NOTE_WRITE = 0x2
OCRNL = 0x10
OFDEL = 0x20000
OFILL = 0x80
ONLCR = 0x2
ONLRET = 0x40
ONOCR = 0x20
ONOEOT = 0x8
OPOST = 0x1
O_ACCMODE = 0x3
O_ALERT = 0x20000000
O_APPEND = 0x8
......@@ -679,6 +742,10 @@ const (
O_SYNC = 0x80
O_TRUNC = 0x400
O_WRONLY = 0x1
PARENB = 0x1000
PARMRK = 0x8
PARODD = 0x2000
PENDIN = 0x20000000
PROT_EXEC = 0x4
PROT_NONE = 0x0
PROT_READ = 0x1
......@@ -937,6 +1004,9 @@ const (
S_IXGRP = 0x8
S_IXOTH = 0x1
S_IXUSR = 0x40
TCIFLUSH = 0x1
TCIOFLUSH = 0x3
TCOFLUSH = 0x2
TCP_CONNECTIONTIMEOUT = 0x20
TCP_KEEPALIVE = 0x10
TCP_MAXHLEN = 0x3c
......@@ -953,6 +1023,7 @@ const (
TCP_NOPUSH = 0x4
TCP_RXT_CONNDROPTIME = 0x80
TCP_RXT_FINDROP = 0x100
TCSAFLUSH = 0x2
TIOCCBRK = 0x2000747a
TIOCCDTR = 0x20007478
TIOCCONS = 0x80047462
......@@ -1022,6 +1093,28 @@ const (
TIOCSWINSZ = 0x80087467
TIOCTIMESTAMP = 0x40087459
TIOCUCNTL = 0x80047466
TOSTOP = 0x400000
VDISCARD = 0xf
VDSUSP = 0xb
VEOF = 0x0
VEOL = 0x1
VEOL2 = 0x2
VERASE = 0x3
VINTR = 0x8
VKILL = 0x5
VLNEXT = 0xe
VMIN = 0x10
VQUIT = 0x9
VREPRINT = 0x6
VSTART = 0xc
VSTATUS = 0x12
VSTOP = 0xd
VSUSP = 0xa
VT0 = 0x0
VT1 = 0x10000
VTDLY = 0x10000
VTIME = 0x11
VWERASE = 0x4
WCONTINUED = 0x10
WCOREFLAG = 0x80
WEXITED = 0x4
......
......@@ -43,6 +43,29 @@ const (
AF_SYSTEM = 0x20
AF_UNIX = 0x1
AF_UNSPEC = 0x0
B0 = 0x0
B110 = 0x6e
B115200 = 0x1c200
B1200 = 0x4b0
B134 = 0x86
B14400 = 0x3840
B150 = 0x96
B1800 = 0x708
B19200 = 0x4b00
B200 = 0xc8
B230400 = 0x38400
B2400 = 0x960
B28800 = 0x7080
B300 = 0x12c
B38400 = 0x9600
B4800 = 0x12c0
B50 = 0x32
B57600 = 0xe100
B600 = 0x258
B7200 = 0x1c20
B75 = 0x4b
B76800 = 0x12c00
B9600 = 0x2580
BIOCFLUSH = 0x20004268
BIOCGBLEN = 0x40044266
BIOCGDLT = 0x4004426a
......@@ -108,6 +131,20 @@ const (
BPF_TXA = 0x80
BPF_W = 0x0
BPF_X = 0x8
BRKINT = 0x2
CFLUSH = 0xf
CLOCAL = 0x8000
CREAD = 0x800
CS5 = 0x0
CS6 = 0x100
CS7 = 0x200
CS8 = 0x300
CSIZE = 0x300
CSTART = 0x11
CSTATUS = 0x14
CSTOP = 0x13
CSTOPB = 0x400
CSUSP = 0x1a
CTL_MAXNAME = 0xc
CTL_NET = 0x4
DLT_APPLE_IP_OVER_IEEE1394 = 0x8a
......@@ -186,6 +223,7 @@ const (
EXTPROC = 0x800
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FLUSHO = 0x800000
F_ADDFILESIGS = 0x3d
F_ADDSIGS = 0x3b
F_ALLOCATEALL = 0x4
......@@ -233,6 +271,10 @@ const (
F_VOLPOSMODE = 0x4
F_WRITEBOOTSTRAP = 0x2f
F_WRLCK = 0x3
HUPCL = 0x4000
ICANON = 0x100
ICRNL = 0x100
IEXTEN = 0x400
IFF_ALLMULTI = 0x200
IFF_ALTPHYS = 0x4000
IFF_BROADCAST = 0x2
......@@ -318,6 +360,12 @@ const (
IFT_X25DDN = 0x4
IFT_X25PLE = 0x28
IFT_XETHER = 0x1a
IGNBRK = 0x1
IGNCR = 0x80
IGNPAR = 0x4
IMAXBEL = 0x2000
INLCR = 0x40
INPCK = 0x10
IN_CLASSA_HOST = 0xffffff
IN_CLASSA_MAX = 0x80
IN_CLASSA_NET = 0xff000000
......@@ -560,6 +608,12 @@ const (
IP_TRAFFIC_MGT_BACKGROUND = 0x41
IP_TTL = 0x4
IP_UNBLOCK_SOURCE = 0x49
ISIG = 0x80
ISTRIP = 0x20
IUTF8 = 0x4000
IXANY = 0x800
IXOFF = 0x400
IXON = 0x200
LOCK_EX = 0x2
LOCK_NB = 0x4
LOCK_SH = 0x1
......@@ -619,6 +673,7 @@ const (
NET_RT_MAXID = 0xa
NET_RT_STAT = 0x4
NET_RT_TRASH = 0x5
NOFLSH = 0x80000000
NOTE_ABSOLUTE = 0x8
NOTE_ATTRIB = 0x8
NOTE_CHILD = 0x4
......@@ -655,6 +710,14 @@ const (
NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000
NOTE_VM_PRESSURE_TERMINATE = 0x40000000
NOTE_WRITE = 0x2
OCRNL = 0x10
OFDEL = 0x20000
OFILL = 0x80
ONLCR = 0x2
ONLRET = 0x40
ONOCR = 0x20
ONOEOT = 0x8
OPOST = 0x1
O_ACCMODE = 0x3
O_ALERT = 0x20000000
O_APPEND = 0x8
......@@ -679,6 +742,10 @@ const (
O_SYNC = 0x80
O_TRUNC = 0x400
O_WRONLY = 0x1
PARENB = 0x1000
PARMRK = 0x8
PARODD = 0x2000
PENDIN = 0x20000000
PROT_EXEC = 0x4
PROT_NONE = 0x0
PROT_READ = 0x1
......@@ -937,6 +1004,9 @@ const (
S_IXGRP = 0x8
S_IXOTH = 0x1
S_IXUSR = 0x40
TCIFLUSH = 0x1
TCIOFLUSH = 0x3
TCOFLUSH = 0x2
TCP_CONNECTIONTIMEOUT = 0x20
TCP_KEEPALIVE = 0x10
TCP_MAXHLEN = 0x3c
......@@ -953,6 +1023,7 @@ const (
TCP_NOPUSH = 0x4
TCP_RXT_CONNDROPTIME = 0x80
TCP_RXT_FINDROP = 0x100
TCSAFLUSH = 0x2
TIOCCBRK = 0x2000747a
TIOCCDTR = 0x20007478
TIOCCONS = 0x80047462
......@@ -1022,6 +1093,28 @@ const (
TIOCSWINSZ = 0x80087467
TIOCTIMESTAMP = 0x40107459
TIOCUCNTL = 0x80047466
TOSTOP = 0x400000
VDISCARD = 0xf
VDSUSP = 0xb
VEOF = 0x0
VEOL = 0x1
VEOL2 = 0x2
VERASE = 0x3
VINTR = 0x8
VKILL = 0x5
VLNEXT = 0xe
VMIN = 0x10
VQUIT = 0x9
VREPRINT = 0x6
VSTART = 0xc
VSTATUS = 0x12
VSTOP = 0xd
VSUSP = 0xa
VT0 = 0x0
VT1 = 0x10000
VTDLY = 0x10000
VTIME = 0x11
VWERASE = 0x4
WCONTINUED = 0x10
WCOREFLAG = 0x80
WEXITED = 0x4
......
......@@ -416,3 +416,13 @@ type BpfHdr struct {
Hdrlen uint16
Pad_cgo_0 [2]byte
}
type Termios struct {
Iflag uint32
Oflag uint32
Cflag uint32
Lflag uint32
Cc [20]uint8
Ispeed uint32
Ospeed uint32
}
......@@ -425,3 +425,14 @@ type BpfHdr struct {
Hdrlen uint16
Pad_cgo_0 [2]byte
}
type Termios struct {
Iflag uint64
Oflag uint64
Cflag uint64
Lflag uint64
Cc [20]uint8
Pad_cgo_0 [4]byte
Ispeed uint64
Ospeed uint64
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment