Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 从内核模块中AF_UNIX套接字的fd获取绝对路径_C_Struct_Linux Kernel_Kernel_Kernel Module - Fatal编程技术网

C 从内核模块中AF_UNIX套接字的fd获取绝对路径

C 从内核模块中AF_UNIX套接字的fd获取绝对路径,c,struct,linux-kernel,kernel,kernel-module,C,Struct,Linux Kernel,Kernel,Kernel Module,给定一个文件描述符,我需要得到它的绝对路径,无论它是常规文件还是AF\u UNIXsocket。at的代码适用于常规文件,但对于AF_UNIXsockets,我得到的是类似于“socket:[12345]”的内容,而不是绝对路径“/tmp/.X11 UNIX/X0” netstat-x通过查阅/proc/net/unix显示unix套接字的完整路径名,该路径由net/unix/af\u unix.c中的unix seq\u show填充。请参见以下操作: 因为它不是常规文件。 struct so

给定一个文件描述符,我需要得到它的绝对路径,无论它是常规文件还是
AF\u UNIX
socket。at的代码适用于常规文件,但对于
AF_UNIX
sockets,我得到的是类似于
“socket:[12345]”
的内容,而不是绝对路径“/tmp/.X11 UNIX/X0”


netstat-x
通过查阅
/proc/net/unix
显示unix套接字的完整路径名,该路径由
net/unix/af\u unix.c
中的
unix seq\u show
填充。请参见以下操作:


因为它不是常规文件。
struct sockaddr_un {
                    unsigned short   sun_family;    // AF_UNIX
                    char            sun_path[108];  // pathname
                    };