unix

package
v0.0.0-...-4f74137 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

README

A temporary shim for "golang.org/x/sys/unix" until v0.27.0 is cut.

We can't simply update go.mod with pre-release version of the package because of the dependency management approach Fedora has for building RPMs from Go sources.

Documentation

Index

Constants

View Source
const (
	HWTSTAMP_FILTER_NONE            = 0x0 //nolint:revive
	HWTSTAMP_FILTER_ALL             = 0x1 //nolint:revive
	HWTSTAMP_FILTER_SOME            = 0x2 //nolint:revive
	HWTSTAMP_FILTER_PTP_V1_L4_EVENT = 0x3 //nolint:revive
	HWTSTAMP_FILTER_PTP_V2_L4_EVENT = 0x6 //nolint:revive
	HWTSTAMP_FILTER_PTP_V2_L2_EVENT = 0x9 //nolint:revive
	HWTSTAMP_FILTER_PTP_V2_EVENT    = 0xc //nolint:revive
)
View Source
const (
	HWTSTAMP_TX_OFF          = 0x0 //nolint:revive
	HWTSTAMP_TX_ON           = 0x1 //nolint:revive
	HWTSTAMP_TX_ONESTEP_SYNC = 0x2 //nolint:revive
)
View Source
const (
	PTP_CLK_MAGIC             = '='        //nolint:revive
	PTP_ENABLE_FEATURE        = 0x1        //nolint:revive
	PTP_EXTTS_EDGES           = 0x6        //nolint:revive
	PTP_EXTTS_EVENT_VALID     = 0x1        //nolint:revive
	PTP_EXTTS_V1_VALID_FLAGS  = 0x7        //nolint:revive
	PTP_EXTTS_VALID_FLAGS     = 0x1f       //nolint:revive
	PTP_EXT_OFFSET            = 0x10       //nolint:revive
	PTP_FALLING_EDGE          = 0x4        //nolint:revive
	PTP_MAX_SAMPLES           = 0x19       //nolint:revive
	PTP_PEROUT_DUTY_CYCLE     = 0x2        //nolint:revive
	PTP_PEROUT_ONE_SHOT       = 0x1        //nolint:revive
	PTP_PEROUT_PHASE          = 0x4        //nolint:revive
	PTP_PEROUT_V1_VALID_FLAGS = 0x0        //nolint:revive
	PTP_PEROUT_VALID_FLAGS    = 0x7        //nolint:revive
	PTP_PIN_GETFUNC           = 0xc0603d06 //nolint:revive
	PTP_PIN_GETFUNC2          = 0xc0603d0f //nolint:revive
	PTP_RISING_EDGE           = 0x2        //nolint:revive
	PTP_STRICT_FLAGS          = 0x8        //nolint:revive
	PTP_SYS_OFFSET_EXTENDED   = 0xc4c03d09 //nolint:revive
	PTP_SYS_OFFSET_EXTENDED2  = 0xc4c03d12 //nolint:revive
	PTP_SYS_OFFSET_PRECISE    = 0xc0403d08 //nolint:revive
	PTP_SYS_OFFSET_PRECISE2   = 0xc0403d11 //nolint:revive
)
View Source
const (
	PTP_PF_NONE    = iota //nolint:revive
	PTP_PF_EXTTS          //nolint:revive
	PTP_PF_PEROUT         //nolint:revive
	PTP_PF_PHYSYNC        //nolint:revive
)
View Source
const (
	AF_INET                       = unix.AF_INET             //nolint:revive
	EAGAIN                        = unix.EAGAIN              //nolint:revive
	EINVAL                        = unix.EINVAL              //nolint:revive
	ENOENT                        = unix.ENOENT              //nolint:revive
	ENOTSUP                       = unix.ENOTSUP             //nolint:revive
	ETHTOOL_GET_TS_INFO           = unix.ETHTOOL_GET_TS_INFO //nolint:revive
	IFNAMSIZ                      = unix.IFNAMSIZ            //nolint:revive
	MSG_ERRQUEUE                  = unix.MSG_ERRQUEUE        //nolint:revive
	POLLERR                       = unix.POLLERR             //nolint:revive
	POLLIN                        = unix.POLLIN
	POLLPRI                       = unix.POLLPRI
	SIOCETHTOOL                   = unix.SIOCETHTOOL   //nolint:revive
	SIOCGHWTSTAMP                 = unix.SIOCGHWTSTAMP //nolint:revive
	SIOCSHWTSTAMP                 = unix.SIOCSHWTSTAMP //nolint:revive
	SizeofPtr                     = unix.SizeofPtr
	SizeofSockaddrInet4           = unix.SizeofSockaddrInet4
	SOCK_DGRAM                    = unix.SOCK_DGRAM                    //nolint:revive
	SOF_TIMESTAMPING_OPT_TSONLY   = unix.SOF_TIMESTAMPING_OPT_TSONLY   //nolint:revive
	SOF_TIMESTAMPING_RAW_HARDWARE = unix.SOF_TIMESTAMPING_RAW_HARDWARE //nolint:revive
	SOF_TIMESTAMPING_RX_HARDWARE  = unix.SOF_TIMESTAMPING_RX_HARDWARE  //nolint:revive
	SOF_TIMESTAMPING_RX_SOFTWARE  = unix.SOF_TIMESTAMPING_RX_SOFTWARE  //nolint:revive
	SOF_TIMESTAMPING_SOFTWARE     = unix.SOF_TIMESTAMPING_SOFTWARE     //nolint:revive
	SOF_TIMESTAMPING_TX_HARDWARE  = unix.SOF_TIMESTAMPING_TX_HARDWARE  //nolint:revive
	SOF_TIMESTAMPING_TX_SOFTWARE  = unix.SOF_TIMESTAMPING_TX_SOFTWARE  //nolint:revive
	SOL_SOCKET                    = unix.SOL_SOCKET                    //nolint:revive
	SO_SELECT_ERR_QUEUE           = unix.SO_SELECT_ERR_QUEUE           //nolint:revive
	SO_TIMESTAMPING_NEW           = unix.SO_TIMESTAMPING_NEW           //nolint:revive
	SO_TIMESTAMPING               = unix.SO_TIMESTAMPING               //nolint:revive
	SYS_CLOCK_SETTIME             = unix.SYS_CLOCK_SETTIME             //nolint:revive
	SYS_IOCTL                     = unix.SYS_IOCTL                     //nolint:revive
	SYS_RECVMSG                   = unix.SYS_RECVMSG                   //nolint:revive
	TIME_OK                       = unix.TIME_OK                       //nolint:revive
)
View Source
const (
	PTP_CLOCK_GETCAPS   = 0x80503d01 //nolint:revive
	PTP_CLOCK_GETCAPS2  = 0x80503d0a //nolint:revive
	PTP_ENABLE_PPS      = 0x40043d04 //nolint:revive
	PTP_ENABLE_PPS2     = 0x40043d0d //nolint:revive
	PTP_EXTTS_REQUEST   = 0x40103d02 //nolint:revive
	PTP_EXTTS_REQUEST2  = 0x40103d0b //nolint:revive
	PTP_MASK_CLEAR_ALL  = 0x3d13     //nolint:revive
	PTP_MASK_EN_SINGLE  = 0x40043d14 //nolint:revive
	PTP_PEROUT_REQUEST  = 0x40383d03 //nolint:revive
	PTP_PEROUT_REQUEST2 = 0x40383d0c //nolint:revive
	PTP_PIN_SETFUNC     = 0x40603d07 //nolint:revive
	PTP_PIN_SETFUNC2    = 0x40603d10 //nolint:revive
	PTP_SYS_OFFSET      = 0x43403d05 //nolint:revive
	PTP_SYS_OFFSET2     = 0x43403d0e //nolint:revive
)

