mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
os,syscall: implement functions related to uid, gid and pid on js/wasm
This change implements the following functions on js/wasm: - os.Chown - os.Fchown - os.Lchown - syscall.Getuid - syscall.Getgid - syscall.Geteuid - syscall.Getegid - syscall.Getgroups - syscall.Getpid - syscall.Getppid - syscall.Umask Change-Id: Icdb0fafc02c9df6e9e3573542f8499c3464dc671 Reviewed-on: https://go-review.googlesource.com/c/go/+/154157 Run-TryBot: Richard Musiol <neelance@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
d0cbf9bf53
commit
b06d2122ee
6 changed files with 62 additions and 15 deletions
|
|
@ -244,18 +244,26 @@ func Chown(path string, uid, gid int) error {
|
|||
if err := checkPath(path); err != nil {
|
||||
return err
|
||||
}
|
||||
return ENOSYS
|
||||
_, err := fsCall("chown", path, uint32(uid), uint32(gid))
|
||||
return err
|
||||
}
|
||||
|
||||
func Fchown(fd int, uid, gid int) error {
|
||||
return ENOSYS
|
||||
_, err := fsCall("fchown", fd, uint32(uid), uint32(gid))
|
||||
return err
|
||||
}
|
||||
|
||||
func Lchown(path string, uid, gid int) error {
|
||||
if err := checkPath(path); err != nil {
|
||||
return err
|
||||
}
|
||||
return ENOSYS
|
||||
if jsFS.Get("lchown") == js.Undefined() {
|
||||
// fs.lchown is unavailable on Linux until Node.js 10.6.0
|
||||
// TODO(neelance): remove when we require at least this Node.js version
|
||||
return ENOSYS
|
||||
}
|
||||
_, err := fsCall("lchown", path, uint32(uid), uint32(gid))
|
||||
return err
|
||||
}
|
||||
|
||||
func UtimesNano(path string, ts []Timespec) error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue