uname: decode olduname and oldolduname syscalls
* linux/dummy.h (sys_oldolduname, sys_olduname): Remove. * tests/.gitignore: Add oldolduname, oldolduname-v, olduname, olduname-v. * tests/pure_executables.list: Likewise. * tests/gen_tests.in (oldolduname, oldolduname-v, olduname, olduname-v): New tests. * tests/oldolduname-v.c: New file. * tests/oldolduname.c: Likewise. * tests/olduname-v.c: Likewise. * tests/olduname.c: Likewise. * uname.c: Include <linux/uname.h> instead of <sys/uname.h>. (DECODE_UTSNAME_COMMON): New macro. (SYS_FUNC(oldolduname), SYS_FUNC(olduname)): New decoders. (SYS_FUNC(uname)): Rewrite using DECODE_UTSNAME_COMMON.
This commit is contained in:
@ -160,8 +160,6 @@
|
||||
|
||||
/* deprecated */
|
||||
#define sys_bdflush printargs
|
||||
#define sys_oldolduname printargs
|
||||
#define sys_olduname printargs
|
||||
#define sys_sysfs printargs
|
||||
|
||||
#endif /* !STRACE_LINUX_DUMMY_H */
|
||||
|
4
tests/.gitignore
vendored
4
tests/.gitignore
vendored
@ -330,11 +330,15 @@ old_mmap-Xverbose
|
||||
old_mmap-v-none
|
||||
oldfstat
|
||||
oldlstat
|
||||
oldolduname
|
||||
oldolduname-v
|
||||
oldselect
|
||||
oldselect-P
|
||||
oldselect-efault
|
||||
oldselect-efault-P
|
||||
oldstat
|
||||
olduname
|
||||
olduname-v
|
||||
open
|
||||
openat
|
||||
osf_utimes
|
||||
|
@ -300,11 +300,15 @@ old_mmap-Xraw -a11 -e trace=mmap -Xraw
|
||||
old_mmap-Xverbose -a11 -e trace=mmap -Xverbose
|
||||
oldfstat -a18 -v -P stat.sample
|
||||
oldlstat -a32 -v -P stat.sample -P /dev/full
|
||||
oldolduname -a50
|
||||
oldolduname-v -a50 -v -e trace=oldolduname
|
||||
oldselect -a13 -e trace=select
|
||||
oldselect-P -a13 -e trace=select -P /dev/full 9>>/dev/full
|
||||
oldselect-efault -a13 -e trace=select
|
||||
oldselect-efault-P -a13 -e trace=select -P /dev/full 9>>/dev/full
|
||||
oldstat -a32 -v -P stat.sample -P /dev/full
|
||||
olduname -a50
|
||||
olduname-v -a50 -v -e trace=olduname
|
||||
open -a30 -P $NAME.sample
|
||||
openat -a36 -P $NAME.sample
|
||||
osf_utimes -a21
|
||||
|
2
tests/oldolduname-v.c
Normal file
2
tests/oldolduname-v.c
Normal file
@ -0,0 +1,2 @@
|
||||
#define VERBOSE 1
|
||||
#include "oldolduname.c"
|
38
tests/oldolduname.c
Normal file
38
tests/oldolduname.c
Normal file
@ -0,0 +1,38 @@
|
||||
#include "tests.h"
|
||||
#include <asm/unistd.h>
|
||||
|
||||
#ifdef __NR_oldolduname
|
||||
|
||||
# include <stdio.h>
|
||||
# include <linux/utsname.h>
|
||||
# include <unistd.h>
|
||||
|
||||
int main(int ac, char **av)
|
||||
{
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct oldold_utsname, uname);
|
||||
int rc = syscall(__NR_oldolduname, uname);
|
||||
printf("oldolduname({sysname=");
|
||||
print_quoted_string(uname->sysname);
|
||||
printf(", nodename=");
|
||||
print_quoted_string(uname->nodename);
|
||||
#if VERBOSE
|
||||
printf(", release=");
|
||||
print_quoted_string(uname->release);
|
||||
printf(", version=");
|
||||
print_quoted_string(uname->version);
|
||||
printf(", machine=");
|
||||
print_quoted_string(uname->machine);
|
||||
#else /* !VERBOSE */
|
||||
printf(", ...");
|
||||
#endif /* VERBOSE */
|
||||
printf("}) = %d\n", rc);
|
||||
|
||||
puts("+++ exited with 0 +++");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
SKIP_MAIN_UNDEFINED("__NR_oldolduname")
|
||||
|
||||
#endif
|
2
tests/olduname-v.c
Normal file
2
tests/olduname-v.c
Normal file
@ -0,0 +1,2 @@
|
||||
#define VERBOSE 1
|
||||
#include "olduname.c"
|
38
tests/olduname.c
Normal file
38
tests/olduname.c
Normal file
@ -0,0 +1,38 @@
|
||||
#include "tests.h"
|
||||
#include <asm/unistd.h>
|
||||
|
||||
#ifdef __NR_olduname
|
||||
|
||||
# include <stdio.h>
|
||||
# include <linux/utsname.h>
|
||||
# include <unistd.h>
|
||||
|
||||
int main(int ac, char **av)
|
||||
{
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct old_utsname, uname);
|
||||
int rc = syscall(__NR_olduname, uname);
|
||||
printf("olduname({sysname=");
|
||||
print_quoted_string(uname->sysname);
|
||||
printf(", nodename=");
|
||||
print_quoted_string(uname->nodename);
|
||||
#if VERBOSE
|
||||
printf(", release=");
|
||||
print_quoted_string(uname->release);
|
||||
printf(", version=");
|
||||
print_quoted_string(uname->version);
|
||||
printf(", machine=");
|
||||
print_quoted_string(uname->machine);
|
||||
#else /* !VERBOSE */
|
||||
printf(", ...");
|
||||
#endif /* VERBOSE */
|
||||
printf("}) = %d\n", rc);
|
||||
|
||||
puts("+++ exited with 0 +++");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
SKIP_MAIN_UNDEFINED("__NR_olduname")
|
||||
|
||||
#endif
|
@ -276,9 +276,13 @@ old_mmap-Xverbose
|
||||
old_mmap-v-none
|
||||
oldfstat
|
||||
oldlstat
|
||||
oldolduname
|
||||
oldolduname-v
|
||||
oldselect
|
||||
oldselect-efault
|
||||
oldstat
|
||||
olduname
|
||||
olduname-v
|
||||
open
|
||||
openat
|
||||
osf_utimes
|
||||
|
66
uname.c
66
uname.c
@ -32,30 +32,54 @@
|
||||
|
||||
#include "defs.h"
|
||||
#include "print_fields.h"
|
||||
#include <sys/utsname.h>
|
||||
#include <linux/utsname.h>
|
||||
|
||||
SYS_FUNC(uname)
|
||||
#define DECODE_UTSNAME_COMMON(var_) \
|
||||
do { \
|
||||
if (entering(tcp)) \
|
||||
return 0; \
|
||||
\
|
||||
if (umove_or_printaddr(tcp, tcp->u_arg[0], &uname)) \
|
||||
return 0; \
|
||||
\
|
||||
PRINT_FIELD_CSTRING("{", var_, sysname); \
|
||||
PRINT_FIELD_CSTRING(", ", var_, nodename); \
|
||||
if (abbrev(tcp)) { \
|
||||
tprints(", ...}"); \
|
||||
return 0; \
|
||||
} \
|
||||
PRINT_FIELD_CSTRING(", ", var_, release); \
|
||||
PRINT_FIELD_CSTRING(", ", var_, version); \
|
||||
PRINT_FIELD_CSTRING(", ", var_, machine); \
|
||||
} while (0)
|
||||
|
||||
SYS_FUNC(oldolduname)
|
||||
{
|
||||
struct utsname uname;
|
||||
struct oldold_utsname uname;
|
||||
|
||||
if (entering(tcp))
|
||||
return 0;
|
||||
|
||||
if (!umove_or_printaddr(tcp, tcp->u_arg[0], &uname)) {
|
||||
PRINT_FIELD_CSTRING("{", uname, sysname);
|
||||
PRINT_FIELD_CSTRING(", ", uname, nodename);
|
||||
if (abbrev(tcp)) {
|
||||
tprints(", ...}");
|
||||
return 0;
|
||||
}
|
||||
PRINT_FIELD_CSTRING(", ", uname, release);
|
||||
PRINT_FIELD_CSTRING(", ", uname, version);
|
||||
PRINT_FIELD_CSTRING(", ", uname, machine);
|
||||
#ifdef HAVE_STRUCT_UTSNAME_DOMAINNAME
|
||||
PRINT_FIELD_CSTRING(", ", uname, domainname);
|
||||
#endif
|
||||
tprints("}");
|
||||
}
|
||||
DECODE_UTSNAME_COMMON(uname);
|
||||
tprints("}");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_FUNC(olduname)
|
||||
{
|
||||
struct old_utsname uname;
|
||||
|
||||
DECODE_UTSNAME_COMMON(uname);
|
||||
tprints("}");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_FUNC(uname)
|
||||
{
|
||||
struct new_utsname uname;
|
||||
|
||||
DECODE_UTSNAME_COMMON(uname);
|
||||
PRINT_FIELD_CSTRING(", ", uname, domainname);
|
||||
tprints("}");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user