OS X 是否有与 FreeBSD 的 make_dev() 函数等效的函数?
我正在尝试将一些代码从 FreeBSD 移植到 OS X。该代码相当低级,它使用 make_dev()
并使用诸如 ioctl()
。
理想情况下,我希望我的代码尽可能接近原始代码,以便将来可以更轻松地合并上游更改:我的问题是,有没有办法在 OS X 上创建此类设备文件?根据 wikipedia 该平台支持该习惯用法。有人能指出我正确的方向吗?
I'm trying to port some code from FreeBSD to OS X. The code is fairly low-level and it creates a number of special device files using make_dev()
and controls functionality using functions like ioctl()
.
Ideally I'd like to keep my code as close to the original as possible so I can more easily merge upstream changes in the future: my question is, is there a way to create such device files on OS X? According to wikipedia the idiom is supported on the platform. Can someone point me in the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据文档,
mknod
可以在 OS X 上运行。您在使用它时遇到什么问题?Per the docs,
mknod
does work on OS X. What problems are you having with it?我想我已经回答了我自己的问题:似乎执行此操作的函数是 devfs_make_node() 。我找不到手册页,但它显示在一些示例代码中 这里。
I think I've answered my own question: it seems the function to do this is
devfs_make_node()
. I can't find a man page but it is shown in some example code here.