On 10/7/2015 3:41 PM, NGie Cooper wrote: > On Wed, Oct 7, 2015 at 3:35 PM, Baptiste Daroussin <b...@freebsd.org> wrote: > ... >> I do not think it is, but I couldn't find a way to reproduce another case >> than >> ENOENT, so I thought maybe the best would be to keep the current behaviour >> for >> other cases :) >
Here's the relevant code: sys/kern/kern_sysctl.c:SYSCTL_PROC(_sysctl, 3, name2oid ... static SYSCTL_NODE(_sysctl, 2, next, CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_next, ""); static int name2oid(char *name, int *oid, int *len, struct sysctl_oid **oidpp) { struct sysctl_oid *oidp; struct sysctl_oid_list *lsp = &sysctl__children; char *p; SYSCTL_ASSERT_LOCKED(); for (*len = 0; *len < CTL_MAXNAME;) { p = strsep(&name, "."); oidp = SLIST_FIRST(lsp); for (;; oidp = SLIST_NEXT(oidp, oid_link)) { if (oidp == NULL) return (ENOENT); if (strcmp(p, oidp->oid_name) == 0) break; } *oid++ = oidp->oid_number; (*len)++; if (name == NULL || *name == '\0') { if (oidpp) *oidpp = oidp; return (0); } if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) break; if (oidp->oid_handler) break; lsp = SYSCTL_CHILDREN(oidp); } return (ENOENT); } It can only return 0 or ENOENT. -- Regards, Bryan Drewery
signature.asc
Description: OpenPGP digital signature