unix: add Termio, Winsize, Statfs_t, TC[GS]ET, Mkdir and Mknod for AIX
These changes add Termio/Winsize/Statfs_t for AIX, constants TC[GS]ET and the syscalls Mkdir and Mknod.
It also changes the comments for AIX which still were talking about Linux and glibc.
Change-Id: I64325330328d6e16cff540f103fdfa533b7d8f5b
Reviewed-on: https://go-review.googlesource.com/136295
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
diff --git a/unix/dev_aix_ppc.go b/unix/dev_aix_ppc.go
index 27f92c9..5e5fb45 100644
--- a/unix/dev_aix_ppc.go
+++ b/unix/dev_aix_ppc.go
@@ -6,17 +6,7 @@
// +build ppc
// Functions to access/create device major and minor numbers matching the
-// encoding used by the Linux kernel and glibc.
-//
-// The information below is extracted and adapted from bits/sysmacros.h in the
-// glibc sources:
-//
-// dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's
-// default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major
-// number and m is a hex digit of the minor number. This is backward compatible
-// with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also
-// backward compatible with the Linux kernel, which for some architectures uses
-// 32-bit dev_t, encoded as mmmM MMmm.
+// encoding used by AIX.
package unix
diff --git a/unix/dev_aix_ppc64.go b/unix/dev_aix_ppc64.go
index 65d93a6..8b40124 100644
--- a/unix/dev_aix_ppc64.go
+++ b/unix/dev_aix_ppc64.go
@@ -6,17 +6,7 @@
// +build ppc64
// Functions to access/create device major and minor numbers matching the
-// encoding used by the Linux kernel and glibc.
-//
-// The information below is extracted and adapted from bits/sysmacros.h in the
-// glibc sources:
-//
-// dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's
-// default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major
-// number and m is a hex digit of the minor number. This is backward compatible
-// with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also
-// backward compatible with the Linux kernel, which for some architectures uses
-// 32-bit dev_t, encoded as mmmM MMmm.
+// encoding used AIX.
package unix
diff --git a/unix/ioctl.go b/unix/ioctl.go
index 8c9aaeb..f121a8d 100644
--- a/unix/ioctl.go
+++ b/unix/ioctl.go
@@ -2,7 +2,7 @@
// 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 solaris
+// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package unix
diff --git a/unix/mkerrors.sh b/unix/mkerrors.sh
index 787ae75..c8449cf 100755
--- a/unix/mkerrors.sh
+++ b/unix/mkerrors.sh
@@ -46,6 +46,7 @@
#include <sys/stropts.h>
#include <sys/mman.h>
#include <sys/poll.h>
+#include <sys/termio.h>
#include <termios.h>
#include <fcntl.h>
diff --git a/unix/syscall_aix.go b/unix/syscall_aix.go
index 86d7c7b..df1f9ea 100644
--- a/unix/syscall_aix.go
+++ b/unix/syscall_aix.go
@@ -345,11 +345,11 @@
return ioctl(fd, req, uintptr(value))
}
-func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
+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 {
+func ioctlSetTermios(fd int, req uint, value *Termios) error {
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
}
@@ -419,8 +419,10 @@
//sysnb Getsid(pid int) (sid int, err error)
//sysnb Kill(pid int, sig syscall.Signal) (err error)
//sys Klogctl(typ int, buf []byte) (n int, err error) = syslog
+//sys Mkdir(dirfd int, path string, mode uint32) (err error)
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
//sys Mkfifo(path string, mode uint32) (err error)
+//sys Mknod(path string, mode uint32, dev int) (err error)
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
//sys Open(path string, mode int, perm uint32) (fd int, err error) = open64
diff --git a/unix/types_aix.go b/unix/types_aix.go
index 355ad6c..18fbddd 100644
--- a/unix/types_aix.go
+++ b/unix/types_aix.go
@@ -22,6 +22,11 @@
#include <utime.h>
#include <sys/utsname.h>
#include <sys/poll.h>
+#include <sys/resource.h>
+#include <sys/stat.h>
+#include <sys/statfs.h>
+#include <sys/termio.h>
+#include <sys/ioctl.h>
#include <termios.h>
@@ -33,7 +38,6 @@
#include <dirent.h>
#include <fcntl.h>
-#include <gcrypt.h>
enum {
sizeofPtr = sizeof(void*),
@@ -224,6 +228,9 @@
// Statfs
+type Fsid_t C.struct_fsid_t
+type Fsid64_t C.struct_fsid64_t
+
type Statfs_t C.struct_statfs
const RNDGETENTCNT = 0x80045200
diff --git a/unix/zerrors_aix_ppc.go b/unix/zerrors_aix_ppc.go
index 17c1537..4b7b965 100644
--- a/unix/zerrors_aix_ppc.go
+++ b/unix/zerrors_aix_ppc.go
@@ -867,6 +867,9 @@
TAB2 = 0x800
TAB3 = 0xc00
TABDLY = 0xc00
+ TCFLSH = 0x540c
+ TCGETA = 0x5405
+ TCGETS = 0x5401
TCIFLUSH = 0x0
TCIOFF = 0x2
TCIOFLUSH = 0x2
@@ -915,6 +918,15 @@
TCP_TIMESTAMP_OPTLEN = 0xc
TCP_UNSETPRIV = 0x28
TCSAFLUSH = 0x2
+ TCSBRK = 0x5409
+ TCSETA = 0x5406
+ TCSETAF = 0x5408
+ TCSETAW = 0x5407
+ TCSETS = 0x5402
+ TCSETSF = 0x5404
+ TCSETSW = 0x5403
+ TCXONC = 0x540b
+ TIOC = 0x5400
TIOCCBRK = 0x2000747a
TIOCCDTR = 0x20007478
TIOCCONS = 0x80047462
diff --git a/unix/zerrors_aix_ppc64.go b/unix/zerrors_aix_ppc64.go
index fdfd25c..ed04fd1 100644
--- a/unix/zerrors_aix_ppc64.go
+++ b/unix/zerrors_aix_ppc64.go
@@ -867,6 +867,9 @@
TAB2 = 0x800
TAB3 = 0xc00
TABDLY = 0xc00
+ TCFLSH = 0x540c
+ TCGETA = 0x5405
+ TCGETS = 0x5401
TCIFLUSH = 0x0
TCIOFF = 0x2
TCIOFLUSH = 0x2
@@ -915,6 +918,15 @@
TCP_TIMESTAMP_OPTLEN = 0xc
TCP_UNSETPRIV = 0x28
TCSAFLUSH = 0x2
+ TCSBRK = 0x5409
+ TCSETA = 0x5406
+ TCSETAF = 0x5408
+ TCSETAW = 0x5407
+ TCSETS = 0x5402
+ TCSETSF = 0x5404
+ TCSETSW = 0x5403
+ TCXONC = 0x540b
+ TIOC = 0x5400
TIOCCBRK = 0x2000747a
TIOCCDTR = 0x20007478
TIOCCONS = 0xffffffff80047462
diff --git a/unix/zsyscall_aix_ppc.go b/unix/zsyscall_aix_ppc.go
index 46d0652..ab2f761 100644
--- a/unix/zsyscall_aix_ppc.go
+++ b/unix/zsyscall_aix_ppc.go
@@ -39,8 +39,10 @@
int getsid(int);
int kill(int, int);
int syslog(int, uintptr_t, size_t);
+int mkdir(int, uintptr_t, unsigned int);
int mkdirat(int, uintptr_t, unsigned int);
int mkfifo(uintptr_t, unsigned int);
+int mknod(uintptr_t, unsigned int, int);
int mknodat(int, uintptr_t, unsigned int, int);
int nanosleep(uintptr_t, uintptr_t);
int open64(uintptr_t, int, unsigned int);
@@ -502,6 +504,17 @@
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Mkdir(dirfd int, path string, mode uint32) (err error) {
+ _p0 := uintptr(unsafe.Pointer(C.CString(path)))
+ r0, er := C.mkdir(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode))
+ if r0 == -1 && er != nil {
+ err = er
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
_p0 := uintptr(unsafe.Pointer(C.CString(path)))
r0, er := C.mkdirat(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode))
@@ -524,6 +537,17 @@
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Mknod(path string, mode uint32, dev int) (err error) {
+ _p0 := uintptr(unsafe.Pointer(C.CString(path)))
+ r0, er := C.mknod(C.uintptr_t(_p0), C.uint(mode), C.int(dev))
+ if r0 == -1 && er != nil {
+ err = er
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
_p0 := uintptr(unsafe.Pointer(C.CString(path)))
r0, er := C.mknodat(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode), C.int(dev))
diff --git a/unix/zsyscall_aix_ppc64.go b/unix/zsyscall_aix_ppc64.go
index b33f9ec..2e4f93f 100644
--- a/unix/zsyscall_aix_ppc64.go
+++ b/unix/zsyscall_aix_ppc64.go
@@ -39,8 +39,10 @@
int getsid(int);
int kill(int, int);
int syslog(int, uintptr_t, size_t);
+int mkdir(int, uintptr_t, unsigned int);
int mkdirat(int, uintptr_t, unsigned int);
int mkfifo(uintptr_t, unsigned int);
+int mknod(uintptr_t, unsigned int, int);
int mknodat(int, uintptr_t, unsigned int, int);
int nanosleep(uintptr_t, uintptr_t);
int open64(uintptr_t, int, unsigned int);
@@ -502,6 +504,17 @@
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Mkdir(dirfd int, path string, mode uint32) (err error) {
+ _p0 := uintptr(unsafe.Pointer(C.CString(path)))
+ r0, er := C.mkdir(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode))
+ if r0 == -1 && er != nil {
+ err = er
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
_p0 := uintptr(unsafe.Pointer(C.CString(path)))
r0, er := C.mkdirat(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode))
@@ -524,6 +537,17 @@
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Mknod(path string, mode uint32, dev int) (err error) {
+ _p0 := uintptr(unsafe.Pointer(C.CString(path)))
+ r0, er := C.mknod(C.uintptr_t(_p0), C.uint(mode), C.int(dev))
+ if r0 == -1 && er != nil {
+ err = er
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
_p0 := uintptr(unsafe.Pointer(C.CString(path)))
r0, er := C.mknodat(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode), C.int(dev))
diff --git a/unix/ztypes_aix_ppc.go b/unix/ztypes_aix_ppc.go
index ee45536..f1cfe7d 100644
--- a/unix/ztypes_aix_ppc.go
+++ b/unix/ztypes_aix_ppc.go
@@ -268,9 +268,22 @@
Cc [16]uint8
}
-type Termio struct{}
+type Termio struct {
+ Iflag uint16
+ Oflag uint16
+ Cflag uint16
+ Lflag uint16
+ Line uint8
+ Cc [8]uint8
+ _ [1]byte
+}
-type Winsize struct{}
+type Winsize struct {
+ Row uint16
+ Col uint16
+ Xpixel uint16
+ Ypixel uint16
+}
type PollFd struct {
Fd int32
@@ -301,6 +314,32 @@
Len int64
}
-type Statfs_t struct{}
+type Fsid_t struct {
+ Val [2]uint32
+}
+type Fsid64_t struct {
+ Val [2]uint64
+}
+
+type Statfs_t struct {
+ Version int32
+ Type int32
+ Bsize uint32
+ Blocks uint32
+ Bfree uint32
+ Bavail uint32
+ Files uint32
+ Ffree uint32
+ Fsid Fsid_t
+ Vfstype int32
+ Fsize uint32
+ Vfsnumber int32
+ Vfsoff int32
+ Vfslen int32
+ Vfsvers int32
+ Fname [32]uint8
+ Fpack [32]uint8
+ Name_max int32
+}
const RNDGETENTCNT = 0x80045200
diff --git a/unix/ztypes_aix_ppc64.go b/unix/ztypes_aix_ppc64.go
index cdb1699..95581a3 100644
--- a/unix/ztypes_aix_ppc64.go
+++ b/unix/ztypes_aix_ppc64.go
@@ -275,9 +275,22 @@
Cc [16]uint8
}
-type Termio struct{}
+type Termio struct {
+ Iflag uint16
+ Oflag uint16
+ Cflag uint16
+ Lflag uint16
+ Line uint8
+ Cc [8]uint8
+ _ [1]byte
+}
-type Winsize struct{}
+type Winsize struct {
+ Row uint16
+ Col uint16
+ Xpixel uint16
+ Ypixel uint16
+}
type PollFd struct {
Fd int32
@@ -308,6 +321,34 @@
Len int64
}
-type Statfs_t struct{}
+type Fsid_t struct {
+ Val [2]uint32
+}
+type Fsid64_t struct {
+ Val [2]uint64
+}
+
+type Statfs_t struct {
+ Version int32
+ Type int32
+ Bsize uint64
+ Blocks uint64
+ Bfree uint64
+ Bavail uint64
+ Files uint64
+ Ffree uint64
+ Fsid Fsid64_t
+ Vfstype int32
+ _ [4]byte
+ Fsize uint64
+ Vfsnumber int32
+ Vfsoff int32
+ Vfslen int32
+ Vfsvers int32
+ Fname [32]uint8
+ Fpack [32]uint8
+ Name_max int32
+ _ [4]byte
+}
const RNDGETENTCNT = 0x80045200