Variables

This section is empty.

Functions

func ByteSliceToString

func ByteSliceToString(b []byte) string

func ClockAdjtime

func ClockAdjtime(c int32, t *Timex) (int, error)

func ClockGettime

func ClockGettime(c int32, t *Timespec) error

func ClockSettime

func ClockSettime(clockid int32, time *Timespec) (err error)

ClockSettime calls the CLOCK_SETTIME syscall

func Close

func Close(fd int) (err error)

func ErrnoName

func ErrnoName(e syscall.Errno) string

func FdToClockID

func FdToClockID(fd int) int32

FdToClockID derives the clock ID from the file descriptor number - see clock_gettime(3), FD_TO_CLOCKID macros. The resulting ID is suitable for system calls like ClockGettime.

func IoctlPtpExttsRequest

func IoctlPtpExttsRequest(fd int, r *PtpExttsRequest) error

IoctlPtpExttsRequest configures the external timestamping mode of the PTP I/O pins.

func IoctlPtpPeroutRequest

func IoctlPtpPeroutRequest(fd int, r *PtpPeroutRequest) error

IoctlPtpPeroutRequest configures the periodic output mode of the PTP I/O pins.

func IoctlPtpPinSetfunc

func IoctlPtpPinSetfunc(fd int, pd *PtpPinDesc) error

IoctlPtpPinSetfunc updates configuration of the specified PTP I/O pin.

func IoctlSetHwTstamp

func IoctlSetHwTstamp(fd int, ifname string, cfg *HwTstampConfig) error

IoctlSetHwTstamp updates the hardware timestamping configuration for the network device specified by ifname.

func Poll

func Poll(f []PollFd, t int) (int, error)

func SetsockoptInt

func SetsockoptInt(a, b, c, d int) error

func Socket

func Socket(domain, typ, proto int) (fd int, err error)

func Uname

func Uname(s *Utsname) error

Types

type Cmsghdr

type Cmsghdr = unix.Cmsghdr

type Errno

type Errno = unix.Errno

func Syscall

func Syscall(a, b, c, d uintptr) (uintptr, uintptr, Errno)

type EthtoolTsInfo

type EthtoolTsInfo struct {
	Cmd             uint32
	So_timestamping uint32    //nolint:revive
	Phc_index       int32     //nolint:revive
	Tx_types        uint32    //nolint:revive
	Tx_reserved     [3]uint32 //nolint:revive
	Rx_filters      uint32    //nolint:revive
	Rx_reserved     [3]uint32 //nolint:revive
}

EthtoolTsInfo a struct returned by ETHTOOL_GET_TS_INFO function of SIOCETHTOOL ioctl.

func IoctlGetEthtoolTsInfo

func IoctlGetEthtoolTsInfo(fd int, ifname string) (*EthtoolTsInfo, error)

IoctlGetEthtoolTsInfo fetches ethtool timestamping and PHC association for the network device specified by ifname.

type HwTstampConfig

type HwTstampConfig struct {
	Flags     int32 //nolint:revive
	Tx_type   int32 //nolint:revive
	Rx_filter int32 //nolint:revive
}

HwTstampConfig is used in SIOCGHWTSTAMP and SIOCSHWTSTAMP ioctls

func IoctlGetHwTstamp

func IoctlGetHwTstamp(fd int, ifname string) (*HwTstampConfig, error)

IoctlGetHwTstamp retrieves the hardware timestamping configuration for the network device specified by ifname.

type Ifreq

type Ifreq struct {
	// contains filtered or unexported fields
}

An Ifreq is a type-safe wrapper around the raw ifreq struct. An Ifreq contains an interface name and a union of arbitrary data which can be accessed using the Ifreq's methods. To create an Ifreq, use the NewIfreq function.

func NewIfreq

func NewIfreq(name string) (*Ifreq, error)

NewIfreq creates an Ifreq with the input network interface name

func (*Ifreq) Name

func (ifr *Ifreq) Name() string

Name returns the interface name associated with the Ifreq.

type Msghdr

type Msghdr = unix.Msghdr

type PollFd

type PollFd = unix.PollFd

type PtpClockCaps

type PtpClockCaps struct {
	Max_adj            int32 //nolint:revive
	N_alarm            int32 //nolint:revive
	N_ext_ts           int32 //nolint:revive
	N_per_out          int32 //nolint:revive
	Pps                int32
	N_pins             int32 //nolint:revive
	Cross_timestamping int32 //nolint:revive
	Adjust_phase       int32 //nolint:revive
	Max_phase_adj      int32 //nolint:revive
	Rsv                [11]int32
}

func IoctlPtpClockGetcaps

func IoctlPtpClockGetcaps(fd int) (*PtpClockCaps, error)

IoctlPtpClockGetcaps returns the description of a given PTP device.

type PtpClockTime

type PtpClockTime struct {
	Sec      int64
	Nsec     uint32
	Reserved uint32
}

type PtpExttsEvent

type PtpExttsEvent struct {
	T     PtpClockTime
	Index uint32
	Flags uint32
	Rsv   [2]uint32
}

type PtpExttsRequest

type PtpExttsRequest struct {
	Index uint32
	Flags uint32
	Rsv   [2]uint32
}

type PtpPeroutRequest

type PtpPeroutRequest struct {
	StartOrPhase PtpClockTime
	Period       PtpClockTime
	Index        uint32
	Flags        uint32
	On           PtpClockTime
}

type PtpPinDesc

type PtpPinDesc struct {
	Name  [64]byte
	Index uint32
	Func  uint32
	Chan  uint32
	Rsv   [5]uint32
}

func IoctlPtpPinGetfunc

func IoctlPtpPinGetfunc(fd int, index uint) (*PtpPinDesc, error)

IoctlPtpPinGetfunc returns the configuration of the specified I/O pin on given PTP device.

type PtpSysOffset

type PtpSysOffset struct {
	Samples uint32
	Rsv     [3]uint32
	Ts      [51]PtpClockTime
}

type PtpSysOffsetExtended

type PtpSysOffsetExtended struct {
	Samples uint32
	Rsv     [3]uint32
	Ts      [25][3]PtpClockTime
}

func IoctlPtpSysOffsetExtended

func IoctlPtpSysOffsetExtended(fd int, samples uint) (*PtpSysOffsetExtended, error)

IoctlPtpSysOffsetExtended returns an extended description of the clock offset compared to the system clock. The samples parameter specifies the desired number of measurements.

type PtpSysOffsetPrecise

type PtpSysOffsetPrecise struct {
	Device   PtpClockTime
	Realtime PtpClockTime
	Monoraw  PtpClockTime
	Rsv      [4]uint32
}

func IoctlPtpSysOffsetPrecise

func IoctlPtpSysOffsetPrecise(fd int) (*PtpSysOffsetPrecise, error)

IoctlPtpSysOffsetPrecise returns a description of the clock offset compared to the system clock.

type RawSockaddrInet4

type RawSockaddrInet4 = unix.RawSockaddrInet4

type Sockaddr

type Sockaddr = unix.Sockaddr

func Recvmsg

func Recvmsg(a int, b, c []byte, d int) (int, int, int, Sockaddr, error)

type SockaddrInet4

type SockaddrInet4 = unix.SockaddrInet4

type SockaddrInet6

type SockaddrInet6 = unix.SockaddrInet6

type Timespec

type Timespec = unix.Timespec

func TimeToTimespec

func TimeToTimespec(t time.Time) (Timespec, error)

type Timex

type Timex = unix.Timex

type Utsname

type Utsname = unix.Utsname

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL