I have used the setns system call in linux to set the current go process's NET namespace. This namespace changes the way /sys/class/net appears to the current process. However, If I try to view these files with the golang apis, I see only the parent's view (not namespaced). I think this is because go is forking without inheriting the parent's namespace. How can I read the files in /sys/class/net with go such that the setns system call persists in the child who is reading the file.
1条回答 默认 最新
- douxuanma4357 2019-06-14 23:39关注
turns out this a known 'wontfix' issue in go: https://github.com/golang/go/issues/8676
the workaround I found was to use cgo to fork in a c function exposed to go runtime and then call setns.
解决 无用评论 打赏 举报
悬赏问题
- ¥15 ubuntu虚拟机打包apk错误
- ¥199 rust编程架构设计的方案 有偿
- ¥15 回答4f系统的像差计算
- ¥15 java如何提取出pdf里的文字?
- ¥100 求三轴之间相互配合画圆以及直线的算法
- ¥100 c语言,请帮蒟蒻写一个题的范例作参考
- ¥15 名为“Product”的列已属于此 DataTable
- ¥15 安卓adb backup备份应用数据失败
- ¥15 eclipse运行项目时遇到的问题
- ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发