update vendor

This commit is contained in:
deepzz0
2017-11-24 22:58:59 +08:00
parent 168937f1b2
commit 1c3106cbb0
87 changed files with 1271 additions and 209 deletions
Generated
+8 -8
View File
@@ -1,5 +1,5 @@
hash: c733fa4abeda21b59b001578b37a168bd33038d337b61198cc5fd94be8bfdf77 hash: c733fa4abeda21b59b001578b37a168bd33038d337b61198cc5fd94be8bfdf77
updated: 2017-11-05T12:08:01.167405372+08:00 updated: 2017-11-24T22:55:44.759966+08:00
imports: imports:
- name: github.com/boj/redistore - name: github.com/boj/redistore
version: 4562487a4bee9a7c272b72bfaeda4917d0a47ab9 version: 4562487a4bee9a7c272b72bfaeda4917d0a47ab9
@@ -8,21 +8,21 @@ imports:
- name: github.com/eiblog/blackfriday - name: github.com/eiblog/blackfriday
version: c0ec111761ae784fe31cc076f2fa0e2d2216d623 version: c0ec111761ae784fe31cc076f2fa0e2d2216d623
- name: github.com/eiblog/utils - name: github.com/eiblog/utils
version: ddfd888542f9a093000f71c3709009c1440a0789 version: d4873fe859435121012ce87b6b8407bd09f89ce0
subpackages: subpackages:
- logd - logd
- mgo - mgo
- tmpl - tmpl
- uuid - uuid
- name: github.com/garyburd/redigo - name: github.com/garyburd/redigo
version: 47dc60e71eed504e3ef8e77ee3c6fe720f3be57f version: 4a7d9db4333c65288dd5fc8c8de7d1f229bb09ec
subpackages: subpackages:
- internal - internal
- redis - redis
- name: github.com/gin-gonic/autotls - name: github.com/gin-gonic/autotls
version: 8ca25fbde72bb72a00466215b94b489c71fcb815 version: 8ca25fbde72bb72a00466215b94b489c71fcb815
- name: github.com/gin-gonic/contrib - name: github.com/gin-gonic/contrib
version: 5aa1e38d1d932e45fa5032bd1b8739e1a548e596 version: 8f08bc9b92a9734916abda03656c5f1b99ad10be
subpackages: subpackages:
- sessions - sessions
- name: github.com/gin-gonic/gin - name: github.com/gin-gonic/gin
@@ -43,7 +43,7 @@ imports:
- name: github.com/manucorporat/sse - name: github.com/manucorporat/sse
version: ee05b128a739a0fb76c7ebd3ae4810c1de808d6d version: ee05b128a739a0fb76c7ebd3ae4810c1de808d6d
- name: github.com/mattn/go-isatty - name: github.com/mattn/go-isatty
version: a5cdd64afdee435007ee3e9f6ed4684af949d568 version: 6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c
- name: github.com/qiniu/api.v7 - name: github.com/qiniu/api.v7
version: b7c7d6a2ce0aff8e5e7d14c39c3cde867efa1123 version: b7c7d6a2ce0aff8e5e7d14c39c3cde867efa1123
subpackages: subpackages:
@@ -61,7 +61,7 @@ imports:
- name: github.com/shurcooL/sanitized_anchor_name - name: github.com/shurcooL/sanitized_anchor_name
version: 86672fcb3f950f35f2e675df2240550f2a50762f version: 86672fcb3f950f35f2e675df2240550f2a50762f
- name: golang.org/x/crypto - name: golang.org/x/crypto
version: bd6f299fb381e4c3393d1c4b1f0b94f5e77650c8 version: b080dc9a8c480b08e698fb1219160d598526310f
subpackages: subpackages:
- acme - acme
- acme/autocert - acme/autocert
@@ -70,7 +70,7 @@ imports:
subpackages: subpackages:
- context - context
- name: golang.org/x/sys - name: golang.org/x/sys
version: 8eb05f94d449fdf134ec24630ce69ada5b469c1c version: a13efeb2fd213cf4be7227992aa54519af3b2ac0
subpackages: subpackages:
- unix - unix
- name: gopkg.in/go-playground/validator.v8 - name: gopkg.in/go-playground/validator.v8
@@ -83,7 +83,7 @@ imports:
- internal/sasl - internal/sasl
- internal/scram - internal/scram
- name: gopkg.in/yaml.v2 - name: gopkg.in/yaml.v2
version: eb3733d160e74a9c7e442f435eb3bea458e1d19f version: 287cf08546ab5e7e37d55a84f7ed3fd1db036de5
- name: qiniupkg.com/x - name: qiniupkg.com/x
version: 946c4a16076d6d98aeb78619e2bd4012357f7228 version: 946c4a16076d6d98aeb78619e2bd4012357f7228
subpackages: subpackages:
+22 -6
View File
@@ -72,6 +72,7 @@ type DialOption struct {
type dialOptions struct { type dialOptions struct {
readTimeout time.Duration readTimeout time.Duration
writeTimeout time.Duration writeTimeout time.Duration
dialer *net.Dialer
dial func(network, addr string) (net.Conn, error) dial func(network, addr string) (net.Conn, error)
db int db int
password string password string
@@ -94,17 +95,27 @@ func DialWriteTimeout(d time.Duration) DialOption {
}} }}
} }
// DialConnectTimeout specifies the timeout for connecting to the Redis server. // DialConnectTimeout specifies the timeout for connecting to the Redis server when
// no DialNetDial option is specified.
func DialConnectTimeout(d time.Duration) DialOption { func DialConnectTimeout(d time.Duration) DialOption {
return DialOption{func(do *dialOptions) { return DialOption{func(do *dialOptions) {
dialer := net.Dialer{Timeout: d} do.dialer.Timeout = d
do.dial = dialer.Dial }}
}
// DialKeepAlive specifies the keep-alive period for TCP connections to the Redis server
// when no DialNetDial option is specified.
// If zero, keep-alives are not enabled. If no DialKeepAlive option is specified then
// the default of 5 minutes is used to ensure that half-closed TCP sessions are detected.
func DialKeepAlive(d time.Duration) DialOption {
return DialOption{func(do *dialOptions) {
do.dialer.KeepAlive = d
}} }}
} }
// DialNetDial specifies a custom dial function for creating TCP // DialNetDial specifies a custom dial function for creating TCP
// connections. If this option is left out, then net.Dial is // connections, otherwise a net.Dialer customized via the other options is used.
// used. DialNetDial overrides DialConnectTimeout. // DialNetDial overrides DialConnectTimeout and DialKeepAlive.
func DialNetDial(dial func(network, addr string) (net.Conn, error)) DialOption { func DialNetDial(dial func(network, addr string) (net.Conn, error)) DialOption {
return DialOption{func(do *dialOptions) { return DialOption{func(do *dialOptions) {
do.dial = dial do.dial = dial
@@ -154,11 +165,16 @@ func DialUseTLS(useTLS bool) DialOption {
// address using the specified options. // address using the specified options.
func Dial(network, address string, options ...DialOption) (Conn, error) { func Dial(network, address string, options ...DialOption) (Conn, error) {
do := dialOptions{ do := dialOptions{
dial: net.Dial, dialer: &net.Dialer{
KeepAlive: time.Minute * 5,
},
} }
for _, option := range options { for _, option := range options {
option.f(&do) option.f(&do)
} }
if do.dial == nil {
do.dial = do.dialer.Dial
}
netConn, err := do.dial(network, address) netConn, err := do.dial(network, address)
if err != nil { if err != nil {
+3 -1
View File
@@ -38,6 +38,7 @@ var (
ErrNegativeInt = errNegativeInt ErrNegativeInt = errNegativeInt
serverPath = flag.String("redis-server", "redis-server", "Path to redis server binary") serverPath = flag.String("redis-server", "redis-server", "Path to redis server binary")
serverAddress = flag.String("redis-address", "127.0.0.1", "The address of the server")
serverBasePort = flag.Int("redis-port", 16379, "Beginning of port range for test servers") serverBasePort = flag.Int("redis-port", 16379, "Beginning of port range for test servers")
serverLogName = flag.String("redis-log", "", "Write Redis server logs to `filename`") serverLogName = flag.String("redis-log", "", "Write Redis server logs to `filename`")
serverLog = ioutil.Discard serverLog = ioutil.Discard
@@ -136,6 +137,7 @@ func startDefaultServer() error {
defaultServer, defaultServerErr = NewServer( defaultServer, defaultServerErr = NewServer(
"default", "default",
"--port", strconv.Itoa(*serverBasePort), "--port", strconv.Itoa(*serverBasePort),
"--bind", *serverAddress,
"--save", "", "--save", "",
"--appendonly", "no") "--appendonly", "no")
return defaultServerErr return defaultServerErr
@@ -147,7 +149,7 @@ func DialDefaultServer() (Conn, error) {
if err := startDefaultServer(); err != nil { if err := startDefaultServer(); err != nil {
return nil, err return nil, err
} }
c, err := Dial("tcp", fmt.Sprintf(":%d", *serverBasePort), DialReadTimeout(1*time.Second), DialWriteTimeout(1*time.Second)) c, err := Dial("tcp", fmt.Sprintf("%v:%d", *serverAddress, *serverBasePort), DialReadTimeout(1*time.Second), DialWriteTimeout(1*time.Second))
if err != nil { if err != nil {
return nil, err return nil, err
} }
+1
View File
@@ -34,3 +34,4 @@ Each author is responsible of maintaining his own code, although if you submit a
+ [gin-oauth2](https://github.com/zalando/gin-oauth2) - for working with OAuth2 + [gin-oauth2](https://github.com/zalando/gin-oauth2) - for working with OAuth2
+ [static](https://github.com/hyperboloide/static) An alternative static assets handler for the gin framework. + [static](https://github.com/hyperboloide/static) An alternative static assets handler for the gin framework.
+ [xss-mw](https://github.com/dvwright/xss-mw) - XssMw is a middleware designed to "auto remove XSS" from user submitted input + [xss-mw](https://github.com/dvwright/xss-mw) - XssMw is a middleware designed to "auto remove XSS" from user submitted input
+ [gin-helmet](https://github.com/danielkov/gin-helmet) - Collection of simple security middleware.
+4
View File
@@ -2,6 +2,10 @@ language: go
go: go:
- tip - tip
os:
- linux
- osx
before_install: before_install:
- go get github.com/mattn/goveralls - go get github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/cover - go get golang.org/x/tools/cmd/cover
+1 -1
View File
@@ -3,7 +3,7 @@
package isatty package isatty
// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
// terminal. This is also always false on this environment. // terminal. This is also always false on this environment.
func IsCygwinTerminal(fd uintptr) bool { func IsCygwinTerminal(fd uintptr) bool {
return false return false
+1 -1
View File
@@ -185,7 +185,7 @@ func testHashes2X(t *testing.T) {
if n, err := h.Read(result[:]); err != nil { if n, err := h.Read(result[:]); err != nil {
t.Fatalf("#unknown length: error from Read: %v", err) t.Fatalf("#unknown length: error from Read: %v", err)
} else if n != len(result) { } else if n != len(result) {
t.Fatalf("#unknown length: Read returned %d bytes, want %d: %v", n, len(result)) t.Fatalf("#unknown length: Read returned %d bytes, want %d", n, len(result))
} }
const expected = "2a9a6977d915a2c4dd07dbcafe1918bf1682e56d9c8e567ecd19bfd7cd93528833c764d12b34a5e2a219c9fd463dab45e972c5574d73f45de5b2e23af72530d8" const expected = "2a9a6977d915a2c4dd07dbcafe1918bf1682e56d9c8e567ecd19bfd7cd93528833c764d12b34a5e2a219c9fd463dab45e972c5574d73f45de5b2e23af72530d8"
+5 -5
View File
@@ -43,11 +43,11 @@ func TestOCSPDecode(t *testing.T) {
} }
if !reflect.DeepEqual(resp.ThisUpdate, expected.ThisUpdate) { if !reflect.DeepEqual(resp.ThisUpdate, expected.ThisUpdate) {
t.Errorf("resp.ThisUpdate: got %d, want %d", resp.ThisUpdate, expected.ThisUpdate) t.Errorf("resp.ThisUpdate: got %v, want %v", resp.ThisUpdate, expected.ThisUpdate)
} }
if !reflect.DeepEqual(resp.NextUpdate, expected.NextUpdate) { if !reflect.DeepEqual(resp.NextUpdate, expected.NextUpdate) {
t.Errorf("resp.NextUpdate: got %d, want %d", resp.NextUpdate, expected.NextUpdate) t.Errorf("resp.NextUpdate: got %v, want %v", resp.NextUpdate, expected.NextUpdate)
} }
if resp.Status != expected.Status { if resp.Status != expected.Status {
@@ -268,15 +268,15 @@ func TestOCSPResponse(t *testing.T) {
} }
if !reflect.DeepEqual(resp.ThisUpdate, template.ThisUpdate) { if !reflect.DeepEqual(resp.ThisUpdate, template.ThisUpdate) {
t.Errorf("resp.ThisUpdate: got %d, want %d", resp.ThisUpdate, template.ThisUpdate) t.Errorf("resp.ThisUpdate: got %v, want %v", resp.ThisUpdate, template.ThisUpdate)
} }
if !reflect.DeepEqual(resp.NextUpdate, template.NextUpdate) { if !reflect.DeepEqual(resp.NextUpdate, template.NextUpdate) {
t.Errorf("resp.NextUpdate: got %d, want %d", resp.NextUpdate, template.NextUpdate) t.Errorf("resp.NextUpdate: got %v, want %v", resp.NextUpdate, template.NextUpdate)
} }
if !reflect.DeepEqual(resp.RevokedAt, template.RevokedAt) { if !reflect.DeepEqual(resp.RevokedAt, template.RevokedAt) {
t.Errorf("resp.RevokedAt: got %d, want %d", resp.RevokedAt, template.RevokedAt) t.Errorf("resp.RevokedAt: got %v, want %v", resp.RevokedAt, template.RevokedAt)
} }
if !reflect.DeepEqual(resp.Extensions, template.ExtraExtensions) { if !reflect.DeepEqual(resp.Extensions, template.ExtraExtensions) {
+1 -1
View File
@@ -304,7 +304,7 @@ type gcmCipher struct {
buf []byte buf []byte
} }
func newGCMCipher(iv, key, macKey []byte) (packetCipher, error) { func newGCMCipher(iv, key []byte) (packetCipher, error) {
c, err := aes.NewCipher(key) c, err := aes.NewCipher(key)
if err != nil { if err != nil {
return nil, err return nil, err
+21
View File
@@ -9,6 +9,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"net" "net"
"os"
"sync" "sync"
"time" "time"
) )
@@ -187,6 +188,10 @@ func Dial(network, addr string, config *ClientConfig) (*Client, error) {
// net.Conn underlying the the SSH connection. // net.Conn underlying the the SSH connection.
type HostKeyCallback func(hostname string, remote net.Addr, key PublicKey) error type HostKeyCallback func(hostname string, remote net.Addr, key PublicKey) error
// BannerCallback is the function type used for treat the banner sent by
// the server. A BannerCallback receives the message sent by the remote server.
type BannerCallback func(message string) error
// A ClientConfig structure is used to configure a Client. It must not be // A ClientConfig structure is used to configure a Client. It must not be
// modified after having been passed to an SSH function. // modified after having been passed to an SSH function.
type ClientConfig struct { type ClientConfig struct {
@@ -209,6 +214,12 @@ type ClientConfig struct {
// FixedHostKey can be used for simplistic host key checks. // FixedHostKey can be used for simplistic host key checks.
HostKeyCallback HostKeyCallback HostKeyCallback HostKeyCallback
// BannerCallback is called during the SSH dance to display a custom
// server's message. The client configuration can supply this callback to
// handle it as wished. The function BannerDisplayStderr can be used for
// simplistic display on Stderr.
BannerCallback BannerCallback
// ClientVersion contains the version identification string that will // ClientVersion contains the version identification string that will
// be used for the connection. If empty, a reasonable default is used. // be used for the connection. If empty, a reasonable default is used.
ClientVersion string ClientVersion string
@@ -255,3 +266,13 @@ func FixedHostKey(key PublicKey) HostKeyCallback {
hk := &fixedHostKey{key} hk := &fixedHostKey{key}
return hk.check return hk.check
} }
// BannerDisplayStderr returns a function that can be used for
// ClientConfig.BannerCallback to display banners on os.Stderr.
func BannerDisplayStderr() BannerCallback {
return func(banner string) error {
_, err := os.Stderr.WriteString(banner)
return err
}
}
+27 -3
View File
@@ -283,7 +283,9 @@ func confirmKeyAck(key PublicKey, c packetConn) (bool, error) {
} }
switch packet[0] { switch packet[0] {
case msgUserAuthBanner: case msgUserAuthBanner:
// TODO(gpaul): add callback to present the banner to the user if err := handleBannerResponse(c, packet); err != nil {
return false, err
}
case msgUserAuthPubKeyOk: case msgUserAuthPubKeyOk:
var msg userAuthPubKeyOkMsg var msg userAuthPubKeyOkMsg
if err := Unmarshal(packet, &msg); err != nil { if err := Unmarshal(packet, &msg); err != nil {
@@ -325,7 +327,9 @@ func handleAuthResponse(c packetConn) (bool, []string, error) {
switch packet[0] { switch packet[0] {
case msgUserAuthBanner: case msgUserAuthBanner:
// TODO: add callback to present the banner to the user if err := handleBannerResponse(c, packet); err != nil {
return false, nil, err
}
case msgUserAuthFailure: case msgUserAuthFailure:
var msg userAuthFailureMsg var msg userAuthFailureMsg
if err := Unmarshal(packet, &msg); err != nil { if err := Unmarshal(packet, &msg); err != nil {
@@ -340,6 +344,24 @@ func handleAuthResponse(c packetConn) (bool, []string, error) {
} }
} }
func handleBannerResponse(c packetConn, packet []byte) error {
var msg userAuthBannerMsg
if err := Unmarshal(packet, &msg); err != nil {
return err
}
transport, ok := c.(*handshakeTransport)
if !ok {
return nil
}
if transport.bannerCallback != nil {
return transport.bannerCallback(msg.Message)
}
return nil
}
// KeyboardInteractiveChallenge should print questions, optionally // KeyboardInteractiveChallenge should print questions, optionally
// disabling echoing (e.g. for passwords), and return all the answers. // disabling echoing (e.g. for passwords), and return all the answers.
// Challenge may be called multiple times in a single session. After // Challenge may be called multiple times in a single session. After
@@ -385,7 +407,9 @@ func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packe
// like handleAuthResponse, but with less options. // like handleAuthResponse, but with less options.
switch packet[0] { switch packet[0] {
case msgUserAuthBanner: case msgUserAuthBanner:
// TODO: Print banners during userauth. if err := handleBannerResponse(c, packet); err != nil {
return false, nil, err
}
continue continue
case msgUserAuthInfoRequest: case msgUserAuthInfoRequest:
// OK // OK
+38
View File
@@ -79,3 +79,41 @@ func TestHostKeyCheck(t *testing.T) {
} }
} }
} }
func TestBannerCallback(t *testing.T) {
c1, c2, err := netPipe()
if err != nil {
t.Fatalf("netPipe: %v", err)
}
defer c1.Close()
defer c2.Close()
serverConf := &ServerConfig{
NoClientAuth: true,
BannerCallback: func(conn ConnMetadata) string {
return "Hello World"
},
}
serverConf.AddHostKey(testSigners["rsa"])
go NewServerConn(c1, serverConf)
var receivedBanner string
clientConf := ClientConfig{
User: "user",
HostKeyCallback: InsecureIgnoreHostKey(),
BannerCallback: func(message string) error {
receivedBanner = message
return nil
},
}
_, _, _, err = NewClientConn(c2, "", &clientConf)
if err != nil {
t.Fatal(err)
}
expected := "Hello World"
if receivedBanner != expected {
t.Fatalf("got %s; want %s", receivedBanner, expected)
}
}
+6
View File
@@ -78,6 +78,11 @@ type handshakeTransport struct {
dialAddress string dialAddress string
remoteAddr net.Addr remoteAddr net.Addr
// bannerCallback is non-empty if we are the client and it has been set in
// ClientConfig. In that case it is called during the user authentication
// dance to handle a custom server's message.
bannerCallback BannerCallback
// Algorithms agreed in the last key exchange. // Algorithms agreed in the last key exchange.
algorithms *algorithms algorithms *algorithms
@@ -120,6 +125,7 @@ func newClientTransport(conn keyingTransport, clientVersion, serverVersion []byt
t.dialAddress = dialAddr t.dialAddress = dialAddr
t.remoteAddr = addr t.remoteAddr = addr
t.hostKeyCallback = config.HostKeyCallback t.hostKeyCallback = config.HostKeyCallback
t.bannerCallback = config.BannerCallback
if config.HostKeyAlgorithms != nil { if config.HostKeyAlgorithms != nil {
t.hostKeyAlgorithms = config.HostKeyAlgorithms t.hostKeyAlgorithms = config.HostKeyAlgorithms
} else { } else {
+12 -4
View File
@@ -23,10 +23,6 @@ const (
msgUnimplemented = 3 msgUnimplemented = 3
msgDebug = 4 msgDebug = 4
msgNewKeys = 21 msgNewKeys = 21
// Standard authentication messages
msgUserAuthSuccess = 52
msgUserAuthBanner = 53
) )
// SSH messages: // SSH messages:
@@ -137,6 +133,18 @@ type userAuthFailureMsg struct {
PartialSuccess bool PartialSuccess bool
} }
// See RFC 4252, section 5.1
const msgUserAuthSuccess = 52
// See RFC 4252, section 5.4
const msgUserAuthBanner = 53
type userAuthBannerMsg struct {
Message string `sshtype:"53"`
// unused, but required to allow message parsing
Language string
}
// See RFC 4256, section 3.2 // See RFC 4256, section 3.2
const msgUserAuthInfoRequest = 60 const msgUserAuthInfoRequest = 60
const msgUserAuthInfoResponse = 61 const msgUserAuthInfoResponse = 61
+17
View File
@@ -95,6 +95,10 @@ type ServerConfig struct {
// Note that RFC 4253 section 4.2 requires that this string start with // Note that RFC 4253 section 4.2 requires that this string start with
// "SSH-2.0-". // "SSH-2.0-".
ServerVersion string ServerVersion string
// BannerCallback, if present, is called and the return string is sent to
// the client after key exchange completed but before authentication.
BannerCallback func(conn ConnMetadata) string
} }
// AddHostKey adds a private key as a host key. If an existing host // AddHostKey adds a private key as a host key. If an existing host
@@ -343,6 +347,19 @@ userAuthLoop:
} }
s.user = userAuthReq.User s.user = userAuthReq.User
if authFailures == 0 && config.BannerCallback != nil {
msg := config.BannerCallback(s)
if msg != "" {
bannerMsg := &userAuthBannerMsg{
Message: msg,
}
if err := s.transport.writePacket(Marshal(bannerMsg)); err != nil {
return nil, err
}
}
}
perms = nil perms = nil
authErr := errors.New("no auth passed yet") authErr := errors.New("no auth passed yet")
+31 -38
View File
@@ -17,44 +17,41 @@
package terminal // import "golang.org/x/crypto/ssh/terminal" package terminal // import "golang.org/x/crypto/ssh/terminal"
import ( import (
"syscall"
"unsafe"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )
// State contains the state of a terminal. // State contains the state of a terminal.
type State struct { type State struct {
termios syscall.Termios termios unix.Termios
} }
// IsTerminal returns true if the given file descriptor is a terminal. // IsTerminal returns true if the given file descriptor is a terminal.
func IsTerminal(fd int) bool { func IsTerminal(fd int) bool {
var termios syscall.Termios _, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) return err == nil
return err == 0
} }
// MakeRaw put the terminal connected to the given file descriptor into raw // MakeRaw put the terminal connected to the given file descriptor into raw
// mode and returns the previous state of the terminal so that it can be // mode and returns the previous state of the terminal so that it can be
// restored. // restored.
func MakeRaw(fd int) (*State, error) { func MakeRaw(fd int) (*State, error) {
var oldState State termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&oldState.termios)), 0, 0, 0); err != 0 { if err != nil {
return nil, err return nil, err
} }
newState := oldState.termios oldState := State{termios: *termios}
// This attempts to replicate the behaviour documented for cfmakeraw in // This attempts to replicate the behaviour documented for cfmakeraw in
// the termios(3) manpage. // the termios(3) manpage.
newState.Iflag &^= syscall.IGNBRK | syscall.BRKINT | syscall.PARMRK | syscall.ISTRIP | syscall.INLCR | syscall.IGNCR | syscall.ICRNL | syscall.IXON termios.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON
newState.Oflag &^= syscall.OPOST termios.Oflag &^= unix.OPOST
newState.Lflag &^= syscall.ECHO | syscall.ECHONL | syscall.ICANON | syscall.ISIG | syscall.IEXTEN termios.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN
newState.Cflag &^= syscall.CSIZE | syscall.PARENB termios.Cflag &^= unix.CSIZE | unix.PARENB
newState.Cflag |= syscall.CS8 termios.Cflag |= unix.CS8
newState.Cc[unix.VMIN] = 1 termios.Cc[unix.VMIN] = 1
newState.Cc[unix.VTIME] = 0 termios.Cc[unix.VTIME] = 0
if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&newState)), 0, 0, 0); err != 0 { if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, termios); err != nil {
return nil, err return nil, err
} }
@@ -64,59 +61,55 @@ func MakeRaw(fd int) (*State, error) {
// GetState returns the current state of a terminal which may be useful to // GetState returns the current state of a terminal which may be useful to
// restore the terminal after a signal. // restore the terminal after a signal.
func GetState(fd int) (*State, error) { func GetState(fd int) (*State, error) {
var oldState State termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&oldState.termios)), 0, 0, 0); err != 0 { if err != nil {
return nil, err return nil, err
} }
return &oldState, nil return &State{termios: *termios}, nil
} }
// Restore restores the terminal connected to the given file descriptor to a // Restore restores the terminal connected to the given file descriptor to a
// previous state. // previous state.
func Restore(fd int, state *State) error { func Restore(fd int, state *State) error {
if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&state.termios)), 0, 0, 0); err != 0 { return unix.IoctlSetTermios(fd, ioctlWriteTermios, &state.termios)
return err
}
return nil
} }
// GetSize returns the dimensions of the given terminal. // GetSize returns the dimensions of the given terminal.
func GetSize(fd int) (width, height int, err error) { func GetSize(fd int) (width, height int, err error) {
var dimensions [4]uint16 ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
if err != nil {
if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(&dimensions)), 0, 0, 0); err != 0 {
return -1, -1, err return -1, -1, err
} }
return int(dimensions[1]), int(dimensions[0]), nil return int(ws.Col), int(ws.Row), nil
} }
// passwordReader is an io.Reader that reads from a specific file descriptor. // passwordReader is an io.Reader that reads from a specific file descriptor.
type passwordReader int type passwordReader int
func (r passwordReader) Read(buf []byte) (int, error) { func (r passwordReader) Read(buf []byte) (int, error) {
return syscall.Read(int(r), buf) return unix.Read(int(r), buf)
} }
// ReadPassword reads a line of input from a terminal without local echo. This // ReadPassword reads a line of input from a terminal without local echo. This
// is commonly used for inputting passwords and other sensitive data. The slice // is commonly used for inputting passwords and other sensitive data. The slice
// returned does not include the \n. // returned does not include the \n.
func ReadPassword(fd int) ([]byte, error) { func ReadPassword(fd int) ([]byte, error) {
var oldState syscall.Termios termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&oldState)), 0, 0, 0); err != 0 { if err != nil {
return nil, err return nil, err
} }
newState := oldState newState := *termios
newState.Lflag &^= syscall.ECHO newState.Lflag &^= unix.ECHO
newState.Lflag |= syscall.ICANON | syscall.ISIG newState.Lflag |= unix.ICANON | unix.ISIG
newState.Iflag |= syscall.ICRNL newState.Iflag |= unix.ICRNL
if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&newState)), 0, 0, 0); err != 0 { if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, &newState); err != nil {
return nil, err return nil, err
} }
defer func() { defer func() {
syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&oldState)), 0, 0, 0) unix.IoctlSetTermios(fd, ioctlWriteTermios, termios)
}() }()
return readPasswordLine(passwordReader(fd)) return readPasswordLine(passwordReader(fd))
+3 -8
View File
@@ -17,6 +17,8 @@
package terminal package terminal
import ( import (
"os"
"golang.org/x/sys/windows" "golang.org/x/sys/windows"
) )
@@ -71,13 +73,6 @@ func GetSize(fd int) (width, height int, err error) {
return int(info.Size.X), int(info.Size.Y), nil return int(info.Size.X), int(info.Size.Y), nil
} }
// passwordReader is an io.Reader that reads from a specific Windows HANDLE.
type passwordReader int
func (r passwordReader) Read(buf []byte) (int, error) {
return windows.Read(windows.Handle(r), buf)
}
// ReadPassword reads a line of input from a terminal without local echo. This // ReadPassword reads a line of input from a terminal without local echo. This
// is commonly used for inputting passwords and other sensitive data. The slice // is commonly used for inputting passwords and other sensitive data. The slice
// returned does not include the \n. // returned does not include the \n.
@@ -98,5 +93,5 @@ func ReadPassword(fd int) ([]byte, error) {
windows.SetConsoleMode(windows.Handle(fd), old) windows.SetConsoleMode(windows.Handle(fd), old)
}() }()
return readPasswordLine(passwordReader(fd)) return readPasswordLine(os.NewFile(uintptr(fd), "stdin"))
} }
+33
View File
@@ -0,0 +1,33 @@
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd linux netbsd openbsd
package test
import (
"testing"
)
func TestBannerCallbackAgainstOpenSSH(t *testing.T) {
server := newServer(t)
defer server.Shutdown()
clientConf := clientConfig()
var receivedBanner string
clientConf.BannerCallback = func(message string) error {
receivedBanner = message
return nil
}
conn := server.Dial(clientConf)
defer conn.Close()
expected := "Server Banner"
if receivedBanner != expected {
t.Fatalf("got %v; want %v", receivedBanner, expected)
}
}
+3
View File
@@ -27,6 +27,7 @@ import (
const sshd_config = ` const sshd_config = `
Protocol 2 Protocol 2
Banner {{.Dir}}/banner
HostKey {{.Dir}}/id_rsa HostKey {{.Dir}}/id_rsa
HostKey {{.Dir}}/id_dsa HostKey {{.Dir}}/id_dsa
HostKey {{.Dir}}/id_ecdsa HostKey {{.Dir}}/id_ecdsa
@@ -256,6 +257,8 @@ func newServer(t *testing.T) *server {
} }
f.Close() f.Close()
writeFile(filepath.Join(dir, "banner"), []byte("Server Banner"))
for k, v := range testdata.PEMBytes { for k, v := range testdata.PEMBytes {
filename := "id_" + k filename := "id_" + k
writeFile(filepath.Join(dir, filename), v) writeFile(filepath.Join(dir, filename), v)
+1 -1
View File
@@ -254,7 +254,7 @@ func newPacketCipher(d direction, algs directionAlgorithms, kex *kexResult) (pac
iv, key, macKey := generateKeys(d, algs, kex) iv, key, macKey := generateKeys(d, algs, kex)
if algs.Cipher == gcmCipherID { if algs.Cipher == gcmCipherID {
return newGCMCipher(iv, key, macKey) return newGCMCipher(iv, key)
} }
if algs.Cipher == aes128cbcID { if algs.Cipher == aes128cbcID {
+2
View File
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build go1.7
package unix_test package unix_test
import ( import (
+2
View File
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build go1.7
package unix_test package unix_test
import ( import (
+2
View File
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build go1.7
package unix_test package unix_test
import ( import (
+2
View File
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build go1.7
package unix_test package unix_test
import ( import (
+2
View File
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build go1.7
package unix_test package unix_test
import ( import (
+2
View File
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build go1.7
package unix_test package unix_test
import ( import (
-27
View File
@@ -1,27 +0,0 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package unix
import (
"os"
"syscall"
)
// FIXME: unexported function from os
// syscallMode returns the syscall-specific mode bits from Go's portable mode bits.
func syscallMode(i os.FileMode) (o uint32) {
o |= uint32(i.Perm())
if i&os.ModeSetuid != 0 {
o |= syscall.S_ISUID
}
if i&os.ModeSetgid != 0 {
o |= syscall.S_ISGID
}
if i&os.ModeSticky != 0 {
o |= syscall.S_ISVTX
}
// No mapping for Go's ModeTemporary (plan9 only).
return
}
-6
View File
@@ -80,12 +80,6 @@ darwin_arm64)
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h" mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
mktypes="GOARCH=$GOARCH go tool cgo -godefs" mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;; ;;
dragonfly_386)
mkerrors="$mkerrors -m32"
mksyscall="./mksyscall.pl -l32 -dragonfly"
mksysnum="curl -s 'http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master' | ./mksysnum_dragonfly.pl"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
dragonfly_amd64) dragonfly_amd64)
mkerrors="$mkerrors -m64" mkerrors="$mkerrors -m64"
mksyscall="./mksyscall.pl -dragonfly" mksyscall="./mksyscall.pl -dragonfly"
+5 -1
View File
@@ -48,6 +48,7 @@ includes_Darwin='
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/mount.h> #include <sys/mount.h>
#include <sys/utsname.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <net/bpf.h> #include <net/bpf.h>
#include <net/if.h> #include <net/if.h>
@@ -386,7 +387,9 @@ ccflags="$@"
$2 == "SOMAXCONN" || $2 == "SOMAXCONN" ||
$2 == "NAME_MAX" || $2 == "NAME_MAX" ||
$2 == "IFNAMSIZ" || $2 == "IFNAMSIZ" ||
$2 ~ /^CTL_(MAXNAME|NET|QUERY)$/ || $2 ~ /^CTL_(HW|KERN|MAXNAME|NET|QUERY)$/ ||
$2 ~ /^KERN_(HOSTNAME|OS(RELEASE|TYPE)|VERSION)$/ ||
$2 ~ /^HW_MACHINE$/ ||
$2 ~ /^SYSCTL_VERS/ || $2 ~ /^SYSCTL_VERS/ ||
$2 ~ /^(MS|MNT|UMOUNT)_/ || $2 ~ /^(MS|MNT|UMOUNT)_/ ||
$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ || $2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
@@ -421,6 +424,7 @@ ccflags="$@"
$2 ~ /^SECCOMP_MODE_/ || $2 ~ /^SECCOMP_MODE_/ ||
$2 ~ /^SPLICE_/ || $2 ~ /^SPLICE_/ ||
$2 ~ /^(VM|VMADDR)_/ || $2 ~ /^(VM|VMADDR)_/ ||
$2 ~ /^IOCTL_VM_SOCKETS_/ ||
$2 ~ /^(TASKSTATS|TS)_/ || $2 ~ /^(TASKSTATS|TS)_/ ||
$2 ~ /^GENL_/ || $2 ~ /^GENL_/ ||
$2 ~ /^UTIME_/ || $2 ~ /^UTIME_/ ||
+8
View File
@@ -60,3 +60,11 @@ func TestSysctlRaw(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
} }
func TestSysctlUint32(t *testing.T) {
maxproc, err := unix.SysctlUint32("kern.maxproc")
if err != nil {
t.Fatal(err)
}
t.Logf("kern.maxproc: %v", maxproc)
}
+46
View File
@@ -270,6 +270,52 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
return &value, err return &value, err
} }
func Uname(uname *Utsname) error {
mib := []_C_int{CTL_KERN, KERN_OSTYPE}
n := unsafe.Sizeof(uname.Sysname)
if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil {
return err
}
mib = []_C_int{CTL_KERN, KERN_HOSTNAME}
n = unsafe.Sizeof(uname.Nodename)
if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil {
return err
}
mib = []_C_int{CTL_KERN, KERN_OSRELEASE}
n = unsafe.Sizeof(uname.Release)
if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil {
return err
}
mib = []_C_int{CTL_KERN, KERN_VERSION}
n = unsafe.Sizeof(uname.Version)
if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil {
return err
}
// The version might have newlines or tabs in it, convert them to
// spaces.
for i, b := range uname.Version {
if b == '\n' || b == '\t' {
if i == len(uname.Version)-1 {
uname.Version[i] = 0
} else {
uname.Version[i] = ' '
}
}
}
mib = []_C_int{CTL_HW, HW_MACHINE}
n = unsafe.Sizeof(uname.Machine)
if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil {
return err
}
return nil
}
/* /*
* Exposed directly * Exposed directly
*/ */
+4
View File
@@ -60,3 +60,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
} }
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
// of darwin/arm the syscall is called sysctl instead of __sysctl.
const SYS___SYSCTL = SYS_SYSCTL
+39 -1
View File
@@ -130,6 +130,45 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
return ENOSYS return ENOSYS
} }
//sys ioctl(fd int, req uint, arg uintptr) (err error)
// ioctl itself should not be exposed directly, but additional get/set
// functions for specific types are permissible.
// IoctlSetInt performs an ioctl operation which sets an integer value
// on fd, using the specified request number.
func IoctlSetInt(fd int, req uint, value int) error {
return ioctl(fd, req, uintptr(value))
}
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
}
func IoctlSetTermios(fd int, req uint, value *Termios) error {
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
}
// IoctlGetInt performs an ioctl operation which gets an integer value
// from fd, using the specified request number.
func IoctlGetInt(fd int, req uint) (int, error) {
var value int
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
return value, err
}
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
var value Winsize
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
return &value, err
}
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
var value Termios
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
return &value, err
}
/* /*
* Exposed directly * Exposed directly
*/ */
@@ -230,7 +269,6 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
// Getlogin // Getlogin
// Sigpending // Sigpending
// Sigaltstack // Sigaltstack
// Ioctl
// Reboot // Reboot
// Execve // Execve
// Vfork // Vfork
+4
View File
@@ -1125,6 +1125,10 @@ func PtracePokeData(pid int, addr uintptr, data []byte) (count int, err error) {
return ptracePoke(PTRACE_POKEDATA, PTRACE_PEEKDATA, pid, addr, data) return ptracePoke(PTRACE_POKEDATA, PTRACE_PEEKDATA, pid, addr, data)
} }
func PtracePokeUser(pid int, addr uintptr, data []byte) (count int, err error) {
return ptracePoke(PTRACE_POKEUSR, PTRACE_PEEKUSR, pid, addr, data)
}
func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) { func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
} }
+39 -2
View File
@@ -55,7 +55,6 @@ func sysctlNodes(mib []_C_int) (nodes []Sysctlnode, err error) {
} }
func nametomib(name string) (mib []_C_int, err error) { func nametomib(name string) (mib []_C_int, err error) {
// Split name into components. // Split name into components.
var parts []string var parts []string
last := 0 last := 0
@@ -129,6 +128,45 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
return ENOSYS return ENOSYS
} }
//sys ioctl(fd int, req uint, arg uintptr) (err error)
// ioctl itself should not be exposed directly, but additional get/set
// functions for specific types are permissible.
// IoctlSetInt performs an ioctl operation which sets an integer value
// on fd, using the specified request number.
func IoctlSetInt(fd int, req uint, value int) error {
return ioctl(fd, req, uintptr(value))
}
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
}
func IoctlSetTermios(fd int, req uint, value *Termios) error {
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
}
// IoctlGetInt performs an ioctl operation which gets an integer value
// from fd, using the specified request number.
func IoctlGetInt(fd int, req uint) (int, error) {
var value int
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
return value, err
}
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
var value Winsize
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
return &value, err
}
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
var value Termios
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
return &value, err
}
/* /*
* Exposed directly * Exposed directly
*/ */
@@ -389,7 +427,6 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
// getitimer // getitimer
// getvfsstat // getvfsstat
// getxattr // getxattr
// ioctl
// ktrace // ktrace
// lchflags // lchflags
// lchmod // lchmod
+45 -18
View File
@@ -13,6 +13,7 @@
package unix package unix
import ( import (
"sort"
"syscall" "syscall"
"unsafe" "unsafe"
) )
@@ -32,23 +33,11 @@ type SockaddrDatalink struct {
func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
func nametomib(name string) (mib []_C_int, err error) { func nametomib(name string) (mib []_C_int, err error) {
i := sort.Search(len(sysctlMib), func(i int) bool {
// Perform lookup via a binary search return sysctlMib[i].ctlname >= name
left := 0 })
right := len(sysctlMib) - 1 if i < len(sysctlMib) && sysctlMib[i].ctlname == name {
for { return sysctlMib[i].ctloid, nil
idx := left + (right-left)/2
switch {
case name == sysctlMib[idx].ctlname:
return sysctlMib[idx].ctloid, nil
case name > sysctlMib[idx].ctlname:
left = idx + 1
default:
right = idx - 1
}
if left > right {
break
}
} }
return nil, EINVAL return nil, EINVAL
} }
@@ -107,6 +96,45 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
return ENOSYS return ENOSYS
} }
//sys ioctl(fd int, req uint, arg uintptr) (err error)
// ioctl itself should not be exposed directly, but additional get/set
// functions for specific types are permissible.
// IoctlSetInt performs an ioctl operation which sets an integer value
// on fd, using the specified request number.
func IoctlSetInt(fd int, req uint, value int) error {
return ioctl(fd, req, uintptr(value))
}
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
}
func IoctlSetTermios(fd int, req uint, value *Termios) error {
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
}
// IoctlGetInt performs an ioctl operation which gets an integer value
// from fd, using the specified request number.
func IoctlGetInt(fd int, req uint) (int, error) {
var value int
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
return value, err
}
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
var value Winsize
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
return &value, err
}
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
var value Termios
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
return &value, err
}
/* /*
* Exposed directly * Exposed directly
*/ */
@@ -227,7 +255,6 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
// getresuid // getresuid
// getrtable // getrtable
// getthrid // getthrid
// ioctl
// ktrace // ktrace
// lfs_bmapv // lfs_bmapv
// lfs_markv // lfs_markv
+5
View File
@@ -39,6 +39,7 @@ package unix
#include <sys/types.h> #include <sys/types.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <sys/un.h> #include <sys/un.h>
#include <sys/utsname.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <net/bpf.h> #include <net/bpf.h>
#include <net/if.h> #include <net/if.h>
@@ -270,3 +271,7 @@ const (
POLLWRBAND = C.POLLWRBAND POLLWRBAND = C.POLLWRBAND
POLLWRNORM = C.POLLWRNORM POLLWRNORM = C.POLLWRNORM
) )
// uname
type Utsname C.struct_utsname
+2
View File
@@ -242,6 +242,8 @@ type BpfHdr C.struct_bpf_hdr
type Termios C.struct_termios type Termios C.struct_termios
type Winsize C.struct_winsize
// fchmodat-like syscalls. // fchmodat-like syscalls.
const ( const (
+2
View File
@@ -228,6 +228,8 @@ type BpfTimeval C.struct_bpf_timeval
type Termios C.struct_termios type Termios C.struct_termios
type Winsize C.struct_winsize
// fchmodat-like syscalls. // fchmodat-like syscalls.
const ( const (
+2
View File
@@ -244,6 +244,8 @@ type BpfTimeval C.struct_bpf_timeval
type Termios C.struct_termios type Termios C.struct_termios
type Winsize C.struct_winsize
// fchmodat-like syscalls. // fchmodat-like syscalls.
const ( const (
+11
View File
@@ -249,6 +249,8 @@ const (
CSTOP = 0x13 CSTOP = 0x13
CSTOPB = 0x400 CSTOPB = 0x400
CSUSP = 0x1a CSUSP = 0x1a
CTL_HW = 0x6
CTL_KERN = 0x1
CTL_MAXNAME = 0xc CTL_MAXNAME = 0xc
CTL_NET = 0x4 CTL_NET = 0x4
DLT_A429 = 0xb8 DLT_A429 = 0xb8
@@ -510,6 +512,7 @@ const (
F_PATHPKG_CHECK = 0x34 F_PATHPKG_CHECK = 0x34
F_PEOFPOSMODE = 0x3 F_PEOFPOSMODE = 0x3
F_PREALLOCATE = 0x2a F_PREALLOCATE = 0x2a
F_PUNCHHOLE = 0x63
F_RDADVISE = 0x2c F_RDADVISE = 0x2c
F_RDAHEAD = 0x2d F_RDAHEAD = 0x2d
F_RDLCK = 0x1 F_RDLCK = 0x1
@@ -526,10 +529,12 @@ const (
F_SINGLE_WRITER = 0x4c F_SINGLE_WRITER = 0x4c
F_THAW_FS = 0x36 F_THAW_FS = 0x36
F_TRANSCODEKEY = 0x4b F_TRANSCODEKEY = 0x4b
F_TRIM_ACTIVE_FILE = 0x64
F_UNLCK = 0x2 F_UNLCK = 0x2
F_VOLPOSMODE = 0x4 F_VOLPOSMODE = 0x4
F_WRLCK = 0x3 F_WRLCK = 0x3
HUPCL = 0x4000 HUPCL = 0x4000
HW_MACHINE = 0x1
ICANON = 0x100 ICANON = 0x100
ICMP6_FILTER = 0x12 ICMP6_FILTER = 0x12
ICRNL = 0x100 ICRNL = 0x100
@@ -766,6 +771,7 @@ const (
IPV6_FAITH = 0x1d IPV6_FAITH = 0x1d
IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00 IPV6_FLOWLABEL_MASK = 0xffff0f00
IPV6_FLOW_ECN_MASK = 0x300
IPV6_FRAGTTL = 0x3c IPV6_FRAGTTL = 0x3c
IPV6_FW_ADD = 0x1e IPV6_FW_ADD = 0x1e
IPV6_FW_DEL = 0x1f IPV6_FW_DEL = 0x1f
@@ -856,6 +862,7 @@ const (
IP_RECVOPTS = 0x5 IP_RECVOPTS = 0x5
IP_RECVPKTINFO = 0x1a IP_RECVPKTINFO = 0x1a
IP_RECVRETOPTS = 0x6 IP_RECVRETOPTS = 0x6
IP_RECVTOS = 0x1b
IP_RECVTTL = 0x18 IP_RECVTTL = 0x18
IP_RETOPTS = 0x8 IP_RETOPTS = 0x8
IP_RF = 0x8000 IP_RF = 0x8000
@@ -874,6 +881,10 @@ const (
IXANY = 0x800 IXANY = 0x800
IXOFF = 0x400 IXOFF = 0x400
IXON = 0x200 IXON = 0x200
KERN_HOSTNAME = 0xa
KERN_OSRELEASE = 0x2
KERN_OSTYPE = 0x1
KERN_VERSION = 0x4
LOCK_EX = 0x2 LOCK_EX = 0x2
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
+11
View File
@@ -249,6 +249,8 @@ const (
CSTOP = 0x13 CSTOP = 0x13
CSTOPB = 0x400 CSTOPB = 0x400
CSUSP = 0x1a CSUSP = 0x1a
CTL_HW = 0x6
CTL_KERN = 0x1
CTL_MAXNAME = 0xc CTL_MAXNAME = 0xc
CTL_NET = 0x4 CTL_NET = 0x4
DLT_A429 = 0xb8 DLT_A429 = 0xb8
@@ -510,6 +512,7 @@ const (
F_PATHPKG_CHECK = 0x34 F_PATHPKG_CHECK = 0x34
F_PEOFPOSMODE = 0x3 F_PEOFPOSMODE = 0x3
F_PREALLOCATE = 0x2a F_PREALLOCATE = 0x2a
F_PUNCHHOLE = 0x63
F_RDADVISE = 0x2c F_RDADVISE = 0x2c
F_RDAHEAD = 0x2d F_RDAHEAD = 0x2d
F_RDLCK = 0x1 F_RDLCK = 0x1
@@ -526,10 +529,12 @@ const (
F_SINGLE_WRITER = 0x4c F_SINGLE_WRITER = 0x4c
F_THAW_FS = 0x36 F_THAW_FS = 0x36
F_TRANSCODEKEY = 0x4b F_TRANSCODEKEY = 0x4b
F_TRIM_ACTIVE_FILE = 0x64
F_UNLCK = 0x2 F_UNLCK = 0x2
F_VOLPOSMODE = 0x4 F_VOLPOSMODE = 0x4
F_WRLCK = 0x3 F_WRLCK = 0x3
HUPCL = 0x4000 HUPCL = 0x4000
HW_MACHINE = 0x1
ICANON = 0x100 ICANON = 0x100
ICMP6_FILTER = 0x12 ICMP6_FILTER = 0x12
ICRNL = 0x100 ICRNL = 0x100
@@ -766,6 +771,7 @@ const (
IPV6_FAITH = 0x1d IPV6_FAITH = 0x1d
IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00 IPV6_FLOWLABEL_MASK = 0xffff0f00
IPV6_FLOW_ECN_MASK = 0x300
IPV6_FRAGTTL = 0x3c IPV6_FRAGTTL = 0x3c
IPV6_FW_ADD = 0x1e IPV6_FW_ADD = 0x1e
IPV6_FW_DEL = 0x1f IPV6_FW_DEL = 0x1f
@@ -856,6 +862,7 @@ const (
IP_RECVOPTS = 0x5 IP_RECVOPTS = 0x5
IP_RECVPKTINFO = 0x1a IP_RECVPKTINFO = 0x1a
IP_RECVRETOPTS = 0x6 IP_RECVRETOPTS = 0x6
IP_RECVTOS = 0x1b
IP_RECVTTL = 0x18 IP_RECVTTL = 0x18
IP_RETOPTS = 0x8 IP_RETOPTS = 0x8
IP_RF = 0x8000 IP_RF = 0x8000
@@ -874,6 +881,10 @@ const (
IXANY = 0x800 IXANY = 0x800
IXOFF = 0x400 IXOFF = 0x400
IXON = 0x200 IXON = 0x200
KERN_HOSTNAME = 0xa
KERN_OSRELEASE = 0x2
KERN_OSTYPE = 0x1
KERN_VERSION = 0x4
LOCK_EX = 0x2 LOCK_EX = 0x2
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
+11
View File
@@ -249,6 +249,8 @@ const (
CSTOP = 0x13 CSTOP = 0x13
CSTOPB = 0x400 CSTOPB = 0x400
CSUSP = 0x1a CSUSP = 0x1a
CTL_HW = 0x6
CTL_KERN = 0x1
CTL_MAXNAME = 0xc CTL_MAXNAME = 0xc
CTL_NET = 0x4 CTL_NET = 0x4
DLT_A429 = 0xb8 DLT_A429 = 0xb8
@@ -510,6 +512,7 @@ const (
F_PATHPKG_CHECK = 0x34 F_PATHPKG_CHECK = 0x34
F_PEOFPOSMODE = 0x3 F_PEOFPOSMODE = 0x3
F_PREALLOCATE = 0x2a F_PREALLOCATE = 0x2a
F_PUNCHHOLE = 0x63
F_RDADVISE = 0x2c F_RDADVISE = 0x2c
F_RDAHEAD = 0x2d F_RDAHEAD = 0x2d
F_RDLCK = 0x1 F_RDLCK = 0x1
@@ -526,10 +529,12 @@ const (
F_SINGLE_WRITER = 0x4c F_SINGLE_WRITER = 0x4c
F_THAW_FS = 0x36 F_THAW_FS = 0x36
F_TRANSCODEKEY = 0x4b F_TRANSCODEKEY = 0x4b
F_TRIM_ACTIVE_FILE = 0x64
F_UNLCK = 0x2 F_UNLCK = 0x2
F_VOLPOSMODE = 0x4 F_VOLPOSMODE = 0x4
F_WRLCK = 0x3 F_WRLCK = 0x3
HUPCL = 0x4000 HUPCL = 0x4000
HW_MACHINE = 0x1
ICANON = 0x100 ICANON = 0x100
ICMP6_FILTER = 0x12 ICMP6_FILTER = 0x12
ICRNL = 0x100 ICRNL = 0x100
@@ -766,6 +771,7 @@ const (
IPV6_FAITH = 0x1d IPV6_FAITH = 0x1d
IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00 IPV6_FLOWLABEL_MASK = 0xffff0f00
IPV6_FLOW_ECN_MASK = 0x300
IPV6_FRAGTTL = 0x3c IPV6_FRAGTTL = 0x3c
IPV6_FW_ADD = 0x1e IPV6_FW_ADD = 0x1e
IPV6_FW_DEL = 0x1f IPV6_FW_DEL = 0x1f
@@ -856,6 +862,7 @@ const (
IP_RECVOPTS = 0x5 IP_RECVOPTS = 0x5
IP_RECVPKTINFO = 0x1a IP_RECVPKTINFO = 0x1a
IP_RECVRETOPTS = 0x6 IP_RECVRETOPTS = 0x6
IP_RECVTOS = 0x1b
IP_RECVTTL = 0x18 IP_RECVTTL = 0x18
IP_RETOPTS = 0x8 IP_RETOPTS = 0x8
IP_RF = 0x8000 IP_RF = 0x8000
@@ -874,6 +881,10 @@ const (
IXANY = 0x800 IXANY = 0x800
IXOFF = 0x400 IXOFF = 0x400
IXON = 0x200 IXON = 0x200
KERN_HOSTNAME = 0xa
KERN_OSRELEASE = 0x2
KERN_OSTYPE = 0x1
KERN_VERSION = 0x4
LOCK_EX = 0x2 LOCK_EX = 0x2
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
+11
View File
@@ -249,6 +249,8 @@ const (
CSTOP = 0x13 CSTOP = 0x13
CSTOPB = 0x400 CSTOPB = 0x400
CSUSP = 0x1a CSUSP = 0x1a
CTL_HW = 0x6
CTL_KERN = 0x1
CTL_MAXNAME = 0xc CTL_MAXNAME = 0xc
CTL_NET = 0x4 CTL_NET = 0x4
DLT_A429 = 0xb8 DLT_A429 = 0xb8
@@ -510,6 +512,7 @@ const (
F_PATHPKG_CHECK = 0x34 F_PATHPKG_CHECK = 0x34
F_PEOFPOSMODE = 0x3 F_PEOFPOSMODE = 0x3
F_PREALLOCATE = 0x2a F_PREALLOCATE = 0x2a
F_PUNCHHOLE = 0x63
F_RDADVISE = 0x2c F_RDADVISE = 0x2c
F_RDAHEAD = 0x2d F_RDAHEAD = 0x2d
F_RDLCK = 0x1 F_RDLCK = 0x1
@@ -526,10 +529,12 @@ const (
F_SINGLE_WRITER = 0x4c F_SINGLE_WRITER = 0x4c
F_THAW_FS = 0x36 F_THAW_FS = 0x36
F_TRANSCODEKEY = 0x4b F_TRANSCODEKEY = 0x4b
F_TRIM_ACTIVE_FILE = 0x64
F_UNLCK = 0x2 F_UNLCK = 0x2
F_VOLPOSMODE = 0x4 F_VOLPOSMODE = 0x4
F_WRLCK = 0x3 F_WRLCK = 0x3
HUPCL = 0x4000 HUPCL = 0x4000
HW_MACHINE = 0x1
ICANON = 0x100 ICANON = 0x100
ICMP6_FILTER = 0x12 ICMP6_FILTER = 0x12
ICRNL = 0x100 ICRNL = 0x100
@@ -766,6 +771,7 @@ const (
IPV6_FAITH = 0x1d IPV6_FAITH = 0x1d
IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00 IPV6_FLOWLABEL_MASK = 0xffff0f00
IPV6_FLOW_ECN_MASK = 0x300
IPV6_FRAGTTL = 0x3c IPV6_FRAGTTL = 0x3c
IPV6_FW_ADD = 0x1e IPV6_FW_ADD = 0x1e
IPV6_FW_DEL = 0x1f IPV6_FW_DEL = 0x1f
@@ -856,6 +862,7 @@ const (
IP_RECVOPTS = 0x5 IP_RECVOPTS = 0x5
IP_RECVPKTINFO = 0x1a IP_RECVPKTINFO = 0x1a
IP_RECVRETOPTS = 0x6 IP_RECVRETOPTS = 0x6
IP_RECVTOS = 0x1b
IP_RECVTTL = 0x18 IP_RECVTTL = 0x18
IP_RETOPTS = 0x8 IP_RETOPTS = 0x8
IP_RF = 0x8000 IP_RF = 0x8000
@@ -874,6 +881,10 @@ const (
IXANY = 0x800 IXANY = 0x800
IXOFF = 0x400 IXOFF = 0x400
IXON = 0x200 IXON = 0x200
KERN_HOSTNAME = 0xa
KERN_OSRELEASE = 0x2
KERN_OSTYPE = 0x1
KERN_VERSION = 0x4
LOCK_EX = 0x2 LOCK_EX = 0x2
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
+1
View File
@@ -623,6 +623,7 @@ const (
IN_OPEN = 0x20 IN_OPEN = 0x20
IN_Q_OVERFLOW = 0x4000 IN_Q_OVERFLOW = 0x4000
IN_UNMOUNT = 0x2000 IN_UNMOUNT = 0x2000
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
IPPROTO_AH = 0x33 IPPROTO_AH = 0x33
IPPROTO_BEETPH = 0x5e IPPROTO_BEETPH = 0x5e
IPPROTO_COMP = 0x6c IPPROTO_COMP = 0x6c
+1
View File
@@ -623,6 +623,7 @@ const (
IN_OPEN = 0x20 IN_OPEN = 0x20
IN_Q_OVERFLOW = 0x4000 IN_Q_OVERFLOW = 0x4000
IN_UNMOUNT = 0x2000 IN_UNMOUNT = 0x2000
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
IPPROTO_AH = 0x33 IPPROTO_AH = 0x33
IPPROTO_BEETPH = 0x5e IPPROTO_BEETPH = 0x5e
IPPROTO_COMP = 0x6c IPPROTO_COMP = 0x6c
+1
View File
@@ -623,6 +623,7 @@ const (
IN_OPEN = 0x20 IN_OPEN = 0x20
IN_Q_OVERFLOW = 0x4000 IN_Q_OVERFLOW = 0x4000
IN_UNMOUNT = 0x2000 IN_UNMOUNT = 0x2000
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
IPPROTO_AH = 0x33 IPPROTO_AH = 0x33
IPPROTO_BEETPH = 0x5e IPPROTO_BEETPH = 0x5e
IPPROTO_COMP = 0x6c IPPROTO_COMP = 0x6c
+1
View File
@@ -625,6 +625,7 @@ const (
IN_OPEN = 0x20 IN_OPEN = 0x20
IN_Q_OVERFLOW = 0x4000 IN_Q_OVERFLOW = 0x4000
IN_UNMOUNT = 0x2000 IN_UNMOUNT = 0x2000
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
IPPROTO_AH = 0x33 IPPROTO_AH = 0x33
IPPROTO_BEETPH = 0x5e IPPROTO_BEETPH = 0x5e
IPPROTO_COMP = 0x6c IPPROTO_COMP = 0x6c
+1
View File
@@ -623,6 +623,7 @@ const (
IN_OPEN = 0x20 IN_OPEN = 0x20
IN_Q_OVERFLOW = 0x4000 IN_Q_OVERFLOW = 0x4000
IN_UNMOUNT = 0x2000 IN_UNMOUNT = 0x2000
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
IPPROTO_AH = 0x33 IPPROTO_AH = 0x33
IPPROTO_BEETPH = 0x5e IPPROTO_BEETPH = 0x5e
IPPROTO_COMP = 0x6c IPPROTO_COMP = 0x6c
+1
View File
@@ -623,6 +623,7 @@ const (
IN_OPEN = 0x20 IN_OPEN = 0x20
IN_Q_OVERFLOW = 0x4000 IN_Q_OVERFLOW = 0x4000
IN_UNMOUNT = 0x2000 IN_UNMOUNT = 0x2000
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
IPPROTO_AH = 0x33 IPPROTO_AH = 0x33
IPPROTO_BEETPH = 0x5e IPPROTO_BEETPH = 0x5e
IPPROTO_COMP = 0x6c IPPROTO_COMP = 0x6c
+1
View File
@@ -623,6 +623,7 @@ const (
IN_OPEN = 0x20 IN_OPEN = 0x20
IN_Q_OVERFLOW = 0x4000 IN_Q_OVERFLOW = 0x4000
IN_UNMOUNT = 0x2000 IN_UNMOUNT = 0x2000
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
IPPROTO_AH = 0x33 IPPROTO_AH = 0x33
IPPROTO_BEETPH = 0x5e IPPROTO_BEETPH = 0x5e
IPPROTO_COMP = 0x6c IPPROTO_COMP = 0x6c
+1
View File
@@ -623,6 +623,7 @@ const (
IN_OPEN = 0x20 IN_OPEN = 0x20
IN_Q_OVERFLOW = 0x4000 IN_Q_OVERFLOW = 0x4000
IN_UNMOUNT = 0x2000 IN_UNMOUNT = 0x2000
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
IPPROTO_AH = 0x33 IPPROTO_AH = 0x33
IPPROTO_BEETPH = 0x5e IPPROTO_BEETPH = 0x5e
IPPROTO_COMP = 0x6c IPPROTO_COMP = 0x6c
+1
View File
@@ -623,6 +623,7 @@ const (
IN_OPEN = 0x20 IN_OPEN = 0x20
IN_Q_OVERFLOW = 0x4000 IN_Q_OVERFLOW = 0x4000
IN_UNMOUNT = 0x2000 IN_UNMOUNT = 0x2000
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
IPPROTO_AH = 0x33 IPPROTO_AH = 0x33
IPPROTO_BEETPH = 0x5e IPPROTO_BEETPH = 0x5e
IPPROTO_COMP = 0x6c IPPROTO_COMP = 0x6c
+1
View File
@@ -623,6 +623,7 @@ const (
IN_OPEN = 0x20 IN_OPEN = 0x20
IN_Q_OVERFLOW = 0x4000 IN_Q_OVERFLOW = 0x4000
IN_UNMOUNT = 0x2000 IN_UNMOUNT = 0x2000
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
IPPROTO_AH = 0x33 IPPROTO_AH = 0x33
IPPROTO_BEETPH = 0x5e IPPROTO_BEETPH = 0x5e
IPPROTO_COMP = 0x6c IPPROTO_COMP = 0x6c
+1
View File
@@ -623,6 +623,7 @@ const (
IN_OPEN = 0x20 IN_OPEN = 0x20
IN_Q_OVERFLOW = 0x4000 IN_Q_OVERFLOW = 0x4000
IN_UNMOUNT = 0x2000 IN_UNMOUNT = 0x2000
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
IPPROTO_AH = 0x33 IPPROTO_AH = 0x33
IPPROTO_BEETPH = 0x5e IPPROTO_BEETPH = 0x5e
IPPROTO_COMP = 0x6c IPPROTO_COMP = 0x6c
+11 -11
View File
@@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Madvise(b []byte, behav int) (err error) { func Madvise(b []byte, behav int) (err error) {
var _p0 unsafe.Pointer var _p0 unsafe.Pointer
if len(b) > 0 { if len(b) > 0 {
@@ -408,17 +419,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Access(path string, mode uint32) (err error) { func Access(path string, mode uint32) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
+11 -11
View File
@@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Madvise(b []byte, behav int) (err error) { func Madvise(b []byte, behav int) (err error) {
var _p0 unsafe.Pointer var _p0 unsafe.Pointer
if len(b) > 0 { if len(b) > 0 {
@@ -408,17 +419,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Access(path string, mode uint32) (err error) { func Access(path string, mode uint32) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
+12 -12
View File
@@ -221,7 +221,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
} else { } else {
_p0 = unsafe.Pointer(&_zero) _p0 = unsafe.Pointer(&_zero)
} }
_, _, e1 := Syscall6(SYS_SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
} }
@@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Madvise(b []byte, behav int) (err error) { func Madvise(b []byte, behav int) (err error) {
var _p0 unsafe.Pointer var _p0 unsafe.Pointer
if len(b) > 0 { if len(b) > 0 {
@@ -408,17 +419,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Access(path string, mode uint32) (err error) { func Access(path string, mode uint32) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
+11 -11
View File
@@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Madvise(b []byte, behav int) (err error) { func Madvise(b []byte, behav int) (err error) {
var _p0 unsafe.Pointer var _p0 unsafe.Pointer
if len(b) > 0 { if len(b) > 0 {
@@ -408,17 +419,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Access(path string, mode uint32) (err error) { func Access(path string, mode uint32) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
+10
View File
@@ -423,6 +423,16 @@ func extpwrite(fd int, p []byte, flags int, offset int64) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ioctl(fd int, req uint, arg uintptr) (err error) {
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Access(path string, mode uint32) (err error) { func Access(path string, mode uint32) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
+10
View File
@@ -406,6 +406,16 @@ func getdents(fd int, buf []byte) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ioctl(fd int, req uint, arg uintptr) (err error) {
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Access(path string, mode uint32) (err error) { func Access(path string, mode uint32) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
+10
View File
@@ -406,6 +406,16 @@ func getdents(fd int, buf []byte) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ioctl(fd int, req uint, arg uintptr) (err error) {
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Access(path string, mode uint32) (err error) { func Access(path string, mode uint32) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
+10
View File
@@ -406,6 +406,16 @@ func getdents(fd int, buf []byte) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ioctl(fd int, req uint, arg uintptr) (err error) {
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Access(path string, mode uint32) (err error) { func Access(path string, mode uint32) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
+10
View File
@@ -404,6 +404,16 @@ func getdents(fd int, buf []byte) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ioctl(fd int, req uint, arg uintptr) (err error) {
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Access(path string, mode uint32) (err error) { func Access(path string, mode uint32) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
+10
View File
@@ -404,6 +404,16 @@ func getdents(fd int, buf []byte) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ioctl(fd int, req uint, arg uintptr) (err error) {
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Access(path string, mode uint32) (err error) { func Access(path string, mode uint32) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
+10
View File
@@ -404,6 +404,16 @@ func getdents(fd int, buf []byte) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ioctl(fd int, req uint, arg uintptr) (err error) {
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Access(path string, mode uint32) (err error) { func Access(path string, mode uint32) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
+49 -11
View File
@@ -1,5 +1,5 @@
// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/sys/syscall.h // mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/syscall.h
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT // Code generated by the command above; see README.md. DO NOT EDIT.
// +build 386,darwin // +build 386,darwin
@@ -121,13 +121,15 @@ const (
SYS_CSOPS = 169 SYS_CSOPS = 169
SYS_CSOPS_AUDITTOKEN = 170 SYS_CSOPS_AUDITTOKEN = 170
SYS_WAITID = 173 SYS_WAITID = 173
SYS_KDEBUG_TYPEFILTER = 177
SYS_KDEBUG_TRACE_STRING = 178
SYS_KDEBUG_TRACE64 = 179 SYS_KDEBUG_TRACE64 = 179
SYS_KDEBUG_TRACE = 180 SYS_KDEBUG_TRACE = 180
SYS_SETGID = 181 SYS_SETGID = 181
SYS_SETEGID = 182 SYS_SETEGID = 182
SYS_SETEUID = 183 SYS_SETEUID = 183
SYS_SIGRETURN = 184 SYS_SIGRETURN = 184
SYS_CHUD = 185 SYS_THREAD_SELFCOUNTS = 186
SYS_FDATASYNC = 187 SYS_FDATASYNC = 187
SYS_STAT = 188 SYS_STAT = 188
SYS_FSTAT = 189 SYS_FSTAT = 189
@@ -278,7 +280,6 @@ const (
SYS_KQUEUE = 362 SYS_KQUEUE = 362
SYS_KEVENT = 363 SYS_KEVENT = 363
SYS_LCHOWN = 364 SYS_LCHOWN = 364
SYS_STACK_SNAPSHOT = 365
SYS_BSDTHREAD_REGISTER = 366 SYS_BSDTHREAD_REGISTER = 366
SYS_WORKQ_OPEN = 367 SYS_WORKQ_OPEN = 367
SYS_WORKQ_KERNRETURN = 368 SYS_WORKQ_KERNRETURN = 368
@@ -287,6 +288,8 @@ const (
SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371
SYS_THREAD_SELFID = 372 SYS_THREAD_SELFID = 372
SYS_LEDGER = 373 SYS_LEDGER = 373
SYS_KEVENT_QOS = 374
SYS_KEVENT_ID = 375
SYS___MAC_EXECVE = 380 SYS___MAC_EXECVE = 380
SYS___MAC_SYSCALL = 381 SYS___MAC_SYSCALL = 381
SYS___MAC_GET_FILE = 382 SYS___MAC_GET_FILE = 382
@@ -298,11 +301,8 @@ const (
SYS___MAC_GET_FD = 388 SYS___MAC_GET_FD = 388
SYS___MAC_SET_FD = 389 SYS___MAC_SET_FD = 389
SYS___MAC_GET_PID = 390 SYS___MAC_GET_PID = 390
SYS___MAC_GET_LCID = 391 SYS_PSELECT = 394
SYS___MAC_GET_LCTX = 392 SYS_PSELECT_NOCANCEL = 395
SYS___MAC_SET_LCTX = 393
SYS_SETLCID = 394
SYS_GETLCID = 395
SYS_READ_NOCANCEL = 396 SYS_READ_NOCANCEL = 396
SYS_WRITE_NOCANCEL = 397 SYS_WRITE_NOCANCEL = 397
SYS_OPEN_NOCANCEL = 398 SYS_OPEN_NOCANCEL = 398
@@ -351,6 +351,7 @@ const (
SYS_GUARDED_CLOSE_NP = 442 SYS_GUARDED_CLOSE_NP = 442
SYS_GUARDED_KQUEUE_NP = 443 SYS_GUARDED_KQUEUE_NP = 443
SYS_CHANGE_FDGUARD_NP = 444 SYS_CHANGE_FDGUARD_NP = 444
SYS_USRCTL = 445
SYS_PROC_RLIMIT_CONTROL = 446 SYS_PROC_RLIMIT_CONTROL = 446
SYS_CONNECTX = 447 SYS_CONNECTX = 447
SYS_DISCONNECTX = 448 SYS_DISCONNECTX = 448
@@ -367,6 +368,7 @@ const (
SYS_COALITION_INFO = 459 SYS_COALITION_INFO = 459
SYS_NECP_MATCH_POLICY = 460 SYS_NECP_MATCH_POLICY = 460
SYS_GETATTRLISTBULK = 461 SYS_GETATTRLISTBULK = 461
SYS_CLONEFILEAT = 462
SYS_OPENAT = 463 SYS_OPENAT = 463
SYS_OPENAT_NOCANCEL = 464 SYS_OPENAT_NOCANCEL = 464
SYS_RENAMEAT = 465 SYS_RENAMEAT = 465
@@ -392,7 +394,43 @@ const (
SYS_GUARDED_WRITE_NP = 485 SYS_GUARDED_WRITE_NP = 485
SYS_GUARDED_PWRITE_NP = 486 SYS_GUARDED_PWRITE_NP = 486
SYS_GUARDED_WRITEV_NP = 487 SYS_GUARDED_WRITEV_NP = 487
SYS_RENAME_EXT = 488 SYS_RENAMEATX_NP = 488
SYS_MREMAP_ENCRYPTED = 489 SYS_MREMAP_ENCRYPTED = 489
SYS_MAXSYSCALL = 490 SYS_NETAGENT_TRIGGER = 490
SYS_STACK_SNAPSHOT_WITH_CONFIG = 491
SYS_MICROSTACKSHOT = 492
SYS_GRAB_PGO_DATA = 493
SYS_PERSONA = 494
SYS_WORK_INTERVAL_CTL = 499
SYS_GETENTROPY = 500
SYS_NECP_OPEN = 501
SYS_NECP_CLIENT_ACTION = 502
SYS___NEXUS_OPEN = 503
SYS___NEXUS_REGISTER = 504
SYS___NEXUS_DEREGISTER = 505
SYS___NEXUS_CREATE = 506
SYS___NEXUS_DESTROY = 507
SYS___NEXUS_GET_OPT = 508
SYS___NEXUS_SET_OPT = 509
SYS___CHANNEL_OPEN = 510
SYS___CHANNEL_GET_INFO = 511
SYS___CHANNEL_SYNC = 512
SYS___CHANNEL_GET_OPT = 513
SYS___CHANNEL_SET_OPT = 514
SYS_ULOCK_WAIT = 515
SYS_ULOCK_WAKE = 516
SYS_FCLONEFILEAT = 517
SYS_FS_SNAPSHOT = 518
SYS_TERMINATE_WITH_PAYLOAD = 520
SYS_ABORT_WITH_PAYLOAD = 521
SYS_NECP_SESSION_OPEN = 522
SYS_NECP_SESSION_ACTION = 523
SYS_SETATTRLISTAT = 524
SYS_NET_QOS_GUIDELINE = 525
SYS_FMOUNT = 526
SYS_NTP_ADJTIME = 527
SYS_NTP_GETTIME = 528
SYS_OS_FAULT_WITH_PAYLOAD = 529
SYS_MAXSYSCALL = 530
SYS_INVALID = 63
) )
+49 -11
View File
@@ -1,5 +1,5 @@
// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/sys/syscall.h // mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/syscall.h
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT // Code generated by the command above; see README.md. DO NOT EDIT.
// +build amd64,darwin // +build amd64,darwin
@@ -121,13 +121,15 @@ const (
SYS_CSOPS = 169 SYS_CSOPS = 169
SYS_CSOPS_AUDITTOKEN = 170 SYS_CSOPS_AUDITTOKEN = 170
SYS_WAITID = 173 SYS_WAITID = 173
SYS_KDEBUG_TYPEFILTER = 177
SYS_KDEBUG_TRACE_STRING = 178
SYS_KDEBUG_TRACE64 = 179 SYS_KDEBUG_TRACE64 = 179
SYS_KDEBUG_TRACE = 180 SYS_KDEBUG_TRACE = 180
SYS_SETGID = 181 SYS_SETGID = 181
SYS_SETEGID = 182 SYS_SETEGID = 182
SYS_SETEUID = 183 SYS_SETEUID = 183
SYS_SIGRETURN = 184 SYS_SIGRETURN = 184
SYS_CHUD = 185 SYS_THREAD_SELFCOUNTS = 186
SYS_FDATASYNC = 187 SYS_FDATASYNC = 187
SYS_STAT = 188 SYS_STAT = 188
SYS_FSTAT = 189 SYS_FSTAT = 189
@@ -278,7 +280,6 @@ const (
SYS_KQUEUE = 362 SYS_KQUEUE = 362
SYS_KEVENT = 363 SYS_KEVENT = 363
SYS_LCHOWN = 364 SYS_LCHOWN = 364
SYS_STACK_SNAPSHOT = 365
SYS_BSDTHREAD_REGISTER = 366 SYS_BSDTHREAD_REGISTER = 366
SYS_WORKQ_OPEN = 367 SYS_WORKQ_OPEN = 367
SYS_WORKQ_KERNRETURN = 368 SYS_WORKQ_KERNRETURN = 368
@@ -287,6 +288,8 @@ const (
SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371
SYS_THREAD_SELFID = 372 SYS_THREAD_SELFID = 372
SYS_LEDGER = 373 SYS_LEDGER = 373
SYS_KEVENT_QOS = 374
SYS_KEVENT_ID = 375
SYS___MAC_EXECVE = 380 SYS___MAC_EXECVE = 380
SYS___MAC_SYSCALL = 381 SYS___MAC_SYSCALL = 381
SYS___MAC_GET_FILE = 382 SYS___MAC_GET_FILE = 382
@@ -298,11 +301,8 @@ const (
SYS___MAC_GET_FD = 388 SYS___MAC_GET_FD = 388
SYS___MAC_SET_FD = 389 SYS___MAC_SET_FD = 389
SYS___MAC_GET_PID = 390 SYS___MAC_GET_PID = 390
SYS___MAC_GET_LCID = 391 SYS_PSELECT = 394
SYS___MAC_GET_LCTX = 392 SYS_PSELECT_NOCANCEL = 395
SYS___MAC_SET_LCTX = 393
SYS_SETLCID = 394
SYS_GETLCID = 395
SYS_READ_NOCANCEL = 396 SYS_READ_NOCANCEL = 396
SYS_WRITE_NOCANCEL = 397 SYS_WRITE_NOCANCEL = 397
SYS_OPEN_NOCANCEL = 398 SYS_OPEN_NOCANCEL = 398
@@ -351,6 +351,7 @@ const (
SYS_GUARDED_CLOSE_NP = 442 SYS_GUARDED_CLOSE_NP = 442
SYS_GUARDED_KQUEUE_NP = 443 SYS_GUARDED_KQUEUE_NP = 443
SYS_CHANGE_FDGUARD_NP = 444 SYS_CHANGE_FDGUARD_NP = 444
SYS_USRCTL = 445
SYS_PROC_RLIMIT_CONTROL = 446 SYS_PROC_RLIMIT_CONTROL = 446
SYS_CONNECTX = 447 SYS_CONNECTX = 447
SYS_DISCONNECTX = 448 SYS_DISCONNECTX = 448
@@ -367,6 +368,7 @@ const (
SYS_COALITION_INFO = 459 SYS_COALITION_INFO = 459
SYS_NECP_MATCH_POLICY = 460 SYS_NECP_MATCH_POLICY = 460
SYS_GETATTRLISTBULK = 461 SYS_GETATTRLISTBULK = 461
SYS_CLONEFILEAT = 462
SYS_OPENAT = 463 SYS_OPENAT = 463
SYS_OPENAT_NOCANCEL = 464 SYS_OPENAT_NOCANCEL = 464
SYS_RENAMEAT = 465 SYS_RENAMEAT = 465
@@ -392,7 +394,43 @@ const (
SYS_GUARDED_WRITE_NP = 485 SYS_GUARDED_WRITE_NP = 485
SYS_GUARDED_PWRITE_NP = 486 SYS_GUARDED_PWRITE_NP = 486
SYS_GUARDED_WRITEV_NP = 487 SYS_GUARDED_WRITEV_NP = 487
SYS_RENAME_EXT = 488 SYS_RENAMEATX_NP = 488
SYS_MREMAP_ENCRYPTED = 489 SYS_MREMAP_ENCRYPTED = 489
SYS_MAXSYSCALL = 490 SYS_NETAGENT_TRIGGER = 490
SYS_STACK_SNAPSHOT_WITH_CONFIG = 491
SYS_MICROSTACKSHOT = 492
SYS_GRAB_PGO_DATA = 493
SYS_PERSONA = 494
SYS_WORK_INTERVAL_CTL = 499
SYS_GETENTROPY = 500
SYS_NECP_OPEN = 501
SYS_NECP_CLIENT_ACTION = 502
SYS___NEXUS_OPEN = 503
SYS___NEXUS_REGISTER = 504
SYS___NEXUS_DEREGISTER = 505
SYS___NEXUS_CREATE = 506
SYS___NEXUS_DESTROY = 507
SYS___NEXUS_GET_OPT = 508
SYS___NEXUS_SET_OPT = 509
SYS___CHANNEL_OPEN = 510
SYS___CHANNEL_GET_INFO = 511
SYS___CHANNEL_SYNC = 512
SYS___CHANNEL_GET_OPT = 513
SYS___CHANNEL_SET_OPT = 514
SYS_ULOCK_WAIT = 515
SYS_ULOCK_WAKE = 516
SYS_FCLONEFILEAT = 517
SYS_FS_SNAPSHOT = 518
SYS_TERMINATE_WITH_PAYLOAD = 520
SYS_ABORT_WITH_PAYLOAD = 521
SYS_NECP_SESSION_OPEN = 522
SYS_NECP_SESSION_ACTION = 523
SYS_SETATTRLISTAT = 524
SYS_NET_QOS_GUIDELINE = 525
SYS_FMOUNT = 526
SYS_NTP_ADJTIME = 527
SYS_NTP_GETTIME = 528
SYS_OS_FAULT_WITH_PAYLOAD = 529
SYS_MAXSYSCALL = 530
SYS_INVALID = 63
) )
+12 -2
View File
@@ -1,4 +1,4 @@
// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/usr/include/sys/syscall.h // mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h
// Code generated by the command above; see README.md. DO NOT EDIT. // Code generated by the command above; see README.md. DO NOT EDIT.
// +build arm,darwin // +build arm,darwin
@@ -129,6 +129,7 @@ const (
SYS_SETEGID = 182 SYS_SETEGID = 182
SYS_SETEUID = 183 SYS_SETEUID = 183
SYS_SIGRETURN = 184 SYS_SIGRETURN = 184
SYS_THREAD_SELFCOUNTS = 186
SYS_FDATASYNC = 187 SYS_FDATASYNC = 187
SYS_STAT = 188 SYS_STAT = 188
SYS_FSTAT = 189 SYS_FSTAT = 189
@@ -288,6 +289,7 @@ const (
SYS_THREAD_SELFID = 372 SYS_THREAD_SELFID = 372
SYS_LEDGER = 373 SYS_LEDGER = 373
SYS_KEVENT_QOS = 374 SYS_KEVENT_QOS = 374
SYS_KEVENT_ID = 375
SYS___MAC_EXECVE = 380 SYS___MAC_EXECVE = 380
SYS___MAC_SYSCALL = 381 SYS___MAC_SYSCALL = 381
SYS___MAC_GET_FILE = 382 SYS___MAC_GET_FILE = 382
@@ -421,6 +423,14 @@ const (
SYS_FS_SNAPSHOT = 518 SYS_FS_SNAPSHOT = 518
SYS_TERMINATE_WITH_PAYLOAD = 520 SYS_TERMINATE_WITH_PAYLOAD = 520
SYS_ABORT_WITH_PAYLOAD = 521 SYS_ABORT_WITH_PAYLOAD = 521
SYS_MAXSYSCALL = 522 SYS_NECP_SESSION_OPEN = 522
SYS_NECP_SESSION_ACTION = 523
SYS_SETATTRLISTAT = 524
SYS_NET_QOS_GUIDELINE = 525
SYS_FMOUNT = 526
SYS_NTP_ADJTIME = 527
SYS_NTP_GETTIME = 528
SYS_OS_FAULT_WITH_PAYLOAD = 529
SYS_MAXSYSCALL = 530
SYS_INVALID = 63 SYS_INVALID = 63
) )
+12 -2
View File
@@ -1,4 +1,4 @@
// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/usr/include/sys/syscall.h // mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h
// Code generated by the command above; see README.md. DO NOT EDIT. // Code generated by the command above; see README.md. DO NOT EDIT.
// +build arm64,darwin // +build arm64,darwin
@@ -129,6 +129,7 @@ const (
SYS_SETEGID = 182 SYS_SETEGID = 182
SYS_SETEUID = 183 SYS_SETEUID = 183
SYS_SIGRETURN = 184 SYS_SIGRETURN = 184
SYS_THREAD_SELFCOUNTS = 186
SYS_FDATASYNC = 187 SYS_FDATASYNC = 187
SYS_STAT = 188 SYS_STAT = 188
SYS_FSTAT = 189 SYS_FSTAT = 189
@@ -288,6 +289,7 @@ const (
SYS_THREAD_SELFID = 372 SYS_THREAD_SELFID = 372
SYS_LEDGER = 373 SYS_LEDGER = 373
SYS_KEVENT_QOS = 374 SYS_KEVENT_QOS = 374
SYS_KEVENT_ID = 375
SYS___MAC_EXECVE = 380 SYS___MAC_EXECVE = 380
SYS___MAC_SYSCALL = 381 SYS___MAC_SYSCALL = 381
SYS___MAC_GET_FILE = 382 SYS___MAC_GET_FILE = 382
@@ -421,6 +423,14 @@ const (
SYS_FS_SNAPSHOT = 518 SYS_FS_SNAPSHOT = 518
SYS_TERMINATE_WITH_PAYLOAD = 520 SYS_TERMINATE_WITH_PAYLOAD = 520
SYS_ABORT_WITH_PAYLOAD = 521 SYS_ABORT_WITH_PAYLOAD = 521
SYS_MAXSYSCALL = 522 SYS_NECP_SESSION_OPEN = 522
SYS_NECP_SESSION_ACTION = 523
SYS_SETATTRLISTAT = 524
SYS_NET_QOS_GUIDELINE = 525
SYS_FMOUNT = 526
SYS_NTP_ADJTIME = 527
SYS_NTP_GETTIME = 528
SYS_OS_FAULT_WITH_PAYLOAD = 529
SYS_MAXSYSCALL = 530
SYS_INVALID = 63 SYS_INVALID = 63
) )
+8
View File
@@ -479,3 +479,11 @@ const (
POLLWRBAND = 0x100 POLLWRBAND = 0x100
POLLWRNORM = 0x4 POLLWRNORM = 0x4
) )
type Utsname struct {
Sysname [256]byte
Nodename [256]byte
Release [256]byte
Version [256]byte
Machine [256]byte
}
+8
View File
@@ -489,3 +489,11 @@ const (
POLLWRBAND = 0x100 POLLWRBAND = 0x100
POLLWRNORM = 0x4 POLLWRNORM = 0x4
) )
type Utsname struct {
Sysname [256]byte
Nodename [256]byte
Release [256]byte
Version [256]byte
Machine [256]byte
}
+8
View File
@@ -480,3 +480,11 @@ const (
POLLWRBAND = 0x100 POLLWRBAND = 0x100
POLLWRNORM = 0x4 POLLWRNORM = 0x4
) )
type Utsname struct {
Sysname [256]byte
Nodename [256]byte
Release [256]byte
Version [256]byte
Machine [256]byte
}
+8
View File
@@ -489,3 +489,11 @@ const (
POLLWRBAND = 0x100 POLLWRBAND = 0x100
POLLWRNORM = 0x4 POLLWRNORM = 0x4
) )
type Utsname struct {
Sysname [256]byte
Nodename [256]byte
Release [256]byte
Version [256]byte
Machine [256]byte
}
+7
View File
@@ -442,6 +442,13 @@ type Termios struct {
Ospeed uint32 Ospeed uint32
} }
type Winsize struct {
Row uint16
Col uint16
Xpixel uint16
Ypixel uint16
}
const ( const (
AT_FDCWD = 0xfffafdcd AT_FDCWD = 0xfffafdcd
AT_SYMLINK_NOFOLLOW = 0x1 AT_SYMLINK_NOFOLLOW = 0x1
+7
View File
@@ -382,6 +382,13 @@ type Termios struct {
Ospeed int32 Ospeed int32
} }
type Winsize struct {
Row uint16
Col uint16
Xpixel uint16
Ypixel uint16
}
const ( const (
AT_FDCWD = -0x64 AT_FDCWD = -0x64
AT_SYMLINK_NOFOLLOW = 0x200 AT_SYMLINK_NOFOLLOW = 0x200
+7
View File
@@ -389,6 +389,13 @@ type Termios struct {
Ospeed int32 Ospeed int32
} }
type Winsize struct {
Row uint16
Col uint16
Xpixel uint16
Ypixel uint16
}
const ( const (
AT_FDCWD = -0x64 AT_FDCWD = -0x64
AT_SYMLINK_NOFOLLOW = 0x200 AT_SYMLINK_NOFOLLOW = 0x200
+7
View File
@@ -387,6 +387,13 @@ type Termios struct {
Ospeed int32 Ospeed int32
} }
type Winsize struct {
Row uint16
Col uint16
Xpixel uint16
Ypixel uint16
}
const ( const (
AT_FDCWD = -0x64 AT_FDCWD = -0x64
AT_SYMLINK_NOFOLLOW = 0x200 AT_SYMLINK_NOFOLLOW = 0x200
+7
View File
@@ -440,6 +440,13 @@ type Termios struct {
Ospeed int32 Ospeed int32
} }
type Winsize struct {
Row uint16
Col uint16
Xpixel uint16
Ypixel uint16
}
const ( const (
AT_FDCWD = -0x64 AT_FDCWD = -0x64
AT_SYMLINK_NOFOLLOW = 0x2 AT_SYMLINK_NOFOLLOW = 0x2
+7
View File
@@ -447,6 +447,13 @@ type Termios struct {
Ospeed int32 Ospeed int32
} }
type Winsize struct {
Row uint16
Col uint16
Xpixel uint16
Ypixel uint16
}
const ( const (
AT_FDCWD = -0x64 AT_FDCWD = -0x64
AT_SYMLINK_NOFOLLOW = 0x2 AT_SYMLINK_NOFOLLOW = 0x2
+7
View File
@@ -433,6 +433,13 @@ type Termios struct {
Ospeed int32 Ospeed int32
} }
type Winsize struct {
Row uint16
Col uint16
Xpixel uint16
Ypixel uint16
}
const ( const (
AT_FDCWD = -0x64 AT_FDCWD = -0x64
AT_SYMLINK_NOFOLLOW = 0x2 AT_SYMLINK_NOFOLLOW = 0x2
+130 -1
View File
@@ -16,7 +16,46 @@ import (
type Handle uintptr type Handle uintptr
const InvalidHandle = ^Handle(0) const (
InvalidHandle = ^Handle(0)
// Flags for DefineDosDevice.
DDD_EXACT_MATCH_ON_REMOVE = 0x00000004
DDD_NO_BROADCAST_SYSTEM = 0x00000008
DDD_RAW_TARGET_PATH = 0x00000001
DDD_REMOVE_DEFINITION = 0x00000002
// Return values for GetDriveType.
DRIVE_UNKNOWN = 0
DRIVE_NO_ROOT_DIR = 1
DRIVE_REMOVABLE = 2
DRIVE_FIXED = 3
DRIVE_REMOTE = 4
DRIVE_CDROM = 5
DRIVE_RAMDISK = 6
// File system flags from GetVolumeInformation and GetVolumeInformationByHandle.
FILE_CASE_SENSITIVE_SEARCH = 0x00000001
FILE_CASE_PRESERVED_NAMES = 0x00000002
FILE_FILE_COMPRESSION = 0x00000010
FILE_DAX_VOLUME = 0x20000000
FILE_NAMED_STREAMS = 0x00040000
FILE_PERSISTENT_ACLS = 0x00000008
FILE_READ_ONLY_VOLUME = 0x00080000
FILE_SEQUENTIAL_WRITE_ONCE = 0x00100000
FILE_SUPPORTS_ENCRYPTION = 0x00020000
FILE_SUPPORTS_EXTENDED_ATTRIBUTES = 0x00800000
FILE_SUPPORTS_HARD_LINKS = 0x00400000
FILE_SUPPORTS_OBJECT_IDS = 0x00010000
FILE_SUPPORTS_OPEN_BY_FILE_ID = 0x01000000
FILE_SUPPORTS_REPARSE_POINTS = 0x00000080
FILE_SUPPORTS_SPARSE_FILES = 0x00000040
FILE_SUPPORTS_TRANSACTIONS = 0x00200000
FILE_SUPPORTS_USN_JOURNAL = 0x02000000
FILE_UNICODE_ON_DISK = 0x00000004
FILE_VOLUME_IS_COMPRESSED = 0x00008000
FILE_VOLUME_QUOTAS = 0x00000020
)
// StringToUTF16 is deprecated. Use UTF16FromString instead. // StringToUTF16 is deprecated. Use UTF16FromString instead.
// If s contains a NUL byte this function panics instead of // If s contains a NUL byte this function panics instead of
@@ -200,6 +239,27 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys ResetEvent(event Handle) (err error) = kernel32.ResetEvent //sys ResetEvent(event Handle) (err error) = kernel32.ResetEvent
//sys PulseEvent(event Handle) (err error) = kernel32.PulseEvent //sys PulseEvent(event Handle) (err error) = kernel32.PulseEvent
// Volume Management Functions
//sys DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW
//sys DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) = DeleteVolumeMountPointW
//sys FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) [failretval==InvalidHandle] = FindFirstVolumeW
//sys FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) [failretval==InvalidHandle] = FindFirstVolumeMountPointW
//sys FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) = FindNextVolumeW
//sys FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) = FindNextVolumeMountPointW
//sys FindVolumeClose(findVolume Handle) (err error)
//sys FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error)
//sys GetDriveType(rootPathName *uint16) (driveType uint32)
//sys GetLogicalDrives() (drivesBitMask uint32, err error) [failretval==0]
//sys GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) [failretval==0] = GetLogicalDriveStringsW
//sys GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) = GetVolumeInformationW
//sys GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) = GetVolumeInformationByHandleW
//sys GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) = GetVolumeNameForVolumeMountPointW
//sys GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) = GetVolumePathNameW
//sys GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) = GetVolumePathNamesForVolumeNameW
//sys QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) [failretval==0] = QueryDosDeviceW
//sys SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) = SetVolumeLabelW
//sys SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) = SetVolumeMountPointW
// syscall interface implementation for other packages // syscall interface implementation for other packages
// GetProcAddressByOrdinal retrieves the address of the exported // GetProcAddressByOrdinal retrieves the address of the exported
@@ -796,6 +856,75 @@ func ConnectEx(fd Handle, sa Sockaddr, sendBuf *byte, sendDataLen uint32, bytesS
return connectEx(fd, ptr, n, sendBuf, sendDataLen, bytesSent, overlapped) return connectEx(fd, ptr, n, sendBuf, sendDataLen, bytesSent, overlapped)
} }
var sendRecvMsgFunc struct {
once sync.Once
sendAddr uintptr
recvAddr uintptr
err error
}
func loadWSASendRecvMsg() error {
sendRecvMsgFunc.once.Do(func() {
var s Handle
s, sendRecvMsgFunc.err = Socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
if sendRecvMsgFunc.err != nil {
return
}
defer CloseHandle(s)
var n uint32
sendRecvMsgFunc.err = WSAIoctl(s,
SIO_GET_EXTENSION_FUNCTION_POINTER,
(*byte)(unsafe.Pointer(&WSAID_WSARECVMSG)),
uint32(unsafe.Sizeof(WSAID_WSARECVMSG)),
(*byte)(unsafe.Pointer(&sendRecvMsgFunc.recvAddr)),
uint32(unsafe.Sizeof(sendRecvMsgFunc.recvAddr)),
&n, nil, 0)
if sendRecvMsgFunc.err != nil {
return
}
sendRecvMsgFunc.err = WSAIoctl(s,
SIO_GET_EXTENSION_FUNCTION_POINTER,
(*byte)(unsafe.Pointer(&WSAID_WSASENDMSG)),
uint32(unsafe.Sizeof(WSAID_WSASENDMSG)),
(*byte)(unsafe.Pointer(&sendRecvMsgFunc.sendAddr)),
uint32(unsafe.Sizeof(sendRecvMsgFunc.sendAddr)),
&n, nil, 0)
})
return sendRecvMsgFunc.err
}
func WSASendMsg(fd Handle, msg *WSAMsg, flags uint32, bytesSent *uint32, overlapped *Overlapped, croutine *byte) error {
err := loadWSASendRecvMsg()
if err != nil {
return err
}
r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.sendAddr, 6, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(flags), uintptr(unsafe.Pointer(bytesSent)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)))
if r1 == socket_error {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return err
}
func WSARecvMsg(fd Handle, msg *WSAMsg, bytesReceived *uint32, overlapped *Overlapped, croutine *byte) error {
err := loadWSASendRecvMsg()
if err != nil {
return err
}
r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.recvAddr, 5, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(bytesReceived)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0)
if r1 == socket_error {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return err
}
// Invented structures to support what package os expects. // Invented structures to support what package os expects.
type Rusage struct { type Rusage struct {
CreationTime Filetime CreationTime Filetime
+54 -3
View File
@@ -29,6 +29,7 @@ const (
ERROR_NOT_FOUND syscall.Errno = 1168 ERROR_NOT_FOUND syscall.Errno = 1168
ERROR_PRIVILEGE_NOT_HELD syscall.Errno = 1314 ERROR_PRIVILEGE_NOT_HELD syscall.Errno = 1314
WSAEACCES syscall.Errno = 10013 WSAEACCES syscall.Errno = 10013
WSAEMSGSIZE syscall.Errno = 10040
WSAECONNRESET syscall.Errno = 10054 WSAECONNRESET syscall.Errno = 10054
) )
@@ -158,9 +159,6 @@ const (
WAIT_OBJECT_0 = 0x00000000 WAIT_OBJECT_0 = 0x00000000
WAIT_FAILED = 0xFFFFFFFF WAIT_FAILED = 0xFFFFFFFF
CREATE_NEW_PROCESS_GROUP = 0x00000200
CREATE_UNICODE_ENVIRONMENT = 0x00000400
PROCESS_TERMINATE = 1 PROCESS_TERMINATE = 1
PROCESS_QUERY_INFORMATION = 0x00000400 PROCESS_QUERY_INFORMATION = 0x00000400
SYNCHRONIZE = 0x00100000 SYNCHRONIZE = 0x00100000
@@ -177,6 +175,26 @@ const (
APPLICATION_ERROR = 1 << 29 APPLICATION_ERROR = 1 << 29
) )
const (
// Process creation flags.
CREATE_BREAKAWAY_FROM_JOB = 0x01000000
CREATE_DEFAULT_ERROR_MODE = 0x04000000
CREATE_NEW_CONSOLE = 0x00000010
CREATE_NEW_PROCESS_GROUP = 0x00000200
CREATE_NO_WINDOW = 0x08000000
CREATE_PROTECTED_PROCESS = 0x00040000
CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000
CREATE_SEPARATE_WOW_VDM = 0x00000800
CREATE_SHARED_WOW_VDM = 0x00001000
CREATE_SUSPENDED = 0x00000004
CREATE_UNICODE_ENVIRONMENT = 0x00000400
DEBUG_ONLY_THIS_PROCESS = 0x00000002
DEBUG_PROCESS = 0x00000001
DETACHED_PROCESS = 0x00000008
EXTENDED_STARTUPINFO_PRESENT = 0x00080000
INHERIT_PARENT_AFFINITY = 0x00010000
)
const ( const (
// flags for CreateToolhelp32Snapshot // flags for CreateToolhelp32Snapshot
TH32CS_SNAPHEAPLIST = 0x01 TH32CS_SNAPHEAPLIST = 0x01
@@ -567,6 +585,16 @@ const (
IPV6_JOIN_GROUP = 0xc IPV6_JOIN_GROUP = 0xc
IPV6_LEAVE_GROUP = 0xd IPV6_LEAVE_GROUP = 0xd
MSG_OOB = 0x1
MSG_PEEK = 0x2
MSG_DONTROUTE = 0x4
MSG_WAITALL = 0x8
MSG_TRUNC = 0x0100
MSG_CTRUNC = 0x0200
MSG_BCAST = 0x0400
MSG_MCAST = 0x0800
SOMAXCONN = 0x7fffffff SOMAXCONN = 0x7fffffff
TCP_NODELAY = 1 TCP_NODELAY = 1
@@ -584,6 +612,15 @@ type WSABuf struct {
Buf *byte Buf *byte
} }
type WSAMsg struct {
Name *syscall.RawSockaddrAny
Namelen int32
Buffers *WSABuf
BufferCount uint32
Control WSABuf
Flags uint32
}
// Invented values to support what package os expects. // Invented values to support what package os expects.
const ( const (
S_IFMT = 0x1f000 S_IFMT = 0x1f000
@@ -1011,6 +1048,20 @@ var WSAID_CONNECTEX = GUID{
[8]byte{0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}, [8]byte{0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e},
} }
var WSAID_WSASENDMSG = GUID{
0xa441e712,
0x754f,
0x43ca,
[8]byte{0x84, 0xa7, 0x0d, 0xee, 0x44, 0xcf, 0x60, 0x6d},
}
var WSAID_WSARECVMSG = GUID{
0xf689d7c8,
0x6f1f,
0x436b,
[8]byte{0x8a, 0x53, 0xe5, 0x4f, 0xe3, 0x51, 0xc3, 0x22},
}
const ( const (
FILE_SKIP_COMPLETION_PORT_ON_SUCCESS = 1 FILE_SKIP_COMPLETION_PORT_ON_SUCCESS = 1
FILE_SKIP_SET_EVENT_ON_HANDLE = 2 FILE_SKIP_SET_EVENT_ON_HANDLE = 2
+246
View File
@@ -178,6 +178,25 @@ var (
procSetEvent = modkernel32.NewProc("SetEvent") procSetEvent = modkernel32.NewProc("SetEvent")
procResetEvent = modkernel32.NewProc("ResetEvent") procResetEvent = modkernel32.NewProc("ResetEvent")
procPulseEvent = modkernel32.NewProc("PulseEvent") procPulseEvent = modkernel32.NewProc("PulseEvent")
procDefineDosDeviceW = modkernel32.NewProc("DefineDosDeviceW")
procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW")
procFindFirstVolumeW = modkernel32.NewProc("FindFirstVolumeW")
procFindFirstVolumeMountPointW = modkernel32.NewProc("FindFirstVolumeMountPointW")
procFindNextVolumeW = modkernel32.NewProc("FindNextVolumeW")
procFindNextVolumeMountPointW = modkernel32.NewProc("FindNextVolumeMountPointW")
procFindVolumeClose = modkernel32.NewProc("FindVolumeClose")
procFindVolumeMountPointClose = modkernel32.NewProc("FindVolumeMountPointClose")
procGetDriveType = modkernel32.NewProc("GetDriveType")
procGetLogicalDrives = modkernel32.NewProc("GetLogicalDrives")
procGetLogicalDriveStringsW = modkernel32.NewProc("GetLogicalDriveStringsW")
procGetVolumeInformationW = modkernel32.NewProc("GetVolumeInformationW")
procGetVolumeInformationByHandleW = modkernel32.NewProc("GetVolumeInformationByHandleW")
procGetVolumeNameForVolumeMountPointW = modkernel32.NewProc("GetVolumeNameForVolumeMountPointW")
procGetVolumePathNameW = modkernel32.NewProc("GetVolumePathNameW")
procGetVolumePathNamesForVolumeNameW = modkernel32.NewProc("GetVolumePathNamesForVolumeNameW")
procQueryDosDeviceW = modkernel32.NewProc("QueryDosDeviceW")
procSetVolumeLabelW = modkernel32.NewProc("SetVolumeLabelW")
procSetVolumeMountPointW = modkernel32.NewProc("SetVolumeMountPointW")
procWSAStartup = modws2_32.NewProc("WSAStartup") procWSAStartup = modws2_32.NewProc("WSAStartup")
procWSACleanup = modws2_32.NewProc("WSACleanup") procWSACleanup = modws2_32.NewProc("WSACleanup")
procWSAIoctl = modws2_32.NewProc("WSAIoctl") procWSAIoctl = modws2_32.NewProc("WSAIoctl")
@@ -1843,6 +1862,233 @@ func PulseEvent(event Handle) (err error) {
return return
} }
func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) {
r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)))
if r1 == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) {
r1, _, e1 := syscall.Syscall(procDeleteVolumeMountPointW.Addr(), 1, uintptr(unsafe.Pointer(volumeMountPoint)), 0, 0)
if r1 == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) {
r0, _, e1 := syscall.Syscall(procFindFirstVolumeW.Addr(), 2, uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength), 0)
handle = Handle(r0)
if handle == InvalidHandle {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) {
r0, _, e1 := syscall.Syscall(procFindFirstVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength))
handle = Handle(r0)
if handle == InvalidHandle {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) {
r1, _, e1 := syscall.Syscall(procFindNextVolumeW.Addr(), 3, uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength))
if r1 == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) {
r1, _, e1 := syscall.Syscall(procFindNextVolumeMountPointW.Addr(), 3, uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength))
if r1 == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func FindVolumeClose(findVolume Handle) (err error) {
r1, _, e1 := syscall.Syscall(procFindVolumeClose.Addr(), 1, uintptr(findVolume), 0, 0)
if r1 == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) {
r1, _, e1 := syscall.Syscall(procFindVolumeMountPointClose.Addr(), 1, uintptr(findVolumeMountPoint), 0, 0)
if r1 == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func GetDriveType(rootPathName *uint16) (driveType uint32) {
r0, _, _ := syscall.Syscall(procGetDriveType.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0)
driveType = uint32(r0)
return
}
func GetLogicalDrives() (drivesBitMask uint32, err error) {
r0, _, e1 := syscall.Syscall(procGetLogicalDrives.Addr(), 0, 0, 0, 0)
drivesBitMask = uint32(r0)
if drivesBitMask == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) {
r0, _, e1 := syscall.Syscall(procGetLogicalDriveStringsW.Addr(), 2, uintptr(bufferLength), uintptr(unsafe.Pointer(buffer)), 0)
n = uint32(r0)
if n == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) {
r1, _, e1 := syscall.Syscall9(procGetVolumeInformationW.Addr(), 8, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0)
if r1 == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) {
r1, _, e1 := syscall.Syscall9(procGetVolumeInformationByHandleW.Addr(), 8, uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0)
if r1 == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) {
r1, _, e1 := syscall.Syscall(procGetVolumeNameForVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength))
if r1 == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) {
r1, _, e1 := syscall.Syscall(procGetVolumePathNameW.Addr(), 3, uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength))
if r1 == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) {
r1, _, e1 := syscall.Syscall6(procGetVolumePathNamesForVolumeNameW.Addr(), 4, uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength)), 0, 0)
if r1 == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) {
r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max))
n = uint32(r0)
if n == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) {
r1, _, e1 := syscall.Syscall(procSetVolumeLabelW.Addr(), 2, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName)), 0)
if r1 == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) {
r1, _, e1 := syscall.Syscall(procSetVolumeMountPointW.Addr(), 2, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), 0)
if r1 == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { func WSAStartup(verreq uint32, data *WSAData) (sockerr error) {
r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0) r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0)
if r0 != 0 { if r0 != 0 {
+1 -1
View File
@@ -251,7 +251,7 @@ func (d *decoder) callUnmarshaler(n *node, u Unmarshaler) (good bool) {
// //
// If n holds a null value, prepare returns before doing anything. // If n holds a null value, prepare returns before doing anything.
func (d *decoder) prepare(n *node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) { func (d *decoder) prepare(n *node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) {
if n.tag == yaml_NULL_TAG || n.kind == scalarNode && n.tag == "" && (n.value == "null" || n.value == "" && n.implicit) { if n.tag == yaml_NULL_TAG || n.kind == scalarNode && n.tag == "" && (n.value == "null" || n.value == "~" || n.value == "" && n.implicit) {
return out, false, false return out, false, false
} }
again := true again := true
+15
View File
@@ -438,6 +438,9 @@ var unmarshalTests = []struct {
{ {
"foo: ''", "foo: ''",
map[string]*string{"foo": new(string)}, map[string]*string{"foo": new(string)},
}, {
"foo: null",
map[string]*string{"foo": nil},
}, { }, {
"foo: null", "foo: null",
map[string]string{"foo": ""}, map[string]string{"foo": ""},
@@ -446,6 +449,18 @@ var unmarshalTests = []struct {
map[string]interface{}{"foo": nil}, map[string]interface{}{"foo": nil},
}, },
// Support for ~
{
"foo: ~",
map[string]*string{"foo": nil},
}, {
"foo: ~",
map[string]string{"foo": ""},
}, {
"foo: ~",
map[string]interface{}{"foo": nil},
},
// Ignored field // Ignored field
{ {
"a: 1\nb: 2\n", "a: 1\nb: 2\n",
+1 -1
View File
@@ -140,7 +140,7 @@ func unmarshal(in []byte, out interface{}, strict bool) (err error) {
// For example: // For example:
// //
// type T struct { // type T struct {
// F int "a,omitempty" // F int `yaml:"a,omitempty"`
// B int // B int
// } // }
// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" // yaml.Marshal(&T{B: 2}) // Returns "b: 2\n"