Lines Matching refs: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()
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)); \
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()
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()
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()