types_linux.go
types_linux.go - Overview
This file provides type conversions and utility functions specific to Linux's epoll
system for the iomultiplexer
package. It facilitates the conversion between generic event and operation types defined in the iomultiplexer
package and their corresponding Linux-specific representations using the syscall
package.
Detailed Documentation
newTime
Purpose: Converts a time.Duration
to an integer representing milliseconds, suitable for use with Linux system calls.
Parameters:
t
(time.Duration
): The duration to convert.
Returns:
int
: The duration in milliseconds as an integer. Returns -1 if the input duration is negative.
Event.toNative
Purpose: Converts a generic Event
to a Linux-specific syscall.EpollEvent
.
Parameters:
e
(Event
): The generic event to convert.
Returns:
syscall.EpollEvent
: The Linux-specific epoll event.
newEvent
Purpose: Converts a Linux-specific syscall.EpollEvent
to a generic Event
.
Parameters:
ePEvent
(syscall.EpollEvent
): The Linux-specific epoll event to convert.
Returns:
Event
: The generic event.
Operations.toNative
Purpose: Converts generic Operations
to a Linux-specific uint32
representation for epoll events.
Parameters:
op
(Operations
): The generic operations to convert.
Returns:
uint32
: The Linux-specific representation of the operations.
newOperations
Purpose: Converts a Linux-specific uint32
representation of epoll events to generic Operations
.
Parameters:
events
(uint32
): The Linux-specific representation of the events.
Returns:
Operations
: The generic operations.