Lines Matching refs:sock

137 static void sendpacket(int sock, struct sockaddr *addr, socklen_t addr_len)  in sendpacket()  argument
142 res = sendto(sock, sync, sizeof(sync), 0, in sendpacket()
155 int sock, int recvmsg_flags, in printpacket() argument
261 if (ioctl(sock, SIOCGSTAMP, &tv)) in printpacket()
269 if (ioctl(sock, SIOCGSTAMPNS, &ts)) in printpacket()
278 static void recvpacket(int sock, int recvmsg_flags, in recvpacket() argument
301 res = recvmsg(sock, &msg, recvmsg_flags|MSG_DONTWAIT); in recvpacket()
309 sock, recvmsg_flags, in recvpacket()
325 int sock; in main() local
367 sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); in main()
368 if (sock < 0) in main()
373 if (ioctl(sock, SIOCGIFADDR, &device) < 0) in main()
387 if (ioctl(sock, SIOCSHWTSTAMP, &hwtstamp) < 0) { in main()
403 if (bind(sock, in main()
414 if (setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, in main()
419 if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, in main()
423 if (setsockopt(sock, IPPROTO_IP, IP_MULTICAST_LOOP, in main()
430 setsockopt(sock, SOL_SOCKET, SO_TIMESTAMP, in main()
435 setsockopt(sock, SOL_SOCKET, SO_TIMESTAMPNS, in main()
440 setsockopt(sock, SOL_SOCKET, SO_TIMESTAMPING, in main()
446 if (setsockopt(sock, SOL_IP, IP_PKTINFO, in main()
452 if (getsockopt(sock, SOL_SOCKET, SO_TIMESTAMP, &val, &len) < 0) in main()
457 if (getsockopt(sock, SOL_SOCKET, SO_TIMESTAMPNS, &val, &len) < 0) in main()
463 if (getsockopt(sock, SOL_SOCKET, SO_TIMESTAMPING, &val, &len) < 0) { in main()
494 FD_SET(sock, &readfs); in main()
495 FD_SET(sock, &errorfs); in main()
499 res = select(sock + 1, &readfs, 0, &errorfs, &delta); in main()
506 if (FD_ISSET(sock, &readfs)) in main()
508 if (FD_ISSET(sock, &errorfs)) in main()
510 recvpacket(sock, 0, in main()
513 recvpacket(sock, MSG_ERRQUEUE, in main()
519 sendpacket(sock, in main()