summaryrefslogtreecommitdiffstats
path: root/Lib/stat.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-05-06 11:38:27 (GMT)
committerGuido van Rossum <guido@python.org>1992-05-06 11:38:27 (GMT)
commit8899a9ca400b90100c2f05eea7211d00b30e4843 (patch)
tree9d53ef82bf1dd0bf1a3a8a59660d2793c05da1d3 /Lib/stat.py
parente238829359755627b414116ba52650324cbd7289 (diff)
downloadcpython-8899a9ca400b90100c2f05eea7211d00b30e4843.zip
cpython-8899a9ca400b90100c2f05eea7211d00b30e4843.tar.gz
cpython-8899a9ca400b90100c2f05eea7211d00b30e4843.tar.bz2
Add names for perm bits (S_IREAD etc).
Only extract 4 bits of mode to get the file type
Diffstat (limited to 'Lib/stat.py')
-rw-r--r--Lib/stat.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/Lib/stat.py b/Lib/stat.py
index afb9a05..381e28a 100644
--- a/Lib/stat.py
+++ b/Lib/stat.py
@@ -29,7 +29,7 @@ def S_IMODE(mode):
return mode & 07777
def S_IFMT(mode):
- return mode & ~07777
+ return mode & 0170000
# Constants used as S_IFMT() for various file types
# (not all are implemented on all systems)
@@ -64,3 +64,25 @@ def S_ISLNK(mode):
def S_ISSOCK(mode):
return S_IFMT(mode) == S_IFSOCK
+
+# Names for permission bits
+
+S_ISUID = 04000
+S_ISGID = 02000
+S_ENFMT = S_ISGID
+S_ISVTX = 01000
+S_IREAD = 00400
+S_IWRITE = 00200
+S_IEXEC = 00100
+S_IRWXU = 00700
+S_IRUSR = 00400
+S_IWUSR = 00200
+S_IXUSR = 00100
+S_IRWXG = 00070
+S_IRGRP = 00040
+S_IWGRP = 00020
+S_IXGRP = 00010
+S_IRWXO = 00007
+S_IROTH = 00004
+S_IWOTH = 00002
+S_IXOTH = 00001