Skip to content

Commit 8d01133

Browse files
committed
update doc comments
Signed-off-by: Loris Cro <[email protected]>
1 parent c196c27 commit 8d01133

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

lib/std/os.zig

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,8 @@ pub const ReadError = error{
314314

315315
/// Returns the number of bytes that were read, which can be less than
316316
/// buf.len. If 0 bytes were read, that means EOF.
317-
/// If the application has a global event loop enabled, EAGAIN is handled
318-
/// via the event loop. Otherwise EAGAIN results in error.WouldBlock.
317+
/// If `fd` is opened in non blocking mode, the function will return error.WouldBlock
318+
/// when EAGAIN is received.
319319
///
320320
/// Linux has a limit on how many bytes may be transferred in one `read` call, which is `0x7ffff000`
321321
/// on both 64-bit and 32-bit systems. This is due to using a signed C int as the return value, as
@@ -382,8 +382,8 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize {
382382

383383
/// Number of bytes read is returned. Upon reading end-of-file, zero is returned.
384384
///
385-
/// For POSIX systems, if the application has a global event loop enabled, EAGAIN is handled
386-
/// via the event loop. Otherwise EAGAIN results in `error.WouldBlock`.
385+
/// For POSIX systems, if `fd` is opened in non blocking mode, the function will
386+
/// return error.WouldBlock when EAGAIN is received.
387387
/// On Windows, if the application has a global event loop enabled, I/O Completion Ports are
388388
/// used to perform the I/O. `error.WouldBlock` is not possible on Windows.
389389
///
@@ -440,8 +440,8 @@ pub const PReadError = ReadError || error{Unseekable};
440440
///
441441
/// Retries when interrupted by a signal.
442442
///
443-
/// For POSIX systems, if the application has a global event loop enabled, EAGAIN is handled
444-
/// via the event loop. Otherwise EAGAIN results in `error.WouldBlock`.
443+
/// For POSIX systems, if `fd` is opened in non blocking mode, the function will
444+
/// return error.WouldBlock when EAGAIN is received.
445445
/// On Windows, if the application has a global event loop enabled, I/O Completion Ports are
446446
/// used to perform the I/O. `error.WouldBlock` is not possible on Windows.
447447
pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize {
@@ -571,8 +571,8 @@ pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void {
571571
///
572572
/// Retries when interrupted by a signal.
573573
///
574-
/// For POSIX systems, if the application has a global event loop enabled, EAGAIN is handled
575-
/// via the event loop. Otherwise EAGAIN results in `error.WouldBlock`.
574+
/// For POSIX systems, if `fd` is opened in non blocking mode, the function will
575+
/// return error.WouldBlock when EAGAIN is received.
576576
/// On Windows, if the application has a global event loop enabled, I/O Completion Ports are
577577
/// used to perform the I/O. `error.WouldBlock` is not possible on Windows.
578578
///
@@ -667,8 +667,8 @@ pub const WriteError = error{
667667
/// another write() call to transfer the remaining bytes. The subsequent call will either
668668
/// transfer further bytes or may result in an error (e.g., if the disk is now full).
669669
///
670-
/// For POSIX systems, if the application has a global event loop enabled, EAGAIN is handled
671-
/// via the event loop. Otherwise EAGAIN results in `error.WouldBlock`.
670+
/// For POSIX systems, if `fd` is opened in non blocking mode, the function will
671+
/// return error.WouldBlock when EAGAIN is received.
672672
/// On Windows, if the application has a global event loop enabled, I/O Completion Ports are
673673
/// used to perform the I/O. `error.WouldBlock` is not possible on Windows.
674674
///
@@ -747,8 +747,8 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize {
747747
/// another write() call to transfer the remaining bytes. The subsequent call will either
748748
/// transfer further bytes or may result in an error (e.g., if the disk is now full).
749749
///
750-
/// For POSIX systems, if the application has a global event loop enabled, EAGAIN is handled
751-
/// via the event loop. Otherwise EAGAIN results in `error.WouldBlock`.
750+
/// For POSIX systems, if `fd` is opened in non blocking mode, the function will
751+
/// return error.WouldBlock when EAGAIN is received.k`.
752752
/// On Windows, if the application has a global event loop enabled, I/O Completion Ports are
753753
/// used to perform the I/O. `error.WouldBlock` is not possible on Windows.
754754
///
@@ -817,8 +817,8 @@ pub const PWriteError = WriteError || error{Unseekable};
817817
/// another write() call to transfer the remaining bytes. The subsequent call will either
818818
/// transfer further bytes or may result in an error (e.g., if the disk is now full).
819819
///
820-
/// For POSIX systems, if the application has a global event loop enabled, EAGAIN is handled
821-
/// via the event loop. Otherwise EAGAIN results in `error.WouldBlock`.
820+
/// For POSIX systems, if `fd` is opened in non blocking mode, the function will
821+
/// return error.WouldBlock when EAGAIN is received.
822822
/// On Windows, if the application has a global event loop enabled, I/O Completion Ports are
823823
/// used to perform the I/O. `error.WouldBlock` is not possible on Windows.
824824
///
@@ -904,8 +904,8 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize {
904904
/// another write() call to transfer the remaining bytes. The subsequent call will either
905905
/// transfer further bytes or may result in an error (e.g., if the disk is now full).
906906
///
907-
/// If the application has a global event loop enabled, EAGAIN is handled
908-
/// via the event loop. Otherwise EAGAIN results in `error.WouldBlock`.
907+
/// If `fd` is opened in non blocking mode, the function will
908+
/// return error.WouldBlock when EAGAIN is received.
909909
///
910910
/// The following systems do not have this syscall, and will return partial writes if more than one
911911
/// vector is provided:
@@ -2806,8 +2806,8 @@ pub const AcceptError = error{
28062806
} || UnexpectedError;
28072807

28082808
/// Accept a connection on a socket.
2809-
/// If the application has a global event loop enabled, EAGAIN is handled
2810-
/// via the event loop. Otherwise EAGAIN results in error.WouldBlock.
2809+
/// If `sockfd` is opened in non blocking mode, the function will
2810+
/// return error.WouldBlock when EAGAIN is received.
28112811
pub fn accept(
28122812
/// This argument is a socket that has been created with `socket`, bound to a local address
28132813
/// with `bind`, and is listening for connections after a `listen`.
@@ -3036,6 +3036,8 @@ pub const ConnectError = error{
30363036
} || UnexpectedError;
30373037

30383038
/// Initiate a connection on a socket.
3039+
/// If `sockfd` is opened in non blocking mode, the function will
3040+
/// return error.WouldBlock when EAGAIN or EINPROGRESS is received.
30393041
pub fn connect(sockfd: socket_t, sock_addr: *const sockaddr, len: socklen_t) ConnectError!void {
30403042
if (builtin.os.tag == .windows) {
30413043
const rc = windows.ws2_32.connect(sockfd, sock_addr, len);
@@ -5051,6 +5053,8 @@ pub const RecvFromError = error{
50515053
SystemResources,
50525054
} || UnexpectedError;
50535055

5056+
/// If `sockfd` is opened in non blocking mode, the function will
5057+
/// return error.WouldBlock when EAGAIN is received.
50545058
pub fn recvfrom(
50555059
sockfd: fd_t,
50565060
buf: []u8,

0 commit comments

Comments
 (0)