diff --git a/vlib/os/const.v b/vlib/os/const.v index 336f661e2d..fda70ac717 100644 --- a/vlib/os/const.v +++ b/vlib/os/const.v @@ -73,3 +73,30 @@ const ( O_SYNC = 64 // open for synchronous I/O. O_TRUNC = 128 // truncate regular writable file when opened. ) + +// Permission bits +const ( + S_IREAD = 0400 /* Read by owner. */ + S_IWRITE = 0200 /* Write by owner. */ + S_IEXEC = 0100 /* Execute by owner. */ + + S_IRUSR = S_IREAD /* Alias of S_IREAD */ + S_IWUSR = S_IWRITE /* Alias of S_IWRITE */ + S_IXUSR = S_IEXEC /* Alias of S_IEXEC */ + + S_IRWXU = (S_IREAD|S_IWRITE|S_IEXEC) + + S_IRGRP = (S_IRUSR >> 3) /* Read by group. */ + S_IWGRP = (S_IWUSR >> 3) /* Write by group. */ + S_IXGRP = (S_IXUSR >> 3) /* Execute by group. */ + S_IRWXG = (S_IRWXU >> 3) /* Read, write, and execute by group. */ + + S_IROTH = (S_IRGRP >> 3) /* Read by others. */ + S_IWOTH = (S_IWGRP >> 3) /* Write by others. */ + S_IXOTH = (S_IXGRP >> 3) /* Execute by others. */ + S_IRWXO = (S_IRWXG >> 3) /* Read, write, and execute by others. */ + + ACCESSPERMS = (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ + ALLPERMS = (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */ + DEFFILEMODE = (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) /* 0666*/ +)