Source file src/syscall/export_bsd_test.go

     1  // Copyright 2024 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 darwin || dragonfly || freebsd || netbsd || openbsd
     6  
     7  package syscall
     8  
     9  import (
    10  	"unsafe"
    11  )
    12  
    13  // pgid should really be pid_t, however _C_int (aka int32) is generally
    14  // equivalent.
    15  
    16  func Tcgetpgrp(fd int) (pgid int32, err error) {
    17  	if err := ioctlPtr(fd, TIOCGPGRP, unsafe.Pointer(&pgid)); err != nil {
    18  		return -1, err
    19  	}
    20  	return pgid, nil
    21  }
    22  
    23  func Tcsetpgrp(fd int, pgid int32) (err error) {
    24  	return ioctlPtr(fd, TIOCSPGRP, unsafe.Pointer(&pgid))
    25  }
    26  

View as plain text