6 # if O_LARGEFILE == 0 /* biarch platforms in 64-bit mode */
9 # define O_LARGEFILE 0x40000
10 # elif defined X86_64 || defined S390X
11 # define O_LARGEFILE 0100000
16 #include "xlat/open_access_modes.h"
17 #include "xlat/open_mode_flags.h"
20 # define AT_FDCWD -100
23 /* The fd is an "int", so when decoding x86 on x86_64, we need to force sign
24 * extension to get the right value. We do this by declaring fd as int here.
27 print_dirfd(struct tcb *tcp, int fd)
30 tprints("AT_FDCWD, ");
38 * low bits of the open(2) flags define access mode,
39 * other bits are real flags.
42 sprint_open_modes(int flags)
44 static char outstr[(1 + ARRAY_SIZE(open_mode_flags)) * sizeof("O_LARGEFILE")];
51 p = stpcpy(outstr, "flags");
52 str = xlookup(open_access_modes, flags & 3);
62 for (x = open_mode_flags; x->str; x++) {
63 if ((flags & x->val) == x->val) {
65 p = stpcpy(p, x->str);
72 /* flags is still nonzero */
74 sprintf(p, "%#x", flags);
79 tprint_open_modes(int flags)
81 tprints(sprint_open_modes(flags) + sizeof("flags"));
85 decode_open(struct tcb *tcp, int offset)
88 printpath(tcp, tcp->u_arg[offset]);
91 tprint_open_modes(tcp->u_arg[offset + 1]);
92 if (tcp->u_arg[offset + 1] & O_CREAT) {
94 tprintf(", %#lo", tcp->u_arg[offset + 2]);
101 sys_open(struct tcb *tcp)
103 return decode_open(tcp, 0);
107 sys_openat(struct tcb *tcp)
110 print_dirfd(tcp, tcp->u_arg[0]);
111 return decode_open(tcp, 1);
115 sys_creat(struct tcb *tcp)
118 printpath(tcp, tcp->u_arg[0]);
119 tprintf(", %#lo", tcp->u_arg[1]);
124 #if defined(SPARC) || defined(SPARC64)
125 # include "xlat/openmodessol.h"
128 solaris_open(struct tcb *tcp)
131 printpath(tcp, tcp->u_arg[0]);
134 printflags(openmodessol, tcp->u_arg[1] + 1, "O_???");
135 if (tcp->u_arg[1] & 0x100) {
137 tprintf(", %#lo", tcp->u_arg[2]);
143 #endif /* SPARC || SPARC64 */