strace/uname.c
Dmitry V. Levin 58dd2cf352 process.c: move uname parser to a separate file
* uname.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_uname): Move to uname.c.
2014-12-11 22:04:01 +00:00

32 lines
729 B
C

#include "defs.h"
#include <sys/utsname.h>
int
sys_uname(struct tcb *tcp)
{
struct utsname uname;
if (exiting(tcp)) {
if (syserror(tcp) || !verbose(tcp))
tprintf("%#lx", tcp->u_arg[0]);
else if (umove(tcp, tcp->u_arg[0], &uname) < 0)
tprints("{...}");
else if (!abbrev(tcp)) {
tprintf("{sysname=\"%s\", nodename=\"%s\", ",
uname.sysname, uname.nodename);
tprintf("release=\"%s\", version=\"%s\", ",
uname.release, uname.version);
tprintf("machine=\"%s\"", uname.machine);
#ifdef HAVE_STRUCT_UTSNAME_DOMAINNAME
tprintf(", domainname=\"%s\"", uname.domainname);
#endif
tprints("}");
}
else
tprintf("{sys=\"%s\", node=\"%s\", ...}",
uname.sysname, uname.nodename);
}
return 0;
}