From: Dr. Florian Grätz Date: Thu, 5 Nov 2015 14:39:38 +0000 (+0100) Subject: Kernel: convert K&R functions to ANSI X-Git-Url: http://zhaoyanbai.com/repos/%22/xml/v3/mem/static/gitweb.css?a=commitdiff_plain;h=6077d1ad241af1cd2881b708610d6ceb54ed9612;p=minix.git Kernel: convert K&R functions to ANSI Changed all K&R style functions to ANSI-style declarations within the kernel directory. The code compiles and aparently works for i386. For arm my toolchain does not work, but I have changed the code with great care. Also, the make command fails for the test suite. Therefore, I strongly recommand to review the code with care. Edited by David van Moolenbroek to convert really all K&R functions. Change-Id: I58cde797d36f4caa9c72db4e4dc27d8545ab8866 --- diff --git a/minix/kernel/arch/earm/arch_do_vmctl.c b/minix/kernel/arch/earm/arch_do_vmctl.c index bb8d231e9..d1cd417c0 100644 --- a/minix/kernel/arch/earm/arch_do_vmctl.c +++ b/minix/kernel/arch/earm/arch_do_vmctl.c @@ -32,9 +32,10 @@ static void set_ttbr(struct proc *p, u32_t ttbr, u32_t *v) /*===========================================================================* * arch_do_vmctl * *===========================================================================*/ -int arch_do_vmctl(m_ptr, p) -register message *m_ptr; /* pointer to request message */ -struct proc *p; +int arch_do_vmctl( + register message *m_ptr, /* pointer to request message */ + struct proc *p +) { switch(m_ptr->SVMCTL_PARAM) { case VMCTL_GET_PDBR: diff --git a/minix/kernel/arch/earm/arch_system.c b/minix/kernel/arch/earm/arch_system.c index 9399c2e4c..7e7de8d61 100644 --- a/minix/kernel/arch/earm/arch_system.c +++ b/minix/kernel/arch/earm/arch_system.c @@ -134,7 +134,7 @@ void arch_init(void) /*===========================================================================* * do_ser_debug * *===========================================================================*/ -void do_ser_debug() +void do_ser_debug(void) { } diff --git a/minix/kernel/arch/earm/bsp/include/bsp_init.h b/minix/kernel/arch/earm/bsp/include/bsp_init.h index 36361243e..d48b8c184 100644 --- a/minix/kernel/arch/earm/bsp/include/bsp_init.h +++ b/minix/kernel/arch/earm/bsp/include/bsp_init.h @@ -2,6 +2,6 @@ #define _BSP_INIT_H_ /* BSP init */ -void bsp_init(); +void bsp_init(void); #endif /* __BSP_INIT_H__ */ diff --git a/minix/kernel/arch/earm/bsp/include/bsp_serial.h b/minix/kernel/arch/earm/bsp/include/bsp_serial.h index 4cd0ee4e7..82b1c54d2 100644 --- a/minix/kernel/arch/earm/bsp/include/bsp_serial.h +++ b/minix/kernel/arch/earm/bsp/include/bsp_serial.h @@ -1,6 +1,7 @@ #ifndef _BSP_SERIAL_H_ #define _BSP_SERIAL_H_ -void bsp_ser_init(); +void bsp_ser_init(void); void bsp_ser_putc(char c); + #endif /* _BSP_SERIAL_H_ */ diff --git a/minix/kernel/arch/earm/bsp/ti/omap_init.c b/minix/kernel/arch/earm/bsp/ti/omap_init.c index 99a47b765..18e246a19 100644 --- a/minix/kernel/arch/earm/bsp/ti/omap_init.c +++ b/minix/kernel/arch/earm/bsp/ti/omap_init.c @@ -5,8 +5,9 @@ #include "bsp_reset.h" void -bsp_init() +bsp_init(void) { + /* map memory for padconf */ bsp_padconf_init(); diff --git a/minix/kernel/arch/earm/bsp/ti/omap_serial.c b/minix/kernel/arch/earm/bsp/ti/omap_serial.c index 9affc52ef..48408073e 100644 --- a/minix/kernel/arch/earm/bsp/ti/omap_serial.c +++ b/minix/kernel/arch/earm/bsp/ti/omap_serial.c @@ -43,7 +43,7 @@ static kern_phys_map serial_phys_map; * in high memory so keep in mind there are two copies of this code in the kernel. */ void -bsp_ser_init() +bsp_ser_init(void) { if (BOARD_IS_BBXM(machine.board_id)) { omap_serial.base = OMAP3_DM37XX_DEBUG_UART_BASE; diff --git a/minix/kernel/arch/earm/bsp/ti/omap_serial.h b/minix/kernel/arch/earm/bsp/ti/omap_serial.h index 84272a2fa..31c8d9805 100644 --- a/minix/kernel/arch/earm/bsp/ti/omap_serial.h +++ b/minix/kernel/arch/earm/bsp/ti/omap_serial.h @@ -19,7 +19,7 @@ #ifndef __ASSEMBLY__ -void omap3_ser_init(); +void omap3_ser_init(void); void omap3_ser_putc(char c); #endif /* __ASSEMBLY__ */ diff --git a/minix/kernel/arch/earm/bsp/ti/omap_timer.c b/minix/kernel/arch/earm/bsp/ti/omap_timer.c index f37f7163f..6226e9a19 100644 --- a/minix/kernel/arch/earm/bsp/ti/omap_timer.c +++ b/minix/kernel/arch/earm/bsp/ti/omap_timer.c @@ -258,7 +258,7 @@ omap3_frclock_init(void) } void -omap3_frclock_stop() +omap3_frclock_stop(void) { mmio_clear(fr_timer->base + fr_timer->regs->TCLR, OMAP3_TCLR_ST); } @@ -328,7 +328,7 @@ bsp_timer_init(unsigned freq) } void -bsp_timer_stop() +bsp_timer_stop(void) { mmio_clear(timer->base + timer->regs->TCLR, OMAP3_TCLR_ST); } @@ -369,7 +369,7 @@ frc_overflow_check(u32_t cur_frc) } void -bsp_timer_int_handler() +bsp_timer_int_handler(void) { /* Clear all interrupts */ u32_t tisr, now; diff --git a/minix/kernel/arch/earm/hw_intr.c b/minix/kernel/arch/earm/hw_intr.c index e426fdb4f..787e9f885 100644 --- a/minix/kernel/arch/earm/hw_intr.c +++ b/minix/kernel/arch/earm/hw_intr.c @@ -13,4 +13,4 @@ void hw_intr_unmask(int irq){ void hw_intr_ack(int irq){}; void hw_intr_used(int irq){}; void hw_intr_not_used(int irq){}; -void hw_intr_disable_all(){}; +void hw_intr_disable_all(void){}; diff --git a/minix/kernel/arch/earm/include/arch_proto.h b/minix/kernel/arch/earm/include/arch_proto.h index 2ec2ef16b..f88bab3fd 100644 --- a/minix/kernel/arch/earm/include/arch_proto.h +++ b/minix/kernel/arch/earm/include/arch_proto.h @@ -115,7 +115,7 @@ int kern_phys_map_ptr( phys_bytes base_address, vir_bytes io_size, int vm_flags, kern_phys_map * priv, vir_bytes ptr); -void arch_ser_init(); +void arch_ser_init(void); /* functions defined in architecture-independent kernel source. */ #include "kernel/proto.h" diff --git a/minix/kernel/arch/earm/include/cpufunc.h b/minix/kernel/arch/earm/include/cpufunc.h index c5606dbe4..6839b9185 100644 --- a/minix/kernel/arch/earm/include/cpufunc.h +++ b/minix/kernel/arch/earm/include/cpufunc.h @@ -44,7 +44,7 @@ static inline void barrier(void) /* Read CLIDR, Cache Level ID Register */ -static inline u32_t read_clidr(){ +static inline u32_t read_clidr(void){ u32_t clidr; asm volatile("mrc p15, 1, %[clidr], c0, c0 , 1 @ READ CLIDR\n\t" : [clidr] "=r" (clidr)); @@ -53,7 +53,7 @@ static inline u32_t read_clidr(){ /* Read CSSELR, Cache Size Selection Register */ -static inline u32_t read_csselr(){ +static inline u32_t read_csselr(void){ u32_t csselr; asm volatile("mrc p15, 2, %[csselr], c0, c0 , 0 @ READ CSSELR\n\t" : [csselr] "=r" (csselr)); @@ -67,7 +67,7 @@ static inline void write_csselr(u32_t csselr){ } /* Read Cache Size ID Register */ -static inline u32_t read_ccsidr() +static inline u32_t read_ccsidr(void) { u32_t ccsidr; asm volatile("mrc p15, 1, %[ccsidr], c0, c0, 0 @ Read CCSIDR\n\t" @@ -76,7 +76,7 @@ static inline u32_t read_ccsidr() } /* Read TLBTR, TLB Type Register */ -static inline u32_t read_tlbtr() +static inline u32_t read_tlbtr(void) { u32_t tlbtr; asm volatile("mrc p15, 0, %[tlbtr], c0, c0, 3 @ Read TLBTR\n\t" @@ -152,10 +152,10 @@ static inline void dcache_maint(int type){ isb(); } -static inline void dcache_clean(){ +static inline void dcache_clean(void){ dcache_maint(1); } -static inline void dcache_invalidate (){ +static inline void dcache_invalidate(void){ dcache_maint(2); } @@ -189,7 +189,7 @@ static inline void refresh_tlb(void) /* Read System Control Register */ -static inline u32_t read_sctlr() +static inline u32_t read_sctlr(void) { u32_t ctl; @@ -208,7 +208,7 @@ static inline void write_sctlr(u32_t ctl) } /* Read Translation Table Base Register 0 */ -static inline u32_t read_ttbr0() +static inline u32_t read_ttbr0(void) { u32_t bar; @@ -241,7 +241,7 @@ static inline void reload_ttbr0(void) } /* Read Translation Table Base Register 1 */ -static inline u32_t read_ttbr1() +static inline u32_t read_ttbr1(void) { u32_t bar; @@ -271,7 +271,7 @@ static inline void reload_ttbr1(void) } /* Read Translation Table Base Control Register */ -static inline u32_t read_ttbcr() +static inline u32_t read_ttbcr(void) { u32_t bcr; @@ -291,7 +291,7 @@ static inline void write_ttbcr(u32_t bcr) } /* Read Domain Access Control Register */ -static inline u32_t read_dacr() +static inline u32_t read_dacr(void) { u32_t dacr; @@ -311,7 +311,7 @@ static inline void write_dacr(u32_t dacr) } /* Read Data Fault Status Register */ -static inline u32_t read_dfsr() +static inline u32_t read_dfsr(void) { u32_t fsr; @@ -331,7 +331,7 @@ static inline void write_dfsr(u32_t fsr) } /* Read Instruction Fault Status Register */ -static inline u32_t read_ifsr() +static inline u32_t read_ifsr(void) { u32_t fsr; @@ -351,7 +351,7 @@ static inline void write_ifsr(u32_t fsr) } /* Read Data Fault Address Register */ -static inline u32_t read_dfar() +static inline u32_t read_dfar(void) { u32_t far; @@ -371,7 +371,7 @@ static inline void write_dfar(u32_t far) } /* Read Instruction Fault Address Register */ -static inline u32_t read_ifar() +static inline u32_t read_ifar(void) { u32_t far; @@ -391,7 +391,7 @@ static inline void write_ifar(u32_t far) } /* Read Vector Base Address Register */ -static inline u32_t read_vbar() +static inline u32_t read_vbar(void) { u32_t vbar; @@ -411,7 +411,7 @@ static inline void write_vbar(u32_t vbar) } /* Read the Main ID Register */ -static inline u32_t read_midr() +static inline u32_t read_midr(void) { u32_t id; @@ -422,7 +422,7 @@ static inline u32_t read_midr() } /* Read Auxiliary Control Register */ -static inline u32_t read_actlr() +static inline u32_t read_actlr(void) { u32_t ctl; @@ -443,7 +443,7 @@ static inline void write_actlr(u32_t ctl) } /* Read Current Program Status Register */ -static inline u32_t read_cpsr() +static inline u32_t read_cpsr(void) { u32_t status; diff --git a/minix/kernel/arch/earm/include/hw_intr.h b/minix/kernel/arch/earm/include/hw_intr.h index 8f26e85cc..b076798e1 100644 --- a/minix/kernel/arch/earm/include/hw_intr.h +++ b/minix/kernel/arch/earm/include/hw_intr.h @@ -10,6 +10,6 @@ void hw_intr_unmask(int irq); void hw_intr_ack(int irq); void hw_intr_used(int irq); void hw_intr_not_used(int irq); -void hw_intr_disable_all(); +void hw_intr_disable_all(void); #endif /* __HW_INTR_ARM_H__ */ diff --git a/minix/kernel/arch/earm/memory.c b/minix/kernel/arch/earm/memory.c index 7f29af43b..5f675cc0a 100644 --- a/minix/kernel/arch/earm/memory.c +++ b/minix/kernel/arch/earm/memory.c @@ -252,11 +252,12 @@ static u32_t phys_get32(phys_bytes addr) /*===========================================================================* * umap_virtual * *===========================================================================*/ -phys_bytes umap_virtual(rp, seg, vir_addr, bytes) -register struct proc *rp; /* pointer to proc table entry for process */ -int seg; /* T, D, or S segment */ -vir_bytes vir_addr; /* virtual address in bytes within the seg */ -vir_bytes bytes; /* # of bytes to be copied */ +phys_bytes umap_virtual( + register struct proc *rp, /* pointer to proc table entry for process */ + int seg, /* T, D, or S segment */ + vir_bytes vir_addr, /* virtual address in bytes within the seg */ + vir_bytes bytes /* # of bytes to be copied */ +) { phys_bytes phys = 0; @@ -489,12 +490,13 @@ int vm_memset(struct proc* caller, endpoint_t who, phys_bytes ph, int c, /*===========================================================================* * virtual_copy_f * *===========================================================================*/ -int virtual_copy_f(caller, src_addr, dst_addr, bytes, vmcheck) -struct proc * caller; -struct vir_addr *src_addr; /* source virtual address */ -struct vir_addr *dst_addr; /* destination virtual address */ -vir_bytes bytes; /* # of bytes to copy */ -int vmcheck; /* if nonzero, can return VMSUSPEND */ +int virtual_copy_f( + struct proc * caller, + struct vir_addr *src_addr, /* source virtual address */ + struct vir_addr *dst_addr, /* destination virtual address */ + vir_bytes bytes, /* # of bytes to copy */ + int vmcheck /* if nonzero, can return VMSUSPEND */ +) { /* Copy bytes from virtual address src_addr to virtual address dst_addr. */ struct vir_addr *vir_addr[2]; /* virtual source and destination address */ diff --git a/minix/kernel/arch/earm/pg_utils.c b/minix/kernel/arch/earm/pg_utils.c index e3e1b28f5..f787e7793 100644 --- a/minix/kernel/arch/earm/pg_utils.c +++ b/minix/kernel/arch/earm/pg_utils.c @@ -240,7 +240,7 @@ void vm_enable_paging(void) write_sctlr(sctlr); } -phys_bytes pg_load() +phys_bytes pg_load(void) { phys_bytes phpagedir = vir2phys(pagedir); write_ttbr0(phpagedir); diff --git a/minix/kernel/arch/earm/protect.c b/minix/kernel/arch/earm/protect.c index b63b09ae3..14404b992 100644 --- a/minix/kernel/arch/earm/protect.c +++ b/minix/kernel/arch/earm/protect.c @@ -74,7 +74,7 @@ multiboot_module_t *bootmod(int pnr) int booting_cpu = 0; -void prot_init() +void prot_init(void) { /* tell the HW where we stored our vector table */ write_vbar((reg_t)&exc_vector_table); diff --git a/minix/kernel/arch/i386/arch_do_vmctl.c b/minix/kernel/arch/i386/arch_do_vmctl.c index c6f36ec46..41083487d 100644 --- a/minix/kernel/arch/i386/arch_do_vmctl.c +++ b/minix/kernel/arch/i386/arch_do_vmctl.c @@ -36,9 +36,10 @@ static void setcr3(struct proc *p, u32_t cr3, u32_t *v) /*===========================================================================* * arch_do_vmctl * *===========================================================================*/ -int arch_do_vmctl(m_ptr, p) -register message *m_ptr; /* pointer to request message */ -struct proc *p; +int arch_do_vmctl( + register message *m_ptr, /* pointer to request message */ + struct proc *p +) { switch(m_ptr->SVMCTL_PARAM) { case VMCTL_GET_PDBR: diff --git a/minix/kernel/arch/i386/arch_system.c b/minix/kernel/arch/i386/arch_system.c index 194dd1dae..a3bd73daa 100644 --- a/minix/kernel/arch/i386/arch_system.c +++ b/minix/kernel/arch/i386/arch_system.c @@ -286,7 +286,7 @@ void arch_init(void) /*===========================================================================* * do_ser_debug * *===========================================================================*/ -void do_ser_debug() +void do_ser_debug(void) { u8_t c, lsr; @@ -421,7 +421,7 @@ static void ser_debug(const int c) #if DEBUG_SERIAL -static void ser_dump_vfs() +static void ser_dump_vfs(void) { /* Notify VFS it has to generate stack traces. Kernel can't do that as * it's not aware of user space threads. diff --git a/minix/kernel/arch/i386/memory.c b/minix/kernel/arch/i386/memory.c index eac6c34ab..b81f5939c 100644 --- a/minix/kernel/arch/i386/memory.c +++ b/minix/kernel/arch/i386/memory.c @@ -280,11 +280,12 @@ static char *cr4_str(u32_t e) /*===========================================================================* * umap_virtual * *===========================================================================*/ -phys_bytes umap_virtual(rp, seg, vir_addr, bytes) -register struct proc *rp; /* pointer to proc table entry for process */ -int seg; /* T, D, or S segment */ -vir_bytes vir_addr; /* virtual address in bytes within the seg */ -vir_bytes bytes; /* # of bytes to be copied */ +phys_bytes umap_virtual( + register struct proc *rp, /* pointer to proc table entry for process */ + int seg, /* T, D, or S segment */ + vir_bytes vir_addr, /* virtual address in bytes within the seg */ + vir_bytes bytes /* # of bytes to be copied */ +) { phys_bytes phys = 0; @@ -589,12 +590,13 @@ int vm_memset(struct proc* caller, endpoint_t who, phys_bytes ph, int c, /*===========================================================================* * virtual_copy_f * *===========================================================================*/ -int virtual_copy_f(caller, src_addr, dst_addr, bytes, vmcheck) -struct proc * caller; -struct vir_addr *src_addr; /* source virtual address */ -struct vir_addr *dst_addr; /* destination virtual address */ -vir_bytes bytes; /* # of bytes to copy */ -int vmcheck; /* if nonzero, can return VMSUSPEND */ +int virtual_copy_f( + struct proc * caller, + struct vir_addr *src_addr, /* source virtual address */ + struct vir_addr *dst_addr, /* destination virtual address */ + vir_bytes bytes, /* # of bytes to copy */ + int vmcheck /* if nonzero, can return VMSUSPEND */ +) { /* Copy bytes from virtual address src_addr to virtual address dst_addr. */ struct vir_addr *vir_addr[2]; /* virtual source and destination address */ diff --git a/minix/kernel/arch/i386/pg_utils.c b/minix/kernel/arch/i386/pg_utils.c index 6a0f09ac2..8e4e0231b 100644 --- a/minix/kernel/arch/i386/pg_utils.c +++ b/minix/kernel/arch/i386/pg_utils.c @@ -239,7 +239,7 @@ void vm_enable_paging(void) write_cr4(cr4); } -phys_bytes pg_load() +phys_bytes pg_load(void) { phys_bytes phpagedir = vir2phys(pagedir); write_cr3(phpagedir); diff --git a/minix/kernel/arch/i386/protect.c b/minix/kernel/arch/i386/protect.c index e75022de1..1ac095b3d 100644 --- a/minix/kernel/arch/i386/protect.c +++ b/minix/kernel/arch/i386/protect.c @@ -320,7 +320,7 @@ void prot_load_selectors(void) /*===========================================================================* * prot_init * *===========================================================================*/ -void prot_init() +void prot_init(void) { extern char k_boot_stktop; diff --git a/minix/kernel/clock.c b/minix/kernel/clock.c index 00c3da834..f627ccb29 100644 --- a/minix/kernel/clock.c +++ b/minix/kernel/clock.c @@ -227,10 +227,11 @@ time_t get_boottime(void) /*===========================================================================* * set_kernel_timer * *===========================================================================*/ -void set_kernel_timer(tp, exp_time, watchdog) -minix_timer_t *tp; /* pointer to timer structure */ -clock_t exp_time; /* expiration monotonic time */ -tmr_func_t watchdog; /* watchdog to be called */ +void set_kernel_timer( + minix_timer_t *tp, /* pointer to timer structure */ + clock_t exp_time, /* expiration monotonic time */ + tmr_func_t watchdog /* watchdog to be called */ +) { /* Insert the new timer in the active timers list. Always update the * next timeout time by setting it to the front of the active list. @@ -242,8 +243,9 @@ tmr_func_t watchdog; /* watchdog to be called */ /*===========================================================================* * reset_kernel_timer * *===========================================================================*/ -void reset_kernel_timer(tp) -minix_timer_t *tp; /* pointer to timer structure */ +void reset_kernel_timer( + minix_timer_t *tp /* pointer to timer structure */ +) { /* The timer pointed to by 'tp' is no longer needed. Remove it from both the * active and expired lists. Always update the next timeout time by setting diff --git a/minix/kernel/main.c b/minix/kernel/main.c index a877fd604..7a5dcc516 100644 --- a/minix/kernel/main.c +++ b/minix/kernel/main.c @@ -403,7 +403,7 @@ void minix_shutdown(minix_timer_t *tp) /*===========================================================================* * cstart * *===========================================================================*/ -void cstart() +void cstart(void) { /* Perform system initializations prior to calling main(). Most settings are * determined with help of the environment strings passed by MINIX' loader. diff --git a/minix/kernel/proc.c b/minix/kernel/proc.c index 5ca6474ad..62ef6081c 100644 --- a/minix/kernel/proc.c +++ b/minix/kernel/proc.c @@ -703,10 +703,11 @@ int do_ipc(reg_t r1, reg_t r2, reg_t r3) /*===========================================================================* * deadlock * *===========================================================================*/ -static int deadlock(function, cp, src_dst_e) -int function; /* trap number */ -register struct proc *cp; /* pointer to caller */ -endpoint_t src_dst_e; /* src or dst process */ +static int deadlock( + int function, /* trap number */ + register struct proc *cp, /* pointer to caller */ + endpoint_t src_dst_e /* src or dst process */ +) { /* Check for deadlock. This can happen if 'caller_ptr' and 'src_dst' have * a cyclic dependency of blocking send and receive calls. The only cyclic @@ -1347,8 +1348,7 @@ static int mini_senda(struct proc *caller_ptr, asynmsg_t *table, size_t size) /*===========================================================================* * try_async * *===========================================================================*/ -static int try_async(caller_ptr) -struct proc *caller_ptr; +static int try_async(struct proc * caller_ptr) { int r; struct priv *privp; @@ -1831,15 +1831,11 @@ struct proc *endpoint_lookup(endpoint_t e) * isokendpt_f * *===========================================================================*/ #if DEBUG_ENABLE_IPC_WARNINGS -int isokendpt_f(file, line, e, p, fatalflag) -const char *file; -int line; +int isokendpt_f(const char * file, int line, endpoint_t e, int * p, + const int fatalflag) #else -int isokendpt_f(e, p, fatalflag) +int isokendpt_f(endpoint_t e, int * p, const int fatalflag) #endif -endpoint_t e; -int *p; -const int fatalflag; { int ok = 0; /* Convert an endpoint number into a process number. @@ -1974,7 +1970,7 @@ void release_fpu(struct proc * p) { *fpu_owner_ptr = NULL; } -void ser_dump_proc() +void ser_dump_proc(void) { struct proc *pp; diff --git a/minix/kernel/profile.c b/minix/kernel/profile.c index ecac1ed22..cbb71df06 100644 --- a/minix/kernel/profile.c +++ b/minix/kernel/profile.c @@ -44,7 +44,7 @@ void init_profile_clock(u32_t freq) /*===========================================================================* * profile_clock_stop * *===========================================================================*/ -void stop_profile_clock() +void stop_profile_clock(void) { arch_stop_profile_clock(); diff --git a/minix/kernel/proto.h b/minix/kernel/proto.h index 219790ed6..209fae7f9 100644 --- a/minix/kernel/proto.h +++ b/minix/kernel/proto.h @@ -89,7 +89,7 @@ int try_deliver_senda(struct proc *caller_ptr, asynmsg_t *table, size_t size); /* start.c */ -void cstart(); +void cstart(void); char *env_get(const char *key); /* system.c */ @@ -169,8 +169,8 @@ void stop_profile_clock(void); #endif /* functions defined in architecture-dependent files. */ -void prot_init(); -void arch_post_init(); +void prot_init(void); +void arch_post_init(void); void arch_set_secondary_ipc_return(struct proc *, u32_t val); phys_bytes phys_copy(phys_bytes source, phys_bytes dest, phys_bytes count); diff --git a/minix/kernel/system.c b/minix/kernel/system.c index a6bc979d1..dc6a2812d 100644 --- a/minix/kernel/system.c +++ b/minix/kernel/system.c @@ -272,9 +272,10 @@ void system_init(void) /*===========================================================================* * get_priv * *===========================================================================*/ -int get_priv(rc, priv_id) -register struct proc *rc; /* new (child) process pointer */ -int priv_id; /* privilege id */ +int get_priv( + register struct proc *rc, /* new (child) process pointer */ + int priv_id /* privilege id */ +) { /* Allocate a new privilege structure for a system process. Privilege ids * can be assigned either statically or dynamically. @@ -386,11 +387,10 @@ int send_sig(endpoint_t ep, int sig_nr) /*===========================================================================* * cause_sig * *===========================================================================*/ -void cause_sig(proc_nr, sig_nr) -proc_nr_t proc_nr; /* process to be signalled */ -int sig_nr; /* signal to be sent */ +void cause_sig(proc_nr_t proc_nr, int sig_nr) { -/* A system process wants to send a signal to a process. Examples are: +/* A system process wants to send signal 'sig_nr' to process 'proc_nr'. + * Examples are: * - HARDWARE wanting to cause a SIGSEGV after a CPU exception * - TTY wanting to cause SIGINT upon getting a DEL * - FS wanting to cause SIGPIPE for a broken pipe @@ -538,9 +538,9 @@ static void clear_ipc( /*===========================================================================* * clear_endpoint * *===========================================================================*/ -void clear_endpoint(rc) -register struct proc *rc; /* slot of process to clean up */ +void clear_endpoint(struct proc * rc) { +/* Clean up the slot of the process given as 'rc'. */ if(isemptyp(rc)) panic("clear_proc: empty process: %d", rc->p_endpoint); @@ -575,9 +575,10 @@ register struct proc *rc; /* slot of process to clean up */ /*===========================================================================* * clear_ipc_refs * *===========================================================================*/ -void clear_ipc_refs(rc, caller_ret) -register struct proc *rc; /* slot of process to clean up */ -int caller_ret; /* code to return on callers */ +void clear_ipc_refs( + register struct proc *rc, /* slot of process to clean up */ + int caller_ret /* code to return on callers */ +) { /* Clear IPC references for a given process slot. */ struct proc *rp; /* iterate over process table */ diff --git a/minix/kernel/system/do_irqctl.c b/minix/kernel/system/do_irqctl.c index 2c330b695..584b753df 100644 --- a/minix/kernel/system/do_irqctl.c +++ b/minix/kernel/system/do_irqctl.c @@ -141,8 +141,7 @@ int do_irqctl(struct proc * caller, message * m_ptr) /*===========================================================================* * generic_handler * *===========================================================================*/ -static int generic_handler(hook) -irq_hook_t *hook; +static int generic_handler(irq_hook_t * hook) { /* This function handles hardware interrupt in a simple and generic way. All * interrupts are transformed into messages to a driver. The IRQ line will be diff --git a/minix/kernel/system/do_safecopy.c b/minix/kernel/system/do_safecopy.c index ce3ef9630..626fb85fa 100644 --- a/minix/kernel/system/do_safecopy.c +++ b/minix/kernel/system/do_safecopy.c @@ -32,16 +32,17 @@ static int safecopy(struct proc *, endpoint_t, endpoint_t, /*===========================================================================* * verify_grant * *===========================================================================*/ -int verify_grant(granter, grantee, grant, bytes, access, - offset_in, offset_result, e_granter, flags) -endpoint_t granter, grantee; /* copyee, copyer */ -cp_grant_id_t grant; /* grant id */ -vir_bytes bytes; /* copy size */ -int access; /* direction (read/write) */ -vir_bytes offset_in; /* copy offset within grant */ -vir_bytes *offset_result; /* copy offset within virtual address space */ -endpoint_t *e_granter; /* new granter (magic grants) */ -u32_t *flags; /* CPF_* */ +int verify_grant( + endpoint_t granter, /* copyee */ + endpoint_t grantee, /* copyer */ + cp_grant_id_t grant, /* grant id */ + vir_bytes bytes, /* copy size */ + int access, /* direction (read/write) */ + vir_bytes offset_in, /* copy offset within grant */ + vir_bytes *offset_result, /* copy offset within virtual address space */ + endpoint_t *e_granter, /* new granter (magic grants) */ + u32_t *flags /* CPF_* */ +) { static cp_grant_t g; static int proc_nr; @@ -246,16 +247,18 @@ u32_t *flags; /* CPF_* */ /*===========================================================================* * safecopy * *===========================================================================*/ -static int safecopy(caller, granter, grantee, grantid, bytes, - g_offset, addr, access) -struct proc * caller; -endpoint_t granter, grantee; -cp_grant_id_t grantid; -size_t bytes; -vir_bytes g_offset, addr; -int access; /* CPF_READ for a copy from granter to grantee, CPF_WRITE +static int safecopy( + struct proc * caller, + endpoint_t granter, + endpoint_t grantee, + cp_grant_id_t grantid, + size_t bytes, + vir_bytes g_offset, + vir_bytes addr, + int access /* CPF_READ for a copy from granter to grantee, CPF_WRITE * for a copy from grantee to granter. */ +) { static struct vir_addr v_src, v_dst; static vir_bytes v_offset; diff --git a/minix/kernel/system/do_vtimer.c b/minix/kernel/system/do_vtimer.c index 47ec2b139..31881373f 100644 --- a/minix/kernel/system/do_vtimer.c +++ b/minix/kernel/system/do_vtimer.c @@ -78,8 +78,7 @@ int do_vtimer(struct proc * caller, message * m_ptr) /*===========================================================================* * vtimer_check * *===========================================================================*/ -void vtimer_check(rp) -struct proc *rp; /* pointer to the process */ +void vtimer_check(struct proc * rp) { /* This is called from the clock task, so we can be interrupted by the clock * interrupt, but not by the system task. Therefore we only have to protect diff --git a/minix/kernel/utility.c b/minix/kernel/utility.c index d5fdbdb02..9417e0c77 100644 --- a/minix/kernel/utility.c +++ b/minix/kernel/utility.c @@ -51,8 +51,9 @@ void panic(const char *fmt, ...) /*===========================================================================* * kputc * *===========================================================================*/ -void kputc(c) -int c; /* character to append */ +void kputc( + int c /* character to append */ +) { /* Accumulate a single character for a kernel message. Send a notification * to the output drivers if an END_OF_KMESS is encountered. @@ -83,8 +84,9 @@ int c; /* character to append */ /*===========================================================================* * _exit * *===========================================================================*/ -void _exit(e) -int e; /* error code */ +void _exit( + int e /* error code */ +) { panic("_exit called from within the kernel, should not happen. (err %i)", e); }