call.c
来自「AUPE的源代码」· C语言 代码 · 共 30 行
C
30 行
#include "call.h"
#include <sys/uio.h> /* struct iovec */
/* Place the call by sending the "args" to the calling server,
* and reading a file descriptor back. */
int
call(const char *args)
{
int csfd, len;
struct iovec iov[2];
/* create connection to conn server */
if ( (csfd = cli_conn(CS_CALL)) < 0)
err_sys("cli_conn error");
iov[0].iov_base = CL_CALL " ";
iov[0].iov_len = strlen(CL_CALL) + 1;
iov[1].iov_base = (char *) args;
iov[1].iov_len = strlen(args) + 1;
/* null at end of args always sent */
len = iov[0].iov_len + iov[1].iov_len;
if (writev(csfd, &iov[0], 2) != len)
err_sys("writev error");
/* read back descriptor */
/* returned errors handled by write() */
return( recv_fd(csfd, write) );
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?