// === 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) );
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;
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;
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)
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)