从 FUSE 文件系统访问数据
有什么方法可以访问 FUSE 文件系统进程创建的数据吗? 例如 在 prefix_write() 中,我将一些数据存储在内存中,并希望从另一个进程访问这些数据。
共享内存应该可以工作。但我正在寻找一种更优雅的解决方案,例如我作为其他进程的函数访问的fuse_operations 中的自定义字段。但据我所知,fuse_operations 中的字段需要来自 POSIX,因此可能不可能这样做。如果我错了,请纠正我。
谢谢
Is there any way that I can access the data created by my FUSE filesystem process?
e.g.
in prefix_write() I store some data in memory and would like to access those data from another process.
Shared memory should work. But I'm looking for a more elegant solution, such as a custom field in fuse_operations that I access as a function from other processes. But as far as I know, the fields in fuse_operations need to be from POSIX, so it's probably impossible to do so. Please correct me if I'm wrong.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您所说的另一个进程是由另一个进程派生的进程。如果是,那么发送数据应该很容易。在fork之前创建一个管道,然后fork,这样管道返回的fd就会被子进程继承。然后您可以使用这些文件描述符进行双向数据传输。
如果您的用例不是这样,那么您能否说明为什么您希望外部进程访问另一个进程的数据?
The other process that you are speaking of, is it a process forked by another process. If yes then it should be pretty easy to send data. Before forking create a pipe and then fork, so the fd's returned by the pipe are inherited by the child process. You can then use these fd's for bi-directional data transfer.
If your use case is not this, then can you illustrate why do you want a foreign process to access another processes data?