Originally posted by: SystemAdmin
Apparently, aix changes the mode of files as their size exceeds 2G.
Where can I programmically read/write the mode of a file greater than 2G?
Where is this documented?
What are the proper flags?
The data involved is the
st_mode
field of type
mode_t
in the
struct stat
required by
POSIX.2
to be in
<sys/stat.h>
As an example, I can create a file "small".
ksh> cat /dev/zero | head -c 2147483640 > small
I can read its numeric mode with the following sniglet (incomplete code)
---- reportmode.c ----
#include <sys/stat.h>
#include <stdio.h>
int main(int argc, char *argv[]){
struct stat s;
lstat(argv[1],&s);
printf("%o\n",s.st_mode);
}
---- reportmode.c ----
I see the normal S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH for small.
ksh> ls -l small
-rw-r--r-- ... 2147483641 ... small
ksh> ./reportmode small
100644
After adding 11 bytes, I no longer see the expected mode.
ksh> /dev/zero | head -c10 >> small
ksh> ls -l small
-rw-r--r-- ... 2147483652 ... small
ksh> ./reportmode small
0 <--- Where is the mode programmimatically accessible?
TIA,