mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-04-20 23:36:29 -04:00
fix setioprio on mac
This commit is contained in:
parent
7696b625e9
commit
8021c541f4
@ -16,8 +16,6 @@ import (
|
||||
"path"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -97,7 +95,7 @@ func (c *Client) setIOPriority() error {
|
||||
prioVal := ((targetClass & ioPrioClassMask) << ioPrioClassShift) | (targetPrio & ioPrioPrioMask)
|
||||
|
||||
// see https://man7.org/linux/man-pages/man2/ioprio_set.2.html
|
||||
ret, _, errno := unix.Syscall(unix.SYS_IOPRIO_SET, ioPrioWhoProcess, uintptr(pid), uintptr(prioVal))
|
||||
ret, _, errno := setioprio(ioPrioWhoProcess, uintptr(pid), uintptr(prioVal))
|
||||
if ret != 0 {
|
||||
return fmt.Errorf("setting I/O priority for etcd: %w", errno)
|
||||
}
|
||||
|
17
bootstrapper/internal/etcdio/setioprio_cross.go
Normal file
17
bootstrapper/internal/etcdio/setioprio_cross.go
Normal file
@ -0,0 +1,17 @@
|
||||
//go:build !linux
|
||||
|
||||
/*
|
||||
Copyright (c) Edgeless Systems GmbH
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package etcdio
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func setioprio(_, _, _ uintptr) (uintptr, uintptr, syscall.Errno) {
|
||||
panic("setioprio not implemented on non-Linux platforms")
|
||||
}
|
19
bootstrapper/internal/etcdio/setioprio_linux.go
Normal file
19
bootstrapper/internal/etcdio/setioprio_linux.go
Normal file
@ -0,0 +1,19 @@
|
||||
//go:build linux
|
||||
|
||||
/*
|
||||
Copyright (c) Edgeless Systems GmbH
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package etcdio
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func setioprio(ioPrioWhoProcess, pid, prioVal uintptr) (uintptr, uintptr, syscall.Errno) {
|
||||
return unix.Syscall(unix.SYS_IOPRIO_SET, ioPrioWhoProcess, pid, prioVal)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user