16
16
#error permission bitflag value assumption(s) violated!
19
/* Generate ls-style "mode string" like "-rwsr-xr-x" or "drwxrwxrwt" */
19
21
#if ( S_IFSOCK!= 0140000 ) || ( S_IFLNK != 0120000 ) \
20
22
|| ( S_IFREG != 0100000 ) || ( S_IFBLK != 0060000 ) \
21
23
|| ( S_IFDIR != 0040000 ) || ( S_IFCHR != 0020000 ) \
22
24
|| ( S_IFIFO != 0010000 )
23
#warning mode type bitflag value assumption(s) violated! falling back to larger version
25
#if (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX) == 07777
27
#define mode_t unsigned short
30
static const mode_t mode_flags[] = {
25
# warning mode type bitflag value assumption(s) violated! falling back to larger version
27
# if (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX) == 07777
29
# define mode_t unsigned short
32
static const mode_t mode_flags[] ALIGN4 = {
31
33
S_IRUSR, S_IWUSR, S_IXUSR, S_ISUID,
32
34
S_IRGRP, S_IWGRP, S_IXGRP, S_ISGID,
33
35
S_IROTH, S_IWOTH, S_IXOTH, S_ISVTX
36
/* The static const char arrays below are duplicated for the two cases
37
* because moving them ahead of the mode_flags declaration cause a text
38
* size increase with the gcc version I'm using. */
40
38
/* The previous version used "0pcCd?bB-?l?s???". However, the '0', 'C',
41
39
* and 'B' types don't appear to be available on linux. So I removed them. */
42
40
static const char type_chars[16] ALIGN1 = "?pc?d?b?-?l?s???";
43
41
/***************************************** 0123456789abcdef */
44
42
static const char mode_chars[7] ALIGN1 = "rwxSTst";
46
const char* FAST_FUNC bb_mode_string(mode_t mode)
44
char* FAST_FUNC bb_mode_string(char buf[11], mode_t mode)
80
74
/* The previous version used "0pcCd?bB-?l?s???". However, the '0', 'C',
81
75
* and 'B' types don't appear to be available on linux. So I removed them. */
82
76
static const char type_chars[16] ALIGN1 = "?pc?d?b?-?l?s???";
83
/********************************** 0123456789abcdef */
77
/***************************************** 0123456789abcdef */
84
78
static const char mode_chars[7] ALIGN1 = "rwxSTst";
86
const char* FAST_FUNC bb_mode_string(mode_t mode)
80
char* FAST_FUNC bb_mode_string(char buf[11], mode_t mode)