overseer/sys_posix.go

40 lines
804 B
Go
Raw Normal View History

2016-02-08 13:20:50 +00:00
// +build linux darwin
package overseer
2016-02-08 13:20:50 +00:00
//this file attempts to contain all posix
//specific stuff, that needs to be implemented
//in some other way on other OSs... TODO!
import (
2016-04-01 20:37:28 +00:00
"os"
2016-02-08 13:20:50 +00:00
"os/exec"
"syscall"
)
var (
supported = true
uid = syscall.Getuid()
gid = syscall.Getgid()
SIGUSR1 = syscall.SIGUSR1
SIGUSR2 = syscall.SIGUSR2
SIGTERM = syscall.SIGTERM
2016-02-08 13:20:50 +00:00
)
func move(dst, src string) error {
2016-04-01 20:37:28 +00:00
if err := os.Rename(src, dst); err == nil {
return nil
}
//HACK: we're shelling out to mv because linux
//throws errors when crossing device boundaryes.
//TODO see sys_posix_mv.go
2016-02-08 13:20:50 +00:00
return exec.Command("mv", src, dst).Run()
}
2016-04-01 20:37:28 +00:00
func chmod(f *os.File, perms os.FileMode) error {
return f.Chmod(perms)
}
func chown(f *os.File, uid, gid int) error {
return f.Chown(uid, gid)
}