Go 中的 Unix FIFO?
有没有办法用Go语言创建unix FIFO? os
包中没有 Mkfifo
和 Mknod
,尽管我预计命名 FIFO 主要用于 posix 操作系统。事实上,有一个创建未命名的 FIFO(管道)的函数,但没有创建命名管道的函数。
我是唯一需要它们的人吗?
Is there any way to create a unix FIFO with Go language? There is no Mkfifo
, nor Mknod
in os
package, though I expected named FIFOs are largely used in posix OS's. In fact, there is a function for creating an unnamed FIFO (pipe), but no function for creating named pipes.
Am I the only one who needs them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了让它在 Linux 上工作,我简单地做了一个
它似乎成功了。
这里是底层 mknod() 调用的参考
In order to get it to work on Linux, I simply did a
It seemed to do the trick.
Here is a reference for the underlying mknod() call
有一个
Mkfifo
,但它位于syscall
中-package :)搜索源代码给我的感觉是,除了 OS X 和 FreeBSD 之外,它在任何其他平台上都不可用:http://www.google .com/codesearch#search&q=Mkfifo+package:http://go%5C.googlecode%5C.com
我没有准备好测试的 unix 机器。如果您想构建一个为您导出的 C 接口包,您可以使用
cgo
。There is a
Mkfifo
, but it's in thesyscall
-package :)Searching through the source gives me the feeling it's not available on anything but OS X and FreeBSD though: http://www.google.com/codesearch#search&q=Mkfifo+package:http://go%5C.googlecode%5C.com
I don't have a unix machine ready to test with. You can use
cgo
if you like to build a C-interface package which exports it for you.