summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Ramesa <mpr@hi.t-com.hr>2013-12-16 23:55:15 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-12-17 19:03:28 +0100
commit827c01fadb98e77f692d39d0fb34a1944e43c99b (patch)
tree46c60239eaddbcfb2f79195989c23b16c3ce55d8
parentece37d66ae394a0d783f3cba8a71d7b61735b0aa (diff)
kern: qualify pointers whose dereferenced values are constant with const
-rw-r--r--kern/assert.h2
-rw-r--r--kern/boot_script.c4
-rw-r--r--kern/debug.c6
-rw-r--r--kern/debug.h4
-rw-r--r--kern/eventcount.c2
-rw-r--r--kern/host.c12
-rw-r--r--kern/ipc_host.c2
-rw-r--r--kern/ipc_mig.c5
-rw-r--r--kern/ipc_mig.h2
-rw-r--r--kern/ipc_tt.c6
-rw-r--r--kern/mach_clock.c16
-rw-r--r--kern/mach_clock.h2
-rw-r--r--kern/machine.c4
-rw-r--r--kern/pc_sample.c34
-rw-r--r--kern/sched_prim.c6
-rw-r--r--kern/syscall_emulation.c2
16 files changed, 55 insertions, 54 deletions
diff --git a/kern/assert.h b/kern/assert.h
index d2bb56e..b074fbb 100644
--- a/kern/assert.h
+++ b/kern/assert.h
@@ -36,7 +36,7 @@
#endif
#if MACH_ASSERT
-extern void Assert(char *exp, char *filename, int line) __attribute__ ((noreturn));
+extern void Assert(const char *exp, const char *filename, int line) __attribute__ ((noreturn));
#define assert(ex) \
MACRO_BEGIN \
diff --git a/kern/boot_script.c b/kern/boot_script.c
index a6196e0..b245d1d 100644
--- a/kern/boot_script.c
+++ b/kern/boot_script.c
@@ -76,14 +76,14 @@ create_task (struct cmd *cmd, long *val)
/* Resume a task. */
static int
-resume_task (struct cmd *cmd, long *val)
+resume_task (struct cmd *cmd, const long *val)
{
return boot_script_task_resume (cmd);
}
/* Resume a task when the user hits return. */
static int
-prompt_resume_task (struct cmd *cmd, long *val)
+prompt_resume_task (struct cmd *cmd, const long *val)
{
return boot_script_prompt_task_resume (cmd);
}
diff --git a/kern/debug.c b/kern/debug.c
index add2acc..fd392d2 100644
--- a/kern/debug.c
+++ b/kern/debug.c
@@ -51,7 +51,7 @@ do_cnputc(char c, vm_offset_t offset)
}
void
-Assert(char *exp, char *file, int line)
+Assert(const char *exp, const char *file, int line)
{
#if NCPUS > 1
simple_lock(&Assert_print_lock);
@@ -67,7 +67,7 @@ Assert(char *exp, char *file, int line)
}
void SoftDebugger(message)
- char * message;
+ const char *message;
{
printf("Debugger invoked: %s\n", message);
@@ -99,7 +99,7 @@ void SoftDebugger(message)
}
void Debugger(message)
- char * message;
+ const char *message;
{
#if !MACH_KDB
panic("Debugger invoked, but there isn't one!");
diff --git a/kern/debug.h b/kern/debug.h
index e429bdd..6c8977b 100644
--- a/kern/debug.h
+++ b/kern/debug.h
@@ -62,7 +62,7 @@ extern void log (int level, const char *fmt, ...);
extern void panic_init(void);
extern void panic (const char *s, ...) __attribute__ ((noreturn));
-extern void SoftDebugger (char *message);
-extern void Debugger (char *message) __attribute__ ((noreturn));
+extern void SoftDebugger (const char *message);
+extern void Debugger (const char *message) __attribute__ ((noreturn));
#endif /* _mach_debug__debug_ */
diff --git a/kern/eventcount.c b/kern/eventcount.c
index aa3f1e3..1bc9968 100644
--- a/kern/eventcount.c
+++ b/kern/eventcount.c
@@ -98,7 +98,7 @@ evc_destroy(evc_t ev)
* Thread termination.
* HORRIBLE. This stuff needs to be fixed.
*/
-void evc_notify_abort(thread_t thread)
+void evc_notify_abort(const thread_t thread)
{
int i;
evc_t ev;
diff --git a/kern/host.c b/kern/host.c
index 698acea..2855cd2 100644
--- a/kern/host.c
+++ b/kern/host.c
@@ -47,7 +47,7 @@
host_data_t realhost;
kern_return_t host_processors(
- host_t host,
+ const host_t host,
processor_array_t *processor_list,
natural_t *countp)
{
@@ -95,7 +95,7 @@ kern_return_t host_processors(
}
kern_return_t host_info(
- host_t host,
+ const host_t host,
int flavor,
host_info_t info,
natural_t *count)
@@ -204,7 +204,7 @@ kern_return_t host_info(
*/
kern_return_t host_kernel_version(
- host_t host,
+ const host_t host,
kernel_version_t out_version)
{
extern char version[];
@@ -225,7 +225,7 @@ kern_return_t host_kernel_version(
#if MACH_HOST
kern_return_t
host_processor_sets(
- host_t host,
+ const host_t host,
processor_set_name_array_t *pset_list,
natural_t *count)
{
@@ -324,7 +324,7 @@ host_processor_sets(
*/
kern_return_t
host_processor_sets(
- host_t host,
+ const host_t host,
processor_set_name_array_t *pset_list,
natural_t *count)
{
@@ -362,7 +362,7 @@ host_processor_sets(
*/
kern_return_t
host_processor_set_priv(
- host_t host,
+ const host_t host,
processor_set_t pset_name,
processor_set_t *pset)
{
diff --git a/kern/ipc_host.c b/kern/ipc_host.c
index cd1c11a..a02eb6f 100644
--- a/kern/ipc_host.c
+++ b/kern/ipc_host.c
@@ -205,7 +205,7 @@ ipc_pset_terminate(
*/
kern_return_t
processor_set_default(
- host_t host,
+ const host_t host,
processor_set_t *pset)
{
if (host == HOST_NULL)
diff --git a/kern/ipc_mig.c b/kern/ipc_mig.c
index f5e8e14..bbc38cf 100644
--- a/kern/ipc_mig.c
+++ b/kern/ipc_mig.c
@@ -92,7 +92,7 @@ mach_msg_send_from_kernel(
mach_msg_return_t
mach_msg_rpc_from_kernel(msg, send_size, reply_size)
- mach_msg_header_t *msg;
+ const mach_msg_header_t *msg;
mach_msg_size_t send_size;
mach_msg_size_t reply_size;
{
@@ -286,7 +286,8 @@ mig_put_reply_port(
* len - Length of destination buffer.
*/
void mig_strncpy(dest, src, len)
-char *dest, *src;
+char *dest;
+const char *src;
int len;
{
int i;
diff --git a/kern/ipc_mig.h b/kern/ipc_mig.h
index 3e368ae..6f063ec 100644
--- a/kern/ipc_mig.h
+++ b/kern/ipc_mig.h
@@ -59,7 +59,7 @@ extern mach_msg_return_t mach_msg_send_from_kernel(
extern void mach_msg_abort_rpc (ipc_thread_t);
extern mach_msg_return_t mach_msg_rpc_from_kernel(
- mach_msg_header_t *msg,
+ const mach_msg_header_t *msg,
mach_msg_size_t send_size,
mach_msg_size_t reply_size);
diff --git a/kern/ipc_tt.c b/kern/ipc_tt.c
index e5d928d..f8d0f63 100644
--- a/kern/ipc_tt.c
+++ b/kern/ipc_tt.c
@@ -648,9 +648,9 @@ task_get_special_port(
kern_return_t
task_set_special_port(
- task_t task,
- int which,
- ipc_port_t port)
+ task_t task,
+ int which,
+ const ipc_port_t port)
{
ipc_port_t *whichp;
ipc_port_t old;
diff --git a/kern/mach_clock.c b/kern/mach_clock.c
index f167291..c68b460 100644
--- a/kern/mach_clock.c
+++ b/kern/mach_clock.c
@@ -387,7 +387,7 @@ record_time_stamp (time_value_t *stamp)
*/
kern_return_t
host_get_time(host, current_time)
- host_t host;
+ const host_t host;
time_value_t *current_time; /* OUT */
{
if (host == HOST_NULL)
@@ -406,7 +406,7 @@ host_get_time(host, current_time)
*/
kern_return_t
host_set_time(host, new_time)
- host_t host;
+ const host_t host;
time_value_t new_time;
{
spl_t s;
@@ -444,7 +444,7 @@ host_set_time(host, new_time)
*/
kern_return_t
host_adjust_time(host, new_adjustment, old_adjustment)
- host_t host;
+ const host_t host;
time_value_t new_adjustment;
time_value_t *old_adjustment; /* OUT */
{
@@ -527,9 +527,9 @@ timer_elt_data_t timeout_timers[NTIMERS];
* interval: timeout interval, in hz.
*/
void timeout(fcn, param, interval)
- void (*fcn)( void * param );
- void * param;
- int interval;
+ void (*fcn)( void * param );
+ void * param;
+ int interval;
{
spl_t s;
timer_elt_t elt;
@@ -555,8 +555,8 @@ void timeout(fcn, param, interval)
* and removed.
*/
boolean_t untimeout(fcn, param)
- void (*fcn)( void * param );
- void * param;
+ void (*fcn)( void * param );
+ const void * param;
{
spl_t s;
timer_elt_t elt;
diff --git a/kern/mach_clock.h b/kern/mach_clock.h
index 72189af..827cf86 100644
--- a/kern/mach_clock.h
+++ b/kern/mach_clock.h
@@ -102,7 +102,7 @@ extern void mapable_time_init (void);
/* For public timer elements. */
extern void timeout(timer_func_t *fcn, void *param, int interval);
-extern boolean_t untimeout(timer_func_t *fcn, void *param);
+extern boolean_t untimeout(timer_func_t *fcn, const void *param);
extern int timeopen(void);
extern int timeclose(void);
diff --git a/kern/machine.c b/kern/machine.c
index 8a33327..5d1ea34 100644
--- a/kern/machine.c
+++ b/kern/machine.c
@@ -126,8 +126,8 @@ void cpu_down(cpu)
kern_return_t
host_reboot(host, options)
- host_t host;
- int options;
+ const host_t host;
+ int options;
{
if (host == HOST_NULL)
return (KERN_INVALID_HOST);
diff --git a/kern/pc_sample.c b/kern/pc_sample.c
index cdf8e95..81b2056 100644
--- a/kern/pc_sample.c
+++ b/kern/pc_sample.c
@@ -44,7 +44,7 @@
typedef sampled_pc_t sampled_pcs[MAX_PC_SAMPLES];
void take_pc_sample(
- thread_t t,
+ const thread_t t,
sample_control_t *cp,
sampled_pc_flavor_t flavor)
{
@@ -241,8 +241,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 */
@@ -250,8 +250,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 */
@@ -259,36 +259,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 */
}
diff --git a/kern/sched_prim.c b/kern/sched_prim.c
index 8aad146..f817004 100644
--- a/kern/sched_prim.c
+++ b/kern/sched_prim.c
@@ -358,7 +358,7 @@ void clear_wait(
}
static inline void __attribute__((noreturn))
-state_panic(thread_t thread, const char *caller)
+state_panic(const thread_t thread, const char *caller)
{
panic ("%s: thread %x has unexpected state %x",
caller, thread, thread->state);
@@ -1076,7 +1076,7 @@ void compute_my_priority(
*
* Update the priorities of all threads periodically.
*/
-void recompute_priorities(void *param)
+void recompute_priorities(const void *param)
{
#if SIMPLE_CLOCK
int new_usec;
@@ -1990,7 +1990,7 @@ void do_thread_scan(void)
#if DEBUG
void checkrq(
run_queue_t rq,
- char *msg)
+ const char *msg)
{
queue_t q1;
int i, j;
diff --git a/kern/syscall_emulation.c b/kern/syscall_emulation.c
index 290c51a..da0a6cf 100644
--- a/kern/syscall_emulation.c
+++ b/kern/syscall_emulation.c
@@ -94,7 +94,7 @@ void eml_task_reference(task, parent)
*/
void eml_task_deallocate(task)
- task_t task;
+ const task_t task;
{
eml_dispatch_t eml;