Assuming I have a syscall to open
.
man 2 open
gives me info, that it requires 2 or 3 parameters
int open(const char *pathname, int flags);
int open(const char *pathname, int flags, mode_t mode);
So, my code runs and In my registers I have
$rdi = 0x00007fffffffdb40 → "/etc/init.d/",
$rsi = 0x0000000000000241,
$rdx = 0x00000000000001c9
How and which flags is it using during the call? How will the dir (or file) be opened?
- I am looking at the man page. The possible flags are mentioned, but not their bit/value/integer being set by
|
'ing the flags together in source code. - I continue at the man page and see above the header files, which define the constants. In this case I'd need to
#include <sys/types.h> <sys/stat.h> <fcntl.h>
. However, in this files, I cannot find bits or integers, whichsum
or|
up to the given flags ($rsi = 0x241
,577
in decimal,1001000001
in binary) I cannot see any pattern.
Question: Do I oversee something? Do I need to look somewhere else? Where are those bits described?
#define
. So compiler will replace that definition with integer. Only enumerations and structures can shows values.