Skip to content

Commit 3ffbd57

Browse files
committed
syscall: match linux Setsid function signature to darwin
SETSID does return an errno - any reason why it has been done this way in zsyscall_linux_* ? Otherwise it should be the same as darwin. From SETSID(2) on my Linux box: ERRORS On error, -1 is returned, and errno is set. Fixes golang#730 R=rsc CC=golang-dev https://golang.org/cl/878047
1 parent 57e7641 commit 3ffbd57

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

src/pkg/syscall/syscall_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ func PtraceDetach(pid int) (errno int) { return ptrace(PTRACE_DETACH, pid, 0, 0)
591591
//sys Sethostname(p []byte) (errno int)
592592
//sys Setpgid(pid int, pgid int) (errno int)
593593
//sys Setrlimit(resource int, rlim *Rlimit) (errno int)
594-
//sys Setsid() (pid int)
594+
//sys Setsid() (pid int, errno int)
595595
//sys Settimeofday(tv *Timeval) (errno int)
596596
//sys Setuid(uid int) (errno int)
597597
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, errno int)

src/pkg/syscall/zsyscall_linux_386.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,10 @@ func Setrlimit(resource int, rlim *Rlimit) (errno int) {
434434
return
435435
}
436436

437-
func Setsid() (pid int) {
438-
r0, _, _ := Syscall(SYS_SETSID, 0, 0, 0)
437+
func Setsid() (pid int, errno int) {
438+
r0, _, e1 := Syscall(SYS_SETSID, 0, 0, 0)
439439
pid = int(r0)
440+
errno = int(e1)
440441
return
441442
}
442443

src/pkg/syscall/zsyscall_linux_amd64.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,10 @@ func Setrlimit(resource int, rlim *Rlimit) (errno int) {
434434
return
435435
}
436436

437-
func Setsid() (pid int) {
438-
r0, _, _ := Syscall(SYS_SETSID, 0, 0, 0)
437+
func Setsid() (pid int, errno int) {
438+
r0, _, e1 := Syscall(SYS_SETSID, 0, 0, 0)
439439
pid = int(r0)
440+
errno = int(e1)
440441
return
441442
}
442443

src/pkg/syscall/zsyscall_linux_arm.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,10 @@ func Setrlimit(resource int, rlim *Rlimit) (errno int) {
434434
return
435435
}
436436

437-
func Setsid() (pid int) {
438-
r0, _, _ := Syscall(SYS_SETSID, 0, 0, 0)
437+
func Setsid() (pid int, errno int) {
438+
r0, _, e1 := Syscall(SYS_SETSID, 0, 0, 0)
439439
pid = int(r0)
440+
errno = int(e1)
440441
return
441442
}
442443

0 commit comments

Comments
 (0)