MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ktrsysctl

Function ktrsysctl

freebsd/kern/kern_ktrace.c:650–680  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

648}
649
650void
651ktrsysctl(int *name, u_int namelen)
652{
653 struct ktr_request *req;
654 u_int mib[CTL_MAXNAME + 2];
655 char *mibname;
656 size_t mibnamelen;
657 int error;
658
659 /* Lookup name of mib. */
660 KASSERT(namelen <= CTL_MAXNAME, ("sysctl MIB too long"));
661 mib[0] = 0;
662 mib[1] = 1;
663 bcopy(name, mib + 2, namelen * sizeof(*name));
664 mibnamelen = 128;
665 mibname = malloc(mibnamelen, M_KTRACE, M_WAITOK);
666 error = kernel_sysctl(curthread, mib, namelen + 2, mibname, &mibnamelen,
667 NULL, 0, &mibnamelen, 0);
668 if (error) {
669 free(mibname, M_KTRACE);
670 return;
671 }
672 req = ktr_getrequest(KTR_SYSCTL);
673 if (req == NULL) {
674 free(mibname, M_KTRACE);
675 return;
676 }
677 req->ktr_header.ktr_len = mibnamelen;
678 req->ktr_buffer = mibname;
679 ktr_submitrequest(curthread, req);
680}
681
682void
683ktrgenio(int fd, enum uio_rw rw, struct uio *uio, int error)

Callers 1

userland_sysctlFunction · 0.85

Calls 5

mallocFunction · 0.85
kernel_sysctlFunction · 0.85
ktr_getrequestFunction · 0.85
ktr_submitrequestFunction · 0.85
freeFunction · 0.70

Tested by

no test coverage detected