| OLD | NEW |
| 1 :mod:`os` --- Miscellaneous operating system interfaces | 1 :mod:`os` --- Miscellaneous operating system interfaces |
| 2 ======================================================= | 2 ======================================================= |
| 3 | 3 |
| 4 .. module:: os | 4 .. module:: os |
| 5 :synopsis: Miscellaneous operating system interfaces. | 5 :synopsis: Miscellaneous operating system interfaces. |
| 6 | 6 |
| 7 | 7 |
| 8 This module provides a portable way of using operating system dependent | 8 This module provides a portable way of using operating system dependent |
| 9 functionality. If you just want to read or write a file see :func:`open`, if | 9 functionality. If you just want to read or write a file see :func:`open`, if |
| 10 you want to manipulate paths, see the :mod:`os.path` module, and if you want to | 10 you want to manipulate paths, see the :mod:`os.path` module, and if you want to |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 | 628 |
| 629 .. function:: fdatasync(fd) | 629 .. function:: fdatasync(fd) |
| 630 | 630 |
| 631 Force write of file with filedescriptor *fd* to disk. Does not force update o
f | 631 Force write of file with filedescriptor *fd* to disk. Does not force update o
f |
| 632 metadata. | 632 metadata. |
| 633 | 633 |
| 634 Availability: Unix. | 634 Availability: Unix. |
| 635 | 635 |
| 636 .. note:: | 636 .. note:: |
| 637 This function is not available on MacOS. | 637 This function is not available on MacOS. |
| 638 |
| 639 |
| 640 .. function:: fexecve(fd, args, env) |
| 641 |
| 642 Execute the program specified by a file descriptor *fd* with arguments given |
| 643 by *args* and environment given by *env*, replacing the current process. |
| 644 *args* and *env* are given as in :func:`execve`. |
| 645 |
| 646 Availability: Unix. |
| 647 |
| 648 .. versionadded:: 3.3 |
| 638 | 649 |
| 639 | 650 |
| 640 .. function:: fpathconf(fd, name) | 651 .. function:: fpathconf(fd, name) |
| 641 | 652 |
| 642 Return system configuration information relevant to an open file. *name* | 653 Return system configuration information relevant to an open file. *name* |
| 643 specifies the configuration value to retrieve; it may be a string which is th
e | 654 specifies the configuration value to retrieve; it may be a string which is th
e |
| 644 name of a defined system value; these names are specified in a number of | 655 name of a defined system value; these names are specified in a number of |
| 645 standards (POSIX.1, Unix 95, Unix 98, and others). Some platforms define | 656 standards (POSIX.1, Unix 95, Unix 98, and others). Some platforms define |
| 646 additional names as well. The names known to the host operating system are | 657 additional names as well. The names known to the host operating system are |
| 647 given in the ``pathconf_names`` dictionary. For configuration variables not | 658 given in the ``pathconf_names`` dictionary. For configuration variables not |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 | 692 |
| 682 Availability: Unix, and Windows. | 693 Availability: Unix, and Windows. |
| 683 | 694 |
| 684 | 695 |
| 685 .. function:: ftruncate(fd, length) | 696 .. function:: ftruncate(fd, length) |
| 686 | 697 |
| 687 Truncate the file corresponding to file descriptor *fd*, so that it is at mos
t | 698 Truncate the file corresponding to file descriptor *fd*, so that it is at mos
t |
| 688 *length* bytes in size. | 699 *length* bytes in size. |
| 689 | 700 |
| 690 Availability: Unix. | 701 Availability: Unix. |
| 702 |
| 703 |
| 704 .. function:: futimens(fd, (atime_sec, atime_nsec), (mtime_sec, mtime_nsec)) |
| 705 futimens(fd, None, None) |
| 706 |
| 707 Updates the timestamps of a file specified by the file descriptor *fd*, with |
| 708 nanosecond precision. |
| 709 The second form sets *atime* and *mtime* to the current time. |
| 710 If *atime_nsec* or *mtime_nsec* is specified as :data:`UTIME_NOW`, the corres
ponding |
| 711 timestamp is updated to the current time. |
| 712 If *atime_nsec* or *mtime_nsec* is specified as :data:`UTIME_OMIT`, the corre
sponding |
| 713 timestamp is not updated. |
| 714 |
| 715 Availability: Unix. |
| 716 |
| 717 .. versionadded:: 3.3 |
| 718 |
| 719 |
| 720 .. data:: UTIME_NOW |
| 721 UTIME_OMIT |
| 722 |
| 723 Flags used with :func:`futimens` to specify that the timestamp must be |
| 724 updated either to the current time or not updated at all. |
| 725 |
| 726 Availability: Unix. |
| 727 |
| 728 .. versionadded:: 3.3 |
| 729 |
| 730 |
| 731 .. function:: futimes(fd, (atime, mtime)) |
| 732 futimes(fd, None) |
| 733 |
| 734 Set the access and modified time of the file specified by the file |
| 735 descriptor *fd* to the given values. If the second form is used, set the |
| 736 access and modified times to the current time. |
| 737 |
| 738 Availability: Unix. |
| 739 |
| 740 .. versionadded:: 3.3 |
| 691 | 741 |
| 692 | 742 |
| 693 .. function:: isatty(fd) | 743 .. function:: isatty(fd) |
| 694 | 744 |
| 695 Return ``True`` if the file descriptor *fd* is open and connected to a | 745 Return ``True`` if the file descriptor *fd* is open and connected to a |
| 696 tty(-like) device, else ``False``. | 746 tty(-like) device, else ``False``. |
| 697 | 747 |
| 698 Availability: Unix. | 748 Availability: Unix. |
| 699 | 749 |
| 750 |
| 751 .. function:: lockf(fd, cmd, len) |
| 752 |
| 753 Apply, test or remove a POSIX lock on an open file descriptor. |
| 754 *fd* is an open file descriptor. |
| 755 *cmd* specifies the command to use - one of :data:`F_LOCK`, :data:`F_TLOCK`, |
| 756 :data:`F_ULOCK` or :data:`F_TEST`. |
| 757 *len* specifies the section of the file to lock. |
| 758 |
| 759 Availability: Unix. |
| 760 |
| 761 .. versionadded:: 3.3 |
| 762 |
| 763 |
| 764 .. data:: F_LOCK |
| 765 F_TLOCK |
| 766 F_ULOCK |
| 767 F_TEST |
| 768 |
| 769 Flags that specify what action :func:`lockf` will take. |
| 770 |
| 771 Availability: Unix. |
| 772 |
| 773 .. versionadded:: 3.3 |
| 700 | 774 |
| 701 .. function:: lseek(fd, pos, how) | 775 .. function:: lseek(fd, pos, how) |
| 702 | 776 |
| 703 Set the current position of file descriptor *fd* to position *pos*, modified | 777 Set the current position of file descriptor *fd* to position *pos*, modified |
| 704 by *how*: :const:`SEEK_SET` or ``0`` to set the position relative to the | 778 by *how*: :const:`SEEK_SET` or ``0`` to set the position relative to the |
| 705 beginning of the file; :const:`SEEK_CUR` or ``1`` to set it relative to the | 779 beginning of the file; :const:`SEEK_CUR` or ``1`` to set it relative to the |
| 706 current position; :const:`os.SEEK_END` or ``2`` to set it relative to the end
of | 780 current position; :const:`os.SEEK_END` or ``2`` to set it relative to the end
of |
| 707 the file. | 781 the file. |
| 708 | 782 |
| 709 Availability: Unix, Windows. | 783 Availability: Unix, Windows. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 | 823 |
| 750 Availability: some flavors of Unix. | 824 Availability: some flavors of Unix. |
| 751 | 825 |
| 752 | 826 |
| 753 .. function:: pipe() | 827 .. function:: pipe() |
| 754 | 828 |
| 755 Create a pipe. Return a pair of file descriptors ``(r, w)`` usable for readi
ng | 829 Create a pipe. Return a pair of file descriptors ``(r, w)`` usable for readi
ng |
| 756 and writing, respectively. | 830 and writing, respectively. |
| 757 | 831 |
| 758 Availability: Unix, Windows. | 832 Availability: Unix, Windows. |
| 833 |
| 834 |
| 835 .. function:: posix_fallocate(fd, offset, len) |
| 836 |
| 837 Ensures that enough disk space is allocated for the file specified by *fd* |
| 838 starting from *offset* and continuing for *len* bytes. |
| 839 |
| 840 Availability: Unix. |
| 841 |
| 842 .. versionadded:: 3.3 |
| 843 |
| 844 |
| 845 .. function:: posix_fadvise(fd, offset, len, advice) |
| 846 |
| 847 Announces an intention to access data in a specific pattern thus allowing |
| 848 the kernel to make optimizations. |
| 849 The advice applies to the region of the file specified by *fd* starting at |
| 850 *offset* and continuing for *len* bytes. |
| 851 *advice* is one of :data:`POSIX_FADV_NORMAL`, :data:`POSIX_FADV_SEQUENTIAL`, |
| 852 :data:`POSIX_FADV_RANDOM`, :data:`POSIX_FADV_NOREUSE`, |
| 853 :data:`POSIX_FADV_WILLNEED` or :data:`POSIX_FADV_DONTNEED`. |
| 854 |
| 855 Availability: Unix. |
| 856 |
| 857 .. versionadded:: 3.3 |
| 858 |
| 859 |
| 860 .. data:: POSIX_FADV_NORMAL |
| 861 POSIX_FADV_SEQUENTIAL |
| 862 POSIX_FADV_RANDOM |
| 863 POSIX_FADV_NOREUSE |
| 864 POSIX_FADV_WILLNEED |
| 865 POSIX_FADV_DONTNEED |
| 866 |
| 867 Flags that can be used in *advice* in :func:`posix_fadvise` that specify |
| 868 the access pattern that is likely to be used. |
| 869 |
| 870 Availability: Unix. |
| 871 |
| 872 .. versionadded:: 3.3 |
| 873 |
| 874 |
| 875 .. function:: pread(fd, buffersize, offset) |
| 876 |
| 877 Read from a file descriptor, *fd*, at a position of *offset*. It will read up |
| 878 to *buffersize* number of bytes. The file offset remains unchanged. |
| 879 |
| 880 Availability: Unix. |
| 881 |
| 882 .. versionadded:: 3.3 |
| 883 |
| 884 |
| 885 .. function:: pwrite(fd, string, offset) |
| 886 |
| 887 Write *string* to a file descriptor, *fd*, from *offset*, leaving the file |
| 888 offset unchanged. |
| 889 |
| 890 Availability: Unix. |
| 891 |
| 892 .. versionadded:: 3.3 |
| 759 | 893 |
| 760 | 894 |
| 761 .. function:: read(fd, n) | 895 .. function:: read(fd, n) |
| 762 | 896 |
| 763 Read at most *n* bytes from file descriptor *fd*. Return a bytestring contain
ing the | 897 Read at most *n* bytes from file descriptor *fd*. Return a bytestring contain
ing the |
| 764 bytes read. If the end of the file referred to by *fd* has been reached, an | 898 bytes read. If the end of the file referred to by *fd* has been reached, an |
| 765 empty bytes object is returned. | 899 empty bytes object is returned. |
| 766 | 900 |
| 767 Availability: Unix, Windows. | 901 Availability: Unix, Windows. |
| 768 | 902 |
| 769 .. note:: | 903 .. note:: |
| 770 | 904 |
| 771 This function is intended for low-level I/O and must be applied to a file | 905 This function is intended for low-level I/O and must be applied to a file |
| 772 descriptor as returned by :func:`os.open` or :func:`pipe`. To read a "fil
e object" | 906 descriptor as returned by :func:`os.open` or :func:`pipe`. To read a "fil
e object" |
| 773 returned by the built-in function :func:`open` or by :func:`popen` or | 907 returned by the built-in function :func:`open` or by :func:`popen` or |
| 774 :func:`fdopen`, or :data:`sys.stdin`, use its :meth:`~file.read` or | 908 :func:`fdopen`, or :data:`sys.stdin`, use its :meth:`~file.read` or |
| 775 :meth:`~file.readline` methods. | 909 :meth:`~file.readline` methods. |
| 910 |
| 911 |
| 912 .. function:: readv(fd, buffers) |
| 913 |
| 914 Read from a file descriptor into a number of writable buffers. *buffers* is |
| 915 an arbitrary sequence of writable buffers. Returns the total number of bytes |
| 916 read. |
| 917 |
| 918 Availability: Unix. |
| 919 |
| 920 .. versionadded:: 3.3 |
| 776 | 921 |
| 777 | 922 |
| 778 .. function:: tcgetpgrp(fd) | 923 .. function:: tcgetpgrp(fd) |
| 779 | 924 |
| 780 Return the process group associated with the terminal given by *fd* (an open | 925 Return the process group associated with the terminal given by *fd* (an open |
| 781 file descriptor as returned by :func:`os.open`). | 926 file descriptor as returned by :func:`os.open`). |
| 782 | 927 |
| 783 Availability: Unix. | 928 Availability: Unix. |
| 784 | 929 |
| 785 | 930 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 807 | 952 |
| 808 Availability: Unix, Windows. | 953 Availability: Unix, Windows. |
| 809 | 954 |
| 810 .. note:: | 955 .. note:: |
| 811 | 956 |
| 812 This function is intended for low-level I/O and must be applied to a file | 957 This function is intended for low-level I/O and must be applied to a file |
| 813 descriptor as returned by :func:`os.open` or :func:`pipe`. To write a "fi
le | 958 descriptor as returned by :func:`os.open` or :func:`pipe`. To write a "fi
le |
| 814 object" returned by the built-in function :func:`open` or by :func:`popen`
or | 959 object" returned by the built-in function :func:`open` or by :func:`popen`
or |
| 815 :func:`fdopen`, or :data:`sys.stdout` or :data:`sys.stderr`, use its | 960 :func:`fdopen`, or :data:`sys.stdout` or :data:`sys.stderr`, use its |
| 816 :meth:`~file.write` method. | 961 :meth:`~file.write` method. |
| 962 |
| 963 |
| 964 .. function:: writev(fd, buffers) |
| 965 |
| 966 Write the the contents of *buffers* to file descriptor *fd*, where *buffers* |
| 967 is an arbitrary sequence of buffers. |
| 968 Returns the total number of bytes written. |
| 969 |
| 970 Availability: Unix. |
| 971 |
| 972 .. versionadded:: 3.3 |
| 817 | 973 |
| 818 | 974 |
| 819 .. _open-constants: | 975 .. _open-constants: |
| 820 | 976 |
| 821 ``open()`` flag constants | 977 ``open()`` flag constants |
| 822 ~~~~~~~~~~~~~~~~~~~~~~~~~ | 978 ~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 823 | 979 |
| 824 The following constants are options for the *flags* parameter to the | 980 The following constants are options for the *flags* parameter to the |
| 825 :func:`~os.open` function. They can be combined using the bitwise OR operator | 981 :func:`~os.open` function. They can be combined using the bitwise OR operator |
| 826 ``|``. Some of them are not available on all platforms. For descriptions of | 982 ``|``. Some of them are not available on all platforms. For descriptions of |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 .. versionchanged:: 3.2 | 1234 .. versionchanged:: 3.2 |
| 1079 The *path* parameter became optional. | 1235 The *path* parameter became optional. |
| 1080 | 1236 |
| 1081 .. function:: lstat(path) | 1237 .. function:: lstat(path) |
| 1082 | 1238 |
| 1083 Like :func:`stat`, but do not follow symbolic links. This is an alias for | 1239 Like :func:`stat`, but do not follow symbolic links. This is an alias for |
| 1084 :func:`stat` on platforms that do not support symbolic links. | 1240 :func:`stat` on platforms that do not support symbolic links. |
| 1085 | 1241 |
| 1086 .. versionchanged:: 3.2 | 1242 .. versionchanged:: 3.2 |
| 1087 Added support for Windows 6.0 (Vista) symbolic links. | 1243 Added support for Windows 6.0 (Vista) symbolic links. |
| 1244 |
| 1245 |
| 1246 .. function:: lutimes(path, (atime, mtime)) |
| 1247 lutimes(path, None) |
| 1248 |
| 1249 Like :func:`utime`, but if *path* is a symbolic link, it is not |
| 1250 dereferenced. |
| 1251 |
| 1252 Availability: Unix. |
| 1253 |
| 1254 .. versionadded:: 3.3 |
| 1088 | 1255 |
| 1089 | 1256 |
| 1090 .. function:: mkfifo(path[, mode]) | 1257 .. function:: mkfifo(path[, mode]) |
| 1091 | 1258 |
| 1092 Create a FIFO (a named pipe) named *path* with numeric mode *mode*. The | 1259 Create a FIFO (a named pipe) named *path* with numeric mode *mode*. The |
| 1093 default *mode* is ``0o666`` (octal). The current umask value is first masked | 1260 default *mode* is ``0o666`` (octal). The current umask value is first masked |
| 1094 out from the mode. | 1261 out from the mode. |
| 1095 | 1262 |
| 1096 FIFOs are pipes that can be accessed like regular files. FIFOs exist until t
hey | 1263 FIFOs are pipes that can be accessed like regular files. FIFOs exist until t
hey |
| 1097 are deleted (for example with :func:`os.unlink`). Generally, FIFOs are used a
s | 1264 are deleted (for example with :func:`os.unlink`). Generally, FIFOs are used a
s |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1402 application as an administrator are ways to successfully create symlinks. | 1569 application as an administrator are ways to successfully create symlinks. |
| 1403 | 1570 |
| 1404 | 1571 |
| 1405 :exc:`OSError` is raised when the function is called by an unprivileged | 1572 :exc:`OSError` is raised when the function is called by an unprivileged |
| 1406 user. | 1573 user. |
| 1407 | 1574 |
| 1408 Availability: Unix, Windows. | 1575 Availability: Unix, Windows. |
| 1409 | 1576 |
| 1410 .. versionchanged:: 3.2 | 1577 .. versionchanged:: 3.2 |
| 1411 Added support for Windows 6.0 (Vista) symbolic links. | 1578 Added support for Windows 6.0 (Vista) symbolic links. |
| 1579 |
| 1580 |
| 1581 .. function:: sync() |
| 1582 |
| 1583 Force write of everything to disk. |
| 1584 |
| 1585 Availability: Unix. |
| 1586 |
| 1587 .. versionadded:: 3.3 |
| 1588 |
| 1589 |
| 1590 .. function:: truncate(path, length) |
| 1591 |
| 1592 Truncate the file corresponding to *path*, so that it is at most |
| 1593 *length* bytes in size. |
| 1594 |
| 1595 Availability: Unix. |
| 1596 |
| 1597 .. versionadded:: 3.3 |
| 1412 | 1598 |
| 1413 | 1599 |
| 1414 .. function:: unlink(path) | 1600 .. function:: unlink(path) |
| 1415 | 1601 |
| 1416 Remove (delete) the file *path*. This is the same function as | 1602 Remove (delete) the file *path*. This is the same function as |
| 1417 :func:`remove`; the :func:`unlink` name is its traditional Unix | 1603 :func:`remove`; the :func:`unlink` name is its traditional Unix |
| 1418 name. | 1604 name. |
| 1419 | 1605 |
| 1420 Availability: Unix, Windows. | 1606 Availability: Unix, Windows. |
| 1421 | 1607 |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1982 | 2168 |
| 1983 .. function:: wait() | 2169 .. function:: wait() |
| 1984 | 2170 |
| 1985 Wait for completion of a child process, and return a tuple containing its pid | 2171 Wait for completion of a child process, and return a tuple containing its pid |
| 1986 and exit status indication: a 16-bit number, whose low byte is the signal num
ber | 2172 and exit status indication: a 16-bit number, whose low byte is the signal num
ber |
| 1987 that killed the process, and whose high byte is the exit status (if the signa
l | 2173 that killed the process, and whose high byte is the exit status (if the signa
l |
| 1988 number is zero); the high bit of the low byte is set if a core file was | 2174 number is zero); the high bit of the low byte is set if a core file was |
| 1989 produced. | 2175 produced. |
| 1990 | 2176 |
| 1991 Availability: Unix. | 2177 Availability: Unix. |
| 2178 |
| 2179 .. function:: waitid(idtype, id, options) |
| 2180 |
| 2181 Wait for the completion of one or more child processes. |
| 2182 *idtype* can be :data:`P_PID`, :data:`P_PGID` or :data:`P_ALL`. |
| 2183 *id* specifies the pid to wait on. |
| 2184 *options* is constructed from the ORing of one or more of :data:`WEXITED`, |
| 2185 :data:`WSTOPPED` or :data:`WCONTINUED` and additionally may be ORed with |
| 2186 :data:`WNOHANG` or :data:`WNOWAIT`. The result is a tuple containing the |
| 2187 same data as *siginfo_t* in the POSIX specification. |
| 2188 |
| 2189 Availability: Unix. |
| 2190 |
| 2191 .. versionadded:: 3.3 |
| 2192 |
| 2193 .. data:: P_PID |
| 2194 P_PGID |
| 2195 P_ALL |
| 2196 |
| 2197 These are the possible values for *idtype* in :func:`waitid`. They affect |
| 2198 how *id* is interpreted. |
| 2199 |
| 2200 Availability: Unix. |
| 2201 |
| 2202 .. versionadded:: 3.3 |
| 2203 |
| 2204 .. data:: WEXITED |
| 2205 WSTOPPED |
| 2206 WNOWAIT |
| 2207 |
| 2208 Flags that can be used in *options* in :func:`waitid` that specify what |
| 2209 child signal to wait for. |
| 2210 |
| 2211 Availability: Unix. |
| 2212 |
| 2213 .. versionadded:: 3.3 |
| 1992 | 2214 |
| 1993 | 2215 |
| 1994 .. function:: waitpid(pid, options) | 2216 .. function:: waitpid(pid, options) |
| 1995 | 2217 |
| 1996 The details of this function differ on Unix and Windows. | 2218 The details of this function differ on Unix and Windows. |
| 1997 | 2219 |
| 1998 On Unix: Wait for completion of a child process given by process id *pid*, an
d | 2220 On Unix: Wait for completion of a child process given by process id *pid*, an
d |
| 1999 return a tuple containing its process id and exit status indication (encoded
as | 2221 return a tuple containing its process id and exit status indication (encoded
as |
| 2000 for :func:`wait`). The semantics of the call are affected by the value of th
e | 2222 for :func:`wait`). The semantics of the call are affected by the value of th
e |
| 2001 integer *options*, which should be ``0`` for normal operation. | 2223 integer *options*, which should be ``0`` for normal operation. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2158 Availability: Unix | 2380 Availability: Unix |
| 2159 | 2381 |
| 2160 | 2382 |
| 2161 .. data:: confstr_names | 2383 .. data:: confstr_names |
| 2162 | 2384 |
| 2163 Dictionary mapping names accepted by :func:`confstr` to the integer values | 2385 Dictionary mapping names accepted by :func:`confstr` to the integer values |
| 2164 defined for those names by the host operating system. This can be used to | 2386 defined for those names by the host operating system. This can be used to |
| 2165 determine the set of names known to the system. | 2387 determine the set of names known to the system. |
| 2166 | 2388 |
| 2167 Availability: Unix. | 2389 Availability: Unix. |
| 2390 |
| 2391 |
| 2392 .. function:: gethostid() |
| 2393 |
| 2394 Returns the host id, a unique 32-bit identifier for the current machine. |
| 2395 |
| 2396 Availability: Unix. |
| 2397 |
| 2398 .. versionadded:: 3.3 |
| 2168 | 2399 |
| 2169 | 2400 |
| 2170 .. function:: getloadavg() | 2401 .. function:: getloadavg() |
| 2171 | 2402 |
| 2172 Return the number of processes in the system run queue averaged over the last | 2403 Return the number of processes in the system run queue averaged over the last |
| 2173 1, 5, and 15 minutes or raises :exc:`OSError` if the load average was | 2404 1, 5, and 15 minutes or raises :exc:`OSError` if the load average was |
| 2174 unobtainable. | 2405 unobtainable. |
| 2175 | 2406 |
| 2176 Availability: Unix. | 2407 Availability: Unix. |
| 2408 |
| 2409 |
| 2410 .. function:: sethostname(name) |
| 2411 |
| 2412 Sets the machine's hostname to *name*. |
| 2413 |
| 2414 Availability: Unix. |
| 2415 |
| 2416 .. versionadded:: 3.3 |
| 2177 | 2417 |
| 2178 | 2418 |
| 2179 .. function:: sysconf(name) | 2419 .. function:: sysconf(name) |
| 2180 | 2420 |
| 2181 Return integer-valued system configuration values. If the configuration value | 2421 Return integer-valued system configuration values. If the configuration value |
| 2182 specified by *name* isn't defined, ``-1`` is returned. The comments regardin
g | 2422 specified by *name* isn't defined, ``-1`` is returned. The comments regardin
g |
| 2183 the *name* parameter for :func:`confstr` apply here as well; the dictionary t
hat | 2423 the *name* parameter for :func:`confstr` apply here as well; the dictionary t
hat |
| 2184 provides information on the known names is given by ``sysconf_names``. | 2424 provides information on the known names is given by ``sysconf_names``. |
| 2185 | 2425 |
| 2186 Availability: Unix. | 2426 Availability: Unix. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2273 | 2513 |
| 2274 .. function:: urandom(n) | 2514 .. function:: urandom(n) |
| 2275 | 2515 |
| 2276 Return a string of *n* random bytes suitable for cryptographic use. | 2516 Return a string of *n* random bytes suitable for cryptographic use. |
| 2277 | 2517 |
| 2278 This function returns random bytes from an OS-specific randomness source. Th
e | 2518 This function returns random bytes from an OS-specific randomness source. Th
e |
| 2279 returned data should be unpredictable enough for cryptographic applications, | 2519 returned data should be unpredictable enough for cryptographic applications, |
| 2280 though its exact quality depends on the OS implementation. On a UNIX-like | 2520 though its exact quality depends on the OS implementation. On a UNIX-like |
| 2281 system this will query /dev/urandom, and on Windows it will use CryptGenRando
m. | 2521 system this will query /dev/urandom, and on Windows it will use CryptGenRando
m. |
| 2282 If a randomness source is not found, :exc:`NotImplementedError` will be raise
d. | 2522 If a randomness source is not found, :exc:`NotImplementedError` will be raise
d. |
| OLD | NEW |