mirror of
https://github.com/golang/go.git
synced 2025-05-07 16:43:03 +00:00
Provide appropriate implementations of internal/syscall/unix.Tcsetpgrp and use this for runSessionLeader in os/signal/signal_cgo_test.go. This avoids calling syscall.Syscall with SYS_IOCTL on BSDs. Updates #59667 Updates #63900 Change-Id: Ifa4696bba9f1eb68e81e7103f030bc254adaf0af Reviewed-on: https://go-review.googlesource.com/c/go/+/540020 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Joel Sing <joel@sing.id.au>
22 lines
537 B
Go
22 lines
537 B
Go
// Copyright 2024 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package unix
|
|
|
|
import (
|
|
"syscall"
|
|
"unsafe"
|
|
)
|
|
|
|
// Note that pgid should really be pid_t, however _C_int (aka int32) is
|
|
// generally equivalent.
|
|
|
|
func Tcsetpgrp(fd int, pgid int32) (err error) {
|
|
_, _, errno := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(syscall.TIOCSPGRP), uintptr(unsafe.Pointer(&pgid)), 0, 0, 0)
|
|
if errno != 0 {
|
|
return errno
|
|
}
|
|
return nil
|
|
}
|