SHARE
TWEET

permissions.java

a guest Dec 6th, 2019 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Permissions{
  2.    
  3.     final static int IFSCK = 0xC000;// Socket
  4.     final static int IFLNK = 0xA000;// Symbolic Link
  5.     final static int IFREG = 0x8000;// Regular File
  6.     final static int IFBLK = 0x6000;// Block Device
  7.     final static int IFDIR = 0x4000;// Directory
  8.     final static int IFCHR = 0x2000;// Character Device
  9.     final static int IFIFO = 0x1000;// FIFO
  10.     final static int ISUID = 0x0800;// Set process User ID
  11.     final static int ISGID = 0x0400;// Set process Group ID
  12.     final static int ISVTX = 0x0200;// Sticky bit
  13.     //User (permissions for read,write and execute)
  14.     final static static int IRUSR = 0x0100;
  15.     final static static int IWUSR = 0x0080;
  16.     final static static int IXUSR = 0x0040;
  17.     // Group (permissions for read,write and execute)
  18.     final static int IRGRP = 0x0020;
  19.     final static int IWGRP = 0x0010;
  20.     final static int IXGRP = 0x0008;
  21.     // Others (permissions for read,write and execute)
  22.     final static int IROTH = 0x0004;
  23.     final static int IWOTH = 0x0002;
  24.     final static int IXOTH = 0x0001;
  25.  
  26.     //if((fileMode&IFREG)==IFREG)fpermission[0]='-';if((fileMode&IFDIR)==IFDIR)fpermission[0]='d';if((fileMode&IRUSR)==IRUSR)fpermission[1]='r';if((fileMode&IWUSR)==IWUSR)fpermission[2]='w';if((fileMode&IXUSR)==IXUSR)fpermission[3]='x';if((fileMode&IRGRP)==IRGRP)fpermission[4]='r';if((fileMode&IXGRP)==IXGRP)fpermission[5]='w';if((fileMode&IWGRP)==IWGRP)fpermission[6]='x';if((fileMode&IROTH)==IROTH)fpermission[7]='r';if((fileMode&IWOTH)==IWOTH)fpermission[8]='w';if((fileMode&IXOTH)==IXOTH)fpermission[9]='x';
  27.   //  String p = new String(fpermission);return p;
  28.  
  29.     public static final static int[] PERMISSIONS  = {
  30.              IFLNK,IFSCK,IFREG, IFBLK,IFDIR,IFCHR,ISUID, ISGID, ISVTX, IRUSR,IWUSR,IXUSR  
  31.          };
  32.  
  33.          public static final String[] PERMISSION_STRINGS = {
  34.             "s", "l", "-", "b", "d", "c", "p",
  35.             "", "", "",
  36.             "r", "w", "x",
  37.             "r", "w", "x",
  38.             "r", "w", "x"
  39.     };
  40.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top