Lines Matching refs:fd
35 int fd;
45 fd = socket(AF_UNIX, SOCK_STREAM, 0);
46 if (fd == -1) {
50 if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
51 close(fd);
55 return fd;
63 write_all(int fd, const void *buf, size_t len)
67 int n = write(fd, buf, len);
80 read_all(int fd, void *buf, size_t len)
84 int n = read(fd, buf, len);
97 send_packet(int fd, const char *buf, uint32_t len)
100 if (write_all(fd, &net_len, sizeof(net_len)) != sizeof(net_len)) return -1;
101 if (write_all(fd, buf, len) != len) return -1;
109 recv_packet(int fd, char **buf, uint32_t *len)
111 if (read_all(fd, len, sizeof(*len)) != sizeof(*len)) return -1;
114 if (read_all(fd, *buf, *len) != *len) {
146 int fd, sendlen;
183 fd = ux_socket_connect(full_socket);
185 if (fd != -1) {
197 if (send_packet(fd, (char *)&samba_pkt, offsetof(struct samba_key_in, pkt) + LEN_PKT_NOMAC) != 0) {
199 close(fd);
203 if (recv_packet(fd, &reply, &reply_len) != 0) {
207 close(fd);
236 close(fd);