Subject: kern/32058: comments for sonewconn1() wrong (patch included)
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <plunky@rya-online.net>
List: netbsd-bugs
Date: 11/12/2005 20:28:01
>Number: 32058
>Category: kern
>Synopsis: comments wrong in kern/uipc_socket2.c (patch included)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: doc-bug
>Submitter-Id: net
>Arrival-Date: Sat Nov 12 20:28:01 +0000 2005
>Originator: Iain Hibbert
>Release: NetBSD 3.99.10
>Organization:
http://maps.google.com/maps?q=ireland&ll=52.2711,-9.8630&spn=0.0244,0.0822&t=k
>Environment:
System: NetBSD galant 3.99.10 NetBSD 3.99.10 (GALANT) #57: Sat Nov 12 17:30:24 GMT 2005 plunky@galant:/home/plunky/src/sys/arch/i386/compile/GALANT i386
Architecture: i386
Machine: i386
>Description:
in sys/kern/uipc_socket2.c, in the comments for sonewconn() it says you can
pass SO_ISCONFIRMING or SO_ISCONNECTED but these defs dont exist. the arg
is stored in so_state and SS_ISCONFIRMING and SS_ISCONNECTED are defined
in sys/socketvar.h especially for so_state so I guess thats what was meant.
patch #1 to change this below
also sonewconn() is #defined as a macro (in socketvar.h) to 'catch
old code missing the new second parameter'. presumably back in the day,
macro expansion was more likely to catch missing parameters, but since:
a) we use --Wstrict-prototypes on our kernels these days, and
b) there is no such old code missing the second parameter
we could remove that artifact now?
separate (& subsequent) patch #2 to change that even further below
>How-To-Repeat:
>Fix:
patch #1 to change SO_ to SS_ in comment
--- sys/kern/uipc_socket2.c.orig 2005-11-12 19:56:59.000000000 +0000
+++ sys/kern/uipc_socket2.c 2005-11-12 19:57:27.000000000 +0000
@@ -148,7 +148,7 @@
* connection is possible (subject to space constraints, etc.)
* then we allocate a new structure, propoerly linked into the
* data structure of the original socket, and return this.
- * Connstatus may be 0, or SO_ISCONFIRMING, or SO_ISCONNECTED.
+ * Connstatus may be 0, or SS_ISCONFIRMING, or SS_ISCONNECTED.
*
* Currently, sonewconn() is defined as sonewconn1() in socketvar.h
* to catch calls that are missing the (new) second parameter.
patch #1 to remove sonewconn1() artifact
--- sys/sys/socketvar.h.orig 2005-11-12 20:18:13.000000000 +0000
+++ sys/sys/socketvar.h 2005-11-12 20:18:48.000000000 +0000
@@ -255,8 +255,6 @@
#ifdef _KERNEL
extern u_long sb_max;
extern int somaxkva;
-/* to catch callers missing new second argument to sonewconn: */
-#define sonewconn(head, connstatus) sonewconn1((head), (connstatus))
/* strings for sleep message: */
extern const char netio[], netcon[], netcls[];
@@ -322,7 +320,7 @@
void soisdisconnecting(struct socket *);
int solisten(struct socket *, int);
struct socket *
- sonewconn1(struct socket *, int);
+ sonewconn(struct socket *, int);
void soqinsque(struct socket *, struct socket *, int);
int soqremque(struct socket *, int);
int soreceive(struct socket *, struct mbuf **, struct uio *,
--- sys/kern/uipc_socket2.c.orig 2005-11-12 20:18:21.000000000 +0000
+++ sys/kern/uipc_socket2.c 2005-11-12 20:19:57.000000000 +0000
@@ -149,12 +149,9 @@
* then we allocate a new structure, propoerly linked into the
* data structure of the original socket, and return this.
* Connstatus may be 0, or SS_ISCONFIRMING, or SS_ISCONNECTED.
- *
- * Currently, sonewconn() is defined as sonewconn1() in socketvar.h
- * to catch calls that are missing the (new) second parameter.
*/
struct socket *
-sonewconn1(struct socket *head, int connstatus)
+sonewconn(struct socket *head, int connstatus)
{
struct socket *so;
int soqueue;