Lines Matching +full:1 +full:- +full:sd
4 # SPDX-License-Identifier: BSD-2-Clause
11 # 1. Redistributions of source code must retain the above copyright
33 # "panic: __rw_wlock_hard: recursing but non-recursive rw unp_link_rwlock @
65 int sd, flags, one;
76 err(1, "fork");
80 sd = socket(PF_LOCAL, SOCK_STREAM, 0);
81 if (sd < 0)
82 err(1, "socket");
83 one = 1;
84 if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &one,
86 err(1, "setsockopt");
87 if (bind(sd, (struct sockaddr *)&sun, sizeof(sun)) < 0) {
88 close(sd);
91 if (listen(sd, 10) != 0)
92 err(1, "listen");
94 (void)close(sd);
100 sd = socket(PF_LOCAL, SOCK_STREAM, 0);
101 if (sd < 0)
102 err(1, "socket");
103 if ((flags = fcntl(sd, F_GETFL, 0)) < 0)
104 err(1, "fcntl(F_GETFL)");
106 if (fcntl(sd, F_SETFL, flags) < 0)
107 err(1, "fcntl(F_SETFL)");
108 (void)connect(sd, (struct sockaddr *)&sun, sizeof(sun));
110 (void)close(sd);
117 mycc -o unix_socket_detach -Wall -Wextra -O2 -g unix_socket_detach.c || exit 1
119 rm -f unix_socket_detach.socket
123 rm -f unix_socket_detach.c unix_socket_detach unix_socket_detach.socket