From ea3ec09ecc7c080ce7fac7da00f50f0062d511f3 Mon Sep 17 00:00:00 2001 From: Marin Ramesa Date: Mon, 9 Sep 2013 22:12:57 +0200 Subject: Drop luna88k bits * device/tty.h [luna88k]: Remove ifdef and include for nonexistent header files. * kern/debug.c: Remove check for luna88k. --- kern/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kern/debug.c') diff --git a/kern/debug.c b/kern/debug.c index 09c8ff48..7f6e5557 100644 --- a/kern/debug.c +++ b/kern/debug.c @@ -96,7 +96,7 @@ void SoftDebugger(message) asm("ta 0x81"); #endif /* sun4 */ -#if defined(mips ) || defined(luna88k) || defined(i860) || defined(alpha) +#if defined(mips ) || defined(i860) || defined(alpha) gimmeabreak(); #endif -- cgit v1.2.3 From 24d8170fa18e3bad9ef2fa1e100e34e93a6c1126 Mon Sep 17 00:00:00 2001 From: Marin Ramesa Date: Sat, 9 Nov 2013 05:29:01 +0100 Subject: Remove lint code --- i386/i386/ast_check.c | 6 ------ i386/i386at/model_dep.c | 4 ---- i386/intel/pmap.c | 9 --------- kern/assert.h | 4 ---- kern/debug.c | 3 --- kern/machine.c | 6 ------ kern/macro_help.h | 5 ----- kern/processor.c | 6 ------ kern/syscall_subr.c | 4 ---- vm/memory_object.c | 5 ----- vm/vm_object.c | 12 ------------ 11 files changed, 64 deletions(-) (limited to 'kern/debug.c') diff --git a/i386/i386/ast_check.c b/i386/i386/ast_check.c index 982c7053..9afb9028 100644 --- a/i386/i386/ast_check.c +++ b/i386/i386/ast_check.c @@ -40,9 +40,6 @@ init_ast_check(processor) processor_t processor; { -#ifdef lint - processor++; -#endif /* lint */ } /* @@ -51,9 +48,6 @@ init_ast_check(processor) cause_ast_check(processor) processor_t processor; { -#ifdef lint - processor++; -#endif /* lint */ } #endif /* NCPUS > 1 */ diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index d97f0850..2bc1996d 100644 --- a/i386/i386at/model_dep.c +++ b/i386/i386at/model_dep.c @@ -625,10 +625,6 @@ timemmap(dev,off,prot) { extern time_value_t *mtime; -#ifdef lint - dev++; off++; -#endif /* lint */ - if (prot & VM_PROT_WRITE) return (-1); return (i386_btop(pmap_extract(pmap_kernel(), (vm_offset_t) mtime))); diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c index 490c1d95..c1eca6e0 100644 --- a/i386/intel/pmap.c +++ b/i386/intel/pmap.c @@ -2150,9 +2150,6 @@ void pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr) vm_size_t len; vm_offset_t src_addr; { -#ifdef lint - dst_pmap++; src_pmap++; dst_addr++; len++; src_addr++; -#endif /* lint */ } #endif /* 0 */ @@ -2303,9 +2300,6 @@ void pmap_deactivate(pmap, th, which_cpu) thread_t th; int which_cpu; { -#ifdef lint - pmap++; th++; which_cpu++; -#endif /* lint */ PMAP_DEACTIVATE(pmap, th, which_cpu); } #endif /* 0 */ @@ -2384,9 +2378,6 @@ pmap_pageable(pmap, start, end, pageable) vm_offset_t end; boolean_t pageable; { -#ifdef lint - pmap++; start++; end++; pageable++; -#endif /* lint */ } /* diff --git a/kern/assert.h b/kern/assert.h index 2829728b..d2bb56e1 100644 --- a/kern/assert.h +++ b/kern/assert.h @@ -44,11 +44,7 @@ MACRO_BEGIN \ Assert(#ex, __FILE__, __LINE__); \ MACRO_END -#ifdef lint -#define assert_static(x) -#else /* lint */ #define assert_static(x) assert(x) -#endif /* lint */ #else /* MACH_ASSERT */ #define assert(ex) diff --git a/kern/debug.c b/kern/debug.c index 7f6e5557..33e64f33 100644 --- a/kern/debug.c +++ b/kern/debug.c @@ -199,9 +199,6 @@ log(int level, const char *fmt, ...) { va_list listp; -#ifdef lint - level++; -#endif va_start(listp, fmt); _doprnt(fmt, listp, do_cnputc, 0, 0); va_end(listp); diff --git a/kern/machine.c b/kern/machine.c index c2a19b99..e0ceb1a2 100644 --- a/kern/machine.c +++ b/kern/machine.c @@ -320,9 +320,6 @@ processor_t processor; processor_set_t new_pset; boolean_t wait; { -#ifdef lint - processor++; new_pset++; wait++; -#endif return KERN_FAILURE; } @@ -668,9 +665,6 @@ processor_t processor; processor_set_t new_pset; boolean_t wait; { -#ifdef lint - processor++; new_pset++; wait++; -#endif /* lint */ return(KERN_FAILURE); } diff --git a/kern/macro_help.h b/kern/macro_help.h index a3d156b7..7ce171f6 100644 --- a/kern/macro_help.h +++ b/kern/macro_help.h @@ -37,13 +37,8 @@ #include -#ifdef lint -boolean_t NEVER; -boolean_t ALWAYS; -#else /* lint */ #define NEVER FALSE #define ALWAYS TRUE -#endif /* lint */ #define MACRO_BEGIN ({ #define MACRO_END }) diff --git a/kern/processor.c b/kern/processor.c index 19868609..55daf7fb 100644 --- a/kern/processor.c +++ b/kern/processor.c @@ -647,18 +647,12 @@ processor_set_create( processor_set_t *new_set, processor_set_t *new_name) { -#ifdef lint - host++; new_set++; new_name++; -#endif /* lint */ return KERN_FAILURE; } kern_return_t processor_set_destroy( processor_set_t pset) { -#ifdef lint - pset++; -#endif /* lint */ return KERN_FAILURE; } diff --git a/kern/syscall_subr.c b/kern/syscall_subr.c index ae2d7d73..1a0ab933 100644 --- a/kern/syscall_subr.c +++ b/kern/syscall_subr.c @@ -113,10 +113,6 @@ boolean_t swtch_pri(pri) register thread_t thread = current_thread(); register processor_t myprocessor; -#ifdef lint - pri++; -#endif /* lint */ - #if NCPUS > 1 myprocessor = current_processor(); if (myprocessor->runq.count == 0 && diff --git a/vm/memory_object.c b/vm/memory_object.c index e281c6a3..8315182a 100644 --- a/vm/memory_object.c +++ b/vm/memory_object.c @@ -337,11 +337,6 @@ kern_return_t memory_object_data_error(object, offset, size, error_value) if (size != round_page(size)) return(KERN_INVALID_ARGUMENT); -#ifdef lint - /* Error value is ignored at this time */ - error_value++; -#endif - vm_object_lock(object); offset -= object->paging_offset; diff --git a/vm/vm_object.c b/vm/vm_object.c index 18a909f8..600aff24 100644 --- a/vm/vm_object.c +++ b/vm/vm_object.c @@ -813,10 +813,6 @@ kern_return_t memory_object_destroy( ipc_port_t old_object, old_name; pager_request_t old_control; -#ifdef lint - reason++; -#endif /* lint */ - if (object == VM_OBJECT_NULL) return KERN_SUCCESS; @@ -1257,10 +1253,6 @@ boolean_t vm_object_copy_temporary( { vm_object_t object = *_object; -#ifdef lint - ++*_offset; -#endif /* lint */ - if (object == VM_OBJECT_NULL) { *_src_needs_copy = FALSE; *_dst_needs_copy = FALSE; @@ -2823,10 +2815,6 @@ boolean_t vm_object_coalesce( { vm_size_t newsize; -#ifdef lint - next_offset++; -#endif /* lint */ - if (next_object != VM_OBJECT_NULL) { return FALSE; } -- cgit v1.2.3 From 016dba1c5e3aa0bfa24595978b296768844193bb Mon Sep 17 00:00:00 2001 From: Marin Ramesa Date: Fri, 29 Nov 2013 22:54:00 +0100 Subject: kern/debug.c: remove forward declaration * kern/debug.c (cnputc): Remove forward declaration. Include device/cons.h. --- kern/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kern/debug.c') diff --git a/kern/debug.c b/kern/debug.c index 33e64f33..e9427a3a 100644 --- a/kern/debug.c +++ b/kern/debug.c @@ -38,7 +38,7 @@ #include #include -extern void cnputc(); +#include #if MACH_KDB extern int db_breakpoints_inserted; -- cgit v1.2.3 From 4dc587e9bd3e5e1a44df36e29c22645a074ae68f Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 8 Dec 2013 23:20:19 +0900 Subject: Always make Assert trigger debugger * kern/debug.c (Assert): Always call Debugger, even if db_breakpoints_insert is not set. --- kern/debug.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'kern/debug.c') diff --git a/kern/debug.c b/kern/debug.c index e9427a3a..2530fa6a 100644 --- a/kern/debug.c +++ b/kern/debug.c @@ -40,10 +40,6 @@ #include -#if MACH_KDB -extern int db_breakpoints_inserted; -#endif - #if NCPUS>1 simple_lock_data_t Assert_print_lock; /* uninited, we take our chances */ #endif @@ -67,9 +63,6 @@ Assert(char *exp, char *file, int line) exp, file, line); #endif -#if MACH_KDB - if (db_breakpoints_inserted) -#endif Debugger("assertion failure"); } -- cgit v1.2.3 From 5b52f611dd714b161337301109c28c2ae4a89dff Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 9 Dec 2013 00:18:22 +0900 Subject: Add comment --- kern/debug.c | 1 + 1 file changed, 1 insertion(+) (limited to 'kern/debug.c') diff --git a/kern/debug.c b/kern/debug.c index 2530fa6a..add2accd 100644 --- a/kern/debug.c +++ b/kern/debug.c @@ -197,6 +197,7 @@ log(int level, const char *fmt, ...) va_end(listp); } +/* GCC references this for stack protection. */ unsigned char __stack_chk_guard [ sizeof (vm_offset_t) ] = { [ sizeof (vm_offset_t) - 3 ] = '\r', -- cgit v1.2.3 From 827c01fadb98e77f692d39d0fb34a1944e43c99b Mon Sep 17 00:00:00 2001 From: Marin Ramesa Date: Mon, 16 Dec 2013 23:55:15 +0100 Subject: kern: qualify pointers whose dereferenced values are constant with const --- kern/assert.h | 2 +- kern/boot_script.c | 4 ++-- kern/debug.c | 6 +++--- kern/debug.h | 4 ++-- kern/eventcount.c | 2 +- kern/host.c | 12 ++++++------ kern/ipc_host.c | 2 +- kern/ipc_mig.c | 5 +++-- kern/ipc_mig.h | 2 +- kern/ipc_tt.c | 6 +++--- kern/mach_clock.c | 16 ++++++++-------- kern/mach_clock.h | 2 +- kern/machine.c | 4 ++-- kern/pc_sample.c | 34 +++++++++++++++++----------------- kern/sched_prim.c | 6 +++--- kern/syscall_emulation.c | 2 +- 16 files changed, 55 insertions(+), 54 deletions(-) (limited to 'kern/debug.c') diff --git a/kern/assert.h b/kern/assert.h index d2bb56e1..b074fbb6 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 a6196e05..b245d1d8 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 add2accd..fd392d21 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 e429bdd1..6c8977b8 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 aa3f1e36..1bc9968d 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 698acea9..2855cd2d 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 cd1c11ab..a02eb6f6 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 f5e8e14e..bbc38cf6 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 3e368ae7..6f063eca 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 e5d928dc..f8d0f63c 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 f167291d..c68b460d 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 72189af6..827cf861 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 8a333271..5d1ea346 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 cdf8e954..81b20560 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 8aad1462..f8170044 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 290c51a5..da0a6cf2 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; -- cgit v1.2.3