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

Function ktrstruct

freebsd/kern/kern_ktrace.c:760–784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

758}
759
760void
761ktrstruct(const char *name, const void *data, size_t datalen)
762{
763 struct ktr_request *req;
764 char *buf;
765 size_t buflen, namelen;
766
767 if (__predict_false(curthread->td_pflags & TDP_INKTRACE))
768 return;
769
770 if (data == NULL)
771 datalen = 0;
772 namelen = strlen(name) + 1;
773 buflen = namelen + datalen;
774 buf = malloc(buflen, M_KTRACE, M_WAITOK);
775 strcpy(buf, name);
776 bcopy(data, buf + namelen, datalen);
777 if ((req = ktr_getrequest(KTR_STRUCT)) == NULL) {
778 free(buf, M_KTRACE);
779 return;
780 }
781 req->ktr_buffer = buf;
782 req->ktr_header.ktr_len = buflen;
783 ktr_submitrequest(curthread, req);
784}
785
786void
787ktrstruct_error(const char *name, const void *data, size_t datalen, int error)

Callers 1

ktrstruct_errorFunction · 0.85

Calls 4

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

Tested by

no test coverage detected