Lines Matching refs:fd
247 int fd;
250 fd = open(path, O_RDONLY, 0);
251 if (fd < 0)
254 cnt = read(fd, buf, sz - 1);
263 close(fd);
267 if (fd >= 0)
268 close(fd);
488 static int handle_uevent_fd(struct charger *charger, int fd)
493 if (fd < 0)
499 n = uevent_kernel_multicast_recv(fd, msg, UEVENT_MSG_LEN);
515 static int uevent_callback(int fd, short revents, void *data)
521 return handle_uevent_fd(charger, fd);
530 int dfd, fd;
534 fd = openat(dfd, "uevent", O_WRONLY);
535 if (fd >= 0) {
536 write(fd, event, strlen(event));
537 close(fd);
554 fd = openat(dfd, de->d_name, O_RDONLY | O_DIRECTORY);
555 if (fd < 0) {
561 d2 = fdopendir(fd);
563 close(fd);
894 static int input_callback(int fd, short revents, void *data)
900 ret = ev_get_input(fd, revents, &ev);
932 int fd;
949 fd = uevent_open_socket(64*1024, true);
950 if (fd >= 0) {
951 fcntl(fd, F_SETFL, O_NONBLOCK);
952 ev_add_fd(fd, uevent_callback, charger);
954 charger->uevent_fd = fd;