MCPcopy Index your code
hub / github.com/F-Stack/f-stack / kernel_sysctl

Function kernel_sysctl

freebsd/kern/kern_sysctl.c:1952–1997  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1950}
1951
1952int
1953kernel_sysctl(struct thread *td, int *name, u_int namelen, void *old,
1954 size_t *oldlenp, void *new, size_t newlen, size_t *retval, int flags)
1955{
1956 int error = 0;
1957 struct sysctl_req req;
1958
1959 bzero(&req, sizeof req);
1960
1961 req.td = td;
1962 req.flags = flags;
1963
1964 if (oldlenp) {
1965 req.oldlen = *oldlenp;
1966 }
1967 req.validlen = req.oldlen;
1968
1969 if (old) {
1970 req.oldptr= old;
1971 }
1972
1973 if (new != NULL) {
1974 req.newlen = newlen;
1975 req.newptr = new;
1976 }
1977
1978 req.oldfunc = sysctl_old_kernel;
1979 req.newfunc = sysctl_new_kernel;
1980 req.lock = REQ_UNWIRED;
1981
1982 error = sysctl_root(0, name, namelen, &req);
1983
1984 if (req.lock == REQ_WIRED && req.validlen > 0)
1985 vsunlock(req.oldptr, req.validlen);
1986
1987 if (error && error != ENOMEM)
1988 return (error);
1989
1990 if (retval) {
1991 if (req.oldptr && req.oldidx > req.validlen)
1992 *retval = req.validlen;
1993 else
1994 *retval = req.oldidx;
1995 }
1996 return (error);
1997}
1998
1999int
2000kernel_sysctlbyname(struct thread *td, char *name, void *old, size_t *oldlenp,

Callers 6

ktrsysctlFunction · 0.85
kernel_sysctlbynameFunction · 0.85
kern___sysctlbynameFunction · 0.85
db_show_sysctl_allFunction · 0.85
ogethostidFunction · 0.85
osethostidFunction · 0.85

Calls 3

bzeroFunction · 0.85
sysctl_rootFunction · 0.85
vsunlockFunction · 0.50

Tested by

no test coverage detected