@@ -791,36 +791,61 @@ process and user.
791791 single: gethostbyaddr() (in module socket)
792792
793793 Returns information identifying the current operating system.
794- The return value is an object with five attributes:
795-
796- * :attr: `sysname ` - operating system name
797- * :attr: `nodename ` - name of machine on network (implementation-defined)
798- * :attr: `release ` - operating system release
799- * :attr: `version ` - operating system version
800- * :attr: `machine ` - hardware identifier
801-
802- For backwards compatibility, this object is also iterable, behaving
803- like a five-tuple containing :attr: `sysname `, :attr: `nodename `,
804- :attr: `release `, :attr: `version `, and :attr: `machine `
805- in that order.
806-
807- Some systems truncate :attr: `nodename ` to 8 characters or to the
808- leading component; a better way to get the hostname is
809- :func: `socket.gethostname ` or even
810- ``socket.gethostbyaddr(socket.gethostname()) ``.
794+ The return value is a :class: `uname_result `.
811795
812796 On macOS, iOS and Android, this returns the *kernel * name and version (i.e.,
813797 ``'Darwin' `` on macOS and iOS; ``'Linux' `` on Android). :func: `platform.uname `
814798 can be used to get the user-facing operating system name and version on iOS and
815799 Android.
816800
801+ .. seealso ::
802+ :data: `sys.platform ` which has finer granularity.
803+
804+ The :mod: `platform ` module provides detailed checks for the
805+ system's identity.
806+
817807 .. availability :: Unix.
818808
819809 .. versionchanged :: 3.3
820810 Return type changed from a tuple to a tuple-like object
821811 with named attributes.
822812
823813
814+ .. class :: uname_result
815+
816+ Name and information about the system returned by :func: `os.uname `.
817+ These attributes correspond to the members described in :manpage: `uname(2)`.
818+
819+ For backwards compatibility, this object is also iterable, behaving
820+ like a five-tuple containing :attr: `~uname_result.sysname `,
821+ :attr: `~uname_result.nodename `, :attr: `~uname_result.release `,
822+ :attr: `~uname_result.version `, and :attr: `~uname_result.machine `
823+ in that order.
824+
825+ .. attribute :: sysname
826+
827+ Operating system name.
828+
829+ .. attribute :: nodename
830+
831+ Name of machine on network. Some systems truncate
832+ :attr: `~uname_result.nodename ` to 8 characters or to the leading
833+ component; a better way to get the hostname is :func: `socket.gethostname `
834+ or even ``socket.gethostbyaddr(socket.gethostname()) ``.
835+
836+ .. attribute :: release
837+
838+ Operating system release.
839+
840+ .. attribute :: version
841+
842+ Operating system version.
843+
844+ .. attribute :: machine
845+
846+ Hardware identifier.
847+
848+
824849.. function :: unsetenv(key, /)
825850
826851 .. index :: single: environment variables; deleting
@@ -1100,8 +1125,8 @@ as internal buffering of data.
11001125.. function :: fstatvfs(fd, /)
11011126
11021127 Return information about the filesystem containing the file associated with
1103- file descriptor *fd *, like :func: `statvfs `. As of Python 3.3, this is
1104- equivalent to ``os.statvfs(fd) ``.
1128+ file descriptor *fd * in a :class: ` statvfs_result ` , like :func: `statvfs `.
1129+ As of Python 3.3, this is equivalent to ``os.statvfs(fd) ``.
11051130
11061131 .. availability :: Unix.
11071132
@@ -3371,48 +3396,174 @@ features:
33713396
33723397.. function :: statvfs(path)
33733398
3374- Perform a :c:func: `!statvfs ` system call on the given path. The return value is
3375- an object whose attributes describe the filesystem on the given path, and
3376- correspond to the members of the :c:struct: `statvfs ` structure, namely:
3377- :attr: `f_bsize `, :attr: `f_frsize `, :attr: `f_blocks `, :attr: `f_bfree `,
3378- :attr: `f_bavail `, :attr: `f_files `, :attr: `f_ffree `, :attr: `f_favail `,
3379- :attr: `f_flag `, :attr: `f_namemax `, :attr: `f_fsid `.
3380-
3381- Two module-level constants are defined for the :attr: `f_flag ` attribute's
3382- bit-flags: if :const: `ST_RDONLY ` is set, the filesystem is mounted
3383- read-only, and if :const: `ST_NOSUID ` is set, the semantics of
3384- setuid/setgid bits are disabled or not supported.
3385-
3386- Additional module-level constants are defined for GNU/glibc based systems.
3387- These are :const: `ST_NODEV ` (disallow access to device special files),
3388- :const: `ST_NOEXEC ` (disallow program execution), :const: `ST_SYNCHRONOUS `
3389- (writes are synced at once), :const: `ST_MANDLOCK ` (allow mandatory locks on an FS),
3390- :const: `ST_WRITE ` (write on file/directory/symlink), :const: `ST_APPEND `
3391- (append-only file), :const: `ST_IMMUTABLE ` (immutable file), :const: `ST_NOATIME `
3392- (do not update access times), :const: `ST_NODIRATIME ` (do not update directory access
3393- times), :const: `ST_RELATIME ` (update atime relative to mtime/ctime).
3399+ Perform a :manpage: `statvfs(3)` system call on the given path. The return value
3400+ is a :class: `statvfs_result ` whose attributes describe the filesystem
3401+ on the given path and correspond to the members of the :c:struct: `statvfs `
3402+ structure.
33943403
33953404 This function can support :ref: `specifying a file descriptor <path_fd >`.
33963405
33973406 .. availability :: Unix.
33983407
3399- .. versionchanged :: 3.2
3400- The :const: `ST_RDONLY ` and :const: `ST_NOSUID ` constants were added.
3401-
34023408 .. versionchanged :: 3.3
34033409 Added support for specifying *path * as an open file descriptor.
34043410
3405- .. versionchanged :: 3.4
3406- The :const: `ST_NODEV `, :const: `ST_NOEXEC `, :const: `ST_SYNCHRONOUS `,
3407- :const: `ST_MANDLOCK `, :const: `ST_WRITE `, :const: `ST_APPEND `,
3408- :const: `ST_IMMUTABLE `, :const: `ST_NOATIME `, :const: `ST_NODIRATIME `,
3409- and :const: `ST_RELATIME ` constants were added.
3410-
34113411 .. versionchanged :: 3.6
34123412 Accepts a :term: `path-like object `.
34133413
3414- .. versionchanged :: 3.7
3415- Added the :attr: `f_fsid ` attribute.
3414+
3415+ .. class :: statvfs_result
3416+
3417+ Filesystem statistics returned by :func: `os.statvfs ` and :func: `os.fstatvfs `.
3418+ See :manpage: `statvfs(3)` for more details.
3419+
3420+ .. attribute :: f_bsize
3421+
3422+ Block size.
3423+
3424+ .. attribute :: f_frsize
3425+
3426+ Fragment size.
3427+
3428+ .. attribute :: f_blocks
3429+
3430+ Number of :attr: `~statvfs_result.f_frsize ` sized blocks the filesystem
3431+ can contain.
3432+
3433+ .. attribute :: f_bfree
3434+
3435+ Number of free blocks.
3436+
3437+ .. attribute :: f_bavail
3438+
3439+ Number of free blocks for unprivileged users.
3440+
3441+ .. attribute :: f_files
3442+
3443+ Number of file entries, inodes, the filesystem can contain.
3444+
3445+ .. attribute :: f_ffree
3446+
3447+ Number of free files entries.
3448+
3449+ .. attribute :: f_favail
3450+
3451+ Number of free file entries for unprivileged users.
3452+
3453+ .. attribute :: f_flag
3454+
3455+ Bit-mask of mount flags. The following flags are defined:
3456+ :data: `ST_RDONLY `, :data: `ST_NOSUID `, :data: `ST_NODEV `,
3457+ :data: `ST_NOEXEC `, :data: `ST_SYNCHRONOUS `, :data: `ST_MANDLOCK `,
3458+ :data: `ST_WRITE `, :data: `ST_APPEND `, :data: `ST_IMMUTABLE `,
3459+ :data: `ST_NOATIME `, :data: `ST_NODIRATIME `, and :data: `ST_RELATIME `.
3460+
3461+ .. attribute :: f_namemax
3462+
3463+ Filesystem max filename length. OS specific limitations such as
3464+ :ref: `Windows MAX_PATH <max-path >` and those described in Linux
3465+ :manpage: `pathname(7)` may exist.
3466+
3467+ .. attribute :: f_fsid
3468+
3469+ Filesystem ID.
3470+
3471+ .. versionadded :: 3.7
3472+
3473+
3474+ The following flags are used in :attr: `statvfs_result.f_flag `.
3475+
3476+ .. data :: ST_RDONLY
3477+
3478+ Read-only filesystem.
3479+
3480+ .. versionadded :: 3.2
3481+
3482+ .. data :: ST_NOSUID
3483+
3484+ Setuid/setgid bits are disabled or not supported.
3485+
3486+ .. versionadded :: 3.2
3487+
3488+ .. data :: ST_NODEV
3489+
3490+ Disallow access to device special files.
3491+
3492+ .. availability :: Linux.
3493+
3494+ .. versionadded :: 3.4
3495+
3496+ .. data :: ST_NOEXEC
3497+
3498+ Disallow program execution.
3499+
3500+ .. availability :: Linux.
3501+
3502+ .. versionadded :: 3.4
3503+
3504+ .. data :: ST_SYNCHRONOUS
3505+
3506+ Writes are synced at once.
3507+
3508+ .. availability :: Linux.
3509+
3510+ .. versionadded :: 3.4
3511+
3512+ .. data :: ST_MANDLOCK
3513+
3514+ Allow mandatory locks on an FS.
3515+
3516+ .. availability :: Linux.
3517+
3518+ .. versionadded :: 3.4
3519+
3520+ .. data :: ST_WRITE
3521+
3522+ Write on file/directory/symlink.
3523+
3524+ .. availability :: Linux.
3525+
3526+ .. versionadded :: 3.4
3527+
3528+ .. data :: ST_APPEND
3529+
3530+ Append-only file.
3531+
3532+ .. availability :: Linux.
3533+
3534+ .. versionadded :: 3.4
3535+
3536+ .. data :: ST_IMMUTABLE
3537+
3538+ Immutable file.
3539+
3540+ .. availability :: Linux.
3541+
3542+ .. versionadded :: 3.4
3543+
3544+ .. data :: ST_NOATIME
3545+
3546+ Do not update access times.
3547+
3548+ .. availability :: Linux.
3549+
3550+ .. versionadded :: 3.4
3551+
3552+ .. data :: ST_NODIRATIME
3553+
3554+ Do not update directory access times.
3555+
3556+ .. availability :: Linux.
3557+
3558+ .. versionadded :: 3.4
3559+
3560+ .. data :: ST_RELATIME
3561+
3562+ Update atime relative to mtime/ctime.
3563+
3564+ .. availability :: Linux.
3565+
3566+ .. versionadded :: 3.4
34163567
34173568
34183569.. data :: supports_dir_fd
0 commit comments