Lines Matching refs:fd
48 int fd, opt, ret = -EINVAL; in linux_socketcan_iface_open() local
50 fd = socket(PF_CAN, SOCK_RAW, CAN_RAW); in linux_socketcan_iface_open()
51 if (fd < 0) { in linux_socketcan_iface_open()
60 ret = ioctl(fd, SIOCGIFINDEX, (void *)&ifr); in linux_socketcan_iface_open()
62 close(fd); in linux_socketcan_iface_open()
69 ret = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); in linux_socketcan_iface_open()
71 close(fd); in linux_socketcan_iface_open()
77 ret = setsockopt(fd, SOL_CAN_RAW, CAN_RAW_RECV_OWN_MSGS, &opt, sizeof(opt)); in linux_socketcan_iface_open()
79 close(fd); in linux_socketcan_iface_open()
83 return fd; in linux_socketcan_iface_open()
86 int linux_socketcan_iface_close(int fd) in linux_socketcan_iface_close() argument
88 return close(fd); in linux_socketcan_iface_close()
91 int linux_socketcan_poll_data(int fd) in linux_socketcan_poll_data() argument
99 FD_SET(fd, &rset); in linux_socketcan_poll_data()
104 ret = select(fd + 1, &rset, NULL, NULL, &timeout); in linux_socketcan_poll_data()
108 if (FD_ISSET(fd, &rset)) { in linux_socketcan_poll_data()
116 int linux_socketcan_read_data(int fd, void *buf, size_t buf_len, bool *msg_confirm) in linux_socketcan_read_data() argument
128 int ret = (int)recvmsg(fd, &msg, MSG_WAITALL); in linux_socketcan_read_data()
148 int linux_socketcan_set_mode_fd(int fd, bool mode_fd) in linux_socketcan_set_mode_fd() argument
152 return setsockopt(fd, SOL_CAN_RAW, CAN_RAW_FD_FRAMES, &opt, sizeof(opt)); in linux_socketcan_set_mode_fd()