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
This commit is contained in:
JianFeeeee
2026-09-10 11:42:22 +08:00
parent 79d18136f6
commit 09c8bce59c
7 changed files with 291 additions and 60 deletions

View File

@ -11,11 +11,10 @@ func (h *Host) procEnvForShm() []string { return nil }
//
// 顺序即 fd 编号(cmd.ExtraFiles[0] → 子进程 fd 3):
//
// fd 3 = StageContext 段
// fd 4 = 事件环段
// fd 5 = 事件通知(eventfd / pipe 读端)
// 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.evtRingFd, h.evtfd}
return []*os.File{h.memfd, h.evtfd}
}