Lines Matching refs:fd
155 int fd;
157 fd = adb_open_mode(path, O_WRONLY | O_CREAT | O_EXCL, mode);
158 if(fd < 0 && errno == ENOENT) {
160 fd = adb_open_mode(path, O_WRONLY | O_CREAT | O_EXCL, mode);
162 if(fd < 0 && errno == EEXIST) {
163 fd = adb_open_mode(path, O_WRONLY, mode);
165 if(fd < 0) {
168 fd = -1;
193 if(fd < 0)
195 if(writex(fd, buffer, len)) {
197 adb_close(fd);
199 fd = -1;
205 if(fd >= 0) {
207 adb_close(fd);
220 if(fd >= 0)
221 adb_close(fd);
322 int fd, r;
324 fd = adb_open(path, O_RDONLY);
325 if(fd < 0) {
332 r = adb_read(fd, buffer, SYNC_DATA_MAX);
337 adb_close(fd);
343 adb_close(fd);
348 adb_close(fd);
359 void file_sync_service(int fd, void *cookie)
371 if(readx(fd, &msg.req, sizeof(msg.req))) {
372 fail_message(fd, "command read failure");
377 fail_message(fd, "invalid namelen");
380 if(readx(fd, name, namelen)) {
381 fail_message(fd, "filename read failure");
391 if(do_stat(fd, name)) goto fail;
394 if(do_list(fd, name)) goto fail;
397 if(do_send(fd, name, buffer)) goto fail;
400 if(do_recv(fd, name, buffer)) goto fail;
405 fail_message(fd, "unknown command");
413 adb_close(fd);