ARGSUSED */
| 407 | #endif |
| 408 | /* ARGSUSED */ |
| 409 | int |
| 410 | sys_profil(struct thread *td, struct profil_args *uap) |
| 411 | { |
| 412 | struct uprof *upp; |
| 413 | struct proc *p; |
| 414 | |
| 415 | if (uap->scale > (1 << 16)) |
| 416 | return (EINVAL); |
| 417 | |
| 418 | p = td->td_proc; |
| 419 | if (uap->scale == 0) { |
| 420 | PROC_LOCK(p); |
| 421 | stopprofclock(p); |
| 422 | PROC_UNLOCK(p); |
| 423 | return (0); |
| 424 | } |
| 425 | PROC_LOCK(p); |
| 426 | upp = &td->td_proc->p_stats->p_prof; |
| 427 | PROC_PROFLOCK(p); |
| 428 | upp->pr_off = uap->offset; |
| 429 | upp->pr_scale = uap->scale; |
| 430 | upp->pr_base = uap->samples; |
| 431 | upp->pr_size = uap->size; |
| 432 | PROC_PROFUNLOCK(p); |
| 433 | startprofclock(p); |
| 434 | PROC_UNLOCK(p); |
| 435 | |
| 436 | return (0); |
| 437 | } |
| 438 | |
| 439 | /* |
| 440 | * Scale is a fixed-point number with the binary point 16 bits |
nothing calls this directly
no test coverage detected