elvish/sys/tc.go

25 lines
308 B
Go
Raw Normal View History

package sys
/*
#include <unistd.h>
2016-02-21 23:20:01 +08:00
#include <errno.h>
int f(int fd, pid_t pid) {
return tcsetpgrp(fd, pid);
}
2016-02-21 23:20:01 +08:00
int e() {
return errno;
}
*/
import "C"
import "syscall"
func Tcsetpgrp(fd int, pid int) error {
2016-02-21 23:20:01 +08:00
i := C.f(C.int(fd), C.pid_t(pid))
if i != 0 {
2016-02-21 23:20:01 +08:00
return syscall.Errno(C.e())
}
return nil
}