{"id":34644027,"url":"https://github.com/hayabusa-cloud/iofd","last_synced_at":"2026-02-17T07:59:23.753Z","repository":{"id":330309892,"uuid":"1120493416","full_name":"hayabusa-cloud/iofd","owner":"hayabusa-cloud","description":"Universal file descriptor abstractions for Unix systems in Go","archived":false,"fork":false,"pushed_at":"2026-02-06T09:02:26.000Z","size":177,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-06T15:35:32.920Z","etag":null,"topics":["fd","golang","unix"],"latest_commit_sha":null,"homepage":"https://code.hybscloud.com/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hayabusa-cloud.png","metadata":{"files":{"readme":"README.es.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"hayabusa-cloud"}},"created_at":"2025-12-21T10:41:49.000Z","updated_at":"2026-02-06T08:44:32.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/hayabusa-cloud/iofd","commit_stats":null,"previous_names":["hayabusa-cloud/iofd"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/hayabusa-cloud/iofd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hayabusa-cloud%2Fiofd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hayabusa-cloud%2Fiofd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hayabusa-cloud%2Fiofd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hayabusa-cloud%2Fiofd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hayabusa-cloud","download_url":"https://codeload.github.com/hayabusa-cloud/iofd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hayabusa-cloud%2Fiofd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29537178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T05:00:25.817Z","status":"ssl_error","status_checked_at":"2026-02-17T04:57:16.126Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fd","golang","unix"],"created_at":"2025-12-24T17:34:47.305Z","updated_at":"2026-02-17T07:59:23.740Z","avatar_url":"https://github.com/hayabusa-cloud.png","language":"Go","funding_links":["https://github.com/sponsors/hayabusa-cloud"],"categories":[],"sub_categories":[],"readme":"# iofd\r\n\r\n[![Go Reference](https://pkg.go.dev/badge/code.hybscloud.com/iofd.svg)](https://pkg.go.dev/code.hybscloud.com/iofd)\r\n[![Go Report Card](https://goreportcard.com/badge/github.com/hayabusa-cloud/iofd)](https://goreportcard.com/report/github.com/hayabusa-cloud/iofd)\r\n[![Codecov](https://codecov.io/gh/hayabusa-cloud/iofd/graph/badge.svg)](https://codecov.io/gh/hayabusa-cloud/iofd)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n\r\nAbstracciones universales de descriptores de archivo para sistemas Unix en Go.\r\n\r\nIdioma: [English](./README.md) | [简体中文](./README.zh-CN.md) | **Español** | [日本語](./README.ja.md) | [Français](./README.fr.md)\r\n\r\n## Descripción General\r\n\r\n`iofd` proporciona abstracciones mínimas de descriptores de archivo y handles especializados de Linux para el ecosistema Go. Sirve como la abstracción canónica de handles para sistemas de E/S de alto rendimiento.\r\n\r\n### Características Principales\r\n\r\n- **Cero Sobrecarga**: Todas las interacciones con el kernel via ensamblador `zcall`, evitando los hooks de syscall de Go\r\n- **Handles Especializados**: `EventFD`, `TimerFD`, `PidFD`, `MemFD`, `SignalFD` específicos de Linux\r\n- **Núcleo Multiplataforma**: Las operaciones base de `FD` funcionan en Linux, Darwin y FreeBSD\r\n\r\n## Instalación\r\n\r\n```bash\r\ngo get code.hybscloud.com/iofd\r\n```\r\n\r\n## Inicio Rápido\r\n\r\n```go\r\nefd, _ := iofd.NewEventFD(0)\r\nefd.Signal(1)\r\nval, _ := efd.Wait() // val == 1\r\nefd.Close()\r\n```\r\n\r\n## API\r\n\r\n### Tipos Principales\r\n\r\n| Tipo | Descripción |\r\n|------|-------------|\r\n| `FD` | Descriptor de archivo universal con operaciones atómicas |\r\n| `EventFD` | eventfd de Linux para señalización entre hilos |\r\n| `TimerFD` | timerfd de Linux para temporizadores de alta resolución |\r\n| `PidFD` | pidfd de Linux para gestión de procesos sin condiciones de carrera |\r\n| `MemFD` | memfd de Linux para archivos anónimos respaldados por memoria |\r\n| `MappedRegion` | Región de memoria mapeada para acceso sin copia |\r\n| `SignalFD` | signalfd de Linux para manejo síncrono de señales |\r\n\r\n### Interfaces\r\n\r\n| Interfaz | Métodos | Descripción |\r\n|----------|---------|-------------|\r\n| `PollFd` | `Fd() int` | Descriptor de archivo consultable |\r\n| `PollCloser` | `Fd()`, `Close()` | Descriptor consultable cerrable |\r\n| `Handle` | `Fd()`, `Close()`, `Read()`, `Write()` | Handle de E/S completo |\r\n| `Signaler` | `Signal()`, `Wait()` | Mecanismo de señalización |\r\n| `Timer` | `Arm()`, `Disarm()`, `Read()` | Handle de temporizador |\r\n\r\n### Operaciones de FD\r\n\r\n```go\r\n// Crear FD desde descriptor raw\r\nfd := iofd.NewFD(rawFd)\r\n\r\n// Operaciones atómicas\r\nfd.Raw()           // Obtener valor int32 raw\r\nfd.Valid()         // Verificar si es válido (no negativo)\r\nfd.Close()         // Cierre idempotente\r\n\r\n// Operaciones de E/S\r\nfd.Read(buf)       // Leer bytes\r\nfd.Write(buf)      // Escribir bytes\r\n\r\n// Flags del descriptor\r\nfd.SetNonblock(true)   // Establecer O_NONBLOCK\r\nfd.SetCloexec(true)    // Establecer FD_CLOEXEC\r\nfd.Dup()               // Duplicar con CLOEXEC\r\n```\r\n\r\n### Mapeo de Memoria MemFD\r\n\r\n```go\r\n// Crear memfd y establecer tamaño\r\nmfd, _ := iofd.NewMemFD(\"buffer\")\r\nmfd.Truncate(4096)\r\n\r\n// Mapear para acceso sin copia\r\nregion, _ := mfd.Mmap(4096, iofd.PROT_READ|iofd.PROT_WRITE)\r\ndata := region.Bytes()  // []byte respaldado por memoria compartida\r\ncopy(data, []byte(\"hello\"))\r\n\r\n// Limpieza\r\nregion.Unmap()\r\nmfd.Close()\r\n```\r\n\r\n## Arquitectura\r\n\r\n```\r\n┌─────────────────────────────────────────────────────────┐\r\n│                   Capa de Aplicación                     │\r\n├─────────────────────────────────────────────────────────┤\r\n│  EventFD │ TimerFD │ MemFD │ PidFD │ SignalFD │   FD   │\r\n├─────────────────────────────────────────────────────────┤\r\n│                        iofd                              │\r\n├─────────────────────────────────────────────────────────┤\r\n│                       zcall                              │\r\n│              (syscalls de cero sobrecarga)               │\r\n├─────────────────────────────────────────────────────────┤\r\n│                    Kernel Linux                          │\r\n└─────────────────────────────────────────────────────────┘\r\n```\r\n\r\n## Soporte de Plataformas\r\n\r\n| Plataforma | FD Núcleo | EventFD | TimerFD | PidFD | MemFD | SignalFD |\r\n|------------|-----------|---------|---------|-------|-------|----------|\r\n| Linux/amd64 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |\r\n| Linux/arm64 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |\r\n| Darwin/arm64 | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |\r\n| FreeBSD/amd64 | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |\r\n\r\n**Nota**: Los handles especializados (`EventFD`, `TimerFD`, etc.) son primitivas del kernel específicas de Linux. En Darwin y FreeBSD, solo el tipo `FD` núcleo está disponible.\r\n\r\n## Consideraciones de Seguridad\r\n\r\n- **Operaciones Atómicas**: Todo acceso a FD usa carga/almacenamiento atómico para seguridad concurrente\r\n- **Verificación de Validez**: Use `Valid()` antes de operaciones en descriptores potencialmente cerrados\r\n- **Idempotencia de Close**: `Close()` puede llamarse múltiples veces de forma segura\r\n- **Vida Útil de MappedRegion**: El slice `Bytes()` solo es válido mientras la región esté mapeada\r\n\r\n## Licencia\r\n\r\nMIT — ver [LICENSE](./LICENSE).\r\n\r\n©2025 Hayabusa Cloud Co., Ltd.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhayabusa-cloud%2Fiofd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhayabusa-cloud%2Fiofd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhayabusa-cloud%2Fiofd/lists"}