From 2a443276edb49bff615c3e09ec20aa81b75555ce Mon Sep 17 00:00:00 2001 From: verhaegs Date: Sat, 7 Jan 2012 17:37:17 +0000 Subject: [PATCH] compiler/clib: Don't hide access to aroscbase behind a #define. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@43492 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- compiler/clib/__arosc_nixmain.c | 4 +- compiler/clib/__arosc_privdata.h | 22 ++-------- compiler/clib/__arosc_startup.c | 4 +- compiler/clib/__arosc_userdata.c | 2 +- compiler/clib/__env.c | 5 ++- compiler/clib/__exec.c | 14 +++---- compiler/clib/__exitfunc.c | 6 +-- compiler/clib/__fdesc.c | 78 ++++++++++++++++++++--------------- compiler/clib/__stat.c | 5 ++- compiler/clib/__upath.c | 39 +++++------------- compiler/clib/__vfork.c | 12 +++--- compiler/clib/access.c | 5 ++- compiler/clib/chdir.c | 19 +++++---- compiler/clib/chown.c | 5 ++- compiler/clib/clock.c | 13 +++--- compiler/clib/fchdir.c | 9 ++-- compiler/clib/fdopen.c | 5 ++- compiler/clib/fflush.c | 6 ++- compiler/clib/flock.c | 10 +++-- compiler/clib/free.c | 5 ++- compiler/clib/getpid.c | 4 +- compiler/clib/getppid.c | 4 +- compiler/clib/gettimeofday.c | 48 ++++++++++----------- compiler/clib/localtime.c | 4 +- compiler/clib/localtime_r.c | 6 ++- compiler/clib/lstat.c | 5 ++- compiler/clib/malloc.c | 19 +++++---- compiler/clib/posix_memalign.c | 5 ++- compiler/clib/readdir.c | 9 ++-- compiler/clib/readlink.c | 5 ++- compiler/clib/sharecontextwithchild.c | 4 +- compiler/clib/stat.c | 5 ++- compiler/clib/strerror.c | 4 +- compiler/clib/system.c | 8 ++-- compiler/clib/umask.c | 16 +++---- 35 files changed, 206 insertions(+), 208 deletions(-) diff --git a/compiler/clib/__arosc_nixmain.c b/compiler/clib/__arosc_nixmain.c index d9340df483..42286327ce 100644 --- a/compiler/clib/__arosc_nixmain.c +++ b/compiler/clib/__arosc_nixmain.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ Desc: special main function for code which has to use special *nix features. @@ -36,7 +36,7 @@ static void update_PATH(void); int __arosc_nixmain(int (*main)(int argc, char *argv[]), int argc, char *argv[]) { - struct aroscbase *aroscbase = __get_aroscbase(), *paroscbase; + struct aroscbase *aroscbase = __GM_GetBase(), *paroscbase; char *old_argv0 = NULL; char *new_argv0 = NULL; struct MinList old_vars; diff --git a/compiler/clib/__arosc_privdata.h b/compiler/clib/__arosc_privdata.h index b7adc9bbd5..323b4e9695 100644 --- a/compiler/clib/__arosc_privdata.h +++ b/compiler/clib/__arosc_privdata.h @@ -126,25 +126,9 @@ struct aroscbase /* !acb_flags */ +/* This function is added by genmodule and returns the current active + libbase. +*/ struct aroscbase *__GM_GetBase(); -#define __get_aroscbase() __GM_GetBase() - -#define __env_list (__get_aroscbase()->acb_env_list) -#define __stdio_files (__get_aroscbase()->acb_stdio_files) -#define __numslots (__get_aroscbase()->acb_numslots) -#define __fd_mempool (__get_aroscbase()->acb_fd_mempool) -#define __fd_array (__get_aroscbase()->acb_fd_array) -#define __mempool (__get_aroscbase()->acb_mempool) -#define __datestamp (__get_aroscbase()->acb_datestamp) -#define __atexit_list (__get_aroscbase()->acb_atexit_list) -#define __umask (__get_aroscbase()->acb_umask) -#define __cd_changed (__get_aroscbase()->acb_cd_changed) -#define __cd_lock (__get_aroscbase()->acb_cd_lock) -#define __timereq (__get_aroscbase()->acb_timereq) -#define __timeport (__get_aroscbase()->acb_timeport) -#define __gmtoffset (__get_aroscbase()->acb_gmtoffset) -#define __apathbuf (__get_aroscbase()->acb_apathbuf) -#define __doupath (__get_aroscbase()->acb_doupath) -#define __flocks_list (__get_aroscbase()->acb_file_locks) #endif /* !___AROSC_PRIVDATA_H */ diff --git a/compiler/clib/__arosc_startup.c b/compiler/clib/__arosc_startup.c index 118a9bcd65..185eb5d1ba 100644 --- a/compiler/clib/__arosc_startup.c +++ b/compiler/clib/__arosc_startup.c @@ -1,5 +1,5 @@ /* - Copyright © 2009-2011, The AROS Development Team. All rights reserved. + Copyright © 2009-2012, The AROS Development Team. All rights reserved. $Id$ Desc: arosc library - support code for entering and leaving a program @@ -18,7 +18,7 @@ void __arosc_program_startup(void) { struct Process *me = (struct Process *)FindTask(NULL); - D(bug("[__arosc_program_startup] aroscbase 0x%p\n", __get_aroscbase())); + D(bug("[__arosc_program_startup] aroscbase 0x%p\n", __GM_GetBase())); /* Function is just a placeholder for the future */ diff --git a/compiler/clib/__arosc_userdata.c b/compiler/clib/__arosc_userdata.c index e562df3dca..4f637e5d18 100644 --- a/compiler/clib/__arosc_userdata.c +++ b/compiler/clib/__arosc_userdata.c @@ -22,7 +22,7 @@ static struct aroscbase *aroscbase; struct arosc_userdata *__get_arosc_userdata(void) { #ifdef AROSC_SHARED - struct aroscbase *aroscbase = __get_aroscbase(); + struct aroscbase *aroscbase = __GM_GetBaseParent(); #endif #ifdef AROSC_STATIC static int __init = 0; diff --git a/compiler/clib/__env.c b/compiler/clib/__env.c index 1b7e37fe5e..540390cede 100644 --- a/compiler/clib/__env.c +++ b/compiler/clib/__env.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2003, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ Internal functions for environment variables handling. @@ -91,11 +91,12 @@ err1: static __env_item **internal_findvar(register const char *name) { + struct aroscbase *aroscbase = __GM_GetBase(); __env_item **curr; for ( - curr = &__env_list; + curr = &aroscbase->acb_env_list; *curr && strcmp((*curr)->name, name); curr = &((*curr)->next) ); diff --git a/compiler/clib/__exec.c b/compiler/clib/__exec.c index 1ad36e5f11..b3aa4ef47b 100644 --- a/compiler/clib/__exec.c +++ b/compiler/clib/__exec.c @@ -1,5 +1,5 @@ /* - Copyright © 2008-2011, The AROS Development Team. All rights reserved. + Copyright © 2008-2012, The AROS Development Team. All rights reserved. $Id$ Support functions for POSIX exec*() functions. @@ -41,7 +41,7 @@ static void close_on_exec(struct aroscbase *aroscbase); APTR __exec_prepare(const char *filename, int searchpath, char *const argv[], char *const envp[]) { - struct aroscbase *aroscbase = __get_aroscbase(); + struct aroscbase *aroscbase = __GM_GetBase(); char *filename2 = NULL; int argssize = 512; struct Process *me; @@ -388,7 +388,7 @@ error: void __exec_do(APTR id) { - struct aroscbase *aroscbase = __get_aroscbase(); + struct aroscbase *aroscbase = __GM_GetBase(); char *oldtaskname; struct CommandLineInterface *cli = Cli(); struct Task *self = FindTask(NULL); @@ -398,8 +398,8 @@ void __exec_do(APTR id) /* id is unused */ (void)id; - /* When exec is not called under vfork condition id == __get_aroscbase() - When exec is called under vfork condition we need to use __get_aroscbase() in the + /* When exec is not called under vfork condition id == __GM_GetBase() + When exec is called under vfork condition we need to use __GM_GetBase() in the parent to check for PRETEND_CHILD and find the udata for signaling the child */ @@ -453,7 +453,7 @@ void __exec_do(APTR id) char *const *__exec_valist2array(const char *arg1, va_list list) { - struct aroscbase *aroscbase = __get_aroscbase(); + struct aroscbase *aroscbase = __GM_GetBase(); int argc, i; static char *no_arg[] = {NULL}; va_list list2; @@ -497,7 +497,7 @@ char *const *__exec_valist2array(const char *arg1, va_list list) void __exec_cleanup_array() { - struct aroscbase *aroscbase = __get_aroscbase(); + struct aroscbase *aroscbase = __GM_GetBase(); if (aroscbase->acb_exec_tmparray) { free((void *)aroscbase->acb_exec_tmparray); diff --git a/compiler/clib/__exitfunc.c b/compiler/clib/__exitfunc.c index 652db1cdd8..029f2f9b46 100644 --- a/compiler/clib/__exitfunc.c +++ b/compiler/clib/__exitfunc.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ */ @@ -12,7 +12,7 @@ int __addexitfunc(struct AtExitNode *aen) { - struct aroscbase *aroscbase = __get_aroscbase(); + struct aroscbase *aroscbase = __GM_GetBase(); ADDHEAD((struct List *)&aroscbase->acb_atexit_list, (struct Node *)aen); @@ -28,7 +28,7 @@ int __init_atexit(struct aroscbase *aroscbase) void __callexitfuncs(void) { - struct aroscbase *aroscbase = __get_aroscbase(); + struct aroscbase *aroscbase = __GM_GetBase(); struct AtExitNode *aen; while ( diff --git a/compiler/clib/__fdesc.c b/compiler/clib/__fdesc.c index 5421dbbaff..d10fd33bcd 100644 --- a/compiler/clib/__fdesc.c +++ b/compiler/clib/__fdesc.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ File descriptors handling internals. @@ -31,26 +31,30 @@ static struct MinList __fdreglist; int __getfdslots(void) { - return __numslots; + struct aroscbase *aroscbase = __GM_GetBase(); + return aroscbase->acb_numslots; } fdesc *__getfdesc(register int fd) { - return ((__numslots>fd) && (fd>=0))?__fd_array[fd]:NULL; + struct aroscbase *aroscbase = __GM_GetBase(); + return ((aroscbase->acb_numslots>fd) && (fd>=0))?aroscbase->acb_fd_array[fd]:NULL; } void __setfdesc(register int fd, fdesc *desc) { + struct aroscbase *aroscbase = __GM_GetBase(); /* FIXME: Check if fd is in valid range... */ - __fd_array[fd] = desc; + aroscbase->acb_fd_array[fd] = desc; } int __getfirstfd(register int startfd) { + struct aroscbase *aroscbase = __GM_GetBase(); /* FIXME: Check if fd is in valid range... */ for ( ; - startfd < __numslots && __fd_array[startfd]; + startfd < aroscbase->acb_numslots && aroscbase->acb_fd_array[startfd]; startfd++ ); @@ -59,32 +63,33 @@ int __getfirstfd(register int startfd) int __getfdslot(int wanted_fd) { - if (wanted_fd>=__numslots) + struct aroscbase *aroscbase = __GM_GetBase(); + if (wanted_fd>=aroscbase->acb_numslots) { void *tmp; - tmp = AllocPooled(__fd_mempool, (wanted_fd+1)*sizeof(fdesc *)); + tmp = AllocPooled(aroscbase->acb_fd_mempool, (wanted_fd+1)*sizeof(fdesc *)); if (!tmp) return -1; - if (__fd_array) + if (aroscbase->acb_fd_array) { - size_t size = __numslots*sizeof(fdesc *); - CopyMem(__fd_array, tmp, size); - FreePooled(__fd_mempool, __fd_array, size); + size_t size = aroscbase->acb_numslots*sizeof(fdesc *); + CopyMem(aroscbase->acb_fd_array, tmp, size); + FreePooled(aroscbase->acb_fd_mempool, aroscbase->acb_fd_array, size); } - __fd_array = tmp; + aroscbase->acb_fd_array = tmp; - bzero(__fd_array + __numslots, (wanted_fd - __numslots + 1) * sizeof(fdesc *)); - __numslots = wanted_fd+1; + bzero(aroscbase->acb_fd_array + aroscbase->acb_numslots, (wanted_fd - aroscbase->acb_numslots + 1) * sizeof(fdesc *)); + aroscbase->acb_numslots = wanted_fd+1; } else if (wanted_fd < 0) { errno = EINVAL; return -1; } - else if (__fd_array[wanted_fd]) + else if (aroscbase->acb_fd_array[wanted_fd]) { close(wanted_fd); } @@ -124,13 +129,14 @@ LONG __oflags2amode(int flags) int __open(int wanted_fd, const char *pathname, int flags, int mode) { + struct aroscbase *aroscbase = __GM_GetBase(); BPTR fh = BNULL, lock = BNULL; fdesc *currdesc = NULL; fcb *cblock = NULL; struct FileInfoBlock *fib = NULL; LONG openmode = __oflags2amode(flags); - if (__doupath && pathname[0] == '\0') + if (aroscbase->acb_doupath && pathname[0] == '\0') { /* On *nix "" is not really a valid file name. */ errno = ENOENT; @@ -300,19 +306,21 @@ err: fdesc *__alloc_fdesc(void) { + struct aroscbase *aroscbase = __GM_GetBase(); fdesc * desc; - desc = AllocPooled(__fd_mempool, sizeof(fdesc)); + desc = AllocPooled(aroscbase->acb_fd_mempool, sizeof(fdesc)); - D(bug("Allocated fdesc %x from %x pool\n", desc, __fd_mempool)); + D(bug("Allocated fdesc %x from %x pool\n", desc, aroscbase->acb_fd_mempool)); return desc; } void __free_fdesc(fdesc *desc) { - D(bug("Freeing fdesc %x from %x pool\n", desc, __fd_mempool)); - FreePooled(__fd_mempool, desc, sizeof(fdesc)); + struct aroscbase *aroscbase = __GM_GetBase(); + D(bug("Freeing fdesc %x from %x pool\n", desc, aroscbase->acb_fd_mempool)); + FreePooled(aroscbase->acb_fd_mempool, desc, sizeof(fdesc)); } @@ -415,15 +423,16 @@ int __init_stdfiles(struct aroscbase *aroscbase) indesc->fcb->opencount = outdesc->fcb->opencount = errdesc->fcb->opencount = 1; indesc->fcb->privflags = outdesc->fcb->privflags = errdesc->fcb->privflags = _FCB_DONTCLOSE_FH; - __fd_array[STDIN_FILENO] = indesc; - __fd_array[STDOUT_FILENO] = outdesc; - __fd_array[STDERR_FILENO] = errdesc; + aroscbase->acb_fd_array[STDIN_FILENO] = indesc; + aroscbase->acb_fd_array[STDOUT_FILENO] = outdesc; + aroscbase->acb_fd_array[STDERR_FILENO] = errdesc; return 1; } static int __copy_fdarray(fdesc **__src_fd_array, int numslots) { + struct aroscbase *aroscbase = __GM_GetBase(); int i; for(i = numslots - 1; i >= 0; i--) @@ -433,12 +442,12 @@ static int __copy_fdarray(fdesc **__src_fd_array, int numslots) if(__getfdslot(i) != i) return 0; - if((__fd_array[i] = __alloc_fdesc()) == NULL) + if((aroscbase->acb_fd_array[i] = __alloc_fdesc()) == NULL) return 0; - __fd_array[i]->fdflags = __src_fd_array[i]->fdflags; - __fd_array[i]->fcb = __src_fd_array[i]->fcb; - __fd_array[i]->fcb->opencount++; + aroscbase->acb_fd_array[i]->fdflags = __src_fd_array[i]->fdflags; + aroscbase->acb_fd_array[i]->fcb = __src_fd_array[i]->fcb; + aroscbase->acb_fd_array[i]->fcb->opencount++; } } @@ -450,7 +459,7 @@ int __init_fd(struct aroscbase *aroscbase) struct __reg_fdarray *regnodeit, *regnode = NULL; struct Task *self = FindTask(NULL); - __fd_mempool = CreatePool(MEMF_PUBLIC, 16*sizeof(fdesc), 16*sizeof(fdesc)); + aroscbase->acb_fd_mempool = CreatePool(MEMF_PUBLIC, 16*sizeof(fdesc), 16*sizeof(fdesc)); ObtainSemaphore(&__fdsem); ForeachNode(&__fdreglist, regnodeit) @@ -495,6 +504,7 @@ void __exit_fd(struct aroscbase *aroscbase) void __updatestdio(void) { + struct aroscbase *aroscbase = __GM_GetBase(); struct Process *me; me = (struct Process *)FindTask(NULL); @@ -503,13 +513,13 @@ void __updatestdio(void) fflush(stdout); fflush(stderr); - __fd_array[STDIN_FILENO]->fcb->fh = Input(); - __fd_array[STDOUT_FILENO]->fcb->fh = Output(); - __fd_array[STDERR_FILENO]->fcb->fh = me->pr_CES ? me->pr_CES : me->pr_COS; + aroscbase->acb_fd_array[STDIN_FILENO]->fcb->fh = Input(); + aroscbase->acb_fd_array[STDOUT_FILENO]->fcb->fh = Output(); + aroscbase->acb_fd_array[STDERR_FILENO]->fcb->fh = me->pr_CES ? me->pr_CES : me->pr_COS; - __fd_array[STDIN_FILENO]->fcb->privflags = - __fd_array[STDOUT_FILENO]->fcb->privflags = - __fd_array[STDERR_FILENO]->fcb->privflags = _FCB_DONTCLOSE_FH; + aroscbase->acb_fd_array[STDIN_FILENO]->fcb->privflags = + aroscbase->acb_fd_array[STDOUT_FILENO]->fcb->privflags = + aroscbase->acb_fd_array[STDERR_FILENO]->fcb->privflags = _FCB_DONTCLOSE_FH; } ADD2INIT(__init_vars, 0); diff --git a/compiler/clib/__stat.c b/compiler/clib/__stat.c index f2fc3e2dbe..60b9be13f7 100644 --- a/compiler/clib/__stat.c +++ b/compiler/clib/__stat.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ */ @@ -540,6 +540,7 @@ static void __fill_statbuffer( int fallback_to_defaults, BPTR lock) { + struct aroscbase *aroscbase = __GM_GetBase(); uint64_t hash; uint32_t pc = 1, pb = 1; /* initial hash values */ @@ -567,7 +568,7 @@ static void __fill_statbuffer( sb->st_size = (off_t)fib->fib_Size; sb->st_atime = sb->st_ctime = - sb->st_mtime = (fib->fib_Date.ds_Days * 24*60 + fib->fib_Date.ds_Minute + __gmtoffset) * 60 + + sb->st_mtime = (fib->fib_Date.ds_Days * 24*60 + fib->fib_Date.ds_Minute + aroscbase->acb_gmtoffset) * 60 + fib->fib_Date.ds_Tick / TICKS_PER_SECOND + OFFSET_FROM_1970; sb->st_uid = __id_a2u(fib->fib_OwnerUID); sb->st_gid = __id_a2u(fib->fib_OwnerGID); diff --git a/compiler/clib/__upath.c b/compiler/clib/__upath.c index 78d5a29730..9cdd3d8d92 100644 --- a/compiler/clib/__upath.c +++ b/compiler/clib/__upath.c @@ -1,6 +1,5 @@ - /* - Copyright © 1995-2010, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ Desc: utility internal function __path_u2a() @@ -16,12 +15,6 @@ static const char *__path_devstuff_u2a(const char *path); static void __path_normalstuff_u2a(const char *path, char *buf); -#ifdef BUILD_TEST - static int __doupath = 1; - static char *__apathbuf; -# define realloc_nocopy realloc -#endif - /***************************************************************************** NAME */ @@ -57,10 +50,11 @@ static void __path_normalstuff_u2a(const char *path, char *buf); ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); const char *newpath; /* Does the path really need to be converted? */ - if (!__doupath) + if (!aroscbase->acb_doupath) return upath; /* Safety check. */ @@ -86,7 +80,7 @@ static void __path_normalstuff_u2a(const char *path, char *buf); if (!newpath) { /* Else, convert it normally */ - newpath = realloc_nocopy(__apathbuf, strlen(upath) + 1); + newpath = realloc_nocopy(aroscbase->acb_apathbuf, strlen(upath) + 1); if (newpath == NULL) { @@ -94,8 +88,8 @@ static void __path_normalstuff_u2a(const char *path, char *buf); return NULL; } - __apathbuf = (char *)newpath; - __path_normalstuff_u2a(upath, __apathbuf); + aroscbase->acb_apathbuf = (char *)newpath; + __path_normalstuff_u2a(upath, aroscbase->acb_apathbuf); } return newpath; @@ -136,6 +130,7 @@ static void __path_normalstuff_u2a(const char *path, char *buf); ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); const char *old_apath = apath; char ch, *upath, *old_upath; size_t size = 0; @@ -157,7 +152,7 @@ static void __path_normalstuff_u2a(const char *path, char *buf); return NULL; } - if (!__doupath) + if (!aroscbase->acb_doupath) return apath; while ((ch = *apath++)) @@ -171,14 +166,14 @@ static void __path_normalstuff_u2a(const char *path, char *buf); if (size == 0) return ""; - old_upath = realloc_nocopy(__apathbuf, 1 + size + 1); + old_upath = realloc_nocopy(aroscbase->acb_apathbuf, 1 + size + 1); if (old_upath == NULL) { errno = ENOMEM; return NULL; } - __apathbuf = old_upath; + aroscbase->acb_apathbuf = old_upath; upath = ++old_upath; apath = old_apath; @@ -422,17 +417,3 @@ static void __path_normalstuff_u2a(const char *path, char *buf) buf[0] = '\0'; } - -#ifdef BUILD_TEST - -#include -int main(int argc, char *argv[]) -{ - if (argc != 3) - return 20; - - printf("%s\n", __path_u2a(argv[1])); - printf("%s\n", __path_a2u(argv[2])); -} -#endif - diff --git a/compiler/clib/__vfork.c b/compiler/clib/__vfork.c index b93b4151a9..a774eae465 100644 --- a/compiler/clib/__vfork.c +++ b/compiler/clib/__vfork.c @@ -1,5 +1,5 @@ /* - Copyright © 2008-2011, The AROS Development Team. All rights reserved. + Copyright © 2008-2012, The AROS Development Team. All rights reserved. $Id$ */ @@ -165,7 +165,7 @@ LONG launcher() pid_t __vfork(jmp_buf env) { - struct aroscbase *aroscbase = __get_aroscbase(); + struct aroscbase *aroscbase = __GM_GetBase(); struct Task *this = FindTask(NULL); struct ETask *etask = NULL; struct vfork_data *udata = AllocMem(sizeof(struct vfork_data), MEMF_ANY | MEMF_CLEAR); @@ -250,7 +250,7 @@ pid_t __vfork(jmp_buf env) /* Stack may have been overwritten when we return here, * we jump to here from a function lower in the call chain */ - aroscbase = __get_aroscbase(); + aroscbase = __GM_GetBase(); udata = aroscbase->acb_vfork_data; D(bug("__vfork: acb_vfork_data = %x\n", udata)); @@ -320,7 +320,7 @@ pid_t __vfork(jmp_buf env) static void parent_enterpretendchild(struct vfork_data *udata) { - struct aroscbase *aroscbase = __get_aroscbase(); + struct aroscbase *aroscbase = __GM_GetBase(); D(bug("parent_enterpretendchild(%x): entered\n", udata)); aroscbase->acb_vfork_data = udata; @@ -356,7 +356,7 @@ static void parent_enterpretendchild(struct vfork_data *udata) static void child_takeover(struct vfork_data *udata) { - struct aroscbase *aroscbase = __get_aroscbase(); + struct aroscbase *aroscbase = __GM_GetBase(); D(bug("child_takeover(%x): entered\n", udata)); /* Set current dir to parent's current dir */ @@ -369,7 +369,7 @@ static void child_takeover(struct vfork_data *udata) static void parent_leavepretendchild(struct vfork_data *udata) { - struct aroscbase *aroscbase = __get_aroscbase(); + struct aroscbase *aroscbase = __GM_GetBase(); D(bug("parent_leavepretendchild(%x): entered\n", udata)); /* Restore parent's malloc mempool */ diff --git a/compiler/clib/access.c b/compiler/clib/access.c index d018ff30c0..38cda9d924 100644 --- a/compiler/clib/access.c +++ b/compiler/clib/access.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2010, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ POSIX function access(). @@ -58,6 +58,7 @@ ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); BPTR lock = BNULL; struct FileInfoBlock *fib = NULL; int result = -1; @@ -79,7 +80,7 @@ } /* POSIX root is (poorly) emulated, its contents is accessible */ - if (__doupath && (path[0] == '/') && (path[1] == '\0')) + if (aroscbase->acb_doupath && (path[0] == '/') && (path[1] == '\0')) { if (mode & (W_OK|R_OK)) { errno = EACCES; diff --git a/compiler/clib/chdir.c b/compiler/clib/chdir.c index 74d260145a..9b8a5d0f19 100644 --- a/compiler/clib/chdir.c +++ b/compiler/clib/chdir.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ ANSI C function chdir(). @@ -55,6 +55,7 @@ ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); BPTR oldlock; BPTR newlock; @@ -73,14 +74,14 @@ oldlock = CurrentDir( newlock ); - if( __cd_changed ) + if( aroscbase->acb_cd_changed ) { UnLock( oldlock ); } else { - __cd_changed = TRUE; - __cd_lock = oldlock; + aroscbase->acb_cd_changed = TRUE; + aroscbase->acb_cd_lock = oldlock; } return 0; @@ -91,18 +92,18 @@ error: return -1; } -int __init_chdir(void) +int __init_chdir(struct aroscbase *aroscbase) { - __cd_changed = FALSE; + aroscbase->acb_cd_changed = FALSE; return 1; } -void __exit_chdir(void) +void __exit_chdir(struct aroscbase *aroscbase) { - if( __cd_changed ) + if( aroscbase->acb_cd_changed ) { - BPTR lock = CurrentDir( __cd_lock ); + BPTR lock = CurrentDir( aroscbase->acb_cd_lock ); UnLock( lock ); } diff --git a/compiler/clib/chown.c b/compiler/clib/chown.c index dcd9e36ab9..d3de9c1fac 100644 --- a/compiler/clib/chown.c +++ b/compiler/clib/chown.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2009, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ */ @@ -51,13 +51,14 @@ ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); int res = -1; BPTR lock = BNULL; struct FileInfoBlock *fib = NULL; BOOL changed = TRUE; /* check for empty path before potential conversion from "." to "" */ - if (__doupath && path && *path == '\0') + if (aroscbase->acb_doupath && path && *path == '\0') { errno = ENOENT; goto out; diff --git a/compiler/clib/clock.c b/compiler/clib/clock.c index 16839584ae..5fa895af7f 100644 --- a/compiler/clib/clock.c +++ b/compiler/clib/clock.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ Returns time passed since start of program. @@ -46,33 +46,34 @@ ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); struct DateStamp t; clock_t retval; DateStamp (&t); /* Get timestamp */ /* Day difference */ - retval = (t.ds_Days - __datestamp.ds_Days); + retval = (t.ds_Days - aroscbase->acb_datestamp.ds_Days); /* Convert into minutes */ retval *= (24 * 60); /* Minute difference */ - retval += (t.ds_Minute - __datestamp.ds_Minute); + retval += (t.ds_Minute - aroscbase->acb_datestamp.ds_Minute); /* Convert into CLOCKS_PER_SEC (which is the same as TICKS_PER_SECOND) units */ retval *= (60 * TICKS_PER_SECOND); /* Add tick difference */ - retval += (t.ds_Tick - __datestamp.ds_Tick); + retval += (t.ds_Tick - aroscbase->acb_datestamp.ds_Tick); return retval; } /* clock */ -int __init_clock(void) +int __init_clock(struct aroscbase *aroscbase) { - DateStamp(&__datestamp); + DateStamp(&aroscbase->acb_datestamp); return 1; } diff --git a/compiler/clib/fchdir.c b/compiler/clib/fchdir.c index c7be2fd1db..c0fbd11f05 100644 --- a/compiler/clib/fchdir.c +++ b/compiler/clib/fchdir.c @@ -1,5 +1,5 @@ /* - Copyright © 2008, The AROS Development Team. All rights reserved. + Copyright © 2008-2012, The AROS Development Team. All rights reserved. $Id$ */ @@ -50,6 +50,7 @@ ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); BPTR oldlock = BNULL; BPTR newlock = BNULL; BPTR handle = BNULL; @@ -69,14 +70,14 @@ } oldlock = CurrentDir( newlock ); - if( __cd_changed ) + if( aroscbase->acb_cd_changed ) { UnLock( oldlock ); } else { - __cd_changed = TRUE; - __cd_lock = oldlock; + aroscbase->acb_cd_changed = TRUE; + aroscbase->acb_cd_lock = oldlock; } return 0; diff --git a/compiler/clib/fdopen.c b/compiler/clib/fdopen.c index d446f29c91..bb3ecddb38 100644 --- a/compiler/clib/fdopen.c +++ b/compiler/clib/fdopen.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2007, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ POSIX function fdopen(). @@ -64,6 +64,7 @@ ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); int oflags, wanted_accmode, current_accmode; fdesc *fdesc; FILENODE *fn; @@ -100,7 +101,7 @@ fn = malloc(sizeof(FILENODE)); if (!fn) return NULL; - AddTail ((struct List *)&__stdio_files, (struct Node *)fn); + AddTail ((struct List *)&aroscbase->acb_stdio_files, (struct Node *)fn); fn->File.flags = __oflags2sflags(oflags); fn->File.fd = filedes; diff --git a/compiler/clib/fflush.c b/compiler/clib/fflush.c index 4d8e28a866..d9474d9964 100644 --- a/compiler/clib/fflush.c +++ b/compiler/clib/fflush.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2007, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ ANSI C function fflush(). @@ -50,12 +50,14 @@ ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); + /* flush all streams opened for output */ if (!stream) { FILENODE *fn; - ForeachNode (&__stdio_files, fn) + ForeachNode (&aroscbase->acb_stdio_files, fn) { if (fn->File.flags & _STDIO_WRITE) { diff --git a/compiler/clib/flock.c b/compiler/clib/flock.c index 56426a9255..3b06e2685b 100644 --- a/compiler/clib/flock.c +++ b/compiler/clib/flock.c @@ -1,5 +1,5 @@ /* - Copyright © 2008-2011, The AROS Development Team. All rights reserved. + Copyright © 2008-2012, The AROS Development Team. All rights reserved. $Id$ 4.4BSD function flock(). @@ -86,7 +86,7 @@ void RemoveFromList(struct SignalSemaphore *sem); Since advisory locks semantics is equal to exec.library semaphores semantics, semaphores are used to implement locks. For a given file a semaphore named FLOCK(path) is created where path is a full path to - the file. Locks held by a given process are stored on __flocks_list + the file. Locks held by a given process are stored on aroscbase->acb_file_locks and released during process exit. ******************************************************************************/ @@ -222,21 +222,23 @@ void RemoveFromList(struct SignalSemaphore *sem); LONG AddToList(struct SignalSemaphore *sem) { + struct aroscbase *aroscbase = __GM_GetBase(); struct FlockNode *node; node = AllocMem(sizeof(struct FlockNode), MEMF_ANY | MEMF_CLEAR); if(!node) return -1; node->sem = sem; - AddHead((struct List *)&__flocks_list, (struct Node*) node); + AddHead((struct List *)&aroscbase->acb_file_locks, (struct Node*) node); return 0; } void RemoveFromList(struct SignalSemaphore *sem) { + struct aroscbase *aroscbase = __GM_GetBase(); struct FlockNode *varNode; struct Node *tmpNode; - ForeachNodeSafe(&__flocks_list, varNode, tmpNode) + ForeachNodeSafe(&aroscbase->acb_file_locks, varNode, tmpNode) { if(varNode->sem == sem) { diff --git a/compiler/clib/free.c b/compiler/clib/free.c index bbeff02471..8f2ddbc5d5 100644 --- a/compiler/clib/free.c +++ b/compiler/clib/free.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2007, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ ANSI C function free(). @@ -47,6 +47,7 @@ ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); if (memory) { unsigned char *mem; @@ -59,7 +60,7 @@ free(((void **) mem)[-1]); else { size += AROS_ALIGN(sizeof(size_t)); - FreePooled (__mempool, mem, size); + FreePooled (aroscbase->acb_mempool, mem, size); } } diff --git a/compiler/clib/getpid.c b/compiler/clib/getpid.c index 3a78ae0867..1a9c76f16f 100644 --- a/compiler/clib/getpid.c +++ b/compiler/clib/getpid.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ POSIX function getpid(). @@ -40,7 +40,7 @@ ******************************************************************************/ { - struct aroscbase *aroscbase = __get_aroscbase(); + struct aroscbase *aroscbase = __GM_GetBase(); struct ETask *et; if(aroscbase->acb_flags & PRETEND_CHILD) diff --git a/compiler/clib/getppid.c b/compiler/clib/getppid.c index 6ae18af746..82a89333be 100644 --- a/compiler/clib/getppid.c +++ b/compiler/clib/getppid.c @@ -1,5 +1,5 @@ /* - Copyright © 2004-2011, The AROS Development Team. All rights reserved. + Copyright © 2004-2012, The AROS Development Team. All rights reserved. $Id$ */ @@ -41,7 +41,7 @@ ******************************************************************************/ { - struct aroscbase *aroscbase = __get_aroscbase(); + struct aroscbase *aroscbase = __GM_GetBase(); struct Task *ParentTask; struct ETask *eThisTask; struct ETask *et; diff --git a/compiler/clib/gettimeofday.c b/compiler/clib/gettimeofday.c index 2671fe822a..3c8e5984f0 100644 --- a/compiler/clib/gettimeofday.c +++ b/compiler/clib/gettimeofday.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ Query the current time and/or timezone. @@ -101,17 +101,19 @@ ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); + if (tv) { GetSysTime(tv); /* Adjust with the current timezone, stored in minutes west of GMT */ - tv->tv_sec += (2922 * 1440 + __gmtoffset) * 60; + tv->tv_sec += (2922 * 1440 + aroscbase->acb_gmtoffset) * 60; } if (tz) { - tz->tz_minuteswest = __gmtoffset; + tz->tz_minuteswest = aroscbase->acb_gmtoffset; /* FIXME: set tz->tz_dsttime */ tz->tz_dsttime = DST_NONE; } @@ -122,30 +124,30 @@ struct Device *TimerBase; -static int __init_timerbase(void) +static int __init_timerbase(struct aroscbase *aroscbase) { - __timeport.mp_Node.ln_Type = NT_MSGPORT; - __timeport.mp_Node.ln_Pri = 0; - __timeport.mp_Node.ln_Name = NULL; - __timeport.mp_Flags = PA_IGNORE; - __timeport.mp_SigTask = FindTask(NULL); - __timeport.mp_SigBit = 0; - NEWLIST(&__timeport.mp_MsgList); - - __timereq.tr_node.io_Message.mn_Node.ln_Type = NT_MESSAGE; - __timereq.tr_node.io_Message.mn_Node.ln_Pri = 0; - __timereq.tr_node.io_Message.mn_Node.ln_Name = NULL; - __timereq.tr_node.io_Message.mn_ReplyPort = &__timeport; - __timereq.tr_node.io_Message.mn_Length = sizeof (__timereq); + aroscbase->acb_timeport.mp_Node.ln_Type = NT_MSGPORT; + aroscbase->acb_timeport.mp_Node.ln_Pri = 0; + aroscbase->acb_timeport.mp_Node.ln_Name = NULL; + aroscbase->acb_timeport.mp_Flags = PA_IGNORE; + aroscbase->acb_timeport.mp_SigTask = FindTask(NULL); + aroscbase->acb_timeport.mp_SigBit = 0; + NEWLIST(&aroscbase->acb_timeport.mp_MsgList); + + aroscbase->acb_timereq.tr_node.io_Message.mn_Node.ln_Type = NT_MESSAGE; + aroscbase->acb_timereq.tr_node.io_Message.mn_Node.ln_Pri = 0; + aroscbase->acb_timereq.tr_node.io_Message.mn_Node.ln_Name = NULL; + aroscbase->acb_timereq.tr_node.io_Message.mn_ReplyPort = &aroscbase->acb_timeport; + aroscbase->acb_timereq.tr_node.io_Message.mn_Length = sizeof (aroscbase->acb_timereq); struct Locale *locale = OpenLocale(NULL); if (locale) { - __gmtoffset = locale->loc_GMTOffset; + aroscbase->acb_gmtoffset = locale->loc_GMTOffset; CloseLocale(locale); } else - __gmtoffset = 0; + aroscbase->acb_gmtoffset = 0; if ( @@ -153,14 +155,14 @@ static int __init_timerbase(void) ( "timer.device", UNIT_VBLANK, - (struct IORequest *)&__timereq, + (struct IORequest *)&aroscbase->acb_timereq, 0 ) == 0 ) { - TimerBase = (struct Device *)__timereq.tr_node.io_Device; + TimerBase = (struct Device *)aroscbase->acb_timereq.tr_node.io_Device; return 1; } else @@ -170,10 +172,10 @@ static int __init_timerbase(void) } -static void __exit_timerbase(void) +static void __exit_timerbase(struct aroscbase *aroscbase) { if (TimerBase != NULL) - CloseDevice((struct IORequest *)&__timereq); + CloseDevice((struct IORequest *)&aroscbase->acb_timereq); } ADD2OPENLIB(__init_timerbase, 0); diff --git a/compiler/clib/localtime.c b/compiler/clib/localtime.c index d167f2137b..6fd7169986 100644 --- a/compiler/clib/localtime.c +++ b/compiler/clib/localtime.c @@ -1,12 +1,10 @@ /* - Copyright © 1995-2007, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ Convert a time into a string. */ -extern long __gmtoffset; - /***************************************************************************** NAME */ diff --git a/compiler/clib/localtime_r.c b/compiler/clib/localtime_r.c index 50ab36f6b4..657a2447df 100644 --- a/compiler/clib/localtime_r.c +++ b/compiler/clib/localtime_r.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2007, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ Convert a time into a string, reentrant. @@ -73,9 +73,11 @@ ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); + time_t ti = *tt; - ti -= __gmtoffset * 60; + ti -= aroscbase->acb_gmtoffset * 60; return gmtime_r (&ti, tm); } /* localtime_r */ diff --git a/compiler/clib/lstat.c b/compiler/clib/lstat.c index a495419d4f..21cf298c10 100644 --- a/compiler/clib/lstat.c +++ b/compiler/clib/lstat.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ */ @@ -60,11 +60,12 @@ static BPTR __lock( ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); int res = 0; BPTR lock; /* check for empty path before potential conversion from "." to "" */ - if (__doupath && path && *path == '\0') + if (aroscbase->acb_doupath && path && *path == '\0') { errno = ENOENT; return -1; diff --git a/compiler/clib/malloc.c b/compiler/clib/malloc.c index 418fc1b57c..6c583852a7 100644 --- a/compiler/clib/malloc.c +++ b/compiler/clib/malloc.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ ANSI C function malloc(). @@ -54,10 +54,11 @@ ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); UBYTE *mem = NULL; /* Allocate the memory */ - mem = AllocPooled (__mempool, size + AROS_ALIGN(sizeof(size_t))); + mem = AllocPooled (aroscbase->acb_mempool, size + AROS_ALIGN(sizeof(size_t))); if (mem) { *((size_t *)mem) = size; @@ -77,11 +78,11 @@ int __init_memstuff(struct aroscbase *aroscbase) FindTask(NULL), aroscbase )); - __mempool = CreatePool(MEMF_ANY | MEMF_SEM_PROTECTED, 65536L, 4096L); + aroscbase->acb_mempool = CreatePool(MEMF_ANY | MEMF_SEM_PROTECTED, 65536L, 4096L); - D(bug("__init_memstuff: __mempool(%x)\n", __mempool)); + D(bug("__init_memstuff: aroscbase->acb_mempool(%x)\n", aroscbase->acb_mempool)); - if (!__mempool) + if (!aroscbase->acb_mempool) { return 0; } @@ -90,15 +91,15 @@ int __init_memstuff(struct aroscbase *aroscbase) } -void __exit_memstuff(void) +void __exit_memstuff(struct aroscbase *aroscbase) { D(bug("__exit_memstuff: task(%x), aroscbase(%x), acb_mempool(%x)\n", - FindTask(NULL), __get_aroscbase(), __mempool + FindTask(NULL), aroscbase, aroscbase->acb_mempool )); - if (__mempool) + if (aroscbase->acb_mempool) { - DeletePool(__mempool); + DeletePool(aroscbase->acb_mempool); } } diff --git a/compiler/clib/posix_memalign.c b/compiler/clib/posix_memalign.c index 04bdf5b5ad..ffa0b1c1d5 100644 --- a/compiler/clib/posix_memalign.c +++ b/compiler/clib/posix_memalign.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ POSIX function posix_memalign(). @@ -65,6 +65,7 @@ ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); UBYTE *mem = NULL, *orig; /* check the alignment is valid */ @@ -72,7 +73,7 @@ return EINVAL; /* allocate enough space to satisfy the alignment and save some info */ - mem = AllocPooled(__mempool, AROS_ALIGN(sizeof(size_t)) + sizeof(void *) + mem = AllocPooled(aroscbase->acb_mempool, AROS_ALIGN(sizeof(size_t)) + sizeof(void *) + AROS_ALIGN(sizeof(size_t)) + alignment + size); if (mem == NULL) return ENOMEM; diff --git a/compiler/clib/readdir.c b/compiler/clib/readdir.c index e8f88be3dc..f574343796 100644 --- a/compiler/clib/readdir.c +++ b/compiler/clib/readdir.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2003, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ POSIX function readdir(). @@ -64,6 +64,7 @@ ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); int const max = MAXFILENAMELENGTH > NAME_MAX ? NAME_MAX : MAXFILENAMELENGTH; fdesc *desc; @@ -84,7 +85,7 @@ return NULL; } - if (__doupath && dir->pos == 0) + if (aroscbase->acb_doupath && dir->pos == 0) { dir->ent.d_type = DT_DIR; dir->ent.d_name[0]='.'; @@ -92,7 +93,7 @@ dir->ent.d_reclen = 1; } else - if (__doupath && dir->pos == 1) + if (aroscbase->acb_doupath && dir->pos == 1) { dir->ent.d_type = DT_DIR; dir->ent.d_name[0]='.'; @@ -121,7 +122,7 @@ while (TRUE) { - if (__doupath && name[0] == '.') + if (aroscbase->acb_doupath && name[0] == '.') { if (name[1] == '.') { diff --git a/compiler/clib/readlink.c b/compiler/clib/readlink.c index 31a1bf3d27..aa3f91847e 100644 --- a/compiler/clib/readlink.c +++ b/compiler/clib/readlink.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2010, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ ANSI C function readlink(). @@ -43,13 +43,14 @@ global variable errno. */ { + struct aroscbase *aroscbase = __GM_GetBase(); ssize_t res = -1; struct DevProc *dvp = NULL; LONG error; struct Process *me = (struct Process *)FindTask(NULL); /* check for empty path before potential conversion from "." to "" */ - if (__doupath && path && *path == '\0') + if (aroscbase->acb_doupath && path && *path == '\0') { errno = ENOENT; return res; diff --git a/compiler/clib/sharecontextwithchild.c b/compiler/clib/sharecontextwithchild.c index 446329f05f..0b9134897f 100644 --- a/compiler/clib/sharecontextwithchild.c +++ b/compiler/clib/sharecontextwithchild.c @@ -1,5 +1,5 @@ /* - Copyright © 2009-2011, The AROS Development Team. All rights reserved. + Copyright © 2009-2012, The AROS Development Team. All rights reserved. $Id$ AROS function sharecontextwithchild(). @@ -61,7 +61,7 @@ ******************************************************************************/ { - struct aroscbase *aroscbase = __get_aroscbase(); + struct aroscbase *aroscbase = __GM_GetBase(); if (aroscbase) { diff --git a/compiler/clib/stat.c b/compiler/clib/stat.c index 82ae22dacb..db3ac3f9ec 100644 --- a/compiler/clib/stat.c +++ b/compiler/clib/stat.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2009, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ */ @@ -77,11 +77,12 @@ ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); int res = 0; BPTR lock; /* check for empty path before potential conversion from "." to "" */ - if (__doupath && path && *path == '\0') + if (aroscbase->acb_doupath && path && *path == '\0') { errno = ENOENT; return -1; diff --git a/compiler/clib/strerror.c b/compiler/clib/strerror.c index b6fd1bf328..5e7b4d27ac 100644 --- a/compiler/clib/strerror.c +++ b/compiler/clib/strerror.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ ANSI C function strerror(). @@ -46,7 +46,7 @@ extern const char * _errstrings[]; { if (n > MAX_ERRNO) { - struct aroscbase *aroscbase = __get_aroscbase(); + struct aroscbase *aroscbase = __GM_GetBase(); Fault(n - MAX_ERRNO, NULL, aroscbase->acb_fault_buf, sizeof(aroscbase->acb_fault_buf)); diff --git a/compiler/clib/system.c b/compiler/clib/system.c index fe2bb22549..62b0a80840 100644 --- a/compiler/clib/system.c +++ b/compiler/clib/system.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ ANSI C function system(). @@ -52,11 +52,12 @@ static int system_no_sh(const char *string); ******************************************************************************/ { + struct aroscbase *aroscbase = __GM_GetBase(); BPTR lock; APTR old_proc_window; struct Process *me; - if (!__doupath) + if (!aroscbase->acb_doupath) return system_no_sh(string); if (string == NULL || string[0] == '\0') @@ -83,6 +84,7 @@ static int system_no_sh(const char *string); static int system_sh(const char *string) { + struct aroscbase *aroscbase = __GM_GetBase(); pid_t pid = vfork(); int status; @@ -96,7 +98,7 @@ static int system_sh(const char *string) } else if(pid == 0) { - execl((__doupath ? "/bin/sh" : "bin:sh"), "sh", "-c", string, (char *) NULL); + execl((aroscbase->acb_doupath ? "/bin/sh" : "bin:sh"), "sh", "-c", string, (char *) NULL); _exit(127); } else diff --git a/compiler/clib/umask.c b/compiler/clib/umask.c index 8f54c7efdf..b84f38302a 100644 --- a/compiler/clib/umask.c +++ b/compiler/clib/umask.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ */ @@ -38,26 +38,26 @@ ******************************************************************************/ { - mode_t oumask = __umask; + struct aroscbase *aroscbase = __GM_GetBase(); + mode_t oumask = aroscbase->acb_umask; - __umask = numask; + aroscbase->acb_umask = numask; return oumask; } -static int __umask_init(void) +static int __umask_init(struct aroscbase *aroscbase) { - struct aroscbase *aroscbase = __get_aroscbase(), - *paroscbase; + struct aroscbase *paroscbase; paroscbase = __GM_GetBaseParent(aroscbase); /* FIXME: Implement umask() properly */ if (paroscbase && (paroscbase->acb_flags & (VFORK_PARENT | EXEC_PARENT))) - __umask = paroscbase->acb_umask; + aroscbase->acb_umask = paroscbase->acb_umask; else - __umask = S_IWGRP|S_IWOTH; + aroscbase->acb_umask = S_IWGRP|S_IWOTH; return 1; } -- 2.11.4.GIT