github.com/ice-blockchain/go/src@v0.0.0-20240403114104-1564d284e521/syscall/exec_aix_test.go (about) 1 // Copyright 2015 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build aix 6 7 package syscall 8 9 import "unsafe" 10 11 //go:cgo_import_dynamic libc_Getpgid getpgid "libc.a/shr_64.o" 12 //go:cgo_import_dynamic libc_Getpgrp getpgrp "libc.a/shr_64.o" 13 14 //go:linkname libc_Getpgid libc_Getpgid 15 //go:linkname libc_Getpgrp libc_Getpgrp 16 17 var ( 18 libc_Getpgid, 19 libc_Getpgrp libcFunc 20 ) 21 22 func Getpgid(pid int) (pgid int, err error) { 23 r0, _, e1 := syscall6(uintptr(unsafe.Pointer(&libc_Getpgid)), 1, uintptr(pid), 0, 0, 0, 0, 0) 24 pgid = int(r0) 25 if e1 != 0 { 26 err = e1 27 } 28 return 29 } 30 31 func Getpgrp() (pgrp int) { 32 r0, _, _ := syscall6(uintptr(unsafe.Pointer(&libc_Getpgrp)), 0, 0, 0, 0, 0, 0, 0) 33 pgrp = int(r0) 34 return 35 } 36 37 func Tcgetpgrp(fd int) (pgid int32, err error) { 38 if errno := ioctlPtr(uintptr(fd), TIOCGPGRP, unsafe.Pointer(&pgid)); errno != 0 { 39 return -1, errno 40 } 41 return pgid, nil 42 } 43 44 func Tcsetpgrp(fd int, pgid int32) (err error) { 45 return ioctlPtr(uintptr(fd), TIOCSPGRP, unsafe.Pointer(&pgid)) 46 }