mirror of
https://github.com/opnsense/src.git
synced 2026-06-12 10:10:24 -04:00
ktrace: trace and decode thr_new() thr_param
Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
c27f7d6b9c
commit
56a4d1a4cc
3 changed files with 31 additions and 0 deletions
|
|
@ -26,11 +26,15 @@
|
|||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opt_ktrace.h"
|
||||
#include "opt_posix.h"
|
||||
#include "opt_hwpmc_hooks.h"
|
||||
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#ifdef KTRACE
|
||||
#include <sys/ktrace.h>
|
||||
#endif
|
||||
#include <sys/limits.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
|
|
@ -188,6 +192,10 @@ kern_thr_new(struct thread *td, struct thr_param *param)
|
|||
return (error);
|
||||
rtpp = &rtp;
|
||||
}
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(td, KTR_STRUCT))
|
||||
ktrthrparam(param);
|
||||
#endif
|
||||
return (thread_create(td, rtpp, thr_new_initthr, param));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -371,6 +371,8 @@ void ktrdata(int, const void *, size_t);
|
|||
ktrstruct("cpuset_t", (s), l)
|
||||
#define ktrsplice(s) \
|
||||
ktrstruct("splice", (s), sizeof(struct splice))
|
||||
#define ktrthrparam(s) \
|
||||
ktrstruct("thrparam", (s), sizeof(struct thr_param))
|
||||
extern u_int ktr_geniosize;
|
||||
#ifdef KTRACE
|
||||
extern int ktr_filesize_limit_signal;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysent.h>
|
||||
#include <sys/thr.h>
|
||||
#include <sys/umtx.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/queue.h>
|
||||
|
|
@ -109,6 +110,7 @@ static void ktrsockaddr(struct sockaddr *);
|
|||
static void ktrsplice(struct splice *);
|
||||
static void ktrstat(struct stat *);
|
||||
static void ktrstruct(char *, size_t);
|
||||
static void ktrthrparam(struct thr_param *);
|
||||
static void ktrcapfail(struct ktr_cap_fail *);
|
||||
static void ktrfault(struct ktr_fault *);
|
||||
static void ktrfaultend(struct ktr_faultend *);
|
||||
|
|
@ -1952,6 +1954,18 @@ ktrsplice(struct splice *sp)
|
|||
(intmax_t)sp->sp_idle.tv_usec);
|
||||
}
|
||||
|
||||
static void
|
||||
ktrthrparam(struct thr_param *tp)
|
||||
{
|
||||
printf("thr param { start=%p arg=%p stack_base=%p "
|
||||
"stack_size=%#zx tls_base=%p tls_size=%#zx child_tidp=%p "
|
||||
"parent_tidp=%p flags=",
|
||||
tp->start_func, tp->arg, tp->stack_base, tp->stack_size,
|
||||
tp->tls_base, tp->tls_size, tp->child_tid, tp->parent_tid);
|
||||
print_mask_arg(sysdecode_thr_create_flags, tp->flags);
|
||||
printf(" rtp=%p }\n", tp->rtp);
|
||||
}
|
||||
|
||||
static void
|
||||
ktrstat(struct stat *statp)
|
||||
{
|
||||
|
|
@ -2147,6 +2161,13 @@ ktrstruct(char *buf, size_t buflen)
|
|||
goto invalid;
|
||||
memcpy(&sp, data, datalen);
|
||||
ktrsplice(&sp);
|
||||
} else if (strcmp(name, "thrparam") == 0) {
|
||||
struct thr_param tp;
|
||||
|
||||
if (datalen != sizeof(tp))
|
||||
goto invalid;
|
||||
memcpy(&tp, data, datalen);
|
||||
ktrthrparam(&tp);
|
||||
} else {
|
||||
#ifdef SYSDECODE_HAVE_LINUX
|
||||
if (ktrstruct_linux(name, data, datalen) == false)
|
||||
|
|
|
|||
Loading…
Reference in a new issue