1
0
mirror of https://github.com/golang/go synced 2024-11-22 01:24:42 -07:00

os: change the type of permissions argument for Open etc. to uint32.

Besides being more correct, it protects against people accidentally
exchanging the permission and open mode arguments to Open.

R=rsc
CC=golang-dev
https://golang.org/cl/1904045
This commit is contained in:
Rob Pike 2010-08-04 08:34:52 +10:00
parent 1badb46313
commit e45b58fe96
21 changed files with 128 additions and 128 deletions

View File

@ -27,7 +27,7 @@ var (
Stderr = newFile(2, "/dev/stderr") Stderr = newFile(2, "/dev/stderr")
) )
func Open(name string, mode int, perm int) (file *File, err os.Error) { func Open(name string, mode int, perm uint32) (file *File, err os.Error) {
r, e := syscall.Open(name, mode, perm) r, e := syscall.Open(name, mode, perm)
if e != 0 { if e != 0 {
err = os.Errno(e) err = os.Errno(e)

View File

@ -3038,7 +3038,7 @@ func open(s string) *bufio.Reader {
return bufio.NewReader(fi) return bufio.NewReader(fi)
} }
func create(s string, m int) *bufio.Writer { func create(s string, m uint32) *bufio.Writer {
fo, err := os.Open(s, os.O_WRONLY|os.O_CREAT|os.O_TRUNC, m) fo, err := os.Open(s, os.O_WRONLY|os.O_CREAT|os.O_TRUNC, m)
if err != nil { if err != nil {
error("error opening %v: %v", s, err) error("error opening %v: %v", s, err)

View File

@ -153,7 +153,7 @@ func main() {
changed[o.Dst] = 1 changed[o.Dst] = 1
} }
if o.Mode != 0 { if o.Mode != 0 {
chk(os.Chmod(o.Dst, o.Mode&0755)) chk(os.Chmod(o.Dst, uint32(o.Mode&0755)))
undoRevert(o.Dst) undoRevert(o.Dst)
changed[o.Dst] = 1 changed[o.Dst] = 1
} }
@ -192,7 +192,7 @@ func makeParent(name string) {
// Copy of os.MkdirAll but adds to undo log after // Copy of os.MkdirAll but adds to undo log after
// creating a directory. // creating a directory.
func mkdirAll(path string, perm int) os.Error { func mkdirAll(path string, perm uint32) os.Error {
dir, err := os.Lstat(path) dir, err := os.Lstat(path)
if err == nil { if err == nil {
if dir.IsDirectory() { if dir.IsDirectory() {

View File

@ -49,7 +49,7 @@ func ReadFile(filename string) ([]byte, os.Error) {
// WriteFile writes data to a file named by filename. // WriteFile writes data to a file named by filename.
// If the file does not exist, WriteFile creates it with permissions perm; // If the file does not exist, WriteFile creates it with permissions perm;
// otherwise WriteFile truncates it before writing. // otherwise WriteFile truncates it before writing.
func WriteFile(filename string, data []byte, perm int) os.Error { func WriteFile(filename string, data []byte, perm uint32) os.Error {
f, err := os.Open(filename, os.O_WRONLY|os.O_CREAT|os.O_TRUNC, perm) f, err := os.Open(filename, os.O_WRONLY|os.O_CREAT|os.O_TRUNC, perm)
if err != nil { if err != nil {
return err return err

View File

@ -46,19 +46,19 @@ var (
// Flags to Open wrapping those of the underlying system. Not all flags // Flags to Open wrapping those of the underlying system. Not all flags
// may be implemented on a given system. // may be implemented on a given system.
const ( const (
O_RDONLY = syscall.O_RDONLY // open the file read-only. O_RDONLY int = syscall.O_RDONLY // open the file read-only.
O_WRONLY = syscall.O_WRONLY // open the file write-only. O_WRONLY int = syscall.O_WRONLY // open the file write-only.
O_RDWR = syscall.O_RDWR // open the file read-write. O_RDWR int = syscall.O_RDWR // open the file read-write.
O_APPEND = syscall.O_APPEND // append data to the file when writing. O_APPEND int = syscall.O_APPEND // append data to the file when writing.
O_ASYNC = syscall.O_ASYNC // generate a signal when I/O is available. O_ASYNC int = syscall.O_ASYNC // generate a signal when I/O is available.
O_CREAT = syscall.O_CREAT // create a new file if none exists. O_CREAT int = syscall.O_CREAT // create a new file if none exists.
O_EXCL = syscall.O_EXCL // used with O_CREAT, file must not exist O_EXCL int = syscall.O_EXCL // used with O_CREAT, file must not exist
O_NOCTTY = syscall.O_NOCTTY // do not make file the controlling tty. O_NOCTTY int = syscall.O_NOCTTY // do not make file the controlling tty.
O_NONBLOCK = syscall.O_NONBLOCK // open in non-blocking mode. O_NONBLOCK int = syscall.O_NONBLOCK // open in non-blocking mode.
O_NDELAY = O_NONBLOCK // synonym for O_NONBLOCK O_NDELAY int = O_NONBLOCK // synonym for O_NONBLOCK
O_SYNC = syscall.O_SYNC // open for synchronous I/O. O_SYNC int = syscall.O_SYNC // open for synchronous I/O.
O_TRUNC = syscall.O_TRUNC // if possible, truncate file when opened. O_TRUNC int = syscall.O_TRUNC // if possible, truncate file when opened.
O_CREATE = O_CREAT // create a new file if none exists. O_CREATE int = O_CREAT // create a new file if none exists.
) )
type eofError int type eofError int
@ -208,7 +208,7 @@ func Pipe() (r *File, w *File, err Error) {
// Mkdir creates a new directory with the specified name and permission bits. // Mkdir creates a new directory with the specified name and permission bits.
// It returns an error, if any. // It returns an error, if any.
func Mkdir(name string, perm int) Error { func Mkdir(name string, perm uint32) Error {
e := syscall.Mkdir(name, perm) e := syscall.Mkdir(name, perm)
if e != 0 { if e != 0 {
return &PathError{"mkdir", name, Errno(e)} return &PathError{"mkdir", name, Errno(e)}
@ -358,7 +358,7 @@ func Rename(oldname, newname string) Error {
// Chmod changes the mode of the named file to mode. // Chmod changes the mode of the named file to mode.
// If the file is a symbolic link, it changes the mode of the link's target. // If the file is a symbolic link, it changes the mode of the link's target.
func Chmod(name string, mode int) Error { func Chmod(name string, mode uint32) Error {
if e := syscall.Chmod(name, mode); e != 0 { if e := syscall.Chmod(name, mode); e != 0 {
return &PathError{"chmod", name, Errno(e)} return &PathError{"chmod", name, Errno(e)}
} }
@ -366,7 +366,7 @@ func Chmod(name string, mode int) Error {
} }
// Chmod changes the mode of the file to mode. // Chmod changes the mode of the file to mode.
func (f *File) Chmod(mode int) Error { func (f *File) Chmod(mode uint32) Error {
if e := syscall.Fchmod(f.fd, mode); e != 0 { if e := syscall.Fchmod(f.fd, mode); e != 0 {
return &PathError{"chmod", f.name, Errno(e)} return &PathError{"chmod", f.name, Errno(e)}
} }

View File

@ -25,7 +25,7 @@ const DevNull = "/dev/null"
// Open opens the named file with specified flag (O_RDONLY etc.) and perm, (0666 etc.) // Open opens the named file with specified flag (O_RDONLY etc.) and perm, (0666 etc.)
// if applicable. If successful, methods on the returned File can be used for I/O. // if applicable. If successful, methods on the returned File can be used for I/O.
// It returns the File and an Error, if any. // It returns the File and an Error, if any.
func Open(name string, flag int, perm int) (file *File, err Error) { func Open(name string, flag int, perm uint32) (file *File, err Error) {
r, e := syscall.Open(name, flag|syscall.O_CLOEXEC, perm) r, e := syscall.Open(name, flag|syscall.O_CLOEXEC, perm)
if e != 0 { if e != 0 {
return nil, &PathError{"open", name, Errno(e)} return nil, &PathError{"open", name, Errno(e)}

View File

@ -21,7 +21,7 @@ const DevNull = "NUL"
func (file *File) isdir() bool { return file != nil && file.dirinfo != nil } func (file *File) isdir() bool { return file != nil && file.dirinfo != nil }
func openFile(name string, flag int, perm int) (file *File, err Error) { func openFile(name string, flag int, perm uint32) (file *File, err Error) {
r, e := syscall.Open(name, flag|syscall.O_CLOEXEC, perm) r, e := syscall.Open(name, flag|syscall.O_CLOEXEC, perm)
if e != 0 { if e != 0 {
return nil, &PathError{"open", name, Errno(e)} return nil, &PathError{"open", name, Errno(e)}
@ -51,7 +51,7 @@ func openDir(name string) (file *File, err Error) {
// Open opens the named file with specified flag (O_RDONLY etc.) and perm, (0666 etc.) // Open opens the named file with specified flag (O_RDONLY etc.) and perm, (0666 etc.)
// if applicable. If successful, methods on the returned File can be used for I/O. // if applicable. If successful, methods on the returned File can be used for I/O.
// It returns the File and an Error, if any. // It returns the File and an Error, if any.
func Open(name string, flag int, perm int) (file *File, err Error) { func Open(name string, flag int, perm uint32) (file *File, err Error) {
// TODO(brainman): not sure about my logic of assuming it is dir first, then fall back to file // TODO(brainman): not sure about my logic of assuming it is dir first, then fall back to file
r, e := openDir(name) r, e := openDir(name)
if e == nil { if e == nil {

View File

@ -12,7 +12,7 @@ package os
// directories that MkdirAll creates. // directories that MkdirAll creates.
// If path is already a directory, MkdirAll does nothing // If path is already a directory, MkdirAll does nothing
// and returns nil. // and returns nil.
func MkdirAll(path string, perm int) Error { func MkdirAll(path string, perm uint32) Error {
// If path exists, stop with success or error. // If path exists, stop with success or error.
dir, err := Lstat(path) dir, err := Lstat(path)
if err == nil { if err == nil {

View File

@ -29,7 +29,7 @@ func Kill(pid int, signum int) (errno int) { return kill(pid, signum, 1) }
//sys Adjtime(delta *Timeval, olddelta *Timeval) (errno int) //sys Adjtime(delta *Timeval, olddelta *Timeval) (errno int)
//sys Chdir(path string) (errno int) //sys Chdir(path string) (errno int)
//sys Chflags(path string, flags int) (errno int) //sys Chflags(path string, flags int) (errno int)
//sys Chmod(path string, mode int) (errno int) //sys Chmod(path string, mode uint32) (errno int)
//sys Chown(path string, uid int, gid int) (errno int) //sys Chown(path string, uid int, gid int) (errno int)
//sys Chroot(path string) (errno int) //sys Chroot(path string) (errno int)
//sys Close(fd int) (errno int) //sys Close(fd int) (errno int)
@ -39,7 +39,7 @@ func Kill(pid int, signum int) (errno int) { return kill(pid, signum, 1) }
//sys Exit(code int) //sys Exit(code int)
//sys Fchdir(fd int) (errno int) //sys Fchdir(fd int) (errno int)
//sys Fchflags(path string, flags int) (errno int) //sys Fchflags(path string, flags int) (errno int)
//sys Fchmod(fd int, mode int) (errno int) //sys Fchmod(fd int, mode uint32) (errno int)
//sys Fchown(fd int, uid int, gid int) (errno int) //sys Fchown(fd int, uid int, gid int) (errno int)
//sys Flock(fd int, how int) (errno int) //sys Flock(fd int, how int) (errno int)
//sys Fpathconf(fd int, name int) (val int, errno int) //sys Fpathconf(fd int, name int) (val int, errno int)
@ -68,10 +68,10 @@ func Kill(pid int, signum int) (errno int) { return kill(pid, signum, 1) }
//sys Link(path string, link string) (errno int) //sys Link(path string, link string) (errno int)
//sys Listen(s int, backlog int) (errno int) //sys Listen(s int, backlog int) (errno int)
//sys Lstat(path string, stat *Stat_t) (errno int) = SYS_LSTAT64 //sys Lstat(path string, stat *Stat_t) (errno int) = SYS_LSTAT64
//sys Mkdir(path string, mode int) (errno int) //sys Mkdir(path string, mode uint32) (errno int)
//sys Mkfifo(path string, mode int) (errno int) //sys Mkfifo(path string, mode uint32) (errno int)
//sys Mknod(path string, mode int, dev int) (errno int) //sys Mknod(path string, mode uint32, dev int) (errno int)
//sys Open(path string, mode int, perm int) (fd int, errno int) //sys Open(path string, mode int, perm uint32) (fd int, errno int)
//sys Pathconf(path string, name int) (val int, errno int) //sys Pathconf(path string, name int) (val int, errno int)
//sys Pread(fd int, p []byte, offset int64) (n int, errno int) //sys Pread(fd int, p []byte, offset int64) (n int, errno int)
//sys Pwrite(fd int, p []byte, offset int64) (n int, errno int) //sys Pwrite(fd int, p []byte, offset int64) (n int, errno int)

View File

@ -21,7 +21,7 @@ const OS = "freebsd"
//sys Adjtime(delta *Timeval, olddelta *Timeval) (errno int) //sys Adjtime(delta *Timeval, olddelta *Timeval) (errno int)
//sys Chdir(path string) (errno int) //sys Chdir(path string) (errno int)
//sys Chflags(path string, flags int) (errno int) //sys Chflags(path string, flags int) (errno int)
//sys Chmod(path string, mode int) (errno int) //sys Chmod(path string, mode uint32) (errno int)
//sys Chown(path string, uid int, gid int) (errno int) //sys Chown(path string, uid int, gid int) (errno int)
//sys Chroot(path string) (errno int) //sys Chroot(path string) (errno int)
//sys Close(fd int) (errno int) //sys Close(fd int) (errno int)
@ -30,7 +30,7 @@ const OS = "freebsd"
//sys Exit(code int) //sys Exit(code int)
//sys Fchdir(fd int) (errno int) //sys Fchdir(fd int) (errno int)
//sys Fchflags(path string, flags int) (errno int) //sys Fchflags(path string, flags int) (errno int)
//sys Fchmod(fd int, mode int) (errno int) //sys Fchmod(fd int, mode uint32) (errno int)
//sys Fchown(fd int, uid int, gid int) (errno int) //sys Fchown(fd int, uid int, gid int) (errno int)
//sys Flock(fd int, how int) (errno int) //sys Flock(fd int, how int) (errno int)
//sys Fpathconf(fd int, name int) (val int, errno int) //sys Fpathconf(fd int, name int) (val int, errno int)
@ -61,11 +61,11 @@ const OS = "freebsd"
//sys Link(path string, link string) (errno int) //sys Link(path string, link string) (errno int)
//sys Listen(s int, backlog int) (errno int) //sys Listen(s int, backlog int) (errno int)
//sys Lstat(path string, stat *Stat_t) (errno int) //sys Lstat(path string, stat *Stat_t) (errno int)
//sys Mkdir(path string, mode int) (errno int) //sys Mkdir(path string, mode uint32) (errno int)
//sys Mkfifo(path string, mode int) (errno int) //sys Mkfifo(path string, mode uint32) (errno int)
//sys Mknod(path string, mode int, dev int) (errno int) //sys Mknod(path string, mode uint32, dev int) (errno int)
//sys Nanosleep(time *Timespec, leftover *Timespec) (errno int) //sys Nanosleep(time *Timespec, leftover *Timespec) (errno int)
//sys Open(path string, mode int, perm int) (fd int, errno int) //sys Open(path string, mode int, perm uint32) (fd int, errno int)
//sys Pathconf(path string, name int) (val int, errno int) //sys Pathconf(path string, name int) (val int, errno int)
//sys Pread(fd int, p []byte, offset int64) (n int, errno int) //sys Pread(fd int, p []byte, offset int64) (n int, errno int)
//sys Pwrite(fd int, p []byte, offset int64) (n int, errno int) //sys Pwrite(fd int, p []byte, offset int64) (n int, errno int)

View File

@ -19,13 +19,13 @@ const OS = "linux"
* Wrapped * Wrapped
*/ */
//sys open(path string, mode int, perm int) (fd int, errno int) //sys open(path string, mode int, perm uint32) (fd int, errno int)
func Open(path string, mode int, perm int) (fd int, errno int) { func Open(path string, mode int, perm uint32) (fd int, errno int) {
return open(path, mode|O_LARGEFILE, perm) return open(path, mode|O_LARGEFILE, perm)
} }
//sys openat(dirfd int, path string, flags int, mode int) (fd int, errno int) //sys openat(dirfd int, path string, flags int, mode uint32) (fd int, errno int)
func Openat(dirfd int, path string, flags int, mode int) (fd int, errno int) { func Openat(dirfd int, path string, flags int, mode uint32) (fd int, errno int) {
return openat(dirfd, path, flags|O_LARGEFILE, mode) return openat(dirfd, path, flags|O_LARGEFILE, mode)
} }
@ -561,25 +561,25 @@ func PtraceDetach(pid int) (errno int) { return ptrace(PTRACE_DETACH, pid, 0, 0)
/* /*
* Direct access * Direct access
*/ */
//sys Access(path string, mode int) (errno int) //sys Access(path string, mode uint32) (errno int)
//sys Acct(path string) (errno int) //sys Acct(path string) (errno int)
//sys Adjtimex(buf *Timex) (state int, errno int) //sys Adjtimex(buf *Timex) (state int, errno int)
//sys Chdir(path string) (errno int) //sys Chdir(path string) (errno int)
//sys Chmod(path string, mode int) (errno int) //sys Chmod(path string, mode uint32) (errno int)
//sys Chroot(path string) (errno int) //sys Chroot(path string) (errno int)
//sys Close(fd int) (errno int) //sys Close(fd int) (errno int)
//sys Creat(path string, mode int) (fd int, errno int) //sys Creat(path string, mode uint32) (fd int, errno int)
//sys Dup(oldfd int) (fd int, errno int) //sys Dup(oldfd int) (fd int, errno int)
//sys Dup2(oldfd int, newfd int) (fd int, errno int) //sys Dup2(oldfd int, newfd int) (fd int, errno int)
//sys EpollCreate(size int) (fd int, errno int) //sys EpollCreate(size int) (fd int, errno int)
//sys EpollCtl(epfd int, op int, fd int, event *EpollEvent) (errno int) //sys EpollCtl(epfd int, op int, fd int, event *EpollEvent) (errno int)
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, errno int) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, errno int)
//sys Exit(code int) = SYS_EXIT_GROUP //sys Exit(code int) = SYS_EXIT_GROUP
//sys Faccessat(dirfd int, path string, mode int, flags int) (errno int) //sys Faccessat(dirfd int, path string, mode uint32, flags int) (errno int)
//sys Fallocate(fd int, mode int, off int64, len int64) (errno int) //sys Fallocate(fd int, mode uint32, off int64, len int64) (errno int)
//sys Fchdir(fd int) (errno int) //sys Fchdir(fd int) (errno int)
//sys Fchmod(fd int, mode int) (errno int) //sys Fchmod(fd int, mode uint32) (errno int)
//sys Fchmodat(dirfd int, path string, mode int, flags int) (errno int) //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (errno int)
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (errno int) //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (errno int)
//sys fcntl(fd int, cmd int, arg int) (val int, errno int) //sys fcntl(fd int, cmd int, arg int) (val int, errno int)
//sys Fdatasync(fd int) (errno int) //sys Fdatasync(fd int) (errno int)
@ -597,10 +597,10 @@ func PtraceDetach(pid int) (errno int) { return ptrace(PTRACE_DETACH, pid, 0, 0)
//sys Kill(pid int, sig int) (errno int) //sys Kill(pid int, sig int) (errno int)
//sys Klogctl(typ int, buf []byte) (n int, errno int) = SYS_SYSLOG //sys Klogctl(typ int, buf []byte) (n int, errno int) = SYS_SYSLOG
//sys Link(oldpath string, newpath string) (errno int) //sys Link(oldpath string, newpath string) (errno int)
//sys Mkdir(path string, mode int) (errno int) //sys Mkdir(path string, mode uint32) (errno int)
//sys Mkdirat(dirfd int, path string, mode int) (errno int) //sys Mkdirat(dirfd int, path string, mode uint32) (errno int)
//sys Mknod(path string, mode int, dev int) (errno int) //sys Mknod(path string, mode uint32, dev int) (errno int)
//sys Mknodat(dirfd int, path string, mode int, dev int) (errno int) //sys Mknodat(dirfd int, path string, mode uint32, dev int) (errno int)
//sys Nanosleep(time *Timespec, leftover *Timespec) (errno int) //sys Nanosleep(time *Timespec, leftover *Timespec) (errno int)
//sys Pause() (errno int) //sys Pause() (errno int)
//sys PivotRoot(newroot string, putold string) (errno int) = SYS_PIVOT_ROOT //sys PivotRoot(newroot string, putold string) (errno int) = SYS_PIVOT_ROOT

View File

@ -10,7 +10,7 @@ const OS = "nacl"
// Auto-generated // Auto-generated
//sys Chmod(path string, mode int) (errno int) //sys Chmod(path string, mode uint32) (errno int)
//sys Clock() (clock int) //sys Clock() (clock int)
//sys Close(fd int) (errno int) //sys Close(fd int) (errno int)
//sys Exit(code int) //sys Exit(code int)
@ -18,7 +18,7 @@ const OS = "nacl"
//sys Getdents(fd int, buf []byte) (n int, errno int) //sys Getdents(fd int, buf []byte) (n int, errno int)
//sys Getpid() (pid int) //sys Getpid() (pid int)
//sys Gettimeofday(tv *Timeval) (errno int) //sys Gettimeofday(tv *Timeval) (errno int)
//sys Open(path string, mode int, perm int) (fd int, errno int) //sys Open(path string, mode int, perm uint32) (fd int, errno int)
//sys Read(fd int, p []byte) (n int, errno int) //sys Read(fd int, p []byte) (n int, errno int)
//sys read(fd int, buf *byte, nbuf int) (n int, errno int) //sys read(fd int, buf *byte, nbuf int) (n int, errno int)
//sys Stat(path string, stat *Stat_t) (errno int) //sys Stat(path string, stat *Stat_t) (errno int)
@ -132,7 +132,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, errno int) {
return 0, ENACL return 0, ENACL
} }
func Mkdir(path string, mode int) (errno int) { return ENACL } func Mkdir(path string, mode uint32) (errno int) { return ENACL }
func Lstat(path string, stat *Stat_t) (errno int) { func Lstat(path string, stat *Stat_t) (errno int) {
return Stat(path, stat) return Stat(path, stat)
@ -160,7 +160,7 @@ func Rename(oldpath, newpath string) (errno int) {
return ENACL return ENACL
} }
func Fchmod(fd int, mode int) (errno int) { return ENACL } func Fchmod(fd int, mode uint32) (errno int) { return ENACL }
func Chown(path string, uid int, gid int) (errno int) { func Chown(path string, uid int, gid int) (errno int) {
return ENACL return ENACL

View File

@ -164,7 +164,7 @@ func Errstr(errno int) string {
func Exit(code int) { ExitProcess(uint32(code)) } func Exit(code int) { ExitProcess(uint32(code)) }
func Open(path string, mode int, perm int) (fd int, errno int) { func Open(path string, mode int, perm uint32) (fd int, errno int) {
if len(path) == 0 { if len(path) == 0 {
return -1, ERROR_FILE_NOT_FOUND return -1, ERROR_FILE_NOT_FOUND
} }
@ -329,7 +329,7 @@ func Chdir(path string) (errno int) {
return 0 return 0
} }
func Mkdir(path string, mode int) (errno int) { func Mkdir(path string, mode uint32) (errno int) {
if ok, e := CreateDirectory(&StringToUTF16(path)[0], nil); !ok { if ok, e := CreateDirectory(&StringToUTF16(path)[0], nil); !ok {
return e return e
} }
@ -620,8 +620,8 @@ func Fchdir(fd int) (errno int) { return EWINDOWS }
func Link(oldpath, newpath string) (errno int) { return EWINDOWS } func Link(oldpath, newpath string) (errno int) { return EWINDOWS }
func Symlink(path, link string) (errno int) { return EWINDOWS } func Symlink(path, link string) (errno int) { return EWINDOWS }
func Readlink(path string, buf []byte) (n int, errno int) { return 0, EWINDOWS } func Readlink(path string, buf []byte) (n int, errno int) { return 0, EWINDOWS }
func Chmod(path string, mode int) (errno int) { return EWINDOWS } func Chmod(path string, mode uint32) (errno int) { return EWINDOWS }
func Fchmod(fd int, mode int) (errno int) { return EWINDOWS } func Fchmod(fd int, mode uint32) (errno int) { return EWINDOWS }
func Chown(path string, uid int, gid int) (errno int) { return EWINDOWS } func Chown(path string, uid int, gid int) (errno int) { return EWINDOWS }
func Lchown(path string, uid int, gid int) (errno int) { return EWINDOWS } func Lchown(path string, uid int, gid int) (errno int) { return EWINDOWS }
func Fchown(fd int, uid int, gid int) (errno int) { return EWINDOWS } func Fchown(fd int, uid int, gid int) (errno int) { return EWINDOWS }

View File

@ -179,7 +179,7 @@ func Chflags(path string, flags int) (errno int) {
return return
} }
func Chmod(path string, mode int) (errno int) { func Chmod(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
@ -239,7 +239,7 @@ func Fchflags(path string, flags int) (errno int) {
return return
} }
func Fchmod(fd int, mode int) (errno int) { func Fchmod(fd int, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
@ -428,25 +428,25 @@ func Lstat(path string, stat *Stat_t) (errno int) {
return return
} }
func Mkdir(path string, mode int) (errno int) { func Mkdir(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
} }
func Mkfifo(path string, mode int) (errno int) { func Mkfifo(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
} }
func Mknod(path string, mode int, dev int) (errno int) { func Mknod(path string, mode uint32, dev int) (errno int) {
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev)) _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev))
errno = int(e1) errno = int(e1)
return return
} }
func Open(path string, mode int, perm int) (fd int, errno int) { func Open(path string, mode int, perm uint32) (fd int, errno int) {
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm)) r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm))
fd = int(r0) fd = int(r0)
errno = int(e1) errno = int(e1)

View File

@ -178,7 +178,7 @@ func Chflags(path string, flags int) (errno int) {
return return
} }
func Chmod(path string, mode int) (errno int) { func Chmod(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
@ -238,7 +238,7 @@ func Fchflags(path string, flags int) (errno int) {
return return
} }
func Fchmod(fd int, mode int) (errno int) { func Fchmod(fd int, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
@ -427,25 +427,25 @@ func Lstat(path string, stat *Stat_t) (errno int) {
return return
} }
func Mkdir(path string, mode int) (errno int) { func Mkdir(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
} }
func Mkfifo(path string, mode int) (errno int) { func Mkfifo(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
} }
func Mknod(path string, mode int, dev int) (errno int) { func Mknod(path string, mode uint32, dev int) (errno int) {
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev)) _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev))
errno = int(e1) errno = int(e1)
return return
} }
func Open(path string, mode int, perm int) (fd int, errno int) { func Open(path string, mode int, perm uint32) (fd int, errno int) {
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm)) r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm))
fd = int(r0) fd = int(r0)
errno = int(e1) errno = int(e1)

View File

@ -172,7 +172,7 @@ func Chflags(path string, flags int) (errno int) {
return return
} }
func Chmod(path string, mode int) (errno int) { func Chmod(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
@ -226,7 +226,7 @@ func Fchflags(path string, flags int) (errno int) {
return return
} }
func Fchmod(fd int, mode int) (errno int) { func Fchmod(fd int, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
@ -427,19 +427,19 @@ func Lstat(path string, stat *Stat_t) (errno int) {
return return
} }
func Mkdir(path string, mode int) (errno int) { func Mkdir(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
} }
func Mkfifo(path string, mode int) (errno int) { func Mkfifo(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
} }
func Mknod(path string, mode int, dev int) (errno int) { func Mknod(path string, mode uint32, dev int) (errno int) {
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev)) _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev))
errno = int(e1) errno = int(e1)
return return
@ -451,7 +451,7 @@ func Nanosleep(time *Timespec, leftover *Timespec) (errno int) {
return return
} }
func Open(path string, mode int, perm int) (fd int, errno int) { func Open(path string, mode int, perm uint32) (fd int, errno int) {
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm)) r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm))
fd = int(r0) fd = int(r0)
errno = int(e1) errno = int(e1)

View File

@ -173,7 +173,7 @@ func Chflags(path string, flags int) (errno int) {
return return
} }
func Chmod(path string, mode int) (errno int) { func Chmod(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
@ -227,7 +227,7 @@ func Fchflags(path string, flags int) (errno int) {
return return
} }
func Fchmod(fd int, mode int) (errno int) { func Fchmod(fd int, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
@ -428,19 +428,19 @@ func Lstat(path string, stat *Stat_t) (errno int) {
return return
} }
func Mkdir(path string, mode int) (errno int) { func Mkdir(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
} }
func Mkfifo(path string, mode int) (errno int) { func Mkfifo(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
} }
func Mknod(path string, mode int, dev int) (errno int) { func Mknod(path string, mode uint32, dev int) (errno int) {
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev)) _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev))
errno = int(e1) errno = int(e1)
return return
@ -452,7 +452,7 @@ func Nanosleep(time *Timespec, leftover *Timespec) (errno int) {
return return
} }
func Open(path string, mode int, perm int) (fd int, errno int) { func Open(path string, mode int, perm uint32) (fd int, errno int) {
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm)) r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm))
fd = int(r0) fd = int(r0)
errno = int(e1) errno = int(e1)

View File

@ -5,14 +5,14 @@ package syscall
import "unsafe" import "unsafe"
func open(path string, mode int, perm int) (fd int, errno int) { func open(path string, mode int, perm uint32) (fd int, errno int) {
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm)) r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm))
fd = int(r0) fd = int(r0)
errno = int(e1) errno = int(e1)
return return
} }
func openat(dirfd int, path string, flags int, mode int) (fd int, errno int) { func openat(dirfd int, path string, flags int, mode uint32) (fd int, errno int) {
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), uintptr(mode), 0, 0) r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), uintptr(mode), 0, 0)
fd = int(r0) fd = int(r0)
errno = int(e1) errno = int(e1)
@ -61,7 +61,7 @@ func ptrace(request int, pid int, addr uintptr, data uintptr) (errno int) {
return return
} }
func Access(path string, mode int) (errno int) { func Access(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
@ -86,7 +86,7 @@ func Chdir(path string) (errno int) {
return return
} }
func Chmod(path string, mode int) (errno int) { func Chmod(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
@ -104,7 +104,7 @@ func Close(fd int) (errno int) {
return return
} }
func Creat(path string, mode int) (fd int, errno int) { func Creat(path string, mode uint32) (fd int, errno int) {
r0, _, e1 := Syscall(SYS_CREAT, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) r0, _, e1 := Syscall(SYS_CREAT, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
fd = int(r0) fd = int(r0)
errno = int(e1) errno = int(e1)
@ -154,13 +154,13 @@ func Exit(code int) {
return return
} }
func Faccessat(dirfd int, path string, mode int, flags int) (errno int) { func Faccessat(dirfd int, path string, mode uint32, flags int) (errno int) {
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(flags), 0, 0) _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(flags), 0, 0)
errno = int(e1) errno = int(e1)
return return
} }
func Fallocate(fd int, mode int, off int64, len int64) (errno int) { func Fallocate(fd int, mode uint32, off int64, len int64) (errno int) {
_, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(off>>32), uintptr(len), uintptr(len>>32)) _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(off>>32), uintptr(len), uintptr(len>>32))
errno = int(e1) errno = int(e1)
return return
@ -172,13 +172,13 @@ func Fchdir(fd int) (errno int) {
return return
} }
func Fchmod(fd int, mode int) (errno int) { func Fchmod(fd int, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
} }
func Fchmodat(dirfd int, path string, mode int, flags int) (errno int) { func Fchmodat(dirfd int, path string, mode uint32, flags int) (errno int) {
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(flags), 0, 0) _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(flags), 0, 0)
errno = int(e1) errno = int(e1)
return return
@ -298,25 +298,25 @@ func Link(oldpath string, newpath string) (errno int) {
return return
} }
func Mkdir(path string, mode int) (errno int) { func Mkdir(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
} }
func Mkdirat(dirfd int, path string, mode int) (errno int) { func Mkdirat(dirfd int, path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode)) _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode))
errno = int(e1) errno = int(e1)
return return
} }
func Mknod(path string, mode int, dev int) (errno int) { func Mknod(path string, mode uint32, dev int) (errno int) {
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev)) _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev))
errno = int(e1) errno = int(e1)
return return
} }
func Mknodat(dirfd int, path string, mode int, dev int) (errno int) { func Mknodat(dirfd int, path string, mode uint32, dev int) (errno int) {
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev), 0, 0) _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev), 0, 0)
errno = int(e1) errno = int(e1)
return return

View File

@ -5,14 +5,14 @@ package syscall
import "unsafe" import "unsafe"
func open(path string, mode int, perm int) (fd int, errno int) { func open(path string, mode int, perm uint32) (fd int, errno int) {
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm)) r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm))
fd = int(r0) fd = int(r0)
errno = int(e1) errno = int(e1)
return return
} }
func openat(dirfd int, path string, flags int, mode int) (fd int, errno int) { func openat(dirfd int, path string, flags int, mode uint32) (fd int, errno int) {
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), uintptr(mode), 0, 0) r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), uintptr(mode), 0, 0)
fd = int(r0) fd = int(r0)
errno = int(e1) errno = int(e1)
@ -61,7 +61,7 @@ func ptrace(request int, pid int, addr uintptr, data uintptr) (errno int) {
return return
} }
func Access(path string, mode int) (errno int) { func Access(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
@ -86,7 +86,7 @@ func Chdir(path string) (errno int) {
return return
} }
func Chmod(path string, mode int) (errno int) { func Chmod(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
@ -104,7 +104,7 @@ func Close(fd int) (errno int) {
return return
} }
func Creat(path string, mode int) (fd int, errno int) { func Creat(path string, mode uint32) (fd int, errno int) {
r0, _, e1 := Syscall(SYS_CREAT, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) r0, _, e1 := Syscall(SYS_CREAT, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
fd = int(r0) fd = int(r0)
errno = int(e1) errno = int(e1)
@ -154,13 +154,13 @@ func Exit(code int) {
return return
} }
func Faccessat(dirfd int, path string, mode int, flags int) (errno int) { func Faccessat(dirfd int, path string, mode uint32, flags int) (errno int) {
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(flags), 0, 0) _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(flags), 0, 0)
errno = int(e1) errno = int(e1)
return return
} }
func Fallocate(fd int, mode int, off int64, len int64) (errno int) { func Fallocate(fd int, mode uint32, off int64, len int64) (errno int) {
_, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(len), 0, 0) _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(len), 0, 0)
errno = int(e1) errno = int(e1)
return return
@ -172,13 +172,13 @@ func Fchdir(fd int) (errno int) {
return return
} }
func Fchmod(fd int, mode int) (errno int) { func Fchmod(fd int, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
} }
func Fchmodat(dirfd int, path string, mode int, flags int) (errno int) { func Fchmodat(dirfd int, path string, mode uint32, flags int) (errno int) {
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(flags), 0, 0) _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(flags), 0, 0)
errno = int(e1) errno = int(e1)
return return
@ -298,25 +298,25 @@ func Link(oldpath string, newpath string) (errno int) {
return return
} }
func Mkdir(path string, mode int) (errno int) { func Mkdir(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
} }
func Mkdirat(dirfd int, path string, mode int) (errno int) { func Mkdirat(dirfd int, path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode)) _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode))
errno = int(e1) errno = int(e1)
return return
} }
func Mknod(path string, mode int, dev int) (errno int) { func Mknod(path string, mode uint32, dev int) (errno int) {
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev)) _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev))
errno = int(e1) errno = int(e1)
return return
} }
func Mknodat(dirfd int, path string, mode int, dev int) (errno int) { func Mknodat(dirfd int, path string, mode uint32, dev int) (errno int) {
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev), 0, 0) _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev), 0, 0)
errno = int(e1) errno = int(e1)
return return

View File

@ -5,14 +5,14 @@ package syscall
import "unsafe" import "unsafe"
func open(path string, mode int, perm int) (fd int, errno int) { func open(path string, mode int, perm uint32) (fd int, errno int) {
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm)) r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm))
fd = int(r0) fd = int(r0)
errno = int(e1) errno = int(e1)
return return
} }
func openat(dirfd int, path string, flags int, mode int) (fd int, errno int) { func openat(dirfd int, path string, flags int, mode uint32) (fd int, errno int) {
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), uintptr(mode), 0, 0) r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), uintptr(mode), 0, 0)
fd = int(r0) fd = int(r0)
errno = int(e1) errno = int(e1)
@ -61,7 +61,7 @@ func ptrace(request int, pid int, addr uintptr, data uintptr) (errno int) {
return return
} }
func Access(path string, mode int) (errno int) { func Access(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
@ -86,7 +86,7 @@ func Chdir(path string) (errno int) {
return return
} }
func Chmod(path string, mode int) (errno int) { func Chmod(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
@ -104,7 +104,7 @@ func Close(fd int) (errno int) {
return return
} }
func Creat(path string, mode int) (fd int, errno int) { func Creat(path string, mode uint32) (fd int, errno int) {
r0, _, e1 := Syscall(SYS_CREAT, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) r0, _, e1 := Syscall(SYS_CREAT, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
fd = int(r0) fd = int(r0)
errno = int(e1) errno = int(e1)
@ -154,13 +154,13 @@ func Exit(code int) {
return return
} }
func Faccessat(dirfd int, path string, mode int, flags int) (errno int) { func Faccessat(dirfd int, path string, mode uint32, flags int) (errno int) {
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(flags), 0, 0) _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(flags), 0, 0)
errno = int(e1) errno = int(e1)
return return
} }
func Fallocate(fd int, mode int, off int64, len int64) (errno int) { func Fallocate(fd int, mode uint32, off int64, len int64) (errno int) {
_, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(off>>32), uintptr(len), uintptr(len>>32)) _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(off>>32), uintptr(len), uintptr(len>>32))
errno = int(e1) errno = int(e1)
return return
@ -172,13 +172,13 @@ func Fchdir(fd int) (errno int) {
return return
} }
func Fchmod(fd int, mode int) (errno int) { func Fchmod(fd int, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
} }
func Fchmodat(dirfd int, path string, mode int, flags int) (errno int) { func Fchmodat(dirfd int, path string, mode uint32, flags int) (errno int) {
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(flags), 0, 0) _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(flags), 0, 0)
errno = int(e1) errno = int(e1)
return return
@ -298,25 +298,25 @@ func Link(oldpath string, newpath string) (errno int) {
return return
} }
func Mkdir(path string, mode int) (errno int) { func Mkdir(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
} }
func Mkdirat(dirfd int, path string, mode int) (errno int) { func Mkdirat(dirfd int, path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode)) _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode))
errno = int(e1) errno = int(e1)
return return
} }
func Mknod(path string, mode int, dev int) (errno int) { func Mknod(path string, mode uint32, dev int) (errno int) {
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev)) _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev))
errno = int(e1) errno = int(e1)
return return
} }
func Mknodat(dirfd int, path string, mode int, dev int) (errno int) { func Mknodat(dirfd int, path string, mode uint32, dev int) (errno int) {
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev), 0, 0) _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev), 0, 0)
errno = int(e1) errno = int(e1)
return return

View File

@ -5,7 +5,7 @@ package syscall
import "unsafe" import "unsafe"
func Chmod(path string, mode int) (errno int) { func Chmod(path string, mode uint32) (errno int) {
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
errno = int(e1) errno = int(e1)
return return
@ -57,7 +57,7 @@ func Gettimeofday(tv *Timeval) (errno int) {
return return
} }
func Open(path string, mode int, perm int) (fd int, errno int) { func Open(path string, mode int, perm uint32) (fd int, errno int) {
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm)) r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm))
fd = int(r0) fd = int(r0)
errno = int(e1) errno = int(e1)