]> git.saurik.com Git - apple/libinfo.git/blob - rpc.subproj/pmap_wakeup.c
Libinfo-222.4.9.tar.gz
[apple/libinfo.git] / rpc.subproj / pmap_wakeup.c
1 #include <sys/socket.h>
2 #include <sys/un.h>
3 #include <string.h>
4 #include <unistd.h>
5 #include <stdbool.h>
6
7 #include "pmap_wakeup.h"
8
9 void pmap_wakeup(void)
10 {
11 struct sockaddr_un sun;
12 int fd;
13 char b;
14
15 memset(&sun, 0, sizeof(sun));
16
17 sun.sun_family = AF_UNIX;
18 strcpy(sun.sun_path, "/var/run/portmap.socket");
19
20 fd = socket(AF_UNIX, SOCK_STREAM, 0);
21 if (fd == -1)
22 return;
23
24 if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) {
25 close(fd);
26 return;
27 }
28
29 read(fd, &b, sizeof(b));
30 close(fd);
31 }