New kardianos/service with support for OpenRC
This commit is contained in:
parent
916e84e798
commit
351bced7c5
6
go.mod
6
go.mod
|
@ -17,12 +17,12 @@ require (
|
|||
github.com/jedisct1/go-minisign v0.0.0-20211028175153-1c139d1cc84b
|
||||
github.com/jedisct1/xsecretbox v0.0.0-20210927135450-ebe41aef7bef
|
||||
github.com/k-sone/critbitgo v1.4.0
|
||||
github.com/kardianos/service v1.2.0
|
||||
github.com/kardianos/service v1.2.1
|
||||
github.com/miekg/dns v1.1.45
|
||||
github.com/powerman/check v1.6.0
|
||||
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3
|
||||
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
|
||||
golang.org/x/net v0.0.0-20220111093109-d55c255bac03
|
||||
golang.org/x/sys v0.0.0-20220111092808-5a964db01320
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0
|
||||
)
|
||||
|
||||
|
|
12
go.sum
12
go.sum
|
@ -390,8 +390,8 @@ github.com/julz/importas v0.0.0-20210419104244-841f0c0fe66d/go.mod h1:oSFU2R4XK/
|
|||
github.com/k-sone/critbitgo v1.4.0 h1:l71cTyBGeh6X5ATh6Fibgw3+rtNT80BA0uNNWgkPrbE=
|
||||
github.com/k-sone/critbitgo v1.4.0/go.mod h1:7E6pyoyADnFxlUBEKcnfS49b7SUAQGMK+OAp/UQvo0s=
|
||||
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
|
||||
github.com/kardianos/service v1.2.0 h1:bGuZ/epo3vrt8IPC7mnKQolqFeYJb7Cs8Rk4PSOBB/g=
|
||||
github.com/kardianos/service v1.2.0/go.mod h1:CIMRFEJVL+0DS1a3Nx06NaMn4Dz63Ng6O7dl0qH0zVM=
|
||||
github.com/kardianos/service v1.2.1 h1:AYndMsehS+ywIS6RB9KOlcXzteWUzxgMgBymJD7+BYk=
|
||||
github.com/kardianos/service v1.2.1/go.mod h1:CIMRFEJVL+0DS1a3Nx06NaMn4Dz63Ng6O7dl0qH0zVM=
|
||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||
github.com/kisielk/errcheck v1.6.0 h1:YTDO4pNy7AUN/021p+JGHycQyYNIyMoenM1YDVK6RlY=
|
||||
|
@ -803,8 +803,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
|
|||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f h1:hEYJvxw1lSnWIl8X9ofsYMklzaDs90JI2az5YMd4fPM=
|
||||
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220111093109-d55c255bac03 h1:0FB83qp0AzVJm+0wcIlauAjJ+tNdh7jLuacRYCIVv7s=
|
||||
golang.org/x/net v0.0.0-20220111093109-d55c255bac03/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
|
@ -881,8 +881,8 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220111092808-5a964db01320 h1:0jf+tOCoZ3LyutmCOWpVni1chK4VfFLhRsDK7MhqGRY=
|
||||
golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package service provides a simple way to create a system service.
|
||||
// Currently supports Windows, Linux/(systemd | Upstart | SysV), and OSX/Launchd.
|
||||
// Currently supports Windows, Linux/(systemd | Upstart | SysV | OpenRC), and OSX/Launchd.
|
||||
//
|
||||
// Windows controls services by setting up callbacks that is non-trivial. This
|
||||
// is very different then other systems. This package provides the same API
|
||||
|
@ -93,6 +93,7 @@ const (
|
|||
optionSysvScript = "SysvScript"
|
||||
optionUpstartScript = "UpstartScript"
|
||||
optionLaunchdConfig = "LaunchdConfig"
|
||||
optionOpenRCScript = "OpenRCScript"
|
||||
)
|
||||
|
||||
// Status represents service status as an byte value
|
||||
|
@ -132,28 +133,6 @@ type Config struct {
|
|||
ChRoot string
|
||||
|
||||
// System specific options.
|
||||
// * OS X
|
||||
// - LaunchdConfig string () - Use custom launchd config
|
||||
// - KeepAlive bool (true)
|
||||
// - RunAtLoad bool (false)
|
||||
// - UserService bool (false) - Install as a current user service.
|
||||
// - SessionCreate bool (false) - Create a full user session.
|
||||
// * POSIX
|
||||
// - SystemdScript string () - Use custom systemd script
|
||||
// - UpstartScript string () - Use custom upstart script
|
||||
// - SysvScript string () - Use custom sysv script
|
||||
// - RunWait func() (wait for SIGNAL) - Do not install signal but wait for this function to return.
|
||||
// - ReloadSignal string () [USR1, ...] - Signal to send on reaload.
|
||||
// - PIDFile string () [/run/prog.pid] - Location of the PID file.
|
||||
// - LogOutput bool (false) - Redirect StdErr & StandardOutPath to files.
|
||||
// - Restart string (always) - How shall service be restarted.
|
||||
// - SuccessExitStatus string () - The list of exit status that shall be considered as successful,
|
||||
// in addition to the default ones.
|
||||
// * Linux (systemd)
|
||||
// - LimitNOFILE int - Maximum open files (ulimit -n) (https://serverfault.com/questions/628610/increasing-nproc-for-processes-launched-by-systemd-on-centos-7)
|
||||
// * Windows
|
||||
// - DelayedAutoStart bool (false) - after booting start this service after some delay
|
||||
|
||||
Option KeyValue
|
||||
}
|
||||
|
||||
|
@ -167,7 +146,7 @@ var (
|
|||
ErrNameFieldRequired = errors.New("Config.Name field is required.")
|
||||
// ErrNoServiceSystemDetected is returned when no system was detected.
|
||||
ErrNoServiceSystemDetected = errors.New("No service system detected.")
|
||||
// ErrNotInstalled is returned when the service is not installed
|
||||
// ErrNotInstalled is returned when the service is not installed.
|
||||
ErrNotInstalled = errors.New("the service is not installed")
|
||||
)
|
||||
|
||||
|
@ -182,8 +161,41 @@ func New(i Interface, c *Config) (Service, error) {
|
|||
return system.New(i, c)
|
||||
}
|
||||
|
||||
// KeyValue provides a list of platform specific options. See platform docs for
|
||||
// more details.
|
||||
// KeyValue provides a list of system specific options.
|
||||
// * OS X
|
||||
// - LaunchdConfig string () - Use custom launchd config.
|
||||
// - KeepAlive bool (true) - Prevent the system from stopping the service automatically.
|
||||
// - RunAtLoad bool (false) - Run the service after its job has been loaded.
|
||||
// - SessionCreate bool (false) - Create a full user session.
|
||||
//
|
||||
// * Solaris
|
||||
// - Prefix string ("application") - Service FMRI prefix.
|
||||
//
|
||||
// * POSIX
|
||||
// - UserService bool (false) - Install as a current user service.
|
||||
// - SystemdScript string () - Use custom systemd script.
|
||||
// - UpstartScript string () - Use custom upstart script.
|
||||
// - SysvScript string () - Use custom sysv script.
|
||||
// - OpenRCScript string () - Use custom OpenRC script.
|
||||
// - RunWait func() (wait for SIGNAL) - Do not install signal but wait for this function to return.
|
||||
// - ReloadSignal string () [USR1, ...] - Signal to send on reload.
|
||||
// - PIDFile string () [/run/prog.pid] - Location of the PID file.
|
||||
// - LogOutput bool (false) - Redirect StdErr & StandardOutPath to files.
|
||||
// - Restart string (always) - How shall service be restarted.
|
||||
// - SuccessExitStatus string () - The list of exit status that shall be considered as successful,
|
||||
// in addition to the default ones.
|
||||
// * Linux (systemd)
|
||||
// - LimitNOFILE int (-1) - Maximum open files (ulimit -n)
|
||||
// (https://serverfault.com/questions/628610/increasing-nproc-for-processes-launched-by-systemd-on-centos-7)
|
||||
// * Windows
|
||||
// - DelayedAutoStart bool (false) - After booting, start this service after some delay.
|
||||
// - Password string () - Password to use when interfacing with the system service manager.
|
||||
// - Interactive bool (false) - The service can interact with the desktop. (more information https://docs.microsoft.com/en-us/windows/win32/services/interactive-services)
|
||||
// - DelayedAutoStart bool (false) - after booting start this service after some delay.
|
||||
// - StartType string ("automatic") - Start service type. (automatic | manual | disabled)
|
||||
// - OnFailure string ("restart" ) - Action to perform on service failure. (restart | reboot | noaction)
|
||||
// - OnFailureDelayDuration string ( "1s" ) - Delay before restarting the service, time.Duration string.
|
||||
// - OnFailureResetPeriod int ( 10 ) - Reset period for errors, seconds.
|
||||
type KeyValue map[string]interface{}
|
||||
|
||||
// bool returns the value of the given name, assuming the value is a boolean.
|
||||
|
|
|
@ -44,20 +44,17 @@ func (aixSystem) New(i Interface, c *Config) (Service, error) {
|
|||
return s, nil
|
||||
}
|
||||
|
||||
func getPidOfSvcMaster() int {
|
||||
pat := regexp.MustCompile(`\s+root\s+(\d+)\s+\d+\s+\d+\s+\w+\s+\d+\s+\S+\s+[0-9:]+\s+/usr/sbin/srcmstr`)
|
||||
cmd := exec.Command("ps", "-ef")
|
||||
func getArgsFromPid(pid int) string {
|
||||
cmd := exec.Command("ps", "-o", "args", "-p", strconv.Itoa(pid))
|
||||
var out bytes.Buffer
|
||||
cmd.Stdout = &out
|
||||
pid := 0
|
||||
if err := cmd.Run(); err == nil {
|
||||
matches := pat.FindAllStringSubmatch(out.String(), -1)
|
||||
for _, match := range matches {
|
||||
pid, _ = strconv.Atoi(match[1])
|
||||
break
|
||||
lines := strings.Split(out.String(), "\n")
|
||||
if len(lines) > 1 {
|
||||
return strings.TrimSpace(lines[1])
|
||||
}
|
||||
}
|
||||
return pid
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
@ -75,8 +72,8 @@ func init() {
|
|||
}
|
||||
|
||||
func isInteractive() (bool, error) {
|
||||
// The PPid of a service process should match PID of srcmstr.
|
||||
return os.Getppid() != getPidOfSvcMaster(), nil
|
||||
// The parent process of a service process should be srcmstr.
|
||||
return getArgsFromPid(os.Getppid()) != "/usr/sbin/srcmstr", nil
|
||||
}
|
||||
|
||||
type aixService struct {
|
||||
|
|
|
@ -186,7 +186,7 @@ func (s *darwinLaunchdService) Uninstall() error {
|
|||
func (s *darwinLaunchdService) Status() (Status, error) {
|
||||
exitCode, out, err := runWithOutput("launchctl", "list", s.Name)
|
||||
if exitCode == 0 && err != nil {
|
||||
if !strings.Contains(err.Error(), "failed with StandardError") {
|
||||
if !strings.Contains(err.Error(), "failed with stderr") {
|
||||
return StatusUnknown, err
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,15 @@ func init() {
|
|||
},
|
||||
new: newUpstartService,
|
||||
},
|
||||
linuxSystemService{
|
||||
name: "linux-openrc",
|
||||
detect: isOpenRC,
|
||||
interactive: func() bool {
|
||||
is, _ := isInteractive()
|
||||
return is
|
||||
},
|
||||
new: newOpenRCService,
|
||||
},
|
||||
linuxSystemService{
|
||||
name: "unix-systemv",
|
||||
detect: func() bool { return true },
|
||||
|
|
|
@ -0,0 +1,238 @@
|
|||
package service
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"regexp"
|
||||
"syscall"
|
||||
"text/template"
|
||||
"time"
|
||||
)
|
||||
|
||||
func isOpenRC() bool {
|
||||
if _, err := exec.LookPath("openrc-init"); err == nil {
|
||||
return true
|
||||
}
|
||||
if _, err := os.Stat("/etc/inittab"); err == nil {
|
||||
filerc, err := os.Open("/etc/inittab")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
defer filerc.Close()
|
||||
|
||||
buf := new(bytes.Buffer)
|
||||
buf.ReadFrom(filerc)
|
||||
contents := buf.String()
|
||||
|
||||
re := regexp.MustCompile(`::sysinit:.*openrc.*sysinit`)
|
||||
matches := re.FindStringSubmatch(contents)
|
||||
if len(matches) > 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type openrc struct {
|
||||
i Interface
|
||||
platform string
|
||||
*Config
|
||||
}
|
||||
|
||||
func (s *openrc) String() string {
|
||||
if len(s.DisplayName) > 0 {
|
||||
return s.DisplayName
|
||||
}
|
||||
return s.Name
|
||||
}
|
||||
|
||||
func (s *openrc) Platform() string {
|
||||
return s.platform
|
||||
}
|
||||
|
||||
func (s *openrc) template() *template.Template {
|
||||
customScript := s.Option.string(optionOpenRCScript, "")
|
||||
|
||||
if customScript != "" {
|
||||
return template.Must(template.New("").Funcs(tf).Parse(customScript))
|
||||
} else {
|
||||
return template.Must(template.New("").Funcs(tf).Parse(openRCScript))
|
||||
}
|
||||
}
|
||||
|
||||
func newOpenRCService(i Interface, platform string, c *Config) (Service, error) {
|
||||
s := &openrc{
|
||||
i: i,
|
||||
platform: platform,
|
||||
Config: c,
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
var errNoUserServiceOpenRC = errors.New("user services are not supported on OpenRC")
|
||||
|
||||
func (s *openrc) configPath() (cp string, err error) {
|
||||
if s.Option.bool(optionUserService, optionUserServiceDefault) {
|
||||
err = errNoUserServiceOpenRC
|
||||
return
|
||||
}
|
||||
cp = "/etc/init.d/" + s.Config.Name
|
||||
return
|
||||
}
|
||||
|
||||
func (s *openrc) Install() error {
|
||||
confPath, err := s.configPath()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = os.Stat(confPath)
|
||||
if err == nil {
|
||||
return fmt.Errorf("Init already exists: %s", confPath)
|
||||
}
|
||||
|
||||
f, err := os.Create(confPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
err = os.Chmod(confPath, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
path, err := s.execPath()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var to = &struct {
|
||||
*Config
|
||||
Path string
|
||||
}{
|
||||
s.Config,
|
||||
path,
|
||||
}
|
||||
|
||||
err = s.template().Execute(f, to)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// run rc-update
|
||||
return s.runAction("add")
|
||||
}
|
||||
|
||||
func (s *openrc) Uninstall() error {
|
||||
confPath, err := s.configPath()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := os.Remove(confPath); err != nil {
|
||||
return err
|
||||
}
|
||||
return s.runAction("delete")
|
||||
}
|
||||
|
||||
func (s *openrc) Logger(errs chan<- error) (Logger, error) {
|
||||
if system.Interactive() {
|
||||
return ConsoleLogger, nil
|
||||
}
|
||||
return s.SystemLogger(errs)
|
||||
}
|
||||
|
||||
func (s *openrc) SystemLogger(errs chan<- error) (Logger, error) {
|
||||
return newSysLogger(s.Name, errs)
|
||||
}
|
||||
|
||||
func (s *openrc) Run() (err error) {
|
||||
err = s.i.Start(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
s.Option.funcSingle(optionRunWait, func() {
|
||||
var sigChan = make(chan os.Signal, 3)
|
||||
signal.Notify(sigChan, syscall.SIGTERM, os.Interrupt)
|
||||
<-sigChan
|
||||
})()
|
||||
|
||||
return s.i.Stop(s)
|
||||
}
|
||||
|
||||
func (s *openrc) Status() (Status, error) {
|
||||
// rc-service uses the errno library for its exit codes:
|
||||
// errno 0 = service started
|
||||
// errno 1 = EPERM 1 Operation not permitted
|
||||
// errno 2 = ENOENT 2 No such file or directory
|
||||
// errno 3 = ESRCH 3 No such process
|
||||
// for more info, see https://man7.org/linux/man-pages/man3/errno.3.html
|
||||
_, out, err := runWithOutput("rc-service", s.Name, "status")
|
||||
if err != nil {
|
||||
if exiterr, ok := err.(*exec.ExitError); ok {
|
||||
// The program has exited with an exit code != 0
|
||||
exitCode := exiterr.ExitCode()
|
||||
switch {
|
||||
case exitCode == 1:
|
||||
return StatusUnknown, err
|
||||
case exitCode == 2:
|
||||
return StatusUnknown, ErrNotInstalled
|
||||
case exitCode == 3:
|
||||
return StatusStopped, nil
|
||||
default:
|
||||
return StatusUnknown, fmt.Errorf("unknown error: %v - %v", out, err)
|
||||
}
|
||||
} else {
|
||||
return StatusUnknown, err
|
||||
}
|
||||
}
|
||||
return StatusRunning, nil
|
||||
}
|
||||
|
||||
func (s *openrc) Start() error {
|
||||
return run("rc-service", s.Name, "start")
|
||||
}
|
||||
|
||||
func (s *openrc) Stop() error {
|
||||
return run("rc-service", s.Name, "stop")
|
||||
}
|
||||
|
||||
func (s *openrc) Restart() error {
|
||||
err := s.Stop()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
return s.Start()
|
||||
}
|
||||
|
||||
func (s *openrc) runAction(action string) error {
|
||||
return s.run(action, s.Name)
|
||||
}
|
||||
|
||||
func (s *openrc) run(action string, args ...string) error {
|
||||
return run("rc-update", append([]string{action}, args...)...)
|
||||
}
|
||||
|
||||
const openRCScript = `#!/sbin/openrc-run
|
||||
supervisor=supervise-daemon
|
||||
name="{{.DisplayName}}"
|
||||
description="{{.Description}}"
|
||||
command={{.Path|cmdEscape}}
|
||||
{{- if .Arguments }}
|
||||
command_args="{{range .Arguments}}{{.}} {{end}}"
|
||||
{{- end }}
|
||||
name=$(basename $(readlink -f $command))
|
||||
supervise_daemon_args="--stdout /var/log/${name}.log --stderr /var/log/${name}.err"
|
||||
|
||||
{{- if .Dependencies }}
|
||||
depend() {
|
||||
{{- range $i, $dep := .Dependencies}}
|
||||
{{"\t"}}{{$dep}}{{end}}
|
||||
}
|
||||
{{- end}}
|
||||
`
|
|
@ -69,7 +69,7 @@ func (s *systemd) Platform() string {
|
|||
|
||||
func (s *systemd) configPath() (cp string, err error) {
|
||||
if !s.isUserService() {
|
||||
cp = "/etc/systemd/system/" + s.Config.Name + ".service"
|
||||
cp = "/etc/systemd/system/" + s.unitName()
|
||||
return
|
||||
}
|
||||
homeDir, err := os.UserHomeDir()
|
||||
|
@ -81,10 +81,14 @@ func (s *systemd) configPath() (cp string, err error) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
cp = filepath.Join(systemdUserDir, s.Config.Name+".service")
|
||||
cp = filepath.Join(systemdUserDir, s.unitName())
|
||||
return
|
||||
}
|
||||
|
||||
func (s *systemd) unitName() string {
|
||||
return s.Config.Name + ".service"
|
||||
}
|
||||
|
||||
func (s *systemd) getSystemdVersion() int64 {
|
||||
_, out, err := runWithOutput("systemctl", "--version")
|
||||
if err != nil {
|
||||
|
@ -230,7 +234,7 @@ func (s *systemd) Run() (err error) {
|
|||
}
|
||||
|
||||
func (s *systemd) Status() (Status, error) {
|
||||
exitCode, out, err := runWithOutput("systemctl", "is-active", s.Name)
|
||||
exitCode, out, err := runWithOutput("systemctl", "is-active", s.unitName())
|
||||
if exitCode == 0 && err != nil {
|
||||
return StatusUnknown, err
|
||||
}
|
||||
|
@ -240,7 +244,7 @@ func (s *systemd) Status() (Status, error) {
|
|||
return StatusRunning, nil
|
||||
case strings.HasPrefix(out, "inactive"):
|
||||
// inactive can also mean its not installed, check unit files
|
||||
exitCode, out, err := runWithOutput("systemctl", "list-unit-files", "-t", "service", s.Name)
|
||||
exitCode, out, err := runWithOutput("systemctl", "list-unit-files", "-t", "service", s.unitName())
|
||||
if exitCode == 0 && err != nil {
|
||||
return StatusUnknown, err
|
||||
}
|
||||
|
@ -279,7 +283,7 @@ func (s *systemd) run(action string, args ...string) error {
|
|||
}
|
||||
|
||||
func (s *systemd) runAction(action string) error {
|
||||
return s.run(action, s.Name+".service")
|
||||
return s.run(action, s.unitName())
|
||||
}
|
||||
|
||||
const systemdScript = `[Unit]
|
||||
|
|
|
@ -213,7 +213,7 @@ get_pid() {
|
|||
}
|
||||
|
||||
is_running() {
|
||||
[ -f "$pid_file" ] && ps $(get_pid) > /dev/null 2>&1
|
||||
[ -f "$pid_file" ] && cat /proc/$(get_pid)/stat > /dev/null 2>&1
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
|
|
@ -11,15 +11,33 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
"golang.org/x/sys/windows/registry"
|
||||
"golang.org/x/sys/windows/svc"
|
||||
"golang.org/x/sys/windows/svc/eventlog"
|
||||
"golang.org/x/sys/windows/svc/mgr"
|
||||
)
|
||||
|
||||
const version = "windows-service"
|
||||
const (
|
||||
version = "windows-service"
|
||||
|
||||
StartType = "StartType"
|
||||
ServiceStartManual = "manual"
|
||||
ServiceStartDisabled = "disabled"
|
||||
ServiceStartAutomatic = "automatic"
|
||||
|
||||
OnFailure = "OnFailure"
|
||||
OnFailureRestart = "restart"
|
||||
OnFailureReboot = "reboot"
|
||||
OnFailureNoAction = "noaction"
|
||||
OnFailureDelayDuration = "OnFailureDelayDuration"
|
||||
OnFailureResetPeriod = "OnFailureResetPeriod"
|
||||
|
||||
errnoServiceDoesNotExist syscall.Errno = 1060
|
||||
)
|
||||
|
||||
type windowsService struct {
|
||||
i Interface
|
||||
|
@ -220,18 +238,59 @@ func (ws *windowsService) Install() error {
|
|||
s.Close()
|
||||
return fmt.Errorf("service %s already exists", ws.Name)
|
||||
}
|
||||
var startType int32
|
||||
switch ws.Option.string(StartType, ServiceStartAutomatic) {
|
||||
case ServiceStartAutomatic:
|
||||
startType = mgr.StartAutomatic
|
||||
case ServiceStartManual:
|
||||
startType = mgr.StartManual
|
||||
case ServiceStartDisabled:
|
||||
startType = mgr.StartDisabled
|
||||
}
|
||||
|
||||
serviceType := windows.SERVICE_WIN32_OWN_PROCESS
|
||||
if ws.Option.bool("Interactive", false) {
|
||||
serviceType = serviceType | windows.SERVICE_INTERACTIVE_PROCESS
|
||||
}
|
||||
|
||||
s, err = m.CreateService(ws.Name, exepath, mgr.Config{
|
||||
DisplayName: ws.DisplayName,
|
||||
Description: ws.Description,
|
||||
StartType: mgr.StartAutomatic,
|
||||
StartType: uint32(startType),
|
||||
ServiceStartName: ws.UserName,
|
||||
Password: ws.Option.string("Password", ""),
|
||||
Dependencies: ws.Dependencies,
|
||||
DelayedAutoStart: ws.Option.bool("DelayedAutoStart", false),
|
||||
ServiceType: uint32(serviceType),
|
||||
}, ws.Arguments...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if onFailure := ws.Option.string(OnFailure, ""); onFailure != "" {
|
||||
var delay = 1 * time.Second
|
||||
if d, err := time.ParseDuration(ws.Option.string(OnFailureDelayDuration, "1s")); err == nil {
|
||||
delay = d
|
||||
}
|
||||
var actionType int
|
||||
switch onFailure {
|
||||
case OnFailureReboot:
|
||||
actionType = mgr.ComputerReboot
|
||||
case OnFailureRestart:
|
||||
actionType = mgr.ServiceRestart
|
||||
case OnFailureNoAction:
|
||||
actionType = mgr.NoAction
|
||||
default:
|
||||
actionType = mgr.ServiceRestart
|
||||
}
|
||||
if err := s.SetRecoveryActions([]mgr.RecoveryAction{
|
||||
{
|
||||
Type: actionType,
|
||||
Delay: delay,
|
||||
},
|
||||
}, uint32(ws.Option.int(OnFailureResetPeriod, 10))); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
defer s.Close()
|
||||
err = eventlog.InstallAsEventCreate(ws.Name, eventlog.Error|eventlog.Warning|eventlog.Info)
|
||||
if err != nil {
|
||||
|
@ -305,7 +364,7 @@ func (ws *windowsService) Status() (Status, error) {
|
|||
|
||||
s, err := m.OpenService(ws.Name)
|
||||
if err != nil {
|
||||
if err.Error() == "The specified service does not exist as an installed service." {
|
||||
if errno, ok := err.(syscall.Errno); ok && errno == errnoServiceDoesNotExist {
|
||||
return StatusUnknown, ErrNotInstalled
|
||||
}
|
||||
return StatusUnknown, err
|
||||
|
|
|
@ -40,7 +40,7 @@ func versionCompare(v1, v2 []int) (int, error) {
|
|||
return 0, nil
|
||||
}
|
||||
|
||||
// parseVersion will parse any integer type version seperated by periods.
|
||||
// parseVersion will parse any integer type version separated by periods.
|
||||
// This does not fully support semver style versions.
|
||||
func parseVersion(v string) []int {
|
||||
version := make([]int, 3)
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build (arm64 || amd64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux
|
||||
// +build arm64 amd64 ppc64 ppc64le mips64 mips64le riscv64 s390x
|
||||
//go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux
|
||||
// +build arm64 amd64 loong64 ppc64 ppc64le mips64 mips64le riscv64 s390x
|
||||
// +build linux
|
||||
|
||||
package socket
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build (arm64 || amd64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || zos)
|
||||
// +build arm64 amd64 ppc64 ppc64le mips64 mips64le riscv64 s390x
|
||||
//go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || zos)
|
||||
// +build arm64 amd64 loong64 ppc64 ppc64le mips64 mips64le riscv64 s390x
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd zos
|
||||
|
||||
package socket
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build (arm64 || amd64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux
|
||||
// +build arm64 amd64 ppc64 ppc64le mips64 mips64le riscv64 s390x
|
||||
//go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux
|
||||
// +build arm64 amd64 loong64 ppc64 ppc64le mips64 mips64le riscv64 s390x
|
||||
// +build linux
|
||||
|
||||
package socket
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright 2021 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.
|
||||
|
||||
//go:build loong64
|
||||
// +build loong64
|
||||
|
||||
package socket
|
||||
|
||||
const (
|
||||
sysRECVMMSG = 0xf3
|
||||
sysSENDMMSG = 0x10d
|
||||
)
|
|
@ -0,0 +1,40 @@
|
|||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
//go:build loong64
|
||||
// +build loong64
|
||||
|
||||
package socket
|
||||
|
||||
type iovec struct {
|
||||
Base *byte
|
||||
Len uint64
|
||||
}
|
||||
|
||||
type msghdr struct {
|
||||
Name *byte
|
||||
Namelen uint32
|
||||
Iov *iovec
|
||||
Iovlen uint64
|
||||
Control *byte
|
||||
Controllen uint64
|
||||
Flags int32
|
||||
Pad_cgo_0 [4]byte
|
||||
}
|
||||
|
||||
type mmsghdr struct {
|
||||
Hdr msghdr
|
||||
Len uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
}
|
||||
|
||||
type cmsghdr struct {
|
||||
Len uint64
|
||||
Level int32
|
||||
Type int32
|
||||
}
|
||||
|
||||
const (
|
||||
sizeofIovec = 0x10
|
||||
sizeofMsghdr = 0x38
|
||||
)
|
|
@ -0,0 +1,77 @@
|
|||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
//go:build loong64
|
||||
// +build loong64
|
||||
|
||||
package ipv4
|
||||
|
||||
const (
|
||||
sizeofKernelSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
sizeofInetPktinfo = 0xc
|
||||
sizeofSockExtendedErr = 0x10
|
||||
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x88
|
||||
sizeofGroupSourceReq = 0x108
|
||||
|
||||
sizeofICMPFilter = 0x4
|
||||
)
|
||||
|
||||
type kernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type inetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
Code uint8
|
||||
Pad uint8
|
||||
Info uint32
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type ipMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group kernelSockaddrStorage
|
||||
Source kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type icmpFilter struct {
|
||||
Data uint32
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
//go:build loong64
|
||||
// +build loong64
|
||||
|
||||
package ipv6
|
||||
|
||||
const (
|
||||
sizeofKernelSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet6 = 0x1c
|
||||
sizeofInet6Pktinfo = 0x14
|
||||
sizeofIPv6Mtuinfo = 0x20
|
||||
sizeofIPv6FlowlabelReq = 0x20
|
||||
|
||||
sizeofIPv6Mreq = 0x14
|
||||
sizeofGroupReq = 0x88
|
||||
sizeofGroupSourceReq = 0x108
|
||||
|
||||
sizeofICMPv6Filter = 0x20
|
||||
)
|
||||
|
||||
type kernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sockaddrInet6 struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Flowinfo uint32
|
||||
Addr [16]byte /* in6_addr */
|
||||
Scope_id uint32
|
||||
}
|
||||
|
||||
type inet6Pktinfo struct {
|
||||
Addr [16]byte /* in6_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type ipv6Mtuinfo struct {
|
||||
Addr sockaddrInet6
|
||||
Mtu uint32
|
||||
}
|
||||
|
||||
type ipv6FlowlabelReq struct {
|
||||
Dst [16]byte /* in6_addr */
|
||||
Label uint32
|
||||
Action uint8
|
||||
Share uint8
|
||||
Flags uint16
|
||||
Expires uint16
|
||||
Linger uint16
|
||||
X__flr_pad uint32
|
||||
}
|
||||
|
||||
type ipv6Mreq struct {
|
||||
Multiaddr [16]byte /* in6_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group kernelSockaddrStorage
|
||||
Source kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type icmpv6Filter struct {
|
||||
Data [8]uint32
|
||||
}
|
|
@ -741,6 +741,7 @@ const (
|
|||
ETH_P_QINQ2 = 0x9200
|
||||
ETH_P_QINQ3 = 0x9300
|
||||
ETH_P_RARP = 0x8035
|
||||
ETH_P_REALTEK = 0x8899
|
||||
ETH_P_SCA = 0x6007
|
||||
ETH_P_SLOW = 0x8809
|
||||
ETH_P_SNAP = 0x5
|
||||
|
@ -810,10 +811,12 @@ const (
|
|||
FAN_EPIDFD = -0x2
|
||||
FAN_EVENT_INFO_TYPE_DFID = 0x3
|
||||
FAN_EVENT_INFO_TYPE_DFID_NAME = 0x2
|
||||
FAN_EVENT_INFO_TYPE_ERROR = 0x5
|
||||
FAN_EVENT_INFO_TYPE_FID = 0x1
|
||||
FAN_EVENT_INFO_TYPE_PIDFD = 0x4
|
||||
FAN_EVENT_METADATA_LEN = 0x18
|
||||
FAN_EVENT_ON_CHILD = 0x8000000
|
||||
FAN_FS_ERROR = 0x8000
|
||||
FAN_MARK_ADD = 0x1
|
||||
FAN_MARK_DONT_FOLLOW = 0x4
|
||||
FAN_MARK_FILESYSTEM = 0x100
|
||||
|
@ -1827,6 +1830,8 @@ const (
|
|||
PERF_MEM_BLK_DATA = 0x2
|
||||
PERF_MEM_BLK_NA = 0x1
|
||||
PERF_MEM_BLK_SHIFT = 0x28
|
||||
PERF_MEM_HOPS_0 = 0x1
|
||||
PERF_MEM_HOPS_SHIFT = 0x2b
|
||||
PERF_MEM_LOCK_LOCKED = 0x2
|
||||
PERF_MEM_LOCK_NA = 0x1
|
||||
PERF_MEM_LOCK_SHIFT = 0x18
|
||||
|
@ -1986,6 +1991,9 @@ const (
|
|||
PR_SCHED_CORE_CREATE = 0x1
|
||||
PR_SCHED_CORE_GET = 0x0
|
||||
PR_SCHED_CORE_MAX = 0x4
|
||||
PR_SCHED_CORE_SCOPE_PROCESS_GROUP = 0x2
|
||||
PR_SCHED_CORE_SCOPE_THREAD = 0x0
|
||||
PR_SCHED_CORE_SCOPE_THREAD_GROUP = 0x1
|
||||
PR_SCHED_CORE_SHARE_FROM = 0x3
|
||||
PR_SCHED_CORE_SHARE_TO = 0x2
|
||||
PR_SET_CHILD_SUBREAPER = 0x24
|
||||
|
@ -2167,12 +2175,23 @@ const (
|
|||
RTCF_NAT = 0x800000
|
||||
RTCF_VALVE = 0x200000
|
||||
RTC_AF = 0x20
|
||||
RTC_BSM_DIRECT = 0x1
|
||||
RTC_BSM_DISABLED = 0x0
|
||||
RTC_BSM_LEVEL = 0x2
|
||||
RTC_BSM_STANDBY = 0x3
|
||||
RTC_FEATURE_ALARM = 0x0
|
||||
RTC_FEATURE_ALARM_RES_2S = 0x3
|
||||
RTC_FEATURE_ALARM_RES_MINUTE = 0x1
|
||||
RTC_FEATURE_CNT = 0x3
|
||||
RTC_FEATURE_BACKUP_SWITCH_MODE = 0x6
|
||||
RTC_FEATURE_CNT = 0x7
|
||||
RTC_FEATURE_CORRECTION = 0x5
|
||||
RTC_FEATURE_NEED_WEEK_DAY = 0x2
|
||||
RTC_FEATURE_UPDATE_INTERRUPT = 0x4
|
||||
RTC_IRQF = 0x80
|
||||
RTC_MAX_FREQ = 0x2000
|
||||
RTC_PARAM_BACKUP_SWITCH_MODE = 0x2
|
||||
RTC_PARAM_CORRECTION = 0x1
|
||||
RTC_PARAM_FEATURES = 0x0
|
||||
RTC_PF = 0x40
|
||||
RTC_UF = 0x10
|
||||
RTF_ADDRCLASSMASK = 0xf8000000
|
||||
|
@ -2532,6 +2551,8 @@ const (
|
|||
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
|
||||
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
|
||||
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
|
||||
SO_VM_SOCKETS_CONNECT_TIMEOUT_NEW = 0x8
|
||||
SO_VM_SOCKETS_CONNECT_TIMEOUT_OLD = 0x6
|
||||
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
|
||||
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
|
||||
SO_VM_SOCKETS_TRUSTED = 0x5
|
||||
|
|
|
@ -250,6 +250,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x4004700e
|
||||
RTC_IRQP_READ = 0x8004700b
|
||||
RTC_IRQP_SET = 0x4004700c
|
||||
RTC_PARAM_GET = 0x40187013
|
||||
RTC_PARAM_SET = 0x40187014
|
||||
RTC_PIE_OFF = 0x7006
|
||||
RTC_PIE_ON = 0x7005
|
||||
RTC_PLL_GET = 0x801c7011
|
||||
|
@ -327,6 +329,7 @@ const (
|
|||
SO_RCVTIMEO = 0x14
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x14
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -251,6 +251,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x4008700e
|
||||
RTC_IRQP_READ = 0x8008700b
|
||||
RTC_IRQP_SET = 0x4008700c
|
||||
RTC_PARAM_GET = 0x40187013
|
||||
RTC_PARAM_SET = 0x40187014
|
||||
RTC_PIE_OFF = 0x7006
|
||||
RTC_PIE_ON = 0x7005
|
||||
RTC_PLL_GET = 0x80207011
|
||||
|
@ -328,6 +330,7 @@ const (
|
|||
SO_RCVTIMEO = 0x14
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x14
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -257,6 +257,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x4004700e
|
||||
RTC_IRQP_READ = 0x8004700b
|
||||
RTC_IRQP_SET = 0x4004700c
|
||||
RTC_PARAM_GET = 0x40187013
|
||||
RTC_PARAM_SET = 0x40187014
|
||||
RTC_PIE_OFF = 0x7006
|
||||
RTC_PIE_ON = 0x7005
|
||||
RTC_PLL_GET = 0x801c7011
|
||||
|
@ -334,6 +336,7 @@ const (
|
|||
SO_RCVTIMEO = 0x14
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x14
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -247,6 +247,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x4008700e
|
||||
RTC_IRQP_READ = 0x8008700b
|
||||
RTC_IRQP_SET = 0x4008700c
|
||||
RTC_PARAM_GET = 0x40187013
|
||||
RTC_PARAM_SET = 0x40187014
|
||||
RTC_PIE_OFF = 0x7006
|
||||
RTC_PIE_ON = 0x7005
|
||||
RTC_PLL_GET = 0x80207011
|
||||
|
@ -324,6 +326,7 @@ const (
|
|||
SO_RCVTIMEO = 0x14
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x14
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -250,6 +250,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x8004700e
|
||||
RTC_IRQP_READ = 0x4004700b
|
||||
RTC_IRQP_SET = 0x8004700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x401c7011
|
||||
|
@ -327,6 +329,7 @@ const (
|
|||
SO_RCVTIMEO = 0x1006
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x1006
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x4
|
||||
SO_REUSEPORT = 0x200
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -250,6 +250,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x8008700e
|
||||
RTC_IRQP_READ = 0x4008700b
|
||||
RTC_IRQP_SET = 0x8008700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x40207011
|
||||
|
@ -327,6 +329,7 @@ const (
|
|||
SO_RCVTIMEO = 0x1006
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x1006
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x4
|
||||
SO_REUSEPORT = 0x200
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -250,6 +250,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x8008700e
|
||||
RTC_IRQP_READ = 0x4008700b
|
||||
RTC_IRQP_SET = 0x8008700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x40207011
|
||||
|
@ -327,6 +329,7 @@ const (
|
|||
SO_RCVTIMEO = 0x1006
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x1006
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x4
|
||||
SO_REUSEPORT = 0x200
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -250,6 +250,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x8004700e
|
||||
RTC_IRQP_READ = 0x4004700b
|
||||
RTC_IRQP_SET = 0x8004700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x401c7011
|
||||
|
@ -327,6 +329,7 @@ const (
|
|||
SO_RCVTIMEO = 0x1006
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x1006
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x4
|
||||
SO_REUSEPORT = 0x200
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -305,6 +305,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x8004700e
|
||||
RTC_IRQP_READ = 0x4004700b
|
||||
RTC_IRQP_SET = 0x8004700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x401c7011
|
||||
|
@ -382,6 +384,7 @@ const (
|
|||
SO_RCVTIMEO = 0x12
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x12
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -309,6 +309,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x8008700e
|
||||
RTC_IRQP_READ = 0x4008700b
|
||||
RTC_IRQP_SET = 0x8008700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x40207011
|
||||
|
@ -386,6 +388,7 @@ const (
|
|||
SO_RCVTIMEO = 0x12
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x12
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -309,6 +309,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x8008700e
|
||||
RTC_IRQP_READ = 0x4008700b
|
||||
RTC_IRQP_SET = 0x8008700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x40207011
|
||||
|
@ -386,6 +388,7 @@ const (
|
|||
SO_RCVTIMEO = 0x12
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x12
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -238,6 +238,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x4008700e
|
||||
RTC_IRQP_READ = 0x8008700b
|
||||
RTC_IRQP_SET = 0x4008700c
|
||||
RTC_PARAM_GET = 0x40187013
|
||||
RTC_PARAM_SET = 0x40187014
|
||||
RTC_PIE_OFF = 0x7006
|
||||
RTC_PIE_ON = 0x7005
|
||||
RTC_PLL_GET = 0x80207011
|
||||
|
@ -315,6 +317,7 @@ const (
|
|||
SO_RCVTIMEO = 0x14
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x14
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -313,6 +313,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x4008700e
|
||||
RTC_IRQP_READ = 0x8008700b
|
||||
RTC_IRQP_SET = 0x4008700c
|
||||
RTC_PARAM_GET = 0x40187013
|
||||
RTC_PARAM_SET = 0x40187014
|
||||
RTC_PIE_OFF = 0x7006
|
||||
RTC_PIE_ON = 0x7005
|
||||
RTC_PLL_GET = 0x80207011
|
||||
|
@ -390,6 +392,7 @@ const (
|
|||
SO_RCVTIMEO = 0x14
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x14
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -304,6 +304,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x8008700e
|
||||
RTC_IRQP_READ = 0x4008700b
|
||||
RTC_IRQP_SET = 0x8008700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x40207011
|
||||
|
@ -381,6 +383,7 @@ const (
|
|||
SO_RCVTIMEO = 0x2000
|
||||
SO_RCVTIMEO_NEW = 0x44
|
||||
SO_RCVTIMEO_OLD = 0x2000
|
||||
SO_RESERVE_MEM = 0x52
|
||||
SO_REUSEADDR = 0x4
|
||||
SO_REUSEPORT = 0x200
|
||||
SO_RXQ_OVFL = 0x24
|
||||
|
|
|
@ -445,4 +445,5 @@ const (
|
|||
SYS_LANDLOCK_RESTRICT_SELF = 446
|
||||
SYS_MEMFD_SECRET = 447
|
||||
SYS_PROCESS_MRELEASE = 448
|
||||
SYS_FUTEX_WAITV = 449
|
||||
)
|
||||
|
|
|
@ -367,4 +367,5 @@ const (
|
|||
SYS_LANDLOCK_RESTRICT_SELF = 446
|
||||
SYS_MEMFD_SECRET = 447
|
||||
SYS_PROCESS_MRELEASE = 448
|
||||
SYS_FUTEX_WAITV = 449
|
||||
)
|
||||
|
|
|
@ -409,4 +409,5 @@ const (
|
|||
SYS_LANDLOCK_ADD_RULE = 445
|
||||
SYS_LANDLOCK_RESTRICT_SELF = 446
|
||||
SYS_PROCESS_MRELEASE = 448
|
||||
SYS_FUTEX_WAITV = 449
|
||||
)
|
||||
|
|
|
@ -312,4 +312,5 @@ const (
|
|||
SYS_LANDLOCK_RESTRICT_SELF = 446
|
||||
SYS_MEMFD_SECRET = 447
|
||||
SYS_PROCESS_MRELEASE = 448
|
||||
SYS_FUTEX_WAITV = 449
|
||||
)
|
||||
|
|
|
@ -429,4 +429,5 @@ const (
|
|||
SYS_LANDLOCK_ADD_RULE = 4445
|
||||
SYS_LANDLOCK_RESTRICT_SELF = 4446
|
||||
SYS_PROCESS_MRELEASE = 4448
|
||||
SYS_FUTEX_WAITV = 4449
|
||||
)
|
||||
|
|
|
@ -359,4 +359,5 @@ const (
|
|||
SYS_LANDLOCK_ADD_RULE = 5445
|
||||
SYS_LANDLOCK_RESTRICT_SELF = 5446
|
||||
SYS_PROCESS_MRELEASE = 5448
|
||||
SYS_FUTEX_WAITV = 5449
|
||||
)
|
||||
|
|
|
@ -359,4 +359,5 @@ const (
|
|||
SYS_LANDLOCK_ADD_RULE = 5445
|
||||
SYS_LANDLOCK_RESTRICT_SELF = 5446
|
||||
SYS_PROCESS_MRELEASE = 5448
|
||||
SYS_FUTEX_WAITV = 5449
|
||||
)
|
||||
|
|
|
@ -429,4 +429,5 @@ const (
|
|||
SYS_LANDLOCK_ADD_RULE = 4445
|
||||
SYS_LANDLOCK_RESTRICT_SELF = 4446
|
||||
SYS_PROCESS_MRELEASE = 4448
|
||||
SYS_FUTEX_WAITV = 4449
|
||||
)
|
||||
|
|
|
@ -436,4 +436,5 @@ const (
|
|||
SYS_LANDLOCK_ADD_RULE = 445
|
||||
SYS_LANDLOCK_RESTRICT_SELF = 446
|
||||
SYS_PROCESS_MRELEASE = 448
|
||||
SYS_FUTEX_WAITV = 449
|
||||
)
|
||||
|
|
|
@ -408,4 +408,5 @@ const (
|
|||
SYS_LANDLOCK_ADD_RULE = 445
|
||||
SYS_LANDLOCK_RESTRICT_SELF = 446
|
||||
SYS_PROCESS_MRELEASE = 448
|
||||
SYS_FUTEX_WAITV = 449
|
||||
)
|
||||
|
|
|
@ -408,4 +408,5 @@ const (
|
|||
SYS_LANDLOCK_ADD_RULE = 445
|
||||
SYS_LANDLOCK_RESTRICT_SELF = 446
|
||||
SYS_PROCESS_MRELEASE = 448
|
||||
SYS_FUTEX_WAITV = 449
|
||||
)
|
||||
|
|
|
@ -310,4 +310,5 @@ const (
|
|||
SYS_LANDLOCK_ADD_RULE = 445
|
||||
SYS_LANDLOCK_RESTRICT_SELF = 446
|
||||
SYS_PROCESS_MRELEASE = 448
|
||||
SYS_FUTEX_WAITV = 449
|
||||
)
|
||||
|
|
|
@ -373,4 +373,5 @@ const (
|
|||
SYS_LANDLOCK_ADD_RULE = 445
|
||||
SYS_LANDLOCK_RESTRICT_SELF = 446
|
||||
SYS_PROCESS_MRELEASE = 448
|
||||
SYS_FUTEX_WAITV = 449
|
||||
)
|
||||
|
|
|
@ -387,4 +387,5 @@ const (
|
|||
SYS_LANDLOCK_ADD_RULE = 445
|
||||
SYS_LANDLOCK_RESTRICT_SELF = 446
|
||||
SYS_PROCESS_MRELEASE = 448
|
||||
SYS_FUTEX_WAITV = 449
|
||||
)
|
||||
|
|
|
@ -1144,7 +1144,8 @@ const (
|
|||
PERF_RECORD_BPF_EVENT = 0x12
|
||||
PERF_RECORD_CGROUP = 0x13
|
||||
PERF_RECORD_TEXT_POKE = 0x14
|
||||
PERF_RECORD_MAX = 0x15
|
||||
PERF_RECORD_AUX_OUTPUT_HW_ID = 0x15
|
||||
PERF_RECORD_MAX = 0x16
|
||||
PERF_RECORD_KSYMBOL_TYPE_UNKNOWN = 0x0
|
||||
PERF_RECORD_KSYMBOL_TYPE_BPF = 0x1
|
||||
PERF_RECORD_KSYMBOL_TYPE_OOL = 0x2
|
||||
|
@ -1784,7 +1785,8 @@ const (
|
|||
|
||||
const (
|
||||
NF_NETDEV_INGRESS = 0x0
|
||||
NF_NETDEV_NUMHOOKS = 0x1
|
||||
NF_NETDEV_EGRESS = 0x1
|
||||
NF_NETDEV_NUMHOOKS = 0x2
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -3166,7 +3168,13 @@ const (
|
|||
DEVLINK_ATTR_RELOAD_ACTION_INFO = 0xa2
|
||||
DEVLINK_ATTR_RELOAD_ACTION_STATS = 0xa3
|
||||
DEVLINK_ATTR_PORT_PCI_SF_NUMBER = 0xa4
|
||||
DEVLINK_ATTR_MAX = 0xa9
|
||||
DEVLINK_ATTR_RATE_TYPE = 0xa5
|
||||
DEVLINK_ATTR_RATE_TX_SHARE = 0xa6
|
||||
DEVLINK_ATTR_RATE_TX_MAX = 0xa7
|
||||
DEVLINK_ATTR_RATE_NODE_NAME = 0xa8
|
||||
DEVLINK_ATTR_RATE_PARENT_NODE_NAME = 0xa9
|
||||
DEVLINK_ATTR_REGION_MAX_SNAPSHOTS = 0xaa
|
||||
DEVLINK_ATTR_MAX = 0xaa
|
||||
DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE = 0x0
|
||||
DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX = 0x1
|
||||
DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT = 0x0
|
||||
|
@ -3463,7 +3471,14 @@ const (
|
|||
ETHTOOL_MSG_CABLE_TEST_ACT = 0x1a
|
||||
ETHTOOL_MSG_CABLE_TEST_TDR_ACT = 0x1b
|
||||
ETHTOOL_MSG_TUNNEL_INFO_GET = 0x1c
|
||||
ETHTOOL_MSG_USER_MAX = 0x21
|
||||
ETHTOOL_MSG_FEC_GET = 0x1d
|
||||
ETHTOOL_MSG_FEC_SET = 0x1e
|
||||
ETHTOOL_MSG_MODULE_EEPROM_GET = 0x1f
|
||||
ETHTOOL_MSG_STATS_GET = 0x20
|
||||
ETHTOOL_MSG_PHC_VCLOCKS_GET = 0x21
|
||||
ETHTOOL_MSG_MODULE_GET = 0x22
|
||||
ETHTOOL_MSG_MODULE_SET = 0x23
|
||||
ETHTOOL_MSG_USER_MAX = 0x23
|
||||
ETHTOOL_MSG_KERNEL_NONE = 0x0
|
||||
ETHTOOL_MSG_STRSET_GET_REPLY = 0x1
|
||||
ETHTOOL_MSG_LINKINFO_GET_REPLY = 0x2
|
||||
|
@ -3494,7 +3509,14 @@ const (
|
|||
ETHTOOL_MSG_CABLE_TEST_NTF = 0x1b
|
||||
ETHTOOL_MSG_CABLE_TEST_TDR_NTF = 0x1c
|
||||
ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY = 0x1d
|
||||
ETHTOOL_MSG_KERNEL_MAX = 0x22
|
||||
ETHTOOL_MSG_FEC_GET_REPLY = 0x1e
|
||||
ETHTOOL_MSG_FEC_NTF = 0x1f
|
||||
ETHTOOL_MSG_MODULE_EEPROM_GET_REPLY = 0x20
|
||||
ETHTOOL_MSG_STATS_GET_REPLY = 0x21
|
||||
ETHTOOL_MSG_PHC_VCLOCKS_GET_REPLY = 0x22
|
||||
ETHTOOL_MSG_MODULE_GET_REPLY = 0x23
|
||||
ETHTOOL_MSG_MODULE_NTF = 0x24
|
||||
ETHTOOL_MSG_KERNEL_MAX = 0x24
|
||||
ETHTOOL_A_HEADER_UNSPEC = 0x0
|
||||
ETHTOOL_A_HEADER_DEV_INDEX = 0x1
|
||||
ETHTOOL_A_HEADER_DEV_NAME = 0x2
|
||||
|
|
|
@ -363,6 +363,8 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
|||
//sys SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error)
|
||||
//sys GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error)
|
||||
//sys SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error)
|
||||
//sys GetActiveProcessorCount(groupNumber uint16) (ret uint32)
|
||||
//sys GetMaximumProcessorCount(groupNumber uint16) (ret uint32)
|
||||
|
||||
// Volume Management Functions
|
||||
//sys DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW
|
||||
|
|
|
@ -3172,3 +3172,5 @@ type ModuleInfo struct {
|
|||
SizeOfImage uint32
|
||||
EntryPoint uintptr
|
||||
}
|
||||
|
||||
const ALL_PROCESSOR_GROUPS = 0xFFFF
|
||||
|
|
|
@ -226,6 +226,7 @@ var (
|
|||
procFreeLibrary = modkernel32.NewProc("FreeLibrary")
|
||||
procGenerateConsoleCtrlEvent = modkernel32.NewProc("GenerateConsoleCtrlEvent")
|
||||
procGetACP = modkernel32.NewProc("GetACP")
|
||||
procGetActiveProcessorCount = modkernel32.NewProc("GetActiveProcessorCount")
|
||||
procGetCommTimeouts = modkernel32.NewProc("GetCommTimeouts")
|
||||
procGetCommandLineW = modkernel32.NewProc("GetCommandLineW")
|
||||
procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW")
|
||||
|
@ -251,6 +252,7 @@ var (
|
|||
procGetLogicalDriveStringsW = modkernel32.NewProc("GetLogicalDriveStringsW")
|
||||
procGetLogicalDrives = modkernel32.NewProc("GetLogicalDrives")
|
||||
procGetLongPathNameW = modkernel32.NewProc("GetLongPathNameW")
|
||||
procGetMaximumProcessorCount = modkernel32.NewProc("GetMaximumProcessorCount")
|
||||
procGetModuleFileNameW = modkernel32.NewProc("GetModuleFileNameW")
|
||||
procGetModuleHandleExW = modkernel32.NewProc("GetModuleHandleExW")
|
||||
procGetNamedPipeHandleStateW = modkernel32.NewProc("GetNamedPipeHandleStateW")
|
||||
|
@ -1967,6 +1969,12 @@ func GetACP() (acp uint32) {
|
|||
return
|
||||
}
|
||||
|
||||
func GetActiveProcessorCount(groupNumber uint16) (ret uint32) {
|
||||
r0, _, _ := syscall.Syscall(procGetActiveProcessorCount.Addr(), 1, uintptr(groupNumber), 0, 0)
|
||||
ret = uint32(r0)
|
||||
return
|
||||
}
|
||||
|
||||
func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procGetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0)
|
||||
if r1 == 0 {
|
||||
|
@ -2169,6 +2177,12 @@ func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err er
|
|||
return
|
||||
}
|
||||
|
||||
func GetMaximumProcessorCount(groupNumber uint16) (ret uint32) {
|
||||
r0, _, _ := syscall.Syscall(procGetMaximumProcessorCount.Addr(), 1, uintptr(groupNumber), 0, 0)
|
||||
ret = uint32(r0)
|
||||
return
|
||||
}
|
||||
|
||||
func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) {
|
||||
r0, _, e1 := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size))
|
||||
n = uint32(r0)
|
||||
|
|
|
@ -281,7 +281,7 @@ github.com/julz/importas
|
|||
# github.com/k-sone/critbitgo v1.4.0
|
||||
## explicit
|
||||
github.com/k-sone/critbitgo
|
||||
# github.com/kardianos/service v1.2.0
|
||||
# github.com/kardianos/service v1.2.1
|
||||
## explicit; go 1.12
|
||||
github.com/kardianos/service
|
||||
# github.com/kisielk/errcheck v1.6.0
|
||||
|
@ -546,7 +546,7 @@ golang.org/x/mod/internal/lazyregexp
|
|||
golang.org/x/mod/modfile
|
||||
golang.org/x/mod/module
|
||||
golang.org/x/mod/semver
|
||||
# golang.org/x/net v0.0.0-20211216030914-fe4d6282115f
|
||||
# golang.org/x/net v0.0.0-20220111093109-d55c255bac03
|
||||
## explicit; go 1.17
|
||||
golang.org/x/net/bpf
|
||||
golang.org/x/net/http/httpguts
|
||||
|
@ -559,7 +559,7 @@ golang.org/x/net/internal/socks
|
|||
golang.org/x/net/ipv4
|
||||
golang.org/x/net/ipv6
|
||||
golang.org/x/net/proxy
|
||||
# golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
|
||||
# golang.org/x/sys v0.0.0-20220111092808-5a964db01320
|
||||
## explicit; go 1.17
|
||||
golang.org/x/sys/cpu
|
||||
golang.org/x/sys/execabs
|
||||
|
|
Loading…
Reference in New Issue