Lines Matching full:fd

48 	int fd = POINTER_TO_INT(can_fd);  in tx()  local
65 ret = send(fd, &sframe, sizeof(sframe), 0); in tx()
77 int fd, ret; in create_socket() local
79 fd = socket(AF_CAN, SOCK_RAW, CAN_RAW); in create_socket()
80 if (fd < 0) { in create_socket()
81 LOG_ERR("Cannot create %s CAN socket (%d)", "2nd", fd); in create_socket()
82 return fd; in create_socket()
89 ret = bind(fd, (struct sockaddr *)&can_addr, sizeof(can_addr)); in create_socket()
92 (void)close(fd); in create_socket()
96 (void)setsockopt(fd, SOL_CAN_RAW, CAN_RAW_FILTER, sfilter, in create_socket()
99 return fd; in create_socket()
108 int fd = POINTER_TO_INT(can_fd); in rx() local
115 LOG_DBG("[%d] Waiting CAN data...", fd); in rx()
123 ret = recvfrom(fd, &sframe, sizeof(struct socketcan_frame), in rx()
126 LOG_ERR("[%d] Cannot receive CAN frame (%d)", fd, in rx()
134 fd, in rx()
140 LOG_INF("[%d] EXT Remote frame received", fd); in rx()
154 (void)close(fd); in rx()
158 fd = create_socket(sfilter); in rx()
159 if (fd < 0) { in rx()
175 int fd, rx_fd; in setup_socket() local
186 fd = socket(AF_CAN, SOCK_RAW, CAN_RAW); in setup_socket()
187 if (fd < 0) { in setup_socket()
196 ret = bind(fd, (struct sockaddr *)&can_addr, sizeof(can_addr)); in setup_socket()
203 ret = setsockopt(fd, SOL_CAN_RAW, CAN_RAW_FILTER, &sock_filter, in setup_socket()
214 tx, INT_TO_POINTER(fd), in setup_socket()
225 LOG_INF("1st RX fd %d", fd); in setup_socket()
227 rx_fd = fd; in setup_socket()
230 fd = create_socket(&sock_filter); in setup_socket()
231 if (fd >= 0) { in setup_socket()
235 INT_TO_POINTER(fd), in setup_socket()
245 LOG_INF("2nd RX fd %d", fd); in setup_socket()
247 LOG_ERR("2nd RX not created (%d)", fd); in setup_socket()
259 (void)close(fd); in setup_socket()
267 int fd; in main() local
286 fd = setup_socket(); in main()
287 if (fd < 0) { in main()
288 LOG_ERR("Cannot start CAN application (%d)", fd); in main()
292 rx(INT_TO_POINTER(fd), NULL, NULL); in main()