Lines Matching refs:fd
70 int fd, yes = 1, err = -EINVAL; in umcast_open() local
78 fd = socket(AF_INET, SOCK_DGRAM, 0); in umcast_open()
80 if (fd < 0) { in umcast_open()
87 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) { in umcast_open()
96 if (setsockopt(fd, SOL_IP, IP_MULTICAST_TTL, &pri->ttl, in umcast_open()
105 if (setsockopt(fd, SOL_IP, IP_MULTICAST_LOOP, in umcast_open()
115 if (bind(fd, (struct sockaddr *) lsin, sizeof(*lsin)) < 0) { in umcast_open()
126 if (setsockopt(fd, SOL_IP, IP_ADD_MEMBERSHIP, in umcast_open()
140 return fd; in umcast_open()
143 close(fd); in umcast_open()
148 static void umcast_close(int fd, void *data) in umcast_close() argument
158 if (setsockopt(fd, SOL_IP, IP_DROP_MEMBERSHIP, in umcast_close()
165 close(fd); in umcast_close()
168 int umcast_user_write(int fd, void *buf, int len, struct umcast_data *pri) in umcast_user_write() argument
172 return net_sendto(fd, buf, len, data_addr, sizeof(*data_addr)); in umcast_user_write()