Lines Matching refs:fd

208 fd_read(int  fd, void*  to, int  len)  in fd_read()  argument
213 ret = read(fd, to, len); in fd_read()
220 fd_write(int fd, const void* from, int len) in fd_write() argument
225 ret = write(fd, from, len); in fd_write()
232 fd_setnonblock(int fd) in fd_setnonblock() argument
237 flags = fcntl(fd, F_GETFD); in fd_setnonblock()
242 __FUNCTION__, fd, strerror(errno) ); in fd_setnonblock()
246 ret = fcntl(fd, F_SETFD, flags | O_NONBLOCK); in fd_setnonblock()
251 __FUNCTION__, fd, strerror(errno) ); in fd_setnonblock()
257 fd_accept(int fd) in fd_accept() argument
264 ret = accept(fd, &from, &fromlen); in fd_accept()
323 int fd; member
369 looper_find( Looper* l, int fd ) in looper_find() argument
375 if (hook->fd == fd) in looper_find()
400 epoll_ctl( l->epoll_fd, EPOLL_CTL_MOD, hook->fd, &ev ); in looper_grow()
408 looper_add( Looper* l, int fd, EventFunc func, void* user ) in looper_add() argument
418 hook->fd = fd; in looper_add()
425 fd_setnonblock(fd); in looper_add()
429 epoll_ctl( l->epoll_fd, EPOLL_CTL_ADD, fd, &ev ); in looper_add()
437 looper_del( Looper* l, int fd ) in looper_del() argument
439 LoopHook* hook = looper_find( l, fd ); in looper_del()
442 D( "%s: invalid fd: %d", __FUNCTION__, fd ); in looper_del()
448 epoll_ctl( l->epoll_fd, EPOLL_CTL_DEL, fd, NULL ); in looper_del()
456 looper_enable( Looper* l, int fd, int events ) in looper_enable() argument
458 LoopHook* hook = looper_find( l, fd ); in looper_enable()
461 D("%s: invalid fd: %d", __FUNCTION__, fd ); in looper_enable()
472 epoll_ctl( l->epoll_fd, EPOLL_CTL_MOD, fd, &ev ); in looper_enable()
481 looper_disable( Looper* l, int fd, int events ) in looper_disable() argument
483 LoopHook* hook = looper_find( l, fd ); in looper_disable()
486 D("%s: invalid fd: %d", __FUNCTION__, fd ); in looper_disable()
497 epoll_ctl( l->epoll_fd, EPOLL_CTL_MOD, fd, &ev ); in looper_disable()
556 epoll_ctl( l->epoll_fd, EPOLL_CTL_MOD, hook->fd, &ev ); in looper_loop()
749 int fd; member
839 if (f->fd >= 0) { in fdhandler_close()
840 looper_del( f->list->looper, f->fd ); in fdhandler_close()
841 close(f->fd); in fdhandler_close()
842 f->fd = -1; in fdhandler_close()
887 looper_enable( f->list->looper, f->fd, EPOLLOUT ); in fdhandler_enqueue()
909 if ((len = fd_read(f->fd, p->data, MAX_PAYLOAD)) < 0) { in fdhandler_event()
921 D("%s: disconnect on fd %d", __FUNCTION__, f->fd); in fdhandler_event()
931 if ((len = fd_write(f->fd, p->data + f->out_pos, avail)) < 0) { in fdhandler_event()
941 looper_disable( f->list->looper, f->fd, EPOLLOUT ); in fdhandler_event()
951 fdhandler_new( int fd, in fdhandler_new() argument
957 f->fd = fd; in fdhandler_new()
966 looper_add( list->looper, fd, (EventFunc) fdhandler_event, f ); in fdhandler_new()
967 looper_enable( list->looper, fd, EPOLLIN ); in fdhandler_new()
984 D("%s: accepting on fd %d", __FUNCTION__, f->fd); in fdhandler_accept_event()
987 p->channel = fd_accept(f->fd); in fdhandler_accept_event()
998 D("%s: closing accept fd %d", __FUNCTION__, f->fd); in fdhandler_accept_event()
1010 fdhandler_new_accept( int fd, in fdhandler_new_accept() argument
1016 f->fd = fd; in fdhandler_new_accept()
1022 looper_add( list->looper, fd, (EventFunc) fdhandler_accept_event, f ); in fdhandler_new_accept()
1023 looper_enable( list->looper, fd, EPOLLIN ); in fdhandler_new_accept()
1024 listen( fd, 5 ); in fdhandler_new_accept()
1184 int fd, in serial_init() argument
1196 s->fdhandler = fdhandler_new( fd, list, &recv ); in serial_init()
1252 funcname, c, c->fdhandler->fd, in client_dump()
1328 T("%s: client %p (%d)", __FUNCTION__, c, c->fdhandler->fd); in client_fd_close()
1383 int fd, in client_new() argument
1402 c->fdhandler = fdhandler_new( fd, pfdhandlers, &recv ); in client_new()
1597 int fd = p->channel; in multiplexer_control_accept() local
1598 Client* client = client_new( m, fd, m->fdhandlers, &m->clients ); in multiplexer_control_accept()
1600 D("created client %p listening on fd %d", client, fd); in multiplexer_control_accept()
1615 int fd, control_fd; in multiplexer_init() local
1624 fd = open(serial_dev, O_RDWR); in multiplexer_init()
1625 } while (fd < 0 && errno == EINTR); in multiplexer_init()
1627 if (fd < 0) { in multiplexer_init()
1634 tcgetattr( fd, &ios ); in multiplexer_init()
1636 tcsetattr( fd, TCSANOW, &ios ); in multiplexer_init()
1644 serial_init( m->serial, fd, m->fdhandlers, &recv ); in multiplexer_init()
1651 fd = android_get_control_socket(CONTROL_SOCKET_NAME); in multiplexer_init()
1652 if (fd < 0) { in multiplexer_init()
1656 fdhandler_new_accept( fd, m->fdhandlers, &recv ); in multiplexer_init()
1678 int fd, len; in main() local
1682 fd = open( "/proc/cmdline", O_RDONLY ); in main()
1683 if (fd < 0) { in main()
1689 len = fd_read( fd, buff, sizeof(buff)-1 ); in main()
1690 close(fd); in main()