code.hybscloud.com/iofd
Package iofd provides minimal file descriptor abstractions and specialized Linux handles for the Go ecosystem. It serves as the canonical handle abstraction for high-performance I/O systems. Zero-Overhead: All kernel interactions use code.hybscloud.com/zcall exclusively, bypassing Go's standard library syscall hooks. This eliminates runtime scheduler overhead in hot paths. Atomic Lifecycle: FD uses atomic operations for concurrent-safe access. Close() is idempotent and can be called multiple times safely. Non-Blocking Default: Constructors default to O_NONBLOCK | O_CLOEXEC. Operations return iox.ErrWouldBlock when they would block. The core FD type works on all Unix platforms. Specialized handles (EventFD, TimerFD, PidFD, MemFD, SignalFD) require Linux. Basic EventFD usage: Timer example: Atomic Operations: All FD access uses atomic load/store. Multiple goroutines can safely call Valid(), Raw(), and Close() concurrently. Valid Check: Always check Valid() or handle ErrClosed before performing operations on potentially closed descriptors. Close Idempotency: Close() can be called multiple times safely. After Close(), Raw() returns -1 and operations return ErrClosed. MappedRegion Lifetime: When using MemFD.Mmap(), the returned MappedRegion's Bytes() slice is only valid while the region is mapped. Call Unmap() when done. This package depends on: Package iofd provides minimal file descriptor abstractions and specialized Linux handles for the Go ecosystem. It serves as the common denominator for kernel resource lifecycle management. All kernel interactions use code.hybscloud.com/zcall exclusively, bypassing Go's standard library syscall hooks for zero-overhead operation.
proxy.golang.org
v0.3.4
21 days ago
8
Links
| Registry | proxy.golang.org |
| Homepage | Homepage |
| Docs | Documentation |
| JSON API | View JSON |
| CodeMeta | codemeta.json |
Package Details
| PURL |
pkg:golang/code.hybscloud.com/iofd
spec |
| License | MIT |
| Namespace | code.hybscloud.com |
| First Release | 3 months ago |
| Last Synced | 6 days ago |