mirror of
https://github.com/XZB-1248/Spark
synced 2025-10-15 12:30:50 +08:00
initial commit
This commit is contained in:
37
client/service/basic/basic_linux.go
Normal file
37
client/service/basic/basic_linux.go
Normal file
@@ -0,0 +1,37 @@
|
||||
// +build linux
|
||||
|
||||
package basic
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func init() {
|
||||
}
|
||||
|
||||
func Lock() error {
|
||||
return errors.New(`the operation is not supported`)
|
||||
}
|
||||
|
||||
func Logoff() error {
|
||||
return errors.New(`the operation is not supported`)
|
||||
}
|
||||
|
||||
func Hibernate() error {
|
||||
_, _, err := syscall.Syscall(syscall.SYS_REBOOT, syscall.LINUX_REBOOT_CMD_HALT, 0, 0)
|
||||
return err
|
||||
}
|
||||
|
||||
func Suspend() error {
|
||||
_, _, err := syscall.Syscall(syscall.SYS_REBOOT, syscall.LINUX_REBOOT_CMD_SW_SUSPEND, 0, 0)
|
||||
return err
|
||||
}
|
||||
|
||||
func Restart() error {
|
||||
return syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART)
|
||||
}
|
||||
|
||||
func Shutdown() error {
|
||||
return syscall.Reboot(syscall.LINUX_REBOOT_CMD_POWER_OFF)
|
||||
}
|
Reference in New Issue
Block a user