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

Function sysctl_kern_msgbuf

freebsd/kern/subr_prf.c:1051–1077  ·  view source on GitHub ↗

Sysctls for accessing/clearing the msgbuf */

Source from the content-addressed store, hash-verified

1049
1050/* Sysctls for accessing/clearing the msgbuf */
1051static int
1052sysctl_kern_msgbuf(SYSCTL_HANDLER_ARGS)
1053{
1054 char buf[128];
1055 u_int seq;
1056 int error, len;
1057
1058 error = priv_check(req->td, PRIV_MSGBUF);
1059 if (error)
1060 return (error);
1061
1062 /* Read the whole buffer, one chunk at a time. */
1063 mtx_lock(&msgbuf_lock);
1064 msgbuf_peekbytes(msgbufp, NULL, 0, &seq);
1065 for (;;) {
1066 len = msgbuf_peekbytes(msgbufp, buf, sizeof(buf), &seq);
1067 mtx_unlock(&msgbuf_lock);
1068 if (len == 0)
1069 return (SYSCTL_OUT(req, "", 1)); /* add nulterm */
1070
1071 error = sysctl_handle_opaque(oidp, buf, len, req);
1072 if (error)
1073 return (error);
1074
1075 mtx_lock(&msgbuf_lock);
1076 }
1077}
1078
1079SYSCTL_PROC(_kern, OID_AUTO, msgbuf,
1080 CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,

Callers

nothing calls this directly

Calls 5

msgbuf_peekbytesFunction · 0.85
sysctl_handle_opaqueFunction · 0.85
priv_checkFunction · 0.70
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected