aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-27 21:59:59 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-27 21:59:59 +0100
commit0eb7b703459e40b41fe75994736fa3cd5c3c2c8f (patch)
tree8009209d0c51c6c4ad258ca85567de9aef154770
parentdoc (diff)
downloadslibc-0eb7b703459e40b41fe75994736fa3cd5c3c2c8f.tar.gz
slibc-0eb7b703459e40b41fe75994736fa3cd5c3c2c8f.tar.bz2
slibc-0eb7b703459e40b41fe75994736fa3cd5c3c2c8f.tar.xz
permission bits
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to '')
-rw-r--r--include/sys/stat.h205
1 files changed, 204 insertions, 1 deletions
diff --git a/include/sys/stat.h b/include/sys/stat.h
index 878a414..967b711 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -22,10 +22,198 @@
+/**
+ * Users that are not the owner and are int the
+ * group (“others”) have read permission.
+ *
+ * @since Always.
+ */
+#define S_IROTH 4
+
+/**
+ * Users that are not the owner and are int the
+ * group (“others”) have write permission.
+ *
+ * @since Always.
+ */
+#define S_IWOTH 2
+
+/**
+ * Users that are not the owner and are int the
+ * group (“others”) have execute permission.
+ * Execute permission for directories means to
+ * be able to list files in the directory.
+ *
+ * @since Always.
+ */
+#define S_IXOTH 1
+
+/**
+ * Users that are not the owner and are int the
+ * group (“others”) have all/some permissions.
+ *
+ * This macro is defined to be equivalent to
+ * `(S_IROTH | S_IWOTH | S_IXOTH)`.
+ *
+ * @since Always.
+ */
+#define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
+
+
+/**
+ * Users that are in the group but is not the
+ * owner have read permission.
+ *
+ * @since Always.
+ */
+#define S_IRGRP (S_IROTH << 3)
+
+/**
+ * Users that are in the group but is not the
+ * owner have write permission.
+ *
+ * @since Always.
+ */
+#define S_IWGRP (S_IWOTH << 3)
+
+/**
+ * Users that are in the group but is not the
+ * owner have execute permission.
+ * Execute permission for directories means to
+ * be able to list files in the directory.
+ *
+ * @since Always.
+ */
+#define S_IXGRP (S_IXOTH << 3)
+
+/**
+ * Users that are in the group but is not the
+ * owner have all/some permissions.
+ *
+ * This macro is defined to be equivalent to
+ * `(S_IRGRP | S_IWGRP | S_IXGRP)`.
+ *
+ * @since Always.
+ */
+#define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
+
+
+/**
+ * The owner (“user”) has read permission.
+ *
+ * @since Always.
+ */
+#define S_IRUSR (S_IROTH << 6)
+
+/**
+ * The owner (“user”) has write permission.
+ *
+ * @since Always.
+ */
+#define S_IWUSR (S_IWOTH << 6)
+
+/**
+ * The owner (“user”) has execute permission.
+ * Execute permission for directories means to
+ * be able to list files in the directory.
+ *
+ * @since Always.
+ */
+#define S_IXUSR (S_IXOTH << 6)
+
+/**
+ * The owner (“user”) has all/some permissions.
+ *
+ * This macro is defined to be equivalent to
+ * `(S_IRUSR | S_IWUSR | S_IXUSR)`.
+ *
+ * @since Always.
+ */
+#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
+
+
+/**
+ * Set user ID upon execution (setuid; set-user-ID)
+ * is set.
+ *
+ * For executable files, when a user runs the
+ * program (must have sufficient privileges to
+ * do so, here is however documentation that is
+ * is not required, so perhaps it is not required
+ * on all systems, but it is required on Linux)
+ * her effective user ID is switched to that of
+ * the owner of the file. Most systems disregard
+ * this flag for interpreted files, and can be
+ * made ineffective with mount options.
+ *
+ * For directories, on some systems, when a new
+ * file or subdirectory is created, it inherit
+ * the user ID (owner) of the directory in which
+ * it is created.
+ *
+ * @since Always.
+ */
+#define S_ISUID (4 << 9)
+
+/**
+ * Set group ID upon execution (setgid; set-group-ID)
+ * is set.
+ *
+ * For executable files, when a user runs the
+ * program (must have sufficient privileges to
+ * do so, here is however documentation that is
+ * is not required, so perhaps it is not required
+ * on all systems, but it is required on Linux)
+ * her effective group ID is switched to that of
+ * the group of the file. Most systems disregard
+ * this flag for interpreted files, and can be
+ * made ineffective with mount options.
+ *
+ * For directories, on some systems, when a new
+ * file or subdirectory is created, it inherit
+ * the group ID of the directory in which it is
+ * created.
+ *
+ * On Linux, if set-group-ID is set, but members
+ * of the group do not have execute permission
+ * (`S_IXGRP` is cleared), the file locks on the
+ * file are mandatory.
+ *
+ * @since Always.
+ */
+#define S_ISGID (2 << 9)
+
+/**
+ * Sticky bit (as it is called for regular files) or
+ * restricted deletion flag (as it is called for
+ * directories) is set.
+ *
+ * If set, for directories, unprivileged users
+ * cannot remove or rename a file in the directory.
+ * They have to own the file or the directory.
+ * Directories that anyone can write to, such as
+ * '/tmp' and '/var/tmp' usually has this set.
+ *
+ * If set, for regular files, it saves the
+ * text image of a the program to the swap device,
+ * so it will load more quickly when run. This
+ * is only present on some older Unix systems.
+ *
+ * @since Always.
+ */
+#define S_ISVTX (1 << 9)
+
+
+
#if defined(__SLIBC_SOURCE)
/**
* Everyone, or anyone, have read permission.
*
+ * This macro is defined to be equivalent to
+ * `(S_IRUSR | S_IRGRP | S_IROTH)`.
+ *
+ * This is a slibc extension.
+ *
* @since Always.
*/
# define S_IRALL (S_IRUSR | S_IRGRP | S_IROTH)
@@ -33,6 +221,11 @@
/**
* Everyone, or anyone, have write permission.
*
+ * This macro is defined to be equivalent to
+ * `(S_IWUSR | S_IWGRP | S_IWOTH)`.
+ *
+ * This is a slibc extension.
+ *
* @since Always.
*/
# define S_IWALL (S_IWUSR | S_IWGRP | S_IWOTH)
@@ -42,14 +235,24 @@
* Execute permission for directories means to
* be able to list files in the directory.
*
+ * This macro is defined to be equivalent to
+ * `(S_IXUSR | S_IXGRP | S_IXOTH)`.
+ *
+ * This is a slibc extension.
+ *
* @since Always.
*/
# define S_IXALL (S_IXUSR | S_IXGRP | S_IXOTH)
/**
- * Set-UID bit, set-GID bit, and/or sticky bit
+ * Set-user-ID bit, set-group-ID bit, and/or sticky bit
* is set.
*
+ * This macro is defined to be equivalent to
+ * `(S_ISUID | S_ISGID | S_ISVTX)`.
+ *
+ * This is a slibc extension.
+ *
* @since Always.
*/
# define S_ISALL (S_ISUID | S_ISGID | S_ISVTX)