• Home
  • Raw
  • Download

Lines Matching full:mode

92 #  define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)  argument
96 # define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) argument
100 # define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) argument
104 # define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) argument
108 # define S_ISDOOR(mode) 0 argument
112 # define S_ISPORT(mode) 0 argument
116 # define S_ISWHT(mode) 0 argument
255 mode_t mode; in _PyLong_AsMode_t() local
261 mode = (mode_t)value; in _PyLong_AsMode_t()
262 if ((unsigned long)mode != value) { in _PyLong_AsMode_t()
263 PyErr_SetString(PyExc_OverflowError, "mode out of range"); in _PyLong_AsMode_t()
266 return mode; in _PyLong_AsMode_t()
274 mode_t mode = _PyLong_AsMode_t(omode); \
275 if ((mode == (mode_t)-1) && PyErr_Occurred()) \
277 return PyBool_FromLong(isfunc(mode)); \
282 "S_ISDIR(mode) -> bool\n\n"
283 "Return True if mode is from a directory.");
286 "S_ISCHR(mode) -> bool\n\n"
287 "Return True if mode is from a character special device file.");
290 "S_ISBLK(mode) -> bool\n\n"
291 "Return True if mode is from a block special device file.");
294 "S_ISREG(mode) -> bool\n\n"
295 "Return True if mode is from a regular file.");
298 "S_ISFIFO(mode) -> bool\n\n"
299 "Return True if mode is from a FIFO (named pipe).");
302 "S_ISLNK(mode) -> bool\n\n"
303 "Return True if mode is from a symbolic link.");
306 "S_ISSOCK(mode) -> bool\n\n"
307 "Return True if mode is from a socket.");
310 "S_ISDOOR(mode) -> bool\n\n"
311 "Return True if mode is from a door.");
314 "S_ISPORT(mode) -> bool\n\n"
315 "Return True if mode is from an event port.");
318 "S_ISWHT(mode) -> bool\n\n"
319 "Return True if mode is from a whiteout.");
323 "Return the portion of the file's mode that can be set by os.chmod().");
328 mode_t mode = _PyLong_AsMode_t(omode); in stat_S_IMODE() local
329 if ((mode == (mode_t)-1) && PyErr_Occurred()) in stat_S_IMODE()
331 return PyLong_FromUnsignedLong(mode & S_IMODE); in stat_S_IMODE()
336 "Return the portion of the file's mode that describes the file type.");
341 mode_t mode = _PyLong_AsMode_t(omode); in stat_S_IFMT() local
342 if ((mode == (mode_t)-1) && PyErr_Occurred()) in stat_S_IFMT()
344 return PyLong_FromUnsignedLong(mode & S_IFMT); in stat_S_IFMT()
351 filetype(mode_t mode) in filetype() argument
354 if (S_ISREG(mode)) return '-'; in filetype()
355 if (S_ISDIR(mode)) return 'd'; in filetype()
356 if (S_ISLNK(mode)) return 'l'; in filetype()
358 if (S_ISBLK(mode)) return 'b'; in filetype()
359 if (S_ISCHR(mode)) return 'c'; in filetype()
360 if (S_ISFIFO(mode)) return 'p'; in filetype()
361 if (S_ISSOCK(mode)) return 's'; in filetype()
363 if (S_ISDOOR(mode)) return 'D'; in filetype()
364 if (S_ISPORT(mode)) return 'P'; in filetype()
365 if (S_ISWHT(mode)) return 'w'; in filetype()
371 fileperm(mode_t mode, char *buf) in fileperm() argument
373 buf[0] = mode & S_IRUSR ? 'r' : '-'; in fileperm()
374 buf[1] = mode & S_IWUSR ? 'w' : '-'; in fileperm()
375 if (mode & S_ISUID) { in fileperm()
376 buf[2] = mode & S_IXUSR ? 's' : 'S'; in fileperm()
378 buf[2] = mode & S_IXUSR ? 'x' : '-'; in fileperm()
380 buf[3] = mode & S_IRGRP ? 'r' : '-'; in fileperm()
381 buf[4] = mode & S_IWGRP ? 'w' : '-'; in fileperm()
382 if (mode & S_ISGID) { in fileperm()
383 buf[5] = mode & S_IXGRP ? 's' : 'S'; in fileperm()
385 buf[5] = mode & S_IXGRP ? 'x' : '-'; in fileperm()
387 buf[6] = mode & S_IROTH ? 'r' : '-'; in fileperm()
388 buf[7] = mode & S_IWOTH ? 'w' : '-'; in fileperm()
389 if (mode & S_ISVTX) { in fileperm()
390 buf[8] = mode & S_IXOTH ? 't' : 'T'; in fileperm()
392 buf[8] = mode & S_IXOTH ? 'x' : '-'; in fileperm()
397 "Convert a file's mode to a string of the form '-rwxrwxrwx'");
403 mode_t mode; in stat_filemode() local
405 mode = _PyLong_AsMode_t(omode); in stat_filemode()
406 if ((mode == (mode_t)-1) && PyErr_Occurred()) in stat_filemode()
409 buf[0] = filetype(mode); in stat_filemode()
410 fileperm(mode, &buf[1]); in stat_filemode()