--- Gnu-Mach/kern/lock.c 2020/09/02 04:36:57 1.1 +++ Gnu-Mach/kern/lock.c 2020/09/02 04:47:29 1.1.1.3 @@ -34,14 +34,15 @@ * Locking primitives implementation */ -#include -#include +#include +#include #include #include #include #if MACH_KDB #include +#include #include #endif @@ -103,7 +104,7 @@ boolean_t simple_lock_try(simple_lock_t #endif /* NCPUS > 1 */ #if NCPUS > 1 -int lock_wait_time = 100; +static int lock_wait_time = 100; #else /* NCPUS > 1 */ /* @@ -111,7 +112,7 @@ int lock_wait_time = 100; * thought something magical would happen to the * want_write bit while we are executing. */ -int lock_wait_time = 0; +static int lock_wait_time = 0; #endif /* NCPUS > 1 */ #if MACH_SLOCKS && NCPUS == 1 @@ -161,8 +162,8 @@ void simple_lock( info = &simple_locks_info[simple_locks_taken++]; info->l = l; /* XXX we want our return address, if possible */ -#ifdef i386 - info->ra = *((unsigned int *)&l - 1); +#if defined(__i386__) + info->ra = *((unsigned long *)&l - 1); #endif /* i386 */ } @@ -179,8 +180,8 @@ boolean_t simple_lock_try( info = &simple_locks_info[simple_locks_taken++]; info->l = l; /* XXX we want our return address, if possible */ -#ifdef i386 - info->ra = *((unsigned int *)&l - 1); +#if defined(__i386__) + info->ra = *((unsigned long *)&l - 1); #endif /* i386 */ return TRUE; @@ -222,7 +223,7 @@ void lock_init( lock_t l, boolean_t can_sleep) { - bzero((char *)l, sizeof(lock_data_t)); + memset(l, 0, sizeof(lock_data_t)); simple_lock_init(&l->interlock); l->want_write = FALSE; l->want_upgrade = FALSE; @@ -249,9 +250,9 @@ void lock_sleepable( */ void lock_write( - register lock_t l) + lock_t l) { - register int i; + int i; check_simple_locks(); simple_lock(&l->interlock); @@ -307,7 +308,7 @@ void lock_write( } void lock_done( - register lock_t l) + lock_t l) { simple_lock(&l->interlock); @@ -339,9 +340,9 @@ void lock_done( } void lock_read( - register lock_t l) + lock_t l) { - register int i; + int i; check_simple_locks(); simple_lock(&l->interlock); @@ -386,9 +387,9 @@ void lock_read( * Returns TRUE if the upgrade *failed*. */ boolean_t lock_read_to_write( - register lock_t l) + lock_t l) { - register int i; + int i; check_simple_locks(); simple_lock(&l->interlock); @@ -442,7 +443,7 @@ boolean_t lock_read_to_write( } void lock_write_to_read( - register lock_t l) + lock_t l) { simple_lock(&l->interlock); @@ -473,7 +474,7 @@ void lock_write_to_read( */ boolean_t lock_try_write( - register lock_t l) + lock_t l) { simple_lock(&l->interlock); @@ -512,7 +513,7 @@ boolean_t lock_try_write( */ boolean_t lock_try_read( - register lock_t l) + lock_t l) { simple_lock(&l->interlock); @@ -546,7 +547,7 @@ boolean_t lock_try_read( * Returns FALSE if the upgrade *failed*. */ boolean_t lock_try_read_to_write( - register lock_t l) + lock_t l) { check_simple_locks(); simple_lock(&l->interlock); @@ -621,7 +622,7 @@ void db_show_all_slocks(void) info = &simple_locks_info[i]; db_printf("%d: ", i); db_printsym(info->l, DB_STGY_ANY); -#if i386 +#if defined(__i386__) db_printf(" locked by "); db_printsym(info->ra, DB_STGY_PROC); #endif