1 // SPDX-License-Identifier: LGPL-2.1
7 #define O_DIRECT 00040000
11 #define O_DIRECTORY 00200000
15 #define O_NOATIME 01000000
19 #define O_TMPFILE 020000000
23 #define O_LARGEFILE 00100000
25 size_t open__scnprintf_flags(unsigned long flags
, char *bf
, size_t size
, bool show_prefix
)
27 const char *prefix
= "O_";
30 if ((flags
& O_ACCMODE
) == O_RDONLY
)
31 printed
= scnprintf(bf
, size
, "%s%s", show_prefix
? prefix
: "", "RDONLY");
35 if (flags & O_##n) { \
36 printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \
62 if ((flags
& O_SYNC
) == O_SYNC
)
63 printed
+= scnprintf(bf
+ printed
, size
- printed
, "%s%s%s", printed
? "|" : "", show_prefix
? prefix
: "", "SYNC");
75 printed
+= scnprintf(bf
+ printed
, size
- printed
, "%s%#x", printed
? "|" : "", flags
);
80 size_t syscall_arg__scnprintf_open_flags(char *bf
, size_t size
, struct syscall_arg
*arg
)
84 if (!(flags
& O_CREAT
))
85 arg
->mask
|= 1 << (arg
->idx
+ 1); /* Mask the mode parm */
87 return open__scnprintf_flags(flags
, bf
, size
, arg
->show_string_prefix
);