strace/uname.c
Dmitry V. Levin 9809e3ab0a uname.c: use umove_or_printaddr
* uname.c (sys_uname): Use umove_or_printaddr.
2015-07-16 01:36:55 +00:00

35 lines
692 B
C

#include "defs.h"
#include <sys/utsname.h>
SYS_FUNC(uname)
{
struct utsname uname;
if (entering(tcp))
return 0;
if (!umove_or_printaddr(tcp, tcp->u_arg[0], &uname)) {
#define PRINT_UTS_MEMBER(prefix, member) \
tprints(prefix #member "="); \
print_quoted_string(uname.member, sizeof(uname.member), \
QUOTE_0_TERMINATED)
PRINT_UTS_MEMBER("{", sysname);
PRINT_UTS_MEMBER(", ", nodename);
if (abbrev(tcp)) {
tprints(", ...}");
return 0;
}
PRINT_UTS_MEMBER(", ", release);
PRINT_UTS_MEMBER(", ", version);
PRINT_UTS_MEMBER(", ", machine);
#ifdef HAVE_STRUCT_UTSNAME_DOMAINNAME
PRINT_UTS_MEMBER(", ", domainname);
#endif
tprints("}");
}
return 0;
}