| 1 | # Copyright (c) 2014, cPanel, Inc. | ||
| 2 | # All rights reserved. | ||
| 3 | # http://cpanel.net/ | ||
| 4 | # | ||
| 5 | # This is free software; you can redistribute it and/or modify it under the same | ||
| 6 | # terms as Perl itself. See the LICENSE file for further details. | ||
| 7 | |||
| 8 | package Filesys::POSIX::Bits; | ||
| 9 | |||
| 10 | 29 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 29 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 29 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 29 | ▶ | use Exporter (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 29 | ▶ | use vars qw(@ISA @EXPORT); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | 29 | our @ISA = qw(Exporter); | |
| 18 | |||
| 19 | 29 | our @EXPORT = qw( | |
| 20 | $O_RDONLY $O_WRONLY $O_RDWR $O_NONBLOCK $O_APPEND $O_CREAT $O_TRUNC | ||
| 21 | $O_EXCL $O_SHLOCK $O_EXLOCK $O_NOFOLLOW $O_EVTONLY $S_IFMT | ||
| 22 | $S_IFIFO $S_IFCHR $S_IFDIR $S_IFBLK $S_IFREG $S_IFLNK $S_IFSOCK | ||
| 23 | $S_IFWHT $S_IPROT $S_ISUID $S_ISGID $S_ISVTX $S_IPERM $S_IRWXU | ||
| 24 | $S_IRUSR $S_IWUSR $S_IXUSR $S_IRWXG $S_IRGRP $S_IWGRP $S_IXGRP | ||
| 25 | $S_IRWXO $S_IROTH $S_IWOTH $S_IXOTH $S_IRW $S_IR $S_IW $S_IX | ||
| 26 | |||
| 27 | $SEEK_SET $SEEK_CUR $SEEK_END | ||
| 28 | ); | ||
| 29 | } | ||
| 30 | |||
| 31 | =head1 NAME | ||
| 32 | |||
| 33 | Filesys::POSIX::Bits - Bitfield and constant definitions for file modes and | ||
| 34 | system call flags | ||
| 35 | |||
| 36 | =head1 DESCRIPTION | ||
| 37 | |||
| 38 | This file contains all the constant definitions for the system call flags and | ||
| 39 | inode mode bitfields and values. The following system calls use these values: | ||
| 40 | |||
| 41 | =over | ||
| 42 | |||
| 43 | =item C<Filesys::POSIX-E<gt>open> | ||
| 44 | |||
| 45 | Uses both flag and mode specifiers for determining permissions, file open mode, | ||
| 46 | and inode format. | ||
| 47 | |||
| 48 | =item C<Filesys::POSIX::IO::Handle-E<gt>seek> | ||
| 49 | |||
| 50 | Uses C<$SEEK_SET>, C<$SEEK_CUR>, and C<$SEEK_END> for the $whence argument. | ||
| 51 | |||
| 52 | =back | ||
| 53 | |||
| 54 | =cut | ||
| 55 | |||
| 56 | # | ||
| 57 | # Flags as recognized by open() | ||
| 58 | # | ||
| 59 | 29 | our $O_MODE = 0x0003; | |
| 60 | |||
| 61 | 29 | our $O_RDONLY = 0x0000; | |
| 62 | 29 | our $O_WRONLY = 0x0001; | |
| 63 | 29 | our $O_RDWR = 0x0002; | |
| 64 | |||
| 65 | 29 | our $O_SYNC = 0x0080; | |
| 66 | |||
| 67 | 29 | our $O_SHLOCK = 0x0010; | |
| 68 | 29 | our $O_EXLOCK = 0x0020; | |
| 69 | 29 | our $O_ASYNC = 0x0040; | |
| 70 | 29 | our $O_FSYNC = $O_SYNC; | |
| 71 | 29 | our $O_NOFOLLOW = 0x0100; | |
| 72 | |||
| 73 | 29 | our $O_CREAT = 0x0200; | |
| 74 | 29 | our $O_TRUNC = 0x0400; | |
| 75 | 29 | our $O_EXCL = 0x0800; | |
| 76 | |||
| 77 | 29 | our $O_NONBLOCK = 0x0004; | |
| 78 | 29 | our $O_APPEND = 0x0008; | |
| 79 | |||
| 80 | 29 | our $O_EVTONLY = 0x8000; | |
| 81 | |||
| 82 | # | ||
| 83 | # Inode format bitfield and values | ||
| 84 | # | ||
| 85 | 29 | our $S_IFMT = 0170000; | |
| 86 | |||
| 87 | 29 | our $S_IFIFO = 0010000; | |
| 88 | 29 | our $S_IFCHR = 0020000; | |
| 89 | 29 | our $S_IFDIR = 0040000; | |
| 90 | 29 | our $S_IFBLK = 0060000; | |
| 91 | 29 | our $S_IFREG = 0100000; | |
| 92 | 29 | our $S_IFLNK = 0120000; | |
| 93 | 29 | our $S_IFSOCK = 0140000; | |
| 94 | 29 | our $S_IFWHT = 0160000; | |
| 95 | |||
| 96 | # | ||
| 97 | # Inode execution protection bitfield and values | ||
| 98 | # | ||
| 99 | 29 | our $S_IPROT = 0007000; | |
| 100 | |||
| 101 | 29 | our $S_ISUID = 0004000; | |
| 102 | 29 | our $S_ISGID = 0002000; | |
| 103 | 29 | our $S_ISVTX = 0001000; | |
| 104 | |||
| 105 | # | ||
| 106 | # Inode permission bitfield and values | ||
| 107 | # | ||
| 108 | 29 | our $S_IR = 0000444; | |
| 109 | 29 | our $S_IW = 0000222; | |
| 110 | 29 | our $S_IX = 0000111; | |
| 111 | 29 | our $S_IRW = $S_IR | $S_IW; | |
| 112 | 29 | our $S_IPERM = $S_IRW | $S_IX; | |
| 113 | |||
| 114 | # Per assigned user | ||
| 115 | 29 | our $S_IRWXU = 0000700; | |
| 116 | |||
| 117 | 29 | our $S_IRUSR = 0000400; | |
| 118 | 29 | our $S_IWUSR = 0000200; | |
| 119 | 29 | our $S_IXUSR = 0000100; | |
| 120 | |||
| 121 | # Per assigned group | ||
| 122 | 29 | our $S_IRWXG = 0000070; | |
| 123 | |||
| 124 | 29 | our $S_IRGRP = 0000040; | |
| 125 | 29 | our $S_IWGRP = 0000020; | |
| 126 | 29 | our $S_IXGRP = 0000010; | |
| 127 | |||
| 128 | # All other users | ||
| 129 | 29 | our $S_IRWXO = 0000007; | |
| 130 | |||
| 131 | 29 | our $S_IROTH = 0000004; | |
| 132 | 29 | our $S_IWOTH = 0000002; | |
| 133 | 29 | our $S_IXOTH = 0000001; | |
| 134 | |||
| 135 | # | ||
| 136 | # seek() operations | ||
| 137 | # | ||
| 138 | 29 | our $SEEK_SET = 0x00; | |
| 139 | 29 | our $SEEK_CUR = 0x01; | |
| 140 | 29 | our $SEEK_END = 0x02; | |
| 141 | |||
| 142 | 29 | 1; | |
| 143 | |||
| 144 | __END__ | ||