]> git.ipfire.org Git - thirdparty/glibc.git/blame - inet/tst-getni1.c
nptl: Move pthread_attr_setschedparam implementation into libc
[thirdparty/glibc.git] / inet / tst-getni1.c
CommitLineData
d4f0720b
UD
1#include <netdb.h>
2#include <stdio.h>
3#include <sys/socket.h>
4
5static int
6do_test (void)
7{
8 int retval = 0;
9
10 struct sockaddr_in s;
11 s.sin_family = AF_INET;
12 s.sin_port = 80;
13 s.sin_addr.s_addr = INADDR_LOOPBACK;
14 int r = getnameinfo((struct sockaddr *) &s, sizeof (s), NULL, 0, NULL, 0,
15 NI_NUMERICHOST | NI_NUMERICSERV);
16 printf("r = %d\n", r);
17 if (r != 0)
18 {
19 puts ("failed without NI_NAMEREQD");
20 retval = 1;
21 }
9c84384c 22
d4f0720b
UD
23 r = getnameinfo((struct sockaddr *) &s, sizeof (s), NULL, 0, NULL, 0,
24 NI_NUMERICHOST | NI_NUMERICSERV | NI_NAMEREQD);
25 printf("r = %d\n", r);
26 if (r != EAI_NONAME)
27 {
28 puts ("did not fail with EAI_NONAME with NI_NAMEREQD set");
29 retval = 1;
30 }
31
32 return retval;
33}
34
35#define TEST_FUNCTION do_test ()
36#include "../test-skeleton.c"