blob: 8d98cb6d625c5d0dc257599a36185453e04a57df [file] [log] [blame]
Fei Jiea067b8d2016-03-31 16:06:49 +08001#include "tests.h"
2#include <sys/syscall.h>
3
4#ifdef __NR_sethostname
5
6# include <errno.h>
7# include <stdio.h>
8# include <unistd.h>
9
10int
11main(void)
12{
13 const char *hostname = NULL;
14 int rc = syscall(__NR_sethostname, hostname, 63);
15 const char *errno_text;
16 switch (errno) {
17 case ENOSYS:
18 errno_text = "ENOSYS";
19 break;
20 case EPERM:
21 errno_text = "EPERM";
22 break;
23 default:
24 errno_text = "EFAULT";
25 }
26 printf("sethostname(NULL, %d) = %d %s (%m)\n",
27 63, rc, errno_text);
28
29 puts("+++ exited with 0 +++");
30 return 0;
31}
32
33#else
34
35SKIP_MAIN_UNDEFINED("__NR_sethostname")
36
37#endif