3843921cf08933a4e6212f0e31e3762452b69456
4 #include <sys/socket.h>
10 #define UNIX_PATH_MAX 108
11 #define SOCK_DIR "/tmp/socks"
12 #define UST_SIGNAL SIGIO
14 static void signal_process(pid_t pid
)
18 result
= kill(pid
, UST_SIGNAL
);
27 int send_message(pid_t pid
, const char *msg
, const char *reply
)
31 struct sockaddr_un addr
;
34 result
= fd
= socket(PF_UNIX
, SOCK_DGRAM
, 0);
40 addr
.sun_family
= AF_UNIX
;
42 result
= snprintf(addr
.sun_path
, UNIX_PATH_MAX
, "%s/%d", SOCK_DIR
, pid
);
43 if(result
>= UNIX_PATH_MAX
) {
44 fprintf(stderr
, "string overflow allocating socket name");
48 asprintf(&buf
, "%s\n", msg
);
52 result
= sendto(fd
, buf
, strlen(buf
), 0, (struct sockaddr
*)&addr
, sizeof(addr
));
This page took 0.031692 seconds and 3 git commands to generate.