mirror of
https://github.com/golang/sys.git
synced 2026-02-08 03:36:03 +03:00
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>
This commit is contained in:
committed by
Tobias Klauser
parent
1061eb656b
commit
1561086e64
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ includes_AIX='
|
||||
#include <sys/stropts.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/termio.h>
|
||||
#include <termios.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
@@ -345,11 +345,11 @@ func IoctlSetInt(fd int, req uint, value int) error {
|
||||
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 @@ func Flock(fd int, how int) (err error) {
|
||||
//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
|
||||
|
||||
@@ -22,6 +22,11 @@ package unix
|
||||
#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 @@ package unix
|
||||
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <gcrypt.h>
|
||||
|
||||
enum {
|
||||
sizeofPtr = sizeof(void*),
|
||||
@@ -224,6 +228,9 @@ type Flock_t C.struct_flock64
|
||||
|
||||
// Statfs
|
||||
|
||||
type Fsid_t C.struct_fsid_t
|
||||
type Fsid64_t C.struct_fsid64_t
|
||||
|
||||
type Statfs_t C.struct_statfs
|
||||
|
||||
const RNDGETENTCNT = 0x80045200
|
||||
|
||||
@@ -867,6 +867,9 @@ const (
|
||||
TAB2 = 0x800
|
||||
TAB3 = 0xc00
|
||||
TABDLY = 0xc00
|
||||
TCFLSH = 0x540c
|
||||
TCGETA = 0x5405
|
||||
TCGETS = 0x5401
|
||||
TCIFLUSH = 0x0
|
||||
TCIOFF = 0x2
|
||||
TCIOFLUSH = 0x2
|
||||
@@ -915,6 +918,15 @@ const (
|
||||
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
|
||||
|
||||
@@ -867,6 +867,9 @@ const (
|
||||
TAB2 = 0x800
|
||||
TAB3 = 0xc00
|
||||
TABDLY = 0xc00
|
||||
TCFLSH = 0x540c
|
||||
TCGETA = 0x5405
|
||||
TCGETS = 0x5401
|
||||
TCIFLUSH = 0x0
|
||||
TCIOFF = 0x2
|
||||
TCIOFLUSH = 0x2
|
||||
@@ -915,6 +918,15 @@ const (
|
||||
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
|
||||
|
||||
@@ -39,8 +39,10 @@ int getrusage(int, uintptr_t);
|
||||
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 @@ func Klogctl(typ int, buf []byte) (n int, err error) {
|
||||
|
||||
// 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 @@ func Mkfifo(path string, mode uint32) (err error) {
|
||||
|
||||
// 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))
|
||||
|
||||
@@ -39,8 +39,10 @@ int getrusage(int, uintptr_t);
|
||||
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 @@ func Klogctl(typ int, buf []byte) (n int, err error) {
|
||||
|
||||
// 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 @@ func Mkfifo(path string, mode uint32) (err error) {
|
||||
|
||||
// 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))
|
||||
|
||||
@@ -268,9 +268,22 @@ type Termios struct {
|
||||
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 @@ type Flock_t struct {
|
||||
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
|
||||
|
||||
@@ -275,9 +275,22 @@ type Termios struct {
|
||||
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 @@ type Flock_t struct {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user