1 /* vi: set sw=4 ts=4 sts=4: */
3 * Nonblocking socket test for uClibc
4 * Copyright (C) 2012 by Kevin Cernekee <cernekee@gmail.com>
6 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
15 #include <sys/types.h>
16 #include <sys/socket.h>
18 #include <sys/fcntl.h>
23 int fd, ret, result = 0;
24 struct sockaddr_un sa;
27 fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0);
33 memset(&sa, 0, sizeof(sa));
34 sa.sun_family = AF_UNIX;
35 strcpy(sa.sun_path, "socktest");
37 if (bind(fd, (const struct sockaddr *)&sa, sizeof(sa)) < 0) {
42 ret = read(fd, &buf, sizeof(buf));
43 if (ret != -1 || errno != EAGAIN) {
44 error(0, 0, "Nonblocking read returned %d", ret);
52 #define TEST_FUNCTION do_test ()
53 #include "../test-skeleton.c"