Lines Matching refs:fd
51 int fd; in setransd_open() local
53 fd = socket(PF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0); in setransd_open()
54 if (fd < 0 && errno == EINVAL) in setransd_open()
57 fd = socket(PF_UNIX, SOCK_STREAM, 0); in setransd_open()
58 if (fd >= 0) in setransd_open()
59 if (fcntl(fd, F_SETFD, FD_CLOEXEC)) { in setransd_open()
60 close(fd); in setransd_open()
64 if (fd < 0) in setransd_open()
70 if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { in setransd_open()
71 close(fd); in setransd_open()
75 return fd; in setransd_open()
80 send_request(int fd, uint32_t function, const char *data1, const char *data2) in send_request() argument
89 if (fd < 0) in send_request()
118 while (((count = sendmsg(fd, &msgh, MSG_NOSIGNAL)) < 0) in send_request()
128 receive_response(int fd, uint32_t function, char **outdata, int32_t * ret_val) in receive_response() argument
137 if (fd < 0) in receive_response()
147 while (((count = readv(fd, resp_hdr, 3)) < 0) && (errno == EINTR)) ; in receive_response()
165 while (((count = readv(fd, &resp_data, 1))) < 0 && (errno == EINTR)) ; in receive_response()
179 int fd; in raw_to_trans_context() local
183 fd = setransd_open(); in raw_to_trans_context()
184 if (fd < 0) in raw_to_trans_context()
185 return fd; in raw_to_trans_context()
187 ret = send_request(fd, RAW_TO_TRANS_CONTEXT, raw, NULL); in raw_to_trans_context()
191 ret = receive_response(fd, RAW_TO_TRANS_CONTEXT, transp, &ret_val); in raw_to_trans_context()
197 close(fd); in raw_to_trans_context()
205 int fd; in trans_to_raw_context() local
209 fd = setransd_open(); in trans_to_raw_context()
210 if (fd < 0) in trans_to_raw_context()
211 return fd; in trans_to_raw_context()
212 ret = send_request(fd, TRANS_TO_RAW_CONTEXT, trans, NULL); in trans_to_raw_context()
216 ret = receive_response(fd, TRANS_TO_RAW_CONTEXT, rawp, &ret_val); in trans_to_raw_context()
222 close(fd); in trans_to_raw_context()
230 int fd; in raw_context_to_color() local
232 fd = setransd_open(); in raw_context_to_color()
233 if (fd < 0) in raw_context_to_color()
234 return fd; in raw_context_to_color()
236 ret = send_request(fd, RAW_CONTEXT_TO_COLOR, raw, NULL); in raw_context_to_color()
240 ret = receive_response(fd, RAW_CONTEXT_TO_COLOR, colors, &ret_val); in raw_context_to_color()
246 close(fd); in raw_context_to_color()