Skip to contentSkip to conversation

getsockopt.2: Corrected the RETURN VALUE

PATCH In review Konstantin Shemyak 2 participants 2 messages Feb 20, 2015 1 message not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 getsockopt.2: Corrected the RETURN VALUE

Hello,

An almost trivial patch - but does not fit in any "XXXfix" categories. 'man setsockopt' tells that the return value in case of success is 0. But since at least 2007, setsockopt() calls the registered handler of the corresponding option, and returns the result of that call.

Patch is made against master as of 20 Feb. 2015 (commit 35800487b675), both inline below and attached.

Konstantin Shemyak.

From 19ac3ce52c7935c8f0792836dc27e02a9f26359a Mon Sep 17 00:00:00 2001
From: Konstantin Shemyak <[email protected]>
Date: Fri, 20 Feb 2015 15:59:19 +0200
Subject: [PATCH] Corrected RETURN VALUE for getsockopt/setsockopt(2)

---
 man2/getsockopt.2 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
man2/getsockopt.2 +4 -1
index 1287efc..1c78fdc 100644
@@ -129,7 +129,10 @@ For a description of the available socket options see
 .BR socket (7)
 and the appropriate protocol man pages.
 .SH RETURN VALUE
-On success, zero is returned.
+On success, the return value from the corresponding option handler
+previously registered by
+.I nf_register_sockopt()
+is returned.
 On error, \-1 is returned, and
 .I errno
 is set appropriately.
Signature · 1 line
1.9.1

From 19ac3ce52c7935c8f0792836dc27e02a9f26359a Mon Sep 17 00:00:00 2001
From: Konstantin Shemyak <[email protected]>
Date: Fri, 20 Feb 2015 15:59:19 +0200
Subject: [PATCH] Corrected RETURN VALUE for getsockopt/setsockopt(2)

---
 man2/getsockopt.2 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
man2/getsockopt.2 +4 -1
index 1287efc..1c78fdc 100644
@@ -129,7 +129,10 @@ For a description of the available socket options see
 .BR socket (7)
 and the appropriate protocol man pages.
 .SH RETURN VALUE
-On success, zero is returned.
+On success, the return value from the corresponding option handler
+previously registered by
+.I nf_register_sockopt()
+is returned.
 On error, \-1 is returned, and
 .I errno
 is set appropriately.
Signature · 1 line
1.9.1

A message that is not in the archive (sent off-list or not yet received): 54ed8560054c044dac40e28887da7b7a-gSWgoXPz5bhBDgjK7y7TUQ@public.gmane.org

#2 lore raw
Quoted 9 lines · Konstantin Shemyak

Hello,

An almost trivial patch - but does not fit in any "XXXfix" categories. 'man setsockopt' tells that the return value in case of success is 0. But since at least 2007, setsockopt() calls the registered handler of the corresponding option, and returns the result of that call.

Patch is made against master as of 20 Feb. 2015 (commit 35800487b675), both inline below and attached.

Hello Konstantin,

Sorry -- I cannot make sense of this patch.

* It seems netfilter-specific
* The man page then conveys less information than before. (The reader asks: "what is nf_register_sockopt()?")
* Are you saying there are case where successful setsockopt() via nf_register_sockopt() might return a value other zero?

Can you elaborate?

Thanks,

Michael

Quoted 27 lines

From 19ac3ce52c7935c8f0792836dc27e02a9f26359a Mon Sep 17 00:00:00 2001
From: Konstantin Shemyak <[email protected]>
Date: Fri, 20 Feb 2015 15:59:19 +0200
Subject: [PATCH] Corrected RETURN VALUE for getsockopt/setsockopt(2)

---
 man2/getsockopt.2 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
man2/getsockopt.2 +4 -2
index 1287efc..1c78fdc 100644
@@ -129,7 +129,10 @@ For a description of the available socket options see
 .BR socket (7)
 and the appropriate protocol man pages.
 .SH RETURN VALUE
-On success, zero is returned.
+On success, the return value from the corresponding option handler
+previously registered by
+.I nf_register_sockopt()
+is returned.
 On error, \-1 is returned, and
 .I errno
 is set appropriately.
--

1.9.1

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html