Commits

Aram Hăvărneanu  committed f808d84

syscall: revert fcntl, fix FcntlFlock

  • Participants
  • Parent commits b3f24ca

Comments (0)

Files changed (3)

File src/pkg/syscall/exec_unix.go

 	} else {
 		flag &= ^O_NONBLOCK
 	}
-	_, err = fcntl(fd, F_SETFL, uintptr(flag))
+	_, err = fcntl(fd, F_SETFL, flag)
 	return err
 }
 

File src/pkg/syscall/syscall_solaris.go

 	return Utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
 }
 
-//sys	fcntl(fd int, cmd int, arg uintptr) (val int, err error)
+//sys	fcntl(fd int, cmd int, arg int) (val int, err error)
 
 // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
 func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
-	_, err := fcntl(int(fd), cmd, uintptr(unsafe.Pointer(lk)))
-	return err
+	_, _, e1 := sysvicall6(procfcntl.Addr(), 3, uintptr(fd), uintptr(cmd), uintptr(unsafe.Pointer(lk)), 0, 0, 0)
+	if e1 != 0 {
+		return e1
+	}
+	return nil
 }
 
 func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {

File src/pkg/syscall/zsyscall_solaris_amd64.go

 	return
 }
 
-func fcntl(fd int, cmd int, arg uintptr) (val int, err error) {
+func fcntl(fd int, cmd int, arg int) (val int, err error) {
 	r0, _, e1 := sysvicall6(procfcntl.Addr(), 3, uintptr(fd), uintptr(cmd), uintptr(arg), 0, 0, 0)
 	val = int(r0)
 	if e1 != 0 {