]> granicus.if.org Git - strace/blob - hostname.c
Update NEWS
[strace] / hostname.c
1 #include "defs.h"
2
3 #ifdef HAVE_LINUX_UTSNAME_H
4 # include <linux/utsname.h>
5 #endif
6
7 #ifndef __NEW_UTS_LEN
8 # define __NEW_UTS_LEN 64
9 #endif
10
11 SYS_FUNC(sethostname)
12 {
13         unsigned int len = tcp->u_arg[1];
14
15         if (len > __NEW_UTS_LEN) {
16                 printaddr(tcp->u_arg[0]);
17         } else {
18                 printstrn(tcp, tcp->u_arg[0], len);
19         }
20
21         tprintf(", %u", len);
22
23         return RVAL_DECODED;
24 }
25
26 #if defined(ALPHA)
27 SYS_FUNC(gethostname)
28 {
29         if (exiting(tcp)) {
30                 if (syserror(tcp))
31                         printaddr(tcp->u_arg[0]);
32                 else
33                         printstr(tcp, tcp->u_arg[0]);
34                 tprintf(", %" PRI_klu, tcp->u_arg[1]);
35         }
36         return 0;
37 }
38 #endif /* ALPHA */