From: John Hodge Date: Mon, 23 Jun 2014 10:20:59 +0000 (+0800) Subject: Tools/NetTest - Fix compilation errors X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=b18d54ac83b9ec53d4e7b4f0a7b4f33f840e2cc0;p=tpg%2Facess2.git Tools/NetTest - Fix compilation errors --- diff --git a/Tools/NetTest/vfs_shim.c b/Tools/NetTest/vfs_shim.c index 6d420646..d2d1d5fe 100644 --- a/Tools/NetTest/vfs_shim.c +++ b/Tools/NetTest/vfs_shim.c @@ -12,7 +12,7 @@ // === CODE === int VFS_AllocHandle(int bIsUser, tVFS_Node *Node, int Mode) { - const int maxfd = *Threads_GetMaxFD(); + const int maxfd = *Threads_GetMaxFD(NULL); tVFS_Handle *handles = *Threads_GetHandlesPtr(); if( !handles ) { handles = calloc( maxfd, sizeof(tVFS_Handle) ); @@ -34,7 +34,7 @@ int VFS_AllocHandle(int bIsUser, tVFS_Node *Node, int Mode) tVFS_Handle *VFS_GetHandle(int FD) { - const int maxfd = *Threads_GetMaxFD(); + const int maxfd = *Threads_GetMaxFD(NULL); tVFS_Handle *handles = *Threads_GetHandlesPtr(); if( !handles ) return NULL; @@ -47,7 +47,7 @@ tVFS_Handle *VFS_GetHandle(int FD) int VFS_SetHandle(int FD, tVFS_Node *Node, int Mode) { - const int maxfd = *Threads_GetMaxFD(); + const int maxfd = *Threads_GetMaxFD(NULL); tVFS_Handle *handles = *Threads_GetHandlesPtr(); if( !handles ) return -1; diff --git a/Tools/nativelib/threads.c b/Tools/nativelib/threads.c index dafdc404..f8044733 100644 --- a/Tools/nativelib/threads.c +++ b/Tools/nativelib/threads.c @@ -40,9 +40,12 @@ tGID Threads_GetGID(void) { return 0; } tTID Threads_GetTID(void) { return lpThreads_This ? lpThreads_This->TID : 0; } -int *Threads_GetMaxFD(void) { return &lpThreads_This->Process->MaxFDs; } -char **Threads_GetCWD(void) { return &lpThreads_This->Process->CWD; } -char **Threads_GetChroot(void) { return &lpThreads_This->Process->Chroot; } +static inline tProcess* getproc(tProcess *Process) { + return (Process ? Process : lpThreads_This->Process); +} +int *Threads_GetMaxFD(tProcess *Process) { return &getproc(Process)->MaxFDs; } +char **Threads_GetCWD(tProcess *Process) { return &getproc(Process)->CWD; } +char **Threads_GetChroot(tProcess *Process) { return &getproc(Process)->Chroot; } void **Threads_GetHandlesPtr(void) { return &lpThreads_This->Process->Handles; } void Threads_Yield(void) diff --git a/Usermode/common_settings.mk b/Usermode/common_settings.mk index 639cab17..1ac039dd 100644 --- a/Usermode/common_settings.mk +++ b/Usermode/common_settings.mk @@ -7,9 +7,9 @@ CFLAGS += -std=gnu99 -g LDFLAGS += -L $(ACESSDIR)/Externals/Output/$(ARCHDIR)/lib CRTI := $(OUTPUTDIR)Libs/crti.o -CRTBEGIN := $(shell $(CC) $(CFLAGS) -print-file-name=crtbegin.o) +CRTBEGIN := $(shell $(CC) $(CFLAGS) -print-file-name=crtbegin.o 2>/dev/null) CRT0 := $(OUTPUTDIR)Libs/crt0.o CRT0S := $(OUTPUTDIR)Libs/crt0S.o -CRTEND := $(shell $(CC) $(CFLAGS) -print-file-name=crtend.o) +CRTEND := $(shell $(CC) $(CFLAGS) -print-file-name=crtend.o 2>/dev/null) CRTN := $(OUTPUTDIR)Libs/crtn.o -LIBGCC_PATH = $(shell $(CC) -print-libgcc-file-name) +LIBGCC_PATH = $(shell $(CC) -print-libgcc-file-name 2>/dev/null)