Files
HomeAgent/internal/plugin/proc/shmpass_unix.go
JianFeeeee ad016e4410 feat(shm): 统一共享内存区域(§13.1) — 单 memfd 容纳 SuperBlock+StageContext+EvtRing
- unified.go: SuperBlock 布局 + SharedRef 类型
- NewHost(): 两段 memfd 合并为单一 memfd,fd 3 = 统一区域,fd 4 = eventfd
- 子进程侧: testdata 插件从 SuperBlock 解析 ctxOff/evtOff
- streaming 测试: EvtConsumer 协程在 host.Close 前 Stop+Wait 防 SIGSEGV
2026-09-10 11:42:22 +08:00

21 lines
647 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//go:build linux || darwin || freebsd
package proc
import "os"
// procEnvForShm 在 Unix 返回 nil段经继承 fd 传递,无需环境变量。
func (h *Host) procEnvForShm() []string { return nil }
// procExtraFilesForShm 返回经 ExtraFiles 传给子进程的 fd 列表。
//
// 顺序即 fd 编号cmd.ExtraFiles[0] → 子进程 fd 3
//
// fd 3 = 统一共享内存区域SuperBlock + StageContext + EvtRing
// fd 4 = 事件通知eventfd / pipe 读端)
//
// 插件侧模板 z_proc_shm_unix.go 的常量与此严格对应。
func (h *Host) procExtraFilesForShm() []*os.File {
return []*os.File{h.memfd, h.evtfd}
}