Lines Matching refs:sock
138 static void sendpacket(int sock, struct sockaddr *addr, socklen_t addr_len)
143 res = sendto(sock, sync, sizeof(sync), 0,
156 int sock, int recvmsg_flags,
264 if (ioctl(sock, SIOCGSTAMP, &tv))
272 if (ioctl(sock, SIOCGSTAMPNS, &ts))
281 static void recvpacket(int sock, int recvmsg_flags,
304 res = recvmsg(sock, &msg, recvmsg_flags|MSG_DONTWAIT);
312 sock, recvmsg_flags,
328 int sock;
372 sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
373 if (sock < 0)
378 if (ioctl(sock, SIOCGIFADDR, &device) < 0)
392 if (ioctl(sock, SIOCSHWTSTAMP, &hwtstamp) < 0) {
408 if (bind(sock,
419 if (setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF,
424 if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
428 if (setsockopt(sock, IPPROTO_IP, IP_MULTICAST_LOOP,
435 setsockopt(sock, SOL_SOCKET, SO_TIMESTAMP,
440 setsockopt(sock, SOL_SOCKET, SO_TIMESTAMPNS,
445 setsockopt(sock, SOL_SOCKET, SO_TIMESTAMPING,
451 if (setsockopt(sock, SOL_IP, IP_PKTINFO,
457 if (getsockopt(sock, SOL_SOCKET, SO_TIMESTAMP, &val, &len) < 0)
462 if (getsockopt(sock, SOL_SOCKET, SO_TIMESTAMPNS, &val, &len) < 0)
468 if (getsockopt(sock, SOL_SOCKET, SO_TIMESTAMPING, &val, &len) < 0) {
499 FD_SET(sock, &readfs);
500 FD_SET(sock, &errorfs);
504 res = select(sock + 1, &readfs, 0, &errorfs, &delta);
511 if (FD_ISSET(sock, &readfs))
513 if (FD_ISSET(sock, &errorfs))
515 recvpacket(sock, 0,
518 recvpacket(sock, MSG_ERRQUEUE,
524 sendpacket(sock,