1

The file mode for a file on AIX returned by the Ruby stat method has 6 digits:

ruby -e 'puts File::stat("testfile_upload-003").mode.to_s(8)'
100644

FWIW, Ruby version is ruby 2.1.6p336 (2015-04-13 revision 50298) [powerpc-aix6.1.0.0], but Perl returns the very same value:

perl -e 'use File::stat; printf "%o\n", stat("testfile_upload-003")->mode;'
100644

Here is the output of istat for the same file.

# /bin/istat testfile_upload-003
Inode 33780 on device 10/7      File
Protection: rw-r--r--
Owner: 0(root)          Group: 0(system)
Link count:   2         Length 51200 bytes

Last updated:   Thu Mar  9 01:13:24 CST 2017
Last modified:  Wed Mar  8 11:52:52 CST 2017
Last accessed:  Wed Mar  8 11:52:52 CST 2017

EDIT: the chmod man page andistat man page do not provide info for the 5th and 6th digits.

And there is no fancy setuid bits set for that file:

# ls -l testfile_upload-003
-rw-r--r--    2 root     system        51200 Mar 08 11:52 testfile_upload-003
  • Read up on chmod or stat – roaima Mar 9 '17 at 8:29
  • 2
    @roaima i forgot to mention I RTFMed and did not find info beyond the 4th digit. – philant Mar 9 '17 at 8:39
3

I found them in <sys/mode.h> :

/*
 *      (stat) st_mode bit values
 */

#define _S_IFMT         0170000         /* type of file */
#define   _S_IFREG      0100000         /*   regular */
#define   _S_IFDIR      0040000         /*   directory */
#define   _S_IFBLK      0060000         /*   block special */
#define   _S_IFCHR      0020000         /*   character special */
#define   _S_IFIFO      0010000         /*   fifo */

The leading '1' indicates a regular file.

A directory has 240755, the '4' indicates a directory, and the '2' means "not a regular file".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.