Hi,

while glancing at the multicast code I noticed the use of ETOOMANYREFS:

                if (imo->imo_num_memberships == imo->imo_max_memberships) {
                        struct in_multi **nmships, **omships;
                        size_t newmax;
                        /*
                         * Resize the vector to next power-of-two minus 1. If 
the
                         * size would exceed the maximum then we know we've 
really
                         * run out of entries. Otherwise, we reallocate the 
vector.
                         */
                        nmships = NULL;
                        omships = imo->imo_membership;
                        newmax = ((imo->imo_max_memberships + 1) * 2) - 1;
                        if (newmax <= IP_MAX_MEMBERSHIPS) {
                                nmships = (struct in_multi **)malloc(
                                    sizeof(*nmships) * newmax, M_IPMOPTS,
                                    M_NOWAIT|M_ZERO);
                                if (nmships != NULL) {
                                        memcpy(nmships, omships,
                                            sizeof(*omships) *
                                            imo->imo_max_memberships);
                                        free(omships, M_IPMOPTS,
                                            sizeof(*omships) *
                                            imo->imo_max_memberships);
                                        imo->imo_membership = nmships;
                                        imo->imo_max_memberships = newmax;
                                }
                        }
                        if (nmships == NULL) {
                                error = ETOOMANYREFS;
                                if_put(ifp);
                                break;
                        }
                }

intro(2) describes it as such:

  59 ETOOMANYREFS Too many references: can't splice. Not used in OpenBSD.

Obviously it *is* used, since rev. 1.1.  FreeBSD and NetBSD also make
use of it, but FreeBSD doesn't document it.

I don't know whether the kernel code should keep on using it, here's
a patch to fix the documentation:

Thoughts?

Index: lib/libc/sys/intro.2
===================================================================
RCS file: /cvs/src/lib/libc/sys/intro.2,v
retrieving revision 1.62
diff -u -p -r1.62 intro.2
--- lib/libc/sys/intro.2        1 Dec 2015 01:34:16 -0000       1.62
+++ lib/libc/sys/intro.2        31 Jan 2016 00:11:06 -0000
@@ -311,8 +311,6 @@ had already been shut down with a previo
 .Xr shutdown 2
 call.
 .It Er 59 ETOOMANYREFS Em "Too many references: can't splice" .
-Not used in
-.Ox .
 .It Er 60 ETIMEDOUT Em "Operation timed out" .
 A
 .Xr connect 2


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to