Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Feb 2025 03:57:28 GMT
From:      Alexander Ziaee <ziaee@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 571df2c64a3c - main - recv.2: Explain how recv functions can return 0
Message-ID:  <202502130357.51D3vSD9098749@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by ziaee:

URL: https://cgit.FreeBSD.org/src/commit/?id=571df2c64a3c1af1fe011303ec08e391e887ecbc

commit 571df2c64a3c1af1fe011303ec08e391e887ecbc
Author:     Felix Johnson <fjohnson@felix-johnson.com>
AuthorDate: 2025-02-13 03:40:59 +0000
Commit:     Alexander Ziaee <ziaee@FreeBSD.org>
CommitDate: 2025-02-13 03:54:14 +0000

    recv.2: Explain how recv functions can return 0
    
    Clarify the RETURN VALUES section with improved structure,
    the condition of the return value 0, and the setting of errno.
    
    PR:                     174581
    Reviewed by:            jhb, ziaee
    Approved by:            mhorne (mentor)
    Differential Revision:  https://reviews.freebsd.org/D48955
---
 lib/libsys/recv.2 | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/libsys/recv.2 b/lib/libsys/recv.2
index 08df62af3d1c..9dc1f3cc84ca 100644
--- a/lib/libsys/recv.2
+++ b/lib/libsys/recv.2
@@ -316,12 +316,19 @@ On data reception the
 .Fa msg_len
 field is updated to the length of the received message.
 .Sh RETURN VALUES
-These calls except
-.Fn recvmmsg
+On successful completion,
+.Fn recv ,
+.Fn recvfrom ,
+and
+.Fn recvmsg
 return the number of bytes received.
 .Fn recvmmsg
 returns the number of messages received.
-A value of -1 is returned if an error occurred.
+If no messages are available to be received and the peer has
+performed an orderly shutdown, 0 is returned.
+Otherwise, -1 is returned and
+.Va errno
+is set to indicate the error.
 .Sh ERRORS
 The calls fail if:
 .Bl -tag -width Er



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502130357.51D3vSD9098749>