X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=AcessNative%2Fld-acess_src%2Fexports.c;h=90eef8654649bad9cf04783bcb26c7d53bff7afd;hb=d02a9dd1f6752a65efe6a8326a86a288a4165c94;hp=9ee04f17df97b28e66c6994ce12a19bcf62a619f;hpb=9698333503f59d07ceb7d0b1bb89bacef05f37e8;p=tpg%2Facess2.git diff --git a/AcessNative/ld-acess_src/exports.c b/AcessNative/ld-acess_src/exports.c index 9ee04f17..90eef865 100644 --- a/AcessNative/ld-acess_src/exports.c +++ b/AcessNative/ld-acess_src/exports.c @@ -11,12 +11,11 @@ #include #include -#define DEBUG(v...) Debug(v) +#define DEBUG(v...) do{}while(0)//Debug(v) #define PAGE_SIZE 4096 typedef struct sFILE FILE; -extern FILE *stderr; extern void exit(int) __attribute__ ((noreturn)); extern int printf(const char *, ...); extern int fprintf(FILE *,const char *, ...); @@ -29,6 +28,7 @@ extern int giSyscall_ClientID; // Needed for execve extern void _InitSyscalls(void); extern void _CloseSyscalls(void); +extern void Warning(const char *Format, ...); extern void Debug(const char *Format, ...); extern int AllocateMemory(uintptr_t VirtAddr, size_t ByteCount); @@ -95,6 +95,7 @@ int acess_seek(int FD, int64_t Ofs, int Dir) { uint64_t acess_tell(int FD) { if(FD & NATIVE_FILE_MASK) return native_tell( FD & (NATIVE_FILE_MASK-1) ); + DEBUG("tell(0x%x)", FD); return _Syscall(SYS_TELL, ">i", FD); } @@ -142,14 +143,17 @@ int acess_select(int nfds, fd_set *read, fd_set *write, fd_set *error, time_t *t int acess__SysOpenChild(int fd, char *name, int flags) { + DEBUG("_SysOpenChild(0x%x, '%s', 0x%x)", fd, name, flags); return _Syscall(SYS_OPENCHILD, ">i >s >i", fd, name, flags); } int acess__SysGetACL(int fd, t_sysACL *dest) { + DEBUG("%s(0x%x, %p)", __func__, fd, dest); return _Syscall(SYS_GETACL, ">i s >s >s >s", Device, Directory, Type, Options); } @@ -172,10 +176,14 @@ uint64_t acess__SysAllocate(uint vaddr) // --- Process Management --- int acess_clone(int flags, void *stack) { + #ifdef __WIN32__ + Warning("Win32 does not support anything like fork(2), cannot emulate"); + exit(-1); + #else extern int fork(void); if(flags & CLONE_VM) { int ret, newID, kernel_tid=0; - printf("USERSIDE fork()\n"); + Debug("USERSIDE fork()"); newID = _Syscall(SYS_AN_FORK, "i i >d", DestTID, Length, Data); } -int acess_SysGetMessage(int *SourceTID, void *Data) +int acess_SysGetMessage(int *SourceTID, int BufLen, void *Data) { -// static __thread int lastlen = 1024; - int lastlen; - - lastlen = _Syscall(SYS_GETMSG, "i", Mask); } @@ -332,9 +342,11 @@ const tSym caBuiltinSymbols[] = { DEFSYM(sleep), DEFSYM(waittid), + DEFSYM(gettid), DEFSYM(setuid), DEFSYM(setgid), - DEFSYM(gettid), + DEFSYM(getuid), + DEFSYM(getgid), DEFSYM(SysSendMessage), DEFSYM(SysGetMessage),