diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2007-01-16 15:10:07 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2007-01-16 15:10:07 +0000 |
commit | 817b708fcb7fb95dee484df2b95ecc2967877419 (patch) | |
tree | 80df9e73c907722291bd4a862537523973786c76 /system.c | |
parent | a0de7c1f643e7a5422e39e8f35afb92bccdbb84a (diff) | |
download | strace-817b708fcb7fb95dee484df2b95ecc2967877419.tar.gz strace-817b708fcb7fb95dee484df2b95ecc2967877419.tar.bz2 strace-817b708fcb7fb95dee484df2b95ecc2967877419.tar.xz |
2007-01-16 Dmitry V. Levin <ldv@altlinux.org>
Update mount parser to match kernel behaviour.
* system.c [LINUX] (MS_VERBOSE): Rename to MS_SILENT.
[LINUX] (MS_UNBINDABLE, MS_PRIVATE, MS_SLAVE, MS_SHARED):
New macros.
[LINUX] (mount_flags): Add them.
[LINUX] (MS_MGC_MSK): New macro.
[LINUX] (sys_mount): Update parser to match kernel behaviour:
discard MS_MGC_VAL magic, do not decode type and/or data
strings when specified flags do not imply valid strings.
Diffstat (limited to 'system.c')
-rw-r--r-- | system.c | 44 |
1 files changed, 34 insertions, 10 deletions
@@ -49,11 +49,16 @@ #define MS_BIND 4096 #define MS_MOVE 8192 #define MS_REC 16384 -#define MS_VERBOSE 32768 +#define MS_SILENT 32768 #define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ +#define MS_UNBINDABLE (1<<17) /* change to unbindable */ +#define MS_PRIVATE (1<<18) /* change to private */ +#define MS_SLAVE (1<<19) /* change to slave */ +#define MS_SHARED (1<<20) /* change to shared */ #define MS_ACTIVE (1<<30) #define MS_NOUSER (1<<31) #define MS_MGC_VAL 0xc0ed0000 /* Magic flag number */ +#define MS_MGC_MSK 0xffff0000 /* Magic flag mask */ #include <sys/socket.h> #include <netinet/in.h> @@ -93,33 +98,52 @@ static const struct xlat mount_flags[] = { { MS_BIND, "MS_BIND" }, { MS_MOVE, "MS_MOVE" }, { MS_REC, "MS_REC" }, - { MS_VERBOSE, "MS_VERBOSE" }, + { MS_SILENT, "MS_SILENT" }, { MS_POSIXACL, "MS_POSIXACL" }, + { MS_UNBINDABLE,"MS_UNBINDABLE" }, + { MS_PRIVATE, "MS_PRIVATE" }, + { MS_SLAVE, "MS_SLAVE" }, + { MS_SHARED, "MS_SHARED" }, { MS_ACTIVE, "MS_ACTIVE" }, { MS_NOUSER, "MS_NOUSER" }, { 0, NULL }, }; int -sys_mount(tcp) -struct tcb *tcp; +sys_mount(struct tcb *tcp) { if (entering(tcp)) { + int ignore_type = 0, ignore_data = 0; + unsigned long flags = tcp->u_arg[3]; + + /* Discard magic */ + if ((flags & MS_MGC_MSK) == MS_MGC_VAL) + flags &= ~MS_MGC_MSK; + + if (flags & MS_REMOUNT) + ignore_type = 1; + else if (flags & (MS_BIND | MS_MOVE)) + ignore_type = ignore_data = 1; + printpath(tcp, tcp->u_arg[0]); tprintf(", "); + printpath(tcp, tcp->u_arg[1]); tprintf(", "); - if ((tcp->u_arg[3] & (MS_BIND|MS_MOVE|MS_REMOUNT)) == 0) - printpath(tcp, tcp->u_arg[2]); - else + + if (ignore_type && tcp->u_arg[2]) tprintf("%#lx", tcp->u_arg[2]); + else + printstr(tcp, tcp->u_arg[2], -1); tprintf(", "); + printflags(mount_flags, tcp->u_arg[3], "MS_???"); tprintf(", "); - if ((tcp->u_arg[3] & (MS_BIND|MS_MOVE)) == 0) - printstr(tcp, tcp->u_arg[4], -1); - else + + if (ignore_data && tcp->u_arg[4]) tprintf("%#lx", tcp->u_arg[4]); + else + printstr(tcp, tcp->u_arg[4], -1); } return 0; } |