ARGSUSED */
| 1063 | |
| 1064 | /* ARGSUSED */ |
| 1065 | int |
| 1066 | sys_utrace(struct thread *td, struct utrace_args *uap) |
| 1067 | { |
| 1068 | |
| 1069 | #ifdef KTRACE |
| 1070 | struct ktr_request *req; |
| 1071 | void *cp; |
| 1072 | int error; |
| 1073 | |
| 1074 | if (!KTRPOINT(td, KTR_USER)) |
| 1075 | return (0); |
| 1076 | if (uap->len > KTR_USER_MAXLEN) |
| 1077 | return (EINVAL); |
| 1078 | cp = malloc(uap->len, M_KTRACE, M_WAITOK); |
| 1079 | error = copyin(uap->addr, cp, uap->len); |
| 1080 | if (error) { |
| 1081 | free(cp, M_KTRACE); |
| 1082 | return (error); |
| 1083 | } |
| 1084 | req = ktr_getrequest(KTR_USER); |
| 1085 | if (req == NULL) { |
| 1086 | free(cp, M_KTRACE); |
| 1087 | return (ENOMEM); |
| 1088 | } |
| 1089 | req->ktr_buffer = cp; |
| 1090 | req->ktr_header.ktr_len = uap->len; |
| 1091 | ktr_submitrequest(td, req); |
| 1092 | return (0); |
| 1093 | #else /* !KTRACE */ |
| 1094 | return (ENOSYS); |
| 1095 | #endif /* KTRACE */ |
| 1096 | } |
| 1097 | |
| 1098 | #ifdef KTRACE |
| 1099 | static int |
nothing calls this directly
no test coverage detected