Luna/libc/include/bits/modes.h

42 lines
1.0 KiB
C
Raw Normal View History

2023-03-12 15:55:46 +00:00
/* bits/modes.h: S_* constants for stat(), mkdir(), open() and more. */
#ifndef _BITS_MODES_H
#define _BITS_MODES_H
#define S_IFMT 070000
#define S_IFREG 000000
#define S_IFLNK 010000
#define S_IFIFO 020000
#define S_IFBLK 030000
2023-03-12 15:55:46 +00:00
#define S_IFDIR 040000
2023-04-10 17:56:03 +00:00
#define S_IFCHR 050000
#define S_IFSOCK 060000
2023-04-10 17:56:03 +00:00
#define __CHECK_TYPE(mode, type) (((mode) & S_IFMT) == type)
2023-05-01 18:00:10 +00:00
#define S_ISREG(mode) __CHECK_TYPE(mode, S_IFREG)
#define S_ISDIR(mode) __CHECK_TYPE(mode, S_IFDIR)
#define S_ISCHR(mode) __CHECK_TYPE(mode, S_IFCHR)
#define S_ISBLK(mode) __CHECK_TYPE(mode, S_IFBLK)
#define S_ISLNK(mode) __CHECK_TYPE(mode, S_IFLNK)
#define S_ISFIFO(mode) __CHECK_TYPE(mode, S_IFIFO)
#define S_ISSOCK(mode) __CHECK_TYPE(mode, S_IFSOCK)
2023-03-12 15:55:46 +00:00
#define S_IRWXU 0700
#define S_IRUSR 0400
#define S_IWUSR 0200
#define S_IXUSR 0100
#define S_IRWXG 070
#define S_IRGRP 040
#define S_IWGRP 020
#define S_IXGRP 010
#define S_IRWXO 07
#define S_IROTH 04
#define S_IWOTH 02
#define S_IXOTH 01
#define S_ISUID 04000
#define S_ISGID 02000
#define S_ISVTX 01000
#endif