This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: os.stat() doesn't return st_rdev
Type: enhancement Stage:
Components: Extension Modules Versions:
process
Status: closed Resolution: later
Dependencies: Superseder:
Assigned To: fdrake Nosy List: amaury.forgeotdarc, doerwalter, fdrake, socketpair, volt
Priority: low Keywords:

Created on 2000-08-09 13:38 by volt, last changed 2022-04-10 16:02 by admin. This issue is now closed.

Messages (6)
msg968 - (view) Author: Jan Danielsson (volt) Date: 2000-08-09 13:38
The call os.stat() returns the fields st_mode, st_ino,
st_nlink, st_uid, st_gid, st_size, st_atime, st_mtime
st_ctime from "struct stat".
To be able to explore device nodes on a linux system
the field st_rdev needed as the major and minor device number is stored in this field.
It would be nice if it could be added as an extra element
in the tuple returned by os.stat, os.lstat etc.
msg969 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2000-08-30 04:51
We could add an additional element to the end with the st_rdev value, but I'm not convinced that's really the right approach; some other platform that defines another field could get that added at the end of the return tuple, and the the 11th position would have incompatible values.

The "right" solution may be to create a new function (nstat?) that returns either a dictionary or other object that has entries for all the fields (using None for fields a platform doesn't provide values for).
msg970 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2000-09-15 19:52
Added as a feature request to PEP 42.
msg971 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2002-06-06 08:53
Logged In: YES 
user_id=89016

I guess this should be closed as fixed (and removed from PEP
42), because it works now via attributes:
>>> import os
>>> os.stat("/dev/tty0").st_rdev
1024
msg155256 - (view) Author: Марк Коренберг (socketpair) * Date: 2012-03-09 19:02
Okay, it returns that field, but still not print one in repr(). Please fix.
msg155260 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2012-03-09 19:44
Марк, issue11698 already track this.
History
Date User Action Args
2022-04-10 16:02:15adminsetgithub: 32905
2012-03-09 19:44:50amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg155260
2012-03-09 19:02:59socketpairsetnosy: + socketpair
messages: + msg155256
2000-08-09 13:38:39voltcreate