summaryrefslogtreecommitdiff
path: root/kern/pc_sample.c
diff options
context:
space:
mode:
Diffstat (limited to 'kern/pc_sample.c')
-rw-r--r--kern/pc_sample.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/kern/pc_sample.c b/kern/pc_sample.c
index 57002581..fcb9d71b 100644
--- a/kern/pc_sample.c
+++ b/kern/pc_sample.c
@@ -43,12 +43,9 @@
typedef sampled_pc_t sampled_pcs[MAX_PC_SAMPLES];
-int pc_sampling_enabled = 0;
-decl_simple_lock_data(, pc_sampling_lock) /* lock for enabling */
-
void take_pc_sample(
- register thread_t t,
- register sample_control_t *cp,
+ const thread_t t,
+ sample_control_t *cp,
sampled_pc_flavor_t flavor)
{
vm_offset_t pc;
@@ -192,6 +189,9 @@ get_sampled_pcs(
(sampled_pc_array_t)cp->buffer,
(seqidx2 + 1) * sizeof(sampled_pc_t));
}
+ } else if (nsamples < 0) {
+ /* Bogus SEQNO supplied. */
+ nsamples = 0;
} else {
/* could either be zero because of overflow, or because
* we are being lied to. In either case, return nothing.
@@ -244,8 +244,8 @@ task_get_sampled_pcs(
kern_return_t
thread_enable_pc_sampling(
- thread_t thread,
- int *tickp,
+ const thread_t thread,
+ const int *tickp,
sampled_pc_flavor_t flavors)
{
return KERN_FAILURE; /* not implemented */
@@ -253,8 +253,8 @@ thread_enable_pc_sampling(
kern_return_t
task_enable_pc_sampling(
- task_t task,
- int *tickp,
+ const task_t task,
+ const int *tickp,
sampled_pc_flavor_t flavors)
{
return KERN_FAILURE; /* not implemented */
@@ -262,36 +262,36 @@ task_enable_pc_sampling(
kern_return_t
thread_disable_pc_sampling(
- thread_t thread,
- int *samplecntp)
+ const thread_t thread,
+ const int *samplecntp)
{
return KERN_FAILURE; /* not implemented */
}
kern_return_t
task_disable_pc_sampling(
- task_t task,
- int *samplecntp)
+ const task_t task,
+ const int *samplecntp)
{
return KERN_FAILURE; /* not implemented */
}
kern_return_t
thread_get_sampled_pcs(
- thread_t thread,
- sampled_pc_seqno_t *seqnop,
- sampled_pc_array_t sampled_pcs_out,
- int *sampled_pcs_cntp)
+ const thread_t thread,
+ const sampled_pc_seqno_t *seqnop,
+ const sampled_pc_array_t sampled_pcs_out,
+ const int *sampled_pcs_cntp)
{
return KERN_FAILURE; /* not implemented */
}
kern_return_t
task_get_sampled_pcs(
- task_t task,
- sampled_pc_seqno_t *seqnop,
- sampled_pc_array_t sampled_pcs_out,
- int *sampled_pcs_cntp)
+ const task_t task,
+ const sampled_pc_seqno_t *seqnop,
+ const sampled_pc_array_t sampled_pcs_out,
+ const int *sampled_pcs_cntp)
{
return KERN_FAILURE; /* not implemented */
}