Dmitry V. Levin | db23b34 | 2014-12-06 03:53:16 +0000 | [diff] [blame] | 1 | #include "defs.h" |
| 2 | |
| 3 | #include <fcntl.h> |
Felix Janda | d34e00b | 2015-03-28 18:21:09 +0100 | [diff] [blame] | 4 | #include <sys/stat.h> |
Dmitry V. Levin | db23b34 | 2014-12-06 03:53:16 +0000 | [diff] [blame] | 5 | |
| 6 | #ifdef MAJOR_IN_SYSMACROS |
| 7 | # include <sys/sysmacros.h> |
| 8 | #endif |
| 9 | |
| 10 | #ifdef MAJOR_IN_MKDEV |
| 11 | # include <sys/mkdev.h> |
| 12 | #endif |
| 13 | |
Dmitry V. Levin | c15dd41 | 2015-07-19 23:07:17 +0000 | [diff] [blame] | 14 | static void |
Dmitry V. Levin | db23b34 | 2014-12-06 03:53:16 +0000 | [diff] [blame] | 15 | decode_mknod(struct tcb *tcp, int offset) |
| 16 | { |
| 17 | int mode = tcp->u_arg[offset + 1]; |
| 18 | |
Dmitry V. Levin | c15dd41 | 2015-07-19 23:07:17 +0000 | [diff] [blame] | 19 | printpath(tcp, tcp->u_arg[offset]); |
| 20 | tprintf(", %s", sprintmode(mode)); |
| 21 | switch (mode & S_IFMT) { |
| 22 | case S_IFCHR: |
| 23 | case S_IFBLK: |
Dmitry V. Levin | db23b34 | 2014-12-06 03:53:16 +0000 | [diff] [blame] | 24 | #if defined(SPARC) || defined(SPARC64) |
Dmitry V. Levin | c15dd41 | 2015-07-19 23:07:17 +0000 | [diff] [blame] | 25 | if (current_personality == 1) |
| 26 | tprintf(", makedev(%lu, %lu)", |
| 27 | (unsigned long) ((tcp->u_arg[offset + 2] >> 18) & 0x3fff), |
| 28 | (unsigned long) (tcp->u_arg[offset + 2] & 0x3ffff)); |
| 29 | else |
Dmitry V. Levin | db23b34 | 2014-12-06 03:53:16 +0000 | [diff] [blame] | 30 | #endif /* SPARC || SPARC64 */ |
Dmitry V. Levin | c15dd41 | 2015-07-19 23:07:17 +0000 | [diff] [blame] | 31 | tprintf(", makedev(%lu, %lu)", |
| 32 | (unsigned long) major(tcp->u_arg[offset + 2]), |
| 33 | (unsigned long) minor(tcp->u_arg[offset + 2])); |
| 34 | break; |
Dmitry V. Levin | db23b34 | 2014-12-06 03:53:16 +0000 | [diff] [blame] | 35 | } |
Dmitry V. Levin | db23b34 | 2014-12-06 03:53:16 +0000 | [diff] [blame] | 36 | } |
| 37 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 38 | SYS_FUNC(mknod) |
Dmitry V. Levin | db23b34 | 2014-12-06 03:53:16 +0000 | [diff] [blame] | 39 | { |
Dmitry V. Levin | c15dd41 | 2015-07-19 23:07:17 +0000 | [diff] [blame] | 40 | decode_mknod(tcp, 0); |
| 41 | |
| 42 | return RVAL_DECODED; |
Dmitry V. Levin | db23b34 | 2014-12-06 03:53:16 +0000 | [diff] [blame] | 43 | } |
| 44 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 45 | SYS_FUNC(mknodat) |
Dmitry V. Levin | db23b34 | 2014-12-06 03:53:16 +0000 | [diff] [blame] | 46 | { |
Dmitry V. Levin | c15dd41 | 2015-07-19 23:07:17 +0000 | [diff] [blame] | 47 | print_dirfd(tcp, tcp->u_arg[0]); |
| 48 | decode_mknod(tcp, 1); |
| 49 | |
| 50 | return RVAL_DECODED; |
Dmitry V. Levin | db23b34 | 2014-12-06 03:53:16 +0000 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | #if defined(SPARC) || defined(SPARC64) |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 54 | SYS_FUNC(xmknod) |
Dmitry V. Levin | db23b34 | 2014-12-06 03:53:16 +0000 | [diff] [blame] | 55 | { |
| 56 | int mode = tcp->u_arg[2]; |
| 57 | |
Dmitry V. Levin | c15dd41 | 2015-07-19 23:07:17 +0000 | [diff] [blame] | 58 | tprintf("%ld, ", tcp->u_arg[0]); |
| 59 | printpath(tcp, tcp->u_arg[1]); |
| 60 | tprintf(", %s", sprintmode(mode)); |
| 61 | switch (mode & S_IFMT) { |
| 62 | case S_IFCHR: |
| 63 | case S_IFBLK: |
| 64 | tprintf(", makedev(%lu, %lu)", |
| 65 | (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff), |
| 66 | (unsigned long) (tcp->u_arg[3] & 0x3ffff)); |
| 67 | break; |
| 68 | default: |
| 69 | break; |
Dmitry V. Levin | db23b34 | 2014-12-06 03:53:16 +0000 | [diff] [blame] | 70 | } |
Dmitry V. Levin | c15dd41 | 2015-07-19 23:07:17 +0000 | [diff] [blame] | 71 | |
| 72 | return RVAL_DECODED; |
Dmitry V. Levin | db23b34 | 2014-12-06 03:53:16 +0000 | [diff] [blame] | 73 | } |
| 74 | #endif /* SPARC || SPARC64 */ |