-static int send_message_path(const char *path, const char *msg, int signalpid)
-{
- int fd;
- int result;
- struct sockaddr_un addr;
-
- result = fd = socket(PF_UNIX, SOCK_STREAM, 0);
- if(result == -1) {
- PERROR("socket");
- return -1;
- }
-
- addr.sun_family = AF_UNIX;
-
- result = snprintf(addr.sun_path, UNIX_PATH_MAX, "%s", path);
- if(result >= UNIX_PATH_MAX) {
- ERR("string overflow allocating socket name");
- return -1;
- }
-
- if(signalpid >= 0) {
- result = signal_process(signalpid);
- if(result == -1) {
- ERR("could not signal process");
- return -1;
- }
- }
-
- result = connect(fd, (struct sockaddr *)&addr, sizeof(addr));
- if(result == -1) {
- PERROR("connect");
- return -1;
- }
-
- return send_message_fd(fd, msg);
-}
-
-///* pid: the pid of the trace process that must receive the msg
-// msg: pointer to a null-terminated message to send
-// reply: location where to put the null-terminated string of the reply;
-// it must be free'd after usage
-// */
-//
-//int send_message_pid(pid_t pid, const char *msg, char **reply)
-//{
-// int result;
-// char path[UNIX_PATH_MAX];
-//
-// result = snprintf(path, UNIX_PATH_MAX, "%s/%d", SOCK_DIR, pid);
-// if(result >= UNIX_PATH_MAX) {
-// fprintf(stderr, "string overflow allocating socket name");
-// return -1;
-// }
-//
-// send_message_path(path, msg, reply, pid);
-//
-// return 0;
-//}
-