交叉内存重视。我如何从一个子进程的远程地址,父进程 [英] cross memory attach. How do I get the remote address from a child process to a parent process

查看:359
本文介绍了交叉内存重视。我如何从一个子进程的远程地址,父进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Linux内核3.2版本,并进一步呼吁一种能力交叉内存重视。

Linux Kernel version 3.2 and further have a capability called cross memory attach.

下面是链接到它。我是不是能够得到很多的帮助在此方面。
http://man7.org/linux/man-pages/man2/process_vm_readv .2.html

Here is the link to it. I was not able to get a lot of help in that regard. http://man7.org/linux/man-pages/man2/process_vm_readv.2.html

在语法,我们需要在这里我们要写入或读取远程存储的地址。我的问题是如何得到这个偏远的内存地址,如果我使用fork()的。

In the syntax we need the address of the remote memory where we want to write to or read from. My question is how do I get the address of this remote memory if I am using fork().

假设我使用交叉内存连接发送从父进程的东西子进程。我如何在远程存储的地址发送给从子进程的父进程?

Suppose I am sending something from parent process to child process using cross memory attach. How do I send the address of the remote memory to the parent process from the child process?

推荐答案

系统调用 process_vm_readv process_vm_writev 是意味着进程之间的快速数据传送。它们应该除了用于进程间通信的一些传统方式。

The system calls process_vm_readv and process_vm_writev are meant for fast data transfer between processes. They are supposed to be used in addition to some traditional way of interprocess communication.

例如,你可以使用常规的管道或FIFO您进程之间传送所需的地址。然后,你可以使用这些地址来建立更快 process_vm _ 通信。以派生进程之间传递东西的simpliest方式应该是管道()函数(人2管有一个很好的例子它的用法)。还有很多其他的方法可以做到这样的过程中,像使用套接字或消息。你甚至可以写一个地址到一个文件中,并让其他进程读取它。

For example, you may use a regular pipe or fifo to transfer the required addresses between your processes. Then you may use those addresses to establish faster process_vm_ communication. The simpliest way to transfer something between forked processes should be the pipe() function (man 2 pipe has a good example of its usage). There are many other ways to do so of course, like using sockets or messages. You can even write an address to a file and let the other process read it.

这篇关于交叉内存重视。我如何从一个子进程的远程地址,父进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