From ebf5d63bc6c53de37adbb111ca02af1bc11d5ddd Mon Sep 17 00:00:00 2001 From: Olaf Barthel Date: Sun, 3 Jul 2005 10:36:48 +0000 Subject: [PATCH] - Moved all the constructor code out of "stdlib_init_exit.c" and into the files which initialize global data, such as the new "stdlib_program_name.c" and "stdlib_malloc.c". - Until I can find a way to invoke it from within the library, the __machine_test() function is no longer invoked. - Tagged global data with NOCOMMON attributes. - Added the __lib_init() and __lib_exit() functions, which are part of the thread-safe library and which can be used to hook up clib2 with standard Amiga shared library/device code. Some documentation on how to use them can be found in the header file. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14999 87f5fb63-7c3d-0410-a384-fd976d0f7a62 --- library/GNUmakefile.68k | 11 +- library/GNUmakefile.os4 | 8 +- library/changes | 14 ++ library/dirent_closedir.c | 4 +- library/include/dos.h | 38 ++- library/locale_init_exit.c | 12 +- library/math_init_exit.c | 16 +- library/mount_convertinfo.c | 18 +- library/signal_raise.c | 6 +- library/smakefile | 8 +- library/socket_init_exit.c | 8 +- library/stat_umask.c | 4 +- library/stdio_file_init.c | 4 +- library/stdio_init_exit.c | 10 +- library/stdio_locksemaphorename.c | 4 +- library/stdio_nostdio.c | 4 +- library/stdlib_arg.c | 6 +- library/stdlib_default_pool_size.c | 4 +- library/stdlib_default_puddle_size.c | 4 +- library/stdlib_exit.c | 24 +- library/stdlib_headers.h | 7 +- library/stdlib_isresident.c | 8 +- library/stdlib_lib_main.c | 234 ++++++++++++++++++ library/stdlib_lib_startup.c | 44 ++++ library/stdlib_machine_test.c | 3 +- library/stdlib_main.c | 4 +- library/stdlib_malloc.c | 41 +-- ...dlib_init_exit.c => stdlib_program_name.c} | 16 +- library/stdlib_protos.h | 4 +- library/stdlib_rand.c | 4 +- library/stdlib_shell_escape.c | 10 +- library/stdlib_showerror.c | 15 +- library/stdlib_stackcheck.c | 4 +- library/stdlib_stackextension.c | 6 +- library/stdlib_stacksize.c | 8 +- library/stdlib_sysbase.c | 10 +- library/stdlib_utilitybase.c | 10 +- library/time_data.c | 10 +- library/unistd_chdir_exit.c | 8 +- library/unistd_currentpathname.c | 4 +- library/unistd_init_exit.c | 4 +- library/unistd_timer.c | 12 +- library/unistd_unix_path_semantics.c | 4 +- library/usergroup_data.c | 10 +- library/usergroup_init_exit.c | 6 +- library/usergroup_rootmode.c | 4 +- 46 files changed, 540 insertions(+), 157 deletions(-) create mode 100755 library/stdlib_lib_main.c create mode 100644 library/stdlib_lib_startup.c rename library/{stdlib_init_exit.c => stdlib_program_name.c} (92%) mode change 100644 => 100755 diff --git a/library/GNUmakefile.68k b/library/GNUmakefile.68k index 6415e1f..62642fd 100644 --- a/library/GNUmakefile.68k +++ b/library/GNUmakefile.68k @@ -1,5 +1,5 @@ # -# $Id: GNUmakefile.68k,v 1.64 2005-06-26 10:23:05 obarthel Exp $ +# $Id: GNUmakefile.68k,v 1.65 2005-07-03 10:36:46 obarthel Exp $ # # :ts=8 # @@ -306,12 +306,13 @@ C_LIB = \ stdlib_getenv.o \ stdlib_getsp.o \ stdlib_get_errno.o \ - stdlib_init_exit.o \ stdlib_isresident.o \ stdlib_labs.o \ stdlib_llabs.o \ stdlib_ldiv.o \ stdlib_lldiv.o \ + stdlib_lib_main.o \ + stdlib_lib_startup.o \ stdlib_machine_test.o \ stdlib_main.o \ stdlib_malloc.o \ @@ -326,6 +327,7 @@ C_LIB = \ stdlib_oslibversion.o \ stdlib_priority.o \ stdlib_process_name.o \ + stdlib_program_name.o \ stdlib_putenv.o \ stdlib_qsort.o \ stdlib_rand.o \ @@ -1035,8 +1037,6 @@ $(LIBC_OBJS)/stdlib_calloc.o : stdlib_calloc.c stdlib_memory.h $(LIBC_OBJS)/stdlib_free.o : stdlib_free.c stdlib_memory.h -$(LIBC_OBJS)/stdlib_init_exit.o : stdlib_init_exit.c stdlib_memory.h - $(LIBC_OBJS)/stdlib_malloc.o : stdlib_malloc.c stdlib_memory.h $(LIBC_OBJS)/stdlib_realloc.o : stdlib_realloc.c stdlib_memory.h @@ -1229,7 +1229,8 @@ CONSTRUCTOR_FILES = \ stdio_init_exit.c \ stdlib_alloca.c \ stdlib_arg.c \ - stdlib_init_exit.c \ + stdlib_malloc.c \ + stdlib_program_name.c \ stdlib_setenv.c \ stdlib_stackcheck.c \ stdlib_stackextension.c \ diff --git a/library/GNUmakefile.os4 b/library/GNUmakefile.os4 index ece012a..2cbc126 100644 --- a/library/GNUmakefile.os4 +++ b/library/GNUmakefile.os4 @@ -1,5 +1,5 @@ # -# $Id: GNUmakefile.os4,v 1.71 2005-06-26 11:46:21 obarthel Exp $ +# $Id: GNUmakefile.os4,v 1.72 2005-07-03 10:36:46 obarthel Exp $ # # :ts=8 # @@ -317,12 +317,13 @@ C_LIB = \ stdlib_getenv.o \ stdlib_getsp.o \ stdlib_get_errno.o \ - stdlib_init_exit.o \ stdlib_isresident.o \ stdlib_labs.o \ stdlib_llabs.o \ stdlib_ldiv.o \ stdlib_lldiv.o \ + stdlib_lib_main.o \ + stdlib_lib_startup.o \ stdlib_machine_test.o \ stdlib_main.o \ stdlib_malloc.o \ @@ -337,6 +338,7 @@ C_LIB = \ stdlib_oslibversion.o \ stdlib_priority.o \ stdlib_process_name.o \ + stdlib_program_name.o \ stdlib_putenv.o \ stdlib_qsort.o \ stdlib_rand.o \ @@ -1057,8 +1059,6 @@ $(LIBC_OBJS)/stdlib_calloc.o : stdlib_calloc.c stdlib_memory.h $(LIBC_OBJS)/stdlib_free.o : stdlib_free.c stdlib_memory.h -$(LIBC_OBJS)/stdlib_init_exit.o : stdlib_init_exit.c stdlib_memory.h - $(LIBC_OBJS)/stdlib_malloc.o : stdlib_malloc.c stdlib_memory.h $(LIBC_OBJS)/stdlib_realloc.o : stdlib_realloc.c stdlib_memory.h diff --git a/library/changes b/library/changes index ee086d0..42679d0 100644 --- a/library/changes +++ b/library/changes @@ -31,6 +31,20 @@ - Added file system names to statfx +- Moved all the constructor code out of "stdlib_init_exit.c" and into the + files which initialize global data, such as the new "stdlib_program_name.c" + and "stdlib_malloc.c". + +- Until I can find a way to invoke it from within the library, the + __machine_test() function is no longer invoked. + +- Tagged global data with NOCOMMON attributes. + +- Added the __lib_init() and __lib_exit() functions, which are part of the + thread-safe library and which can be used to hook up clib2 with standard + Amiga shared library/device code. Some documentation on how to use them + can be found in the header file. + c.lib 1.193 (4.6.2005) diff --git a/library/dirent_closedir.c b/library/dirent_closedir.c index 1287b21..2fc09f8 100644 --- a/library/dirent_closedir.c +++ b/library/dirent_closedir.c @@ -1,5 +1,5 @@ /* - * $Id: dirent_closedir.c,v 1.13 2005-04-24 08:46:37 obarthel Exp $ + * $Id: dirent_closedir.c,v 1.14 2005-07-03 10:36:46 obarthel Exp $ * * :ts=4 * @@ -54,7 +54,7 @@ /****************************************************************************/ /* Directories being scanned whose locks need to be freed when shutting down. */ -struct MinList __directory_list; +struct MinList NOCOMMON __directory_list; /****************************************************************************/ diff --git a/library/include/dos.h b/library/include/dos.h index 9035c8c..5660cc2 100644 --- a/library/include/dos.h +++ b/library/include/dos.h @@ -1,5 +1,5 @@ /* - * $Id: dos.h,v 1.9 2005-03-06 09:04:44 obarthel Exp $ + * $Id: dos.h,v 1.10 2005-07-03 10:36:48 obarthel Exp $ * * :ts=4 * @@ -52,6 +52,10 @@ extern "C" { /****************************************************************************/ +#ifndef EXEC_LIBRARIES_H +#include +#endif /* EXEC_LIBRARIES_H */ + #ifndef WORKBENCH_STARTUP_H #include #endif /* WORKBENCH_STARTUP_H */ @@ -328,6 +332,38 @@ extern int __translate_io_error_to_errno(LONG io_error); /****************************************************************************/ +/* + * Routines for use with shared libraries: invoke __lib_init() in your own + * shared library initialization function and __lib_exit() in your shared + * library cleanup function. + * + * __lib_init() will initialize the global SysBase/DOSBase variables + * (and the IExec/IDOS variables for OS4) and invoke the constructor + * functions required by your library code. It returns FALSE upon + * failure and TRUE otherwise. Make this the very first function you + * call in your shared library initialization function. The __lib_init() + * function expects to be called with a pointer to the exec.library + * base, which is normally passed to your shared library as part of the + * library startup code initialization performed by the operating + * system. + * + * __lib_exit() will undo all the initializations performed by the + * __lib_init() function, but leave the global SysBase variable + * (and the IExec variable for OS4) intact. Make this the very last + * function you call in your shared library cleanup function. + * + * Note that neither __lib_init() nor __lib_exit() are reentrant. You must + * make sure that while you are calling them no other library user can + * call them by accident. + * + * Both functions are only available as part of the thread-safe clib2 + * linker library. + */ +extern VOID __lib_exit(VOID); +extern BOOL __lib_init(struct Library * SysBase); + +/****************************************************************************/ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/library/locale_init_exit.c b/library/locale_init_exit.c index c39d033..c7b830e 100644 --- a/library/locale_init_exit.c +++ b/library/locale_init_exit.c @@ -1,5 +1,5 @@ /* - * $Id: locale_init_exit.c,v 1.13 2005-04-24 08:46:37 obarthel Exp $ + * $Id: locale_init_exit.c,v 1.14 2005-07-03 10:36:46 obarthel Exp $ * * :ts=4 * @@ -43,22 +43,22 @@ /****************************************************************************/ -struct Library * __LocaleBase; +struct Library * NOCOMMON __LocaleBase; /****************************************************************************/ #if defined(__amigaos4__) -struct LocaleIFace * __ILocale; +struct LocaleIFace * NOCOMMON __ILocale; #endif /* __amigaos4__ */ /****************************************************************************/ -struct Locale * __default_locale; -struct Locale * __locale_table[NUM_LOCALES]; +struct Locale * NOCOMMON __default_locale; +struct Locale * NOCOMMON __locale_table[NUM_LOCALES]; /****************************************************************************/ -char __locale_name_table[NUM_LOCALES][MAX_LOCALE_NAME_LEN]; +char NOCOMMON __locale_name_table[NUM_LOCALES][MAX_LOCALE_NAME_LEN]; /****************************************************************************/ diff --git a/library/math_init_exit.c b/library/math_init_exit.c index 656b8f3..2d8b8ec 100644 --- a/library/math_init_exit.c +++ b/library/math_init_exit.c @@ -1,5 +1,5 @@ /* - * $Id: math_init_exit.c,v 1.17 2005-05-29 10:09:54 obarthel Exp $ + * $Id: math_init_exit.c,v 1.18 2005-07-03 10:36:46 obarthel Exp $ * * :ts=4 * @@ -65,21 +65,21 @@ #if defined(IEEE_FLOATING_POINT_SUPPORT) -struct Library * MathIeeeSingBasBase; -struct Library * MathIeeeDoubBasBase; -struct Library * MathIeeeDoubTransBase; +struct Library * NOCOMMON MathIeeeSingBasBase; +struct Library * NOCOMMON MathIeeeDoubBasBase; +struct Library * NOCOMMON MathIeeeDoubTransBase; #endif /* IEEE_FLOATING_POINT_SUPPORT */ /****************************************************************************/ -float __infinity; -float __nan; +float NOCOMMON __infinity; +float NOCOMMON __nan; /****************************************************************************/ -float __huge_val_float; -double __huge_val; +float NOCOMMON __huge_val_float; +double NOCOMMON __huge_val; /****************************************************************************/ diff --git a/library/mount_convertinfo.c b/library/mount_convertinfo.c index ecc5a5b..aae7cc4 100644 --- a/library/mount_convertinfo.c +++ b/library/mount_convertinfo.c @@ -1,5 +1,5 @@ /* - * $Id: mount_convertinfo.c,v 1.4 2005-06-26 11:59:37 tfrieden Exp $ + * $Id: mount_convertinfo.c,v 1.5 2005-07-03 10:36:46 obarthel Exp $ * * :ts=4 * @@ -90,50 +90,62 @@ __convert_info_to_statfs(struct InfoData * id,struct statfs * f) if(id->id_DiskState != ID_VALIDATED) SET_FLAG(f->f_flags,MNT_RDONLY); - switch (id->id_DiskType) { case ID_NO_DISK_PRESENT: strcpy(f->f_fstypename, "None"); break; + case ID_UNREADABLE_DISK: strcpy(f->f_fstypename, "NDOS"); break; + case ID_BUSY_DISK: strcpy(f->f_fstypename, "Busy"); break; + case ID_DOS_DISK: strcpy(f->f_fstypename, "DOS\\0"); break; + case ID_FFS_DISK: strcpy(f->f_fstypename, "DOS\\1"); break; + case ID_INTER_DOS_DISK: strcpy(f->f_fstypename, "DOS\\2"); break; + case ID_INTER_FFS_DISK: strcpy(f->f_fstypename, "DOS\\3"); break; + case ID_FASTDIR_DOS_DISK: strcpy(f->f_fstypename, "DOS\\4"); break; + case ID_FASTDIR_FFS_DISK: strcpy(f->f_fstypename, "DOS\\5"); break; + case ID_LONGNAME_DOS_DISK: strcpy(f->f_fstypename, "DOS\\6"); break; + case ID_LONGNAME_FFS_DISK: strcpy(f->f_fstypename, "DOS\\7"); break; + case 0x53465300: strcpy(f->f_fstypename, "SFS\\0"); break; + case ID_NOT_REALLY_DOS: strcpy(f->f_fstypename, "NDOS"); break; + default: - strcpy(f->f_fstypename, "Unkown"); + strcpy(f->f_fstypename, "Unknown"); break; } diff --git a/library/signal_raise.c b/library/signal_raise.c index 23716a6..e43214f 100644 --- a/library/signal_raise.c +++ b/library/signal_raise.c @@ -1,5 +1,5 @@ /* - * $Id: signal_raise.c,v 1.8 2005-04-24 08:46:37 obarthel Exp $ + * $Id: signal_raise.c,v 1.9 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -38,7 +38,7 @@ /****************************************************************************/ /* This table holds pointers to all signal handlers configured at a time. */ -signal_handler_t __signal_handler_table[NUM_SIGNALS] = +signal_handler_t NOCOMMON __signal_handler_table[NUM_SIGNALS] = { SIG_DFL, /* SIGABRT */ SIG_DFL, /* SIGFPE */ @@ -53,7 +53,7 @@ signal_handler_t __signal_handler_table[NUM_SIGNALS] = /* This holds a mask of all signals whose delivery is currently blocked. The sigaddset(), sigblock(), sigprocmask() and sigsetmask() functions modify or query it. */ -int __signals_blocked; +int NOCOMMON __signals_blocked; /****************************************************************************/ diff --git a/library/smakefile b/library/smakefile index 945e43b..70ed86d 100644 --- a/library/smakefile +++ b/library/smakefile @@ -1,5 +1,5 @@ # -# $Id: smakefile,v 1.47 2005-06-18 07:23:16 obarthel Exp $ +# $Id: smakefile,v 1.48 2005-07-03 10:36:47 obarthel Exp $ # # :ts=8 # @@ -478,10 +478,11 @@ STDLIB_OBJ = \ stdlib_getdefstacksize.o \ stdlib_getenv.o \ stdlib_getsp.o \ - stdlib_init_exit.o \ stdlib_isresident.o \ stdlib_labs.o \ stdlib_ldiv.o \ + stdlib_lib_main.o \ + stdlib_lib_startup.o \ stdlib_main.o \ stdlib_malloc.o \ stdlib_machine_test.o \ @@ -493,6 +494,7 @@ STDLIB_OBJ = \ stdlib_oslibversion.o \ stdlib_priority.o \ stdlib_process_name.o \ + stdlib_program_name.o \ stdlib_putenv.o \ stdlib_qsort.o \ stdlib_rand.o \ @@ -753,8 +755,6 @@ stdlib_calloc.o : stdlib_calloc.c stdlib_memory.h stdlib_free.o : stdlib_free.c stdlib_memory.h -stdlib_init_exit.o : stdlib_init_exit.c stdlib_memory.h - stdlib_malloc.o : stdlib_malloc.c stdlib_memory.h stdlib_realloc.o : stdlib_realloc.c stdlib_memory.h diff --git a/library/socket_init_exit.c b/library/socket_init_exit.c index 0fb9bf5..28aa4bb 100644 --- a/library/socket_init_exit.c +++ b/library/socket_init_exit.c @@ -1,5 +1,5 @@ /* - * $Id: socket_init_exit.c,v 1.19 2005-03-18 12:38:23 obarthel Exp $ + * $Id: socket_init_exit.c,v 1.20 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -80,17 +80,17 @@ struct DaemonMessage /****************************************************************************/ -struct Library * __SocketBase; +struct Library * NOCOMMON __SocketBase; /****************************************************************************/ #if defined(__amigaos4__) -struct SocketIFace *__ISocket; +struct SocketIFace * NOCOMMON __ISocket; #endif /* __amigaos4__ */ /****************************************************************************/ -int h_errno; +int NOCOMMON h_errno; /****************************************************************************/ diff --git a/library/stat_umask.c b/library/stat_umask.c index 045e462..6a69a0e 100644 --- a/library/stat_umask.c +++ b/library/stat_umask.c @@ -1,5 +1,5 @@ /* - * $Id: stat_umask.c,v 1.5 2005-04-24 14:04:36 obarthel Exp $ + * $Id: stat_umask.c,v 1.6 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -41,7 +41,7 @@ /****************************************************************************/ -mode_t __current_umask = S_IWGRP | S_IWOTH; +mode_t NOCOMMON __current_umask = S_IWGRP | S_IWOTH; /****************************************************************************/ diff --git a/library/stdio_file_init.c b/library/stdio_file_init.c index 482e09a..dd62cae 100644 --- a/library/stdio_file_init.c +++ b/library/stdio_file_init.c @@ -1,5 +1,5 @@ /* - * $Id: stdio_file_init.c,v 1.9 2005-04-24 08:46:37 obarthel Exp $ + * $Id: stdio_file_init.c,v 1.10 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -72,7 +72,7 @@ static BPTR input; /****************************************************************************/ -struct WBStartup * __WBenchMsg; +struct WBStartup * NOCOMMON __WBenchMsg; /****************************************************************************/ diff --git a/library/stdio_init_exit.c b/library/stdio_init_exit.c index 687c642..bfcad18 100644 --- a/library/stdio_init_exit.c +++ b/library/stdio_init_exit.c @@ -1,5 +1,5 @@ /* - * $Id: stdio_init_exit.c,v 1.31 2005-03-27 10:02:50 obarthel Exp $ + * $Id: stdio_init_exit.c,v 1.32 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -54,14 +54,14 @@ /****************************************************************************/ /* The file handle table. */ -struct iob ** __iob; -int __num_iob; +struct iob ** NOCOMMON __iob; +int NOCOMMON __num_iob; /****************************************************************************/ /* The file descriptor table. */ -struct fd ** __fd; -int __num_fd; +struct fd ** NOCOMMON __fd; +int NOCOMMON __num_fd; /****************************************************************************/ diff --git a/library/stdio_locksemaphorename.c b/library/stdio_locksemaphorename.c index be8568a..847be69 100644 --- a/library/stdio_locksemaphorename.c +++ b/library/stdio_locksemaphorename.c @@ -1,5 +1,5 @@ /* - * $Id: stdio_locksemaphorename.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ + * $Id: stdio_locksemaphorename.c,v 1.3 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -37,4 +37,4 @@ /****************************************************************************/ -char * __file_lock_semaphore_name = "Advisory File Locking"; +char * NOCOMMON __file_lock_semaphore_name = "Advisory File Locking"; diff --git a/library/stdio_nostdio.c b/library/stdio_nostdio.c index 8a2a168..8ce10d0 100644 --- a/library/stdio_nostdio.c +++ b/library/stdio_nostdio.c @@ -1,5 +1,5 @@ /* - * $Id: stdio_nostdio.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ + * $Id: stdio_nostdio.c,v 1.3 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -37,4 +37,4 @@ /****************************************************************************/ -BOOL __no_standard_io; +BOOL NOCOMMON __no_standard_io; diff --git a/library/stdlib_arg.c b/library/stdlib_arg.c index ca72c17..fdd58e8 100644 --- a/library/stdlib_arg.c +++ b/library/stdlib_arg.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_arg.c,v 1.7 2005-06-26 10:23:05 obarthel Exp $ + * $Id: stdlib_arg.c,v 1.8 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -65,8 +65,8 @@ /****************************************************************************/ -char ** __argv; -int __argc; +char ** NOCOMMON __argv; +int NOCOMMON __argc; /****************************************************************************/ diff --git a/library/stdlib_default_pool_size.c b/library/stdlib_default_pool_size.c index e62ea77..7893cf9 100644 --- a/library/stdlib_default_pool_size.c +++ b/library/stdlib_default_pool_size.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_default_pool_size.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ + * $Id: stdlib_default_pool_size.c,v 1.3 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -37,4 +37,4 @@ /****************************************************************************/ -int __default_pool_size = 4096; +int NOCOMMON __default_pool_size = 4096; diff --git a/library/stdlib_default_puddle_size.c b/library/stdlib_default_puddle_size.c index b14a48a..f05d4a3 100644 --- a/library/stdlib_default_puddle_size.c +++ b/library/stdlib_default_puddle_size.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_default_puddle_size.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ + * $Id: stdlib_default_puddle_size.c,v 1.3 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -37,4 +37,4 @@ /****************************************************************************/ -int __default_puddle_size = 4096; +int NOCOMMON __default_puddle_size = 4096; diff --git a/library/stdlib_exit.c b/library/stdlib_exit.c index 28ac51a..b0dd521 100644 --- a/library/stdlib_exit.c +++ b/library/stdlib_exit.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_exit.c,v 1.4 2005-03-19 10:15:56 obarthel Exp $ + * $Id: stdlib_exit.c,v 1.5 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -37,17 +37,21 @@ /****************************************************************************/ -jmp_buf __exit_jmp_buf; -int __exit_value = RETURN_FAIL; +jmp_buf NOCOMMON __exit_jmp_buf; +int NOCOMMON __exit_value = RETURN_FAIL; +BOOL NOCOMMON __exit_blocked; /****************************************************************************/ void _exit(int return_code) { - __exit_value = return_code; + if(NOT __exit_blocked) + { + __exit_value = return_code; - longjmp(__exit_jmp_buf,1); + longjmp(__exit_jmp_buf,1); + } } /****************************************************************************/ @@ -56,7 +60,8 @@ _exit(int return_code) void _Exit(int return_code) { - _exit(return_code); + if(NOT __exit_blocked) + _exit(return_code); } /****************************************************************************/ @@ -64,7 +69,10 @@ _Exit(int return_code) void exit(int return_code) { - __exit_trap_trigger(); + if(NOT __exit_blocked) + { + __exit_trap_trigger(); - _exit(return_code); + _exit(return_code); + } } diff --git a/library/stdlib_headers.h b/library/stdlib_headers.h index 8897974..17e5c97 100644 --- a/library/stdlib_headers.h +++ b/library/stdlib_headers.h @@ -1,5 +1,5 @@ /* - * $Id: stdlib_headers.h,v 1.17 2005-03-30 19:37:27 obarthel Exp $ + * $Id: stdlib_headers.h,v 1.18 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -150,6 +150,7 @@ extern unsigned int NOCOMMON __random_seed; extern jmp_buf NOCOMMON __exit_jmp_buf; extern int NOCOMMON __exit_value; +extern BOOL NOCOMMON __exit_blocked; /****************************************************************************/ @@ -188,6 +189,10 @@ extern int NOCOMMON __argc; /****************************************************************************/ +extern BOOL NOCOMMON __lib_startup; + +/****************************************************************************/ + #ifndef _STDLIB_PROTOS_H #include "stdlib_protos.h" #endif /* _STDLIB_PROTOS_H */ diff --git a/library/stdlib_isresident.c b/library/stdlib_isresident.c index 2468369..2373238 100644 --- a/library/stdlib_isresident.c +++ b/library/stdlib_isresident.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_isresident.c,v 1.3 2005-03-18 12:38:24 obarthel Exp $ + * $Id: stdlib_isresident.c,v 1.4 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -37,4 +37,8 @@ /****************************************************************************/ -BOOL __is_resident; +#include "macros.h" + +/****************************************************************************/ + +BOOL NOCOMMON __is_resident; diff --git a/library/stdlib_lib_main.c b/library/stdlib_lib_main.c new file mode 100755 index 0000000..5d6a3dc --- /dev/null +++ b/library/stdlib_lib_main.c @@ -0,0 +1,234 @@ +/* + * $Id: stdlib_lib_main.c,v 1.1 2005-07-03 10:36:47 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2005 by Olaf Barthel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Neither the name of Olaf Barthel nor the names of contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#if defined(__THREAD_SAFE) + +/****************************************************************************/ + +#ifndef EXEC_EXECBASE_H +#include +#endif /* EXEC_EXECBASE_H */ + +/****************************************************************************/ + +#include +#include +#include +#include +#include + +/****************************************************************************/ + +#ifndef _STDLIB_HEADERS_H +#include "stdlib_headers.h" +#endif /* _STDLIB_HEADERS_H */ + +#ifndef _STDIO_HEADERS_H +#include "stdio_headers.h" +#endif /* _STDIO_HEADERS_H */ + +/****************************************************************************/ + +STATIC BOOL lib_init_successful; + +/****************************************************************************/ + +STATIC BOOL +open_libraries(struct Library * sys_base) +{ + BOOL success = FALSE; + int os_version; + + SysBase = sys_base; + + #if defined(__amigaos4__) + { + /* Get exec interface */ + IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; + } + #endif /* __amigaos4__ */ + + /* Check which minimum operating system version we actually require. */ + os_version = 37; + if(__minimum_os_lib_version > 37) + os_version = __minimum_os_lib_version; + + /* Open the minimum required libraries. */ + DOSBase = (struct Library *)OpenLibrary("dos.library",os_version); + if(DOSBase == NULL) + goto out; + + __UtilityBase = OpenLibrary("utility.library",os_version); + if(__UtilityBase == NULL) + goto out; + + #if defined(__amigaos4__) + { + /* Obtain the interfaces for these libraries. */ + IDOS = (struct DOSIFace *)GetInterface(DOSBase, "main", 1, 0); + if(IDOS == NULL) + goto out; + + __IUtility = (struct UtilityIFace *)GetInterface(__UtilityBase, "main", 1, 0); + if(__IUtility == NULL) + goto out; + } + #endif /* __amigaos4__ */ + + success = TRUE; + + out: + + return(success); +} + +/****************************************************************************/ + +STATIC VOID +close_libraries(VOID) +{ + #if defined(__amigaos4__) + { + if(__IUtility != NULL) + { + DropInterface((struct Interface *)__IUtility); + __IUtility = NULL; + } + + if(IDOS != NULL) + { + DropInterface((struct Interface *)IDOS); + IDOS = NULL; + } + } + #endif /* __amigaos4__ */ + + if(__UtilityBase != NULL) + { + CloseLibrary(__UtilityBase); + __UtilityBase = NULL; + } + + if(DOSBase != NULL) + { + CloseLibrary(DOSBase); + DOSBase = NULL; + } +} + +/****************************************************************************/ + +VOID +__lib_exit(VOID) +{ + ENTER(); + + if(lib_init_successful) + { + /* Enable exit() again. */ + __exit_blocked = FALSE; + + /* If one of the destructors drops into exit(), either directly + or through a failed assert() call, processing will resume with + the next following destructor. */ + (void)setjmp(__exit_jmp_buf); + + /* Go through the destructor list */ + _fini(); + + close_libraries(); + + lib_init_successful = FALSE; + } + + LEAVE(); +} + +/****************************************************************************/ + +BOOL +__lib_init(struct Library * sys_base) +{ + int result = FALSE; + + ENTER(); + + /* Make sure that no requesters and such pop up if anything + goes wrong during initialization. */ + __lib_startup = TRUE; + + /* Open dos.library and utility.library. */ + if(CANNOT open_libraries(sys_base)) + goto out; + + /* This plants the return buffer for _exit(). */ + if(setjmp(__exit_jmp_buf) != 0) + { + SHOWMSG("invoking the destructors"); + + /* If one of the destructors drops into exit(), either directly + or through a failed assert() call, processing will resume with + the next following destructor. */ + (void)setjmp(__exit_jmp_buf); + + /* Go through the destructor list */ + _fini(); + + goto out; + } + + SHOWMSG("now invoking the constructors"); + + /* Go through the constructor list */ + _init(); + + /* Disable exit() and its kin. */ + __exit_blocked = TRUE; + + /* Remember this so that __lib_exit() will know what to do. */ + lib_init_successful = TRUE; + + result = TRUE; + + out: + + if(NOT lib_init_successful) + close_libraries(); + + RETURN(result); + return(result); +} + +/****************************************************************************/ + +#endif /* __THREAD_SAFE */ diff --git a/library/stdlib_lib_startup.c b/library/stdlib_lib_startup.c new file mode 100644 index 0000000..f5fdf65 --- /dev/null +++ b/library/stdlib_lib_startup.c @@ -0,0 +1,44 @@ +/* + * $Id: stdlib_lib_startup.c,v 1.1 2005-07-03 10:36:47 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2005 by Olaf Barthel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Neither the name of Olaf Barthel nor the names of contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef EXEC_TYPES_H +#include +#endif /* EXEC_TYPES_H */ + +/****************************************************************************/ + +#include "macros.h" + +/****************************************************************************/ + +BOOL NOCOMMON __lib_startup; diff --git a/library/stdlib_machine_test.c b/library/stdlib_machine_test.c index 3f6f19b..9796ddb 100644 --- a/library/stdlib_machine_test.c +++ b/library/stdlib_machine_test.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_machine_test.c,v 1.6 2005-03-20 17:14:58 obarthel Exp $ + * $Id: stdlib_machine_test.c,v 1.7 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -43,6 +43,7 @@ /****************************************************************************/ +/* ZZZ this function should be called somewhere, but where from? */ int __machine_test(void) { diff --git a/library/stdlib_main.c b/library/stdlib_main.c index 70a1f76..9d3ac88 100644 --- a/library/stdlib_main.c +++ b/library/stdlib_main.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_main.c,v 1.24 2005-04-24 14:04:36 obarthel Exp $ + * $Id: stdlib_main.c,v 1.25 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -66,7 +66,7 @@ extern int main(int arg_c,char ** arg_v); /****************************************************************************/ /* This will be set to TRUE in case a stack overflow was detected. */ -BOOL __stack_overflow; +BOOL NOCOMMON __stack_overflow; /****************************************************************************/ diff --git a/library/stdlib_malloc.c b/library/stdlib_malloc.c index cc51791..9b4f39d 100644 --- a/library/stdlib_malloc.c +++ b/library/stdlib_malloc.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_malloc.c,v 1.12 2005-03-18 12:38:24 obarthel Exp $ + * $Id: stdlib_malloc.c,v 1.13 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -43,6 +43,12 @@ /****************************************************************************/ +#ifndef _STDLIB_CONSTRUCTOR_H +#include "stdlib_constructor.h" +#endif /* _STDLIB_CONSTRUCTOR_H */ + +/****************************************************************************/ + #undef malloc #undef __malloc @@ -50,21 +56,21 @@ #ifdef __MEM_DEBUG -unsigned long __maximum_memory_allocated; -unsigned long __current_memory_allocated; -unsigned long __maximum_num_memory_chunks_allocated; -unsigned long __current_num_memory_chunks_allocated; +unsigned long NOCOMMON __maximum_memory_allocated; +unsigned long NOCOMMON __current_memory_allocated; +unsigned long NOCOMMON __maximum_num_memory_chunks_allocated; +unsigned long NOCOMMON __current_num_memory_chunks_allocated; #if defined(__USE_MEM_TREES) -struct MemoryTree __memory_tree; +struct MemoryTree NOCOMMON __memory_tree; #endif /* __USE_MEM_TREES */ #endif /* __MEM_DEBUG */ /****************************************************************************/ -APTR __memory_pool; -struct MinList __memory_list; +APTR NOCOMMON __memory_pool; +struct MinList NOCOMMON __memory_list; /****************************************************************************/ @@ -296,8 +302,7 @@ __memory_unlock(void) /****************************************************************************/ -void -__memory_exit(void) +STDLIB_DESTRUCTOR(stdlib_memory_exit) { ENTER(); @@ -368,10 +373,9 @@ __memory_exit(void) /****************************************************************************/ -int -__memory_init(void) +STDLIB_CONSTRUCTOR(stdlib_memory_init) { - int result = ERROR; + BOOL success = FALSE; ENTER(); @@ -402,10 +406,15 @@ __memory_init(void) } #endif /* __amigaos4__ */ - result = OK; + success = TRUE; out: - RETURN(result); - return(result); + SHOWVALUE(success); + LEAVE(); + + if(success) + CONSTRUCTOR_SUCCEED(); + else + CONSTRUCTOR_FAIL(); } diff --git a/library/stdlib_init_exit.c b/library/stdlib_program_name.c old mode 100644 new mode 100755 similarity index 92% rename from library/stdlib_init_exit.c rename to library/stdlib_program_name.c index 4aa62da..7871e47 --- a/library/stdlib_init_exit.c +++ b/library/stdlib_program_name.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_init_exit.c,v 1.11 2005-03-18 12:38:24 obarthel Exp $ + * $Id: stdlib_program_name.c,v 1.1 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -53,16 +53,14 @@ static BOOL free_program_name; /****************************************************************************/ -char * __program_name; +char * NOCOMMON __program_name; /****************************************************************************/ -STDLIB_DESTRUCTOR(stdlib_exit) +STDLIB_DESTRUCTOR(stdlib_program_name_exit) { ENTER(); - __memory_exit(); - if(free_program_name && __program_name != NULL) { FreeVec(__program_name); @@ -74,15 +72,12 @@ STDLIB_DESTRUCTOR(stdlib_exit) /****************************************************************************/ -STDLIB_CONSTRUCTOR(stdlib_init) +STDLIB_CONSTRUCTOR(stdlib_program_name_init) { BOOL success = FALSE; ENTER(); - if(__machine_test() < 0) - goto out; - if(__WBenchMsg == NULL) { const size_t program_name_size = 256; @@ -102,9 +97,6 @@ STDLIB_CONSTRUCTOR(stdlib_init) __program_name = (char *)__WBenchMsg->sm_ArgList[0].wa_Name; } - if(__memory_init() < 0) - goto out; - success = TRUE; out: diff --git a/library/stdlib_protos.h b/library/stdlib_protos.h index 46b57e0..5f5815c 100644 --- a/library/stdlib_protos.h +++ b/library/stdlib_protos.h @@ -1,5 +1,5 @@ /* - * $Id: stdlib_protos.h,v 1.14 2005-03-20 11:18:06 obarthel Exp $ + * $Id: stdlib_protos.h,v 1.15 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -134,8 +134,6 @@ extern int __arg_init(void); /****************************************************************************/ /* stdlib_malloc.c */ -extern int __memory_init(void); -extern void __memory_exit(void); extern size_t __get_allocation_size(size_t size); extern void * __allocate_memory(size_t size,BOOL never_free,const char * file,int line); diff --git a/library/stdlib_rand.c b/library/stdlib_rand.c index 86dc0a6..75f05a0 100644 --- a/library/stdlib_rand.c +++ b/library/stdlib_rand.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_rand.c,v 1.4 2005-02-27 18:09:11 obarthel Exp $ + * $Id: stdlib_rand.c,v 1.5 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -37,7 +37,7 @@ /****************************************************************************/ -unsigned int __random_seed = 1; +unsigned int NOCOMMON __random_seed = 1; /****************************************************************************/ diff --git a/library/stdlib_shell_escape.c b/library/stdlib_shell_escape.c index a83f3ed..a7228d6 100644 --- a/library/stdlib_shell_escape.c +++ b/library/stdlib_shell_escape.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_shell_escape.c,v 1.3 2005-03-18 12:38:25 obarthel Exp $ + * $Id: stdlib_shell_escape.c,v 1.4 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -43,12 +43,16 @@ /****************************************************************************/ +#include "macros.h" + +/****************************************************************************/ + /* Quick "hack" to help GCC compile itself */ #if defined(GCC_HELP_SUPPORT) /******************************************************************************/ -UBYTE __shell_escape_character = '\\'; +UBYTE NOCOMMON __shell_escape_character = '\\'; /******************************************************************************/ @@ -56,7 +60,7 @@ UBYTE __shell_escape_character = '\\'; /******************************************************************************/ -UBYTE __shell_escape_character = '*'; +UBYTE NOCOMMON __shell_escape_character = '*'; /******************************************************************************/ diff --git a/library/stdlib_showerror.c b/library/stdlib_showerror.c index 0a4c339..de24c8e 100644 --- a/library/stdlib_showerror.c +++ b/library/stdlib_showerror.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_showerror.c,v 1.11 2005-03-18 12:38:25 obarthel Exp $ + * $Id: stdlib_showerror.c,v 1.12 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -135,11 +135,20 @@ __show_error(const char * message) struct DOSIFace * IDOS = NULL; #endif /* __amigaos4__ */ - struct Library * IntuitionBase; - struct Library * DOSBase; + struct Library * IntuitionBase = NULL; + struct Library * DOSBase = NULL; PROFILE_OFF(); + /* Don't show anything if this is the thread-safe library and + we were invoked indirectly by shared library startup code. */ + #if defined(__THREAD_SAFE) + { + if(__lib_startup) + goto out; + } + #endif /* __THREAD_SAFE */ + DOSBase = OpenLibrary("dos.library",0); IntuitionBase = OpenLibrary("intuition.library",0); diff --git a/library/stdlib_stackcheck.c b/library/stdlib_stackcheck.c index 47320ea..04f12b9 100644 --- a/library/stdlib_stackcheck.c +++ b/library/stdlib_stackcheck.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_stackcheck.c,v 1.8 2005-03-18 12:38:25 obarthel Exp $ + * $Id: stdlib_stackcheck.c,v 1.9 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -105,7 +105,7 @@ overflow: \n\ /****************************************************************************/ -UBYTE * __stk_limit; +UBYTE * NOCOMMON __stk_limit; /****************************************************************************/ diff --git a/library/stdlib_stackextension.c b/library/stdlib_stackextension.c index 05cd4a6..617cf42 100644 --- a/library/stdlib_stackextension.c +++ b/library/stdlib_stackextension.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_stackextension.c,v 1.11 2005-03-18 12:38:25 obarthel Exp $ + * $Id: stdlib_stackextension.c,v 1.12 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -77,8 +77,8 @@ static struct stackframe * __stk_spare; /* spare stackframes */ /****************************************************************************/ -ULONG __stk_extensions; /* number of stack extensions performed */ -ULONG __stk_maxsize; /* maximum amount of memory allocated for stack extension */ +ULONG NOCOMMON __stk_extensions; /* number of stack extensions performed */ +ULONG NOCOMMON __stk_maxsize; /* maximum amount of memory allocated for stack extension */ /****************************************************************************/ diff --git a/library/stdlib_stacksize.c b/library/stdlib_stacksize.c index 6d641b0..e0b09e9 100644 --- a/library/stdlib_stacksize.c +++ b/library/stdlib_stacksize.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_stacksize.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ + * $Id: stdlib_stacksize.c,v 1.4 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -37,6 +37,10 @@ /****************************************************************************/ +#include "macros.h" + +/****************************************************************************/ + /* Quick "hack" to help GCC compile itself */ #if defined(GCC_HELP_SUPPORT) @@ -73,7 +77,7 @@ unsigned int __stack_size = 200000; /******************************************************************************/ -unsigned int __stack_size; +unsigned int NOCOMMON __stack_size; /******************************************************************************/ diff --git a/library/stdlib_sysbase.c b/library/stdlib_sysbase.c index 7daebd4..fd89b1b 100644 --- a/library/stdlib_sysbase.c +++ b/library/stdlib_sysbase.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_sysbase.c,v 1.3 2005-03-18 12:38:25 obarthel Exp $ + * $Id: stdlib_sysbase.c,v 1.4 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -39,12 +39,16 @@ /****************************************************************************/ -struct ExecBase * SysBase; +#include "macros.h" + +/****************************************************************************/ + +struct ExecBase * NOCOMMON SysBase; /****************************************************************************/ #if defined(__amigaos4__) -struct ExecIFace * IExec; +struct ExecIFace * NOCOMMON IExec; #endif /* __amigaos4__ */ diff --git a/library/stdlib_utilitybase.c b/library/stdlib_utilitybase.c index 3dcd3fa..8bd048a 100644 --- a/library/stdlib_utilitybase.c +++ b/library/stdlib_utilitybase.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_utilitybase.c,v 1.1 2005-03-30 19:37:47 obarthel Exp $ + * $Id: stdlib_utilitybase.c,v 1.2 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -39,12 +39,16 @@ /****************************************************************************/ -struct Library * __UtilityBase; +#include "macros.h" + +/****************************************************************************/ + +struct Library * NOCOMMON __UtilityBase; /****************************************************************************/ #if defined(__amigaos4__) -struct UtilityIFace * __IUtility; +struct UtilityIFace * NOCOMMON __IUtility; #endif /* __amigaos4__ */ diff --git a/library/time_data.c b/library/time_data.c index 2c3f9db..46da1e2 100644 --- a/library/time_data.c +++ b/library/time_data.c @@ -1,5 +1,5 @@ /* - * $Id: time_data.c,v 1.3 2005-01-02 09:07:19 obarthel Exp $ + * $Id: time_data.c,v 1.4 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -37,7 +37,7 @@ /****************************************************************************/ -const char * const __abbreviated_week_day_names[7] = +const char * const NOCOMMON __abbreviated_week_day_names[7] = { "Sun", "Mon", @@ -48,7 +48,7 @@ const char * const __abbreviated_week_day_names[7] = "Sat" }; -const char * const __week_day_names[7] = +const char * const NOCOMMON __week_day_names[7] = { "Sunday", "Monday", @@ -59,7 +59,7 @@ const char * const __week_day_names[7] = "Saturday" }; -const char * const __abbreviated_month_names[12] = +const char * const NOCOMMON __abbreviated_month_names[12] = { "Jan", "Feb", @@ -75,7 +75,7 @@ const char * const __abbreviated_month_names[12] = "Dec" }; -const char * const __month_names[12] = +const char * const NOCOMMON __month_names[12] = { "January", "February", diff --git a/library/unistd_chdir_exit.c b/library/unistd_chdir_exit.c index 6b06faf..f6b3553 100644 --- a/library/unistd_chdir_exit.c +++ b/library/unistd_chdir_exit.c @@ -1,5 +1,5 @@ /* - * $Id: unistd_chdir_exit.c,v 1.5 2005-03-18 12:38:25 obarthel Exp $ + * $Id: unistd_chdir_exit.c,v 1.6 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -49,9 +49,9 @@ /* If the program's current directory was changed, here is where we find out about it. */ -BPTR __original_current_directory; -BOOL __current_directory_changed; -BOOL __unlock_current_directory; +BPTR NOCOMMON __original_current_directory; +BOOL NOCOMMON __current_directory_changed; +BOOL NOCOMMON __unlock_current_directory; /****************************************************************************/ diff --git a/library/unistd_currentpathname.c b/library/unistd_currentpathname.c index e440e06..fafd4fc 100644 --- a/library/unistd_currentpathname.c +++ b/library/unistd_currentpathname.c @@ -1,5 +1,5 @@ /* - * $Id: unistd_currentpathname.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ + * $Id: unistd_currentpathname.c,v 1.3 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -37,4 +37,4 @@ /****************************************************************************/ -char __current_path_name[MAXPATHLEN]; +char NOCOMMON __current_path_name[MAXPATHLEN]; diff --git a/library/unistd_init_exit.c b/library/unistd_init_exit.c index 6083a90..648d027 100644 --- a/library/unistd_init_exit.c +++ b/library/unistd_init_exit.c @@ -1,5 +1,5 @@ /* - * $Id: unistd_init_exit.c,v 1.11 2005-03-18 12:38:25 obarthel Exp $ + * $Id: unistd_init_exit.c,v 1.12 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -44,7 +44,7 @@ /****************************************************************************/ /* Names of files and directories to delete when shutting down. */ -struct MinList __unlink_list; +struct MinList NOCOMMON __unlink_list; /****************************************************************************/ diff --git a/library/unistd_timer.c b/library/unistd_timer.c index 2269ade..b8cf62e 100644 --- a/library/unistd_timer.c +++ b/library/unistd_timer.c @@ -1,5 +1,5 @@ /* - * $Id: unistd_timer.c,v 1.7 2005-03-18 12:38:25 obarthel Exp $ + * $Id: unistd_timer.c,v 1.8 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -52,15 +52,15 @@ /****************************************************************************/ /* Local timer I/O. */ -struct MsgPort * __timer_port; -struct timerequest * __timer_request; -BOOL __timer_busy; -struct Library * __TimerBase; +struct MsgPort * NOCOMMON __timer_port; +struct timerequest * NOCOMMON __timer_request; +BOOL NOCOMMON __timer_busy; +struct Library * NOCOMMON __TimerBase; /****************************************************************************/ #if defined(__amigaos4__) -struct TimerIFace * __ITimer; +struct TimerIFace * NOCOMMON __ITimer; #endif /* __amigaos4__ */ /****************************************************************************/ diff --git a/library/unistd_unix_path_semantics.c b/library/unistd_unix_path_semantics.c index c53ab22..d721811 100644 --- a/library/unistd_unix_path_semantics.c +++ b/library/unistd_unix_path_semantics.c @@ -1,5 +1,5 @@ /* - * $Id: unistd_unix_path_semantics.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ + * $Id: unistd_unix_path_semantics.c,v 1.3 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -37,4 +37,4 @@ /****************************************************************************/ -BOOL __unix_path_semantics = TRUE; +BOOL NOCOMMON __unix_path_semantics = TRUE; diff --git a/library/usergroup_data.c b/library/usergroup_data.c index e9e2247..000b28f 100644 --- a/library/usergroup_data.c +++ b/library/usergroup_data.c @@ -1,5 +1,5 @@ /* - * $Id: usergroup_data.c,v 1.3 2005-01-02 09:07:19 obarthel Exp $ + * $Id: usergroup_data.c,v 1.4 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -41,10 +41,10 @@ /****************************************************************************/ -int __root_uid; -int __root_gid; -int __root_euid; -int __root_egid; +int NOCOMMON __root_uid; +int NOCOMMON __root_gid; +int NOCOMMON __root_euid; +int NOCOMMON __root_egid; /****************************************************************************/ diff --git a/library/usergroup_init_exit.c b/library/usergroup_init_exit.c index b4ff709..bde94c5 100644 --- a/library/usergroup_init_exit.c +++ b/library/usergroup_init_exit.c @@ -1,5 +1,5 @@ /* - * $Id: usergroup_init_exit.c,v 1.10 2005-03-18 12:38:25 obarthel Exp $ + * $Id: usergroup_init_exit.c,v 1.11 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -52,12 +52,12 @@ /****************************************************************************/ -struct Library * __UserGroupBase; +struct Library * NOCOMMON __UserGroupBase; /****************************************************************************/ #if defined(__amigaos4__) -struct UserGroupIFace * __IUserGroup; +struct UserGroupIFace * NOCOMMON __IUserGroup; #endif /* __amigaos4__ */ /****************************************************************************/ diff --git a/library/usergroup_rootmode.c b/library/usergroup_rootmode.c index 88646eb..f2aa5d4 100644 --- a/library/usergroup_rootmode.c +++ b/library/usergroup_rootmode.c @@ -1,5 +1,5 @@ /* - * $Id: usergroup_rootmode.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ + * $Id: usergroup_rootmode.c,v 1.3 2005-07-03 10:36:47 obarthel Exp $ * * :ts=4 * @@ -41,7 +41,7 @@ /****************************************************************************/ -BOOL __root_mode; +BOOL NOCOMMON __root_mode; /****************************************************************************/