]>
Commit | Line | Data |
---|---|---|
c29f2fcc A |
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 | ||
b3dd680f | 9 | int pmap_wakeup(void) |
c29f2fcc A |
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) | |
b3dd680f | 22 | return -1; |
c29f2fcc A |
23 | |
24 | if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) { | |
25 | close(fd); | |
b3dd680f | 26 | return -1; |
c29f2fcc A |
27 | } |
28 | ||
29 | read(fd, &b, sizeof(b)); | |
30 | close(fd); | |
b3dd680f | 31 | return 0; |
c29f2fcc | 32 | } |