@@ -767,36 +767,61 @@ process and user.
767767 single: gethostbyaddr() (in module socket)
768768
769769 Returns information identifying the current operating system.
770- The return value is an object with five attributes:
771-
772- * :attr: `sysname ` - operating system name
773- * :attr: `nodename ` - name of machine on network (implementation-defined)
774- * :attr: `release ` - operating system release
775- * :attr: `version ` - operating system version
776- * :attr: `machine ` - hardware identifier
777-
778- For backwards compatibility, this object is also iterable, behaving
779- like a five-tuple containing :attr: `sysname `, :attr: `nodename `,
780- :attr: `release `, :attr: `version `, and :attr: `machine `
781- in that order.
782-
783- Some systems truncate :attr: `nodename ` to 8 characters or to the
784- leading component; a better way to get the hostname is
785- :func: `socket.gethostname ` or even
786- ``socket.gethostbyaddr(socket.gethostname()) ``.
770+ The return value is a :class: `uname_result `.
787771
788772 On macOS, iOS and Android, this returns the *kernel * name and version (i.e.,
789773 ``'Darwin' `` on macOS and iOS; ``'Linux' `` on Android). :func: `platform.uname `
790774 can be used to get the user-facing operating system name and version on iOS and
791775 Android.
792776
777+ .. seealso ::
778+ :data: `sys.platform ` which has finer granularity.
779+
780+ The :mod: `platform ` module provides detailed checks for the
781+ system's identity.
782+
793783 .. availability :: Unix.
794784
795785 .. versionchanged :: 3.3
796786 Return type changed from a tuple to a tuple-like object
797787 with named attributes.
798788
799789
790+ .. class :: uname_result
791+
792+ Name and information about the system returned by :func: `os.uname `.
793+ These attributes correspond to the members described in :manpage: `uname(2)`.
794+
795+ For backwards compatibility, this object is also iterable, behaving
796+ like a five-tuple containing :attr: `~uname_result.sysname `,
797+ :attr: `~uname_result.nodename `, :attr: `~uname_result.release `,
798+ :attr: `~uname_result.version `, and :attr: `~uname_result.machine `
799+ in that order.
800+
801+ .. attribute :: sysname
802+
803+ Operating system name.
804+
805+ .. attribute :: nodename
806+
807+ Name of machine on network. Some systems truncate
808+ :attr: `~uname_result.nodename ` to 8 characters or to the leading
809+ component; a better way to get the hostname is :func: `socket.gethostname `
810+ or even ``socket.gethostbyaddr(socket.gethostname()) ``.
811+
812+ .. attribute :: release
813+
814+ Operating system release.
815+
816+ .. attribute :: version
817+
818+ Operating system version.
819+
820+ .. attribute :: machine
821+
822+ Hardware identifier.
823+
824+
800825.. function :: unsetenv(key, /)
801826
802827 .. index :: single: environment variables; deleting
@@ -1074,8 +1099,8 @@ as internal buffering of data.
10741099.. function :: fstatvfs(fd, /)
10751100
10761101 Return information about the filesystem containing the file associated with
1077- file descriptor *fd *, like :func: `statvfs `. As of Python 3.3, this is
1078- equivalent to ``os.statvfs(fd) ``.
1102+ file descriptor *fd * in a :class: ` statvfs_result ` , like :func: `statvfs `.
1103+ As of Python 3.3, this is equivalent to ``os.statvfs(fd) ``.
10791104
10801105 .. availability :: Unix.
10811106
@@ -3298,48 +3323,174 @@ features:
32983323
32993324.. function :: statvfs(path)
33003325
3301- Perform a :c:func: `!statvfs ` system call on the given path. The return value is
3302- an object whose attributes describe the filesystem on the given path, and
3303- correspond to the members of the :c:struct: `statvfs ` structure, namely:
3304- :attr: `f_bsize `, :attr: `f_frsize `, :attr: `f_blocks `, :attr: `f_bfree `,
3305- :attr: `f_bavail `, :attr: `f_files `, :attr: `f_ffree `, :attr: `f_favail `,
3306- :attr: `f_flag `, :attr: `f_namemax `, :attr: `f_fsid `.
3307-
3308- Two module-level constants are defined for the :attr: `f_flag ` attribute's
3309- bit-flags: if :const: `ST_RDONLY ` is set, the filesystem is mounted
3310- read-only, and if :const: `ST_NOSUID ` is set, the semantics of
3311- setuid/setgid bits are disabled or not supported.
3312-
3313- Additional module-level constants are defined for GNU/glibc based systems.
3314- These are :const: `ST_NODEV ` (disallow access to device special files),
3315- :const: `ST_NOEXEC ` (disallow program execution), :const: `ST_SYNCHRONOUS `
3316- (writes are synced at once), :const: `ST_MANDLOCK ` (allow mandatory locks on an FS),
3317- :const: `ST_WRITE ` (write on file/directory/symlink), :const: `ST_APPEND `
3318- (append-only file), :const: `ST_IMMUTABLE ` (immutable file), :const: `ST_NOATIME `
3319- (do not update access times), :const: `ST_NODIRATIME ` (do not update directory access
3320- times), :const: `ST_RELATIME ` (update atime relative to mtime/ctime).
3326+ Perform a :manpage: `statvfs(3)` system call on the given path. The return value
3327+ is a :class: `statvfs_result ` whose attributes describe the filesystem
3328+ on the given path and correspond to the members of the :c:struct: `statvfs `
3329+ structure.
33213330
33223331 This function can support :ref: `specifying a file descriptor <path_fd >`.
33233332
33243333 .. availability :: Unix.
33253334
3326- .. versionchanged :: 3.2
3327- The :const: `ST_RDONLY ` and :const: `ST_NOSUID ` constants were added.
3328-
33293335 .. versionchanged :: 3.3
33303336 Added support for specifying *path * as an open file descriptor.
33313337
3332- .. versionchanged :: 3.4
3333- The :const: `ST_NODEV `, :const: `ST_NOEXEC `, :const: `ST_SYNCHRONOUS `,
3334- :const: `ST_MANDLOCK `, :const: `ST_WRITE `, :const: `ST_APPEND `,
3335- :const: `ST_IMMUTABLE `, :const: `ST_NOATIME `, :const: `ST_NODIRATIME `,
3336- and :const: `ST_RELATIME ` constants were added.
3337-
33383338 .. versionchanged :: 3.6
33393339 Accepts a :term: `path-like object `.
33403340
3341- .. versionchanged :: 3.7
3342- Added the :attr: `f_fsid ` attribute.
3341+
3342+ .. class :: statvfs_result
3343+
3344+ Filesystem statistics returned by :func: `os.statvfs ` and :func: `os.fstatvfs `.
3345+ See :manpage: `statvfs(3)` for more details.
3346+
3347+ .. attribute :: f_bsize
3348+
3349+ Block size.
3350+
3351+ .. attribute :: f_frsize
3352+
3353+ Fragment size.
3354+
3355+ .. attribute :: f_blocks
3356+
3357+ Number of :attr: `~statvfs_result.f_frsize ` sized blocks the filesystem
3358+ can contain.
3359+
3360+ .. attribute :: f_bfree
3361+
3362+ Number of free blocks.
3363+
3364+ .. attribute :: f_bavail
3365+
3366+ Number of free blocks for unprivileged users.
3367+
3368+ .. attribute :: f_files
3369+
3370+ Number of file entries, inodes, the filesystem can contain.
3371+
3372+ .. attribute :: f_ffree
3373+
3374+ Number of free files entries.
3375+
3376+ .. attribute :: f_favail
3377+
3378+ Number of free file entries for unprivileged users.
3379+
3380+ .. attribute :: f_flag
3381+
3382+ Bit-mask of mount flags. The following flags are defined:
3383+ :data: `ST_RDONLY `, :data: `ST_NOSUID `, :data: `ST_NODEV `,
3384+ :data: `ST_NOEXEC `, :data: `ST_SYNCHRONOUS `, :data: `ST_MANDLOCK `,
3385+ :data: `ST_WRITE `, :data: `ST_APPEND `, :data: `ST_IMMUTABLE `,
3386+ :data: `ST_NOATIME `, :data: `ST_NODIRATIME `, and :data: `ST_RELATIME `.
3387+
3388+ .. attribute :: f_namemax
3389+
3390+ Filesystem max filename length. OS specific limitations such as
3391+ :ref: `Windows MAX_PATH <max-path >` and those described in Linux
3392+ :manpage: `pathname(7)` may exist.
3393+
3394+ .. attribute :: f_fsid
3395+
3396+ Filesystem ID.
3397+
3398+ .. versionadded :: 3.7
3399+
3400+
3401+ The following flags are used in :attr: `statvfs_result.f_flag `.
3402+
3403+ .. data :: ST_RDONLY
3404+
3405+ Read-only filesystem.
3406+
3407+ .. versionadded :: 3.2
3408+
3409+ .. data :: ST_NOSUID
3410+
3411+ Setuid/setgid bits are disabled or not supported.
3412+
3413+ .. versionadded :: 3.2
3414+
3415+ .. data :: ST_NODEV
3416+
3417+ Disallow access to device special files.
3418+
3419+ .. availability :: Linux.
3420+
3421+ .. versionadded :: 3.4
3422+
3423+ .. data :: ST_NOEXEC
3424+
3425+ Disallow program execution.
3426+
3427+ .. availability :: Linux.
3428+
3429+ .. versionadded :: 3.4
3430+
3431+ .. data :: ST_SYNCHRONOUS
3432+
3433+ Writes are synced at once.
3434+
3435+ .. availability :: Linux.
3436+
3437+ .. versionadded :: 3.4
3438+
3439+ .. data :: ST_MANDLOCK
3440+
3441+ Allow mandatory locks on an FS.
3442+
3443+ .. availability :: Linux.
3444+
3445+ .. versionadded :: 3.4
3446+
3447+ .. data :: ST_WRITE
3448+
3449+ Write on file/directory/symlink.
3450+
3451+ .. availability :: Linux.
3452+
3453+ .. versionadded :: 3.4
3454+
3455+ .. data :: ST_APPEND
3456+
3457+ Append-only file.
3458+
3459+ .. availability :: Linux.
3460+
3461+ .. versionadded :: 3.4
3462+
3463+ .. data :: ST_IMMUTABLE
3464+
3465+ Immutable file.
3466+
3467+ .. availability :: Linux.
3468+
3469+ .. versionadded :: 3.4
3470+
3471+ .. data :: ST_NOATIME
3472+
3473+ Do not update access times.
3474+
3475+ .. availability :: Linux.
3476+
3477+ .. versionadded :: 3.4
3478+
3479+ .. data :: ST_NODIRATIME
3480+
3481+ Do not update directory access times.
3482+
3483+ .. availability :: Linux.
3484+
3485+ .. versionadded :: 3.4
3486+
3487+ .. data :: ST_RELATIME
3488+
3489+ Update atime relative to mtime/ctime.
3490+
3491+ .. availability :: Linux.
3492+
3493+ .. versionadded :: 3.4
33433494
33443495
33453496.. data :: supports_dir_fd
0 commit comments