- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我知道如果unix进程派生,则子进程可以使用父进程的fd。这是继承:但不是相反。
尽管unix的高级编程 Material 说,如果我们使用unix域套接字,则不仅可以将fd从子级转移到父级,而且还可以在进程之间转移。
这很奇怪:
an fd is only meaningful within one process, in different process, same fd value could mean very different.
Then how could unix domain socket really transfer fds between processes? I mean the integer (4 bytes) can be transferred by any means, but it doesn't seem to make sence that one process can operate another process's fd?
最佳答案
您应该真正尝试一下。就像在unix(7)的手册页中所说的那样:
SCM_RIGHTS
Send or receive a set of open file descriptors from another
process. The data portion contains an integer array of the
file descriptors. The passed file descriptors behave as
though they have been created with dup(2).
这意味着接收到的fds不等于按数字发送的fds,它们就像是新创建的fds,但是从内核的角度来看,它们实际上是同一回事。
关于sockets - 为什么可以使用unix域套接字将fd从 child 转移到父亲?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46500936/
正如我不断发现的那样,有各种各样的文件描述符——几乎所有的东西都是围绕文件描述符抽象出来的:常规文件、套接字、信号和计时器(例如)。所有文件描述符都只是整数。 给定一个文件描述符,是否可以知道它是什么
socket fd 长什么样子? 什么是 socket fd ?粗糙的来讲,就是网络 fd,比如我们最常见的 C/S 客户端服务端的编程模式,就是网络通信的一种方式。撇开底层
如果我调用了shutdown(fd,SHUT_RDWR),但没有调用close(fd),会发生什么? inline void CSocket::close() { if (_socket_fd
我有以下结构: struct myfds_for_nic { int fd1; int fd2; int fd3; int fd4; int fd5;
fd 是否有等价于 fseek 的东西?我已经使用 int fds 很长时间了,想使用 fseek...但我知道没有搜索功能。 提前致谢! 最佳答案 参见 POSIX 函数 lseek(2) : SY
我正在使用 Clojure 的 core.logic CLP(FD) 库(core.logic 版本 0.8.3)开发一种简单的方形打包算法。 正方形的表示方式如下: [[[x11 y11] [x12
我正在学习 linux 操作系统,我有一个关于管道的问题。 我想实现一个管道。 所以我定义了int fd[2]; 但是为什么fd[0]是读而fd[1]是写呢? 0代表stdin吗? (我认为是写)而1
我知道进程的pid,需要获取它使用的socketfd,所以在/proc/$pid/中查找fd,例如: $ ls -la /proc/1442/fd | grep socket lrwx------ 1
我正在检查当前 fatrace 的源代码。 调用fanotify获取数据值的主循环如下: res = read (fan_fd, buffer, 4096); ... data
Docker daemon documentation建议大多数设置使用以下 hosts 选项: dockerd -H fd:// 我猜 fd 代表文件描述符。我不明白 fd 如何用于套接字通信。 我
在执行之前:os.read(fd,1024) 我想检查是否会有输出,而不是挂起直到收到输出。由于 fd 是一个 int 对象,我不能这样做: os.fstat(f.fileno()).st_size
我有一个程序 ( https://github.com/raboof/connbeat ) 依赖于 /proc/[pid]/fd/* 来查找给定(网络)inode 的进程。 /proc/[pid]/f
#define STACK_SIZE (1024 * 1024) static char container_stack[STACK_SIZE]; char* const container_args
inotify file in C 我看过下面的代码用来调用 (void) inotify_rm_watch(fd, wd); (void) close(fd); 为什么不呢? inotify_rm_
下面的小 C 程序(我们称之为 pointless): /* pointless.c */ #include #include void main(){ write(STDOUT_FILENO
考虑这个代码示例: #include #include #include int main() { //this file exists and contains data: "ABCD
在父进程中close(fd[1]);, 为什么它会跳过第一个 fd[1](替换为父 STD_OUT)并在子进程中关闭 fd[1]? #define STD_INPUT 0 #define STD_OU
需要使用代理设置运行模拟器,我在命令提示符下使用以下命令来启动模拟器 emulator -avd AVD_for_3_7_WVGA_Nexus_One -http-proxy http://usern
我正在 appcelerator studio 中创建应用程序。在我向其添加 admob 模块之前,它在我的 Android 6 Lenovo a7000 上正常运行。现在我收到这些错误: [ERRO
我不明白必须如何解决以下问题。非常感谢任何帮助学习如何解决这个问题的人! Consider Relation Schema R = {ABCDEFG} with a set of Functional
我是一名优秀的程序员,十分优秀!