From: John Hodge Date: Wed, 8 Aug 2012 03:23:26 +0000 (+0800) Subject: Usermode - Renamed readdir() to SysReadDir() X-Git-Tag: rel0.15~706^2~55 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=808a29b42448b1229e07933050aa2b4cbe1fc923;p=tpg%2Facess2.git Usermode - Renamed readdir() to SysReadDir() - readdir() is a POSIX function operating on DIR* not file descriptors --- diff --git a/Usermode/Applications/CLIShell_src/main.c b/Usermode/Applications/CLIShell_src/main.c index 7abed27f..24889faf 100644 --- a/Usermode/Applications/CLIShell_src/main.c +++ b/Usermode/Applications/CLIShell_src/main.c @@ -352,7 +352,7 @@ void Command_Dir(int argc, char **argv) fileName = (char*)(tmpPath+dirLen); // Read Directory Content - while( (fp = readdir(dp, fileName)) ) + while( (fp = SysReadDir(dp, fileName)) ) { if(fp < 0) { diff --git a/Usermode/Applications/dhcpclient_src/main.c b/Usermode/Applications/dhcpclient_src/main.c index 820a119a..8831cd6e 100644 --- a/Usermode/Applications/dhcpclient_src/main.c +++ b/Usermode/Applications/dhcpclient_src/main.c @@ -171,7 +171,7 @@ void Scan_Dir(tInterface **IfaceList, const char *Directory) fprintf(stderr, "Unable to open directory '%s'\n", Directory); } - while( readdir(dp, filename) ) + while( SysReadDir(dp, filename) ) { if( filename[0] == '.' ) continue ; if( strcmp(filename, "lo") == 0 ) continue ; diff --git a/Usermode/Applications/ip_src/addr.c b/Usermode/Applications/ip_src/addr.c index 579aa477..cf5d5dca 100644 --- a/Usermode/Applications/ip_src/addr.c +++ b/Usermode/Applications/ip_src/addr.c @@ -131,7 +131,7 @@ void DumpInterfaces(void) dp = open(IPSTACK_ROOT, OPENFLAG_READ); - while( readdir(dp, filename) ) + while( SysReadDir(dp, filename) ) { if(filename[0] == '.') continue; DumpInterface(filename); diff --git a/Usermode/Applications/ip_src/routes.c b/Usermode/Applications/ip_src/routes.c index 1d60fbc6..f074bff8 100644 --- a/Usermode/Applications/ip_src/routes.c +++ b/Usermode/Applications/ip_src/routes.c @@ -118,7 +118,7 @@ void DumpRoutes(void) printf("Type\tNetwork \tGateway \tMetric\tIFace\n"); - while( readdir(dp, filename) ) + while( SysReadDir(dp, filename) ) { if(filename[0] == '.') continue; DumpRoute(filename); diff --git a/Usermode/Applications/ls_src/main.c b/Usermode/Applications/ls_src/main.c index 4be8f0ae..2394af61 100644 --- a/Usermode/Applications/ls_src/main.c +++ b/Usermode/Applications/ls_src/main.c @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) } // Traverse Directory - while( (tmp = readdir(fd, buf)) > 0 ) + while( (tmp = SysReadDir(fd, buf)) > 0 ) { // Error check if(tmp < 0) { diff --git a/Usermode/Libraries/Makefile.tpl b/Usermode/Libraries/Makefile.tpl index 7687f2e1..e252210d 100644 --- a/Usermode/Libraries/Makefile.tpl +++ b/Usermode/Libraries/Makefile.tpl @@ -37,7 +37,7 @@ endif $(_BIN): $(OBJ) $(_LIBS) @mkdir -p $(dir $(_BIN)) @echo [LD] -o $(BIN) $(OBJ) - $(LD) $(LDFLAGS) -o $(_BIN) $(OBJ) $(shell $(CC) -print-libgcc-file-name) + @$(LD) $(LDFLAGS) -o $(_BIN) $(OBJ) $(shell $(CC) -print-libgcc-file-name) @$(DISASM) -S $(_BIN) > $(_OBJPREFIX)$(BIN).dsm $(_OBJPREFIX)%.o: %.c diff --git a/Usermode/Libraries/ld-acess.so_src/arch/syscalls.s.h b/Usermode/Libraries/ld-acess.so_src/arch/syscalls.s.h index cd7b8fea..aef22474 100644 --- a/Usermode/Libraries/ld-acess.so_src/arch/syscalls.s.h +++ b/Usermode/Libraries/ld-acess.so_src/arch/syscalls.s.h @@ -46,7 +46,7 @@ SYSCALL3(write, SYS_WRITE) // int, uint, void* SYSCALL4(seek, SYS_SEEK) // int, uint64_t, int SYSCALL1(tell, SYS_TELL) // int SYSCALL3(finfo, SYS_FINFO) // int, void*, int -SYSCALL2(readdir, SYS_READDIR) // int, char* +SYSCALL2(SysReadDir, SYS_READDIR) // int, char* SYSCALL2(_SysGetACL,SYS_GETACL) // int, void* SYSCALL1(chdir, SYS_CHDIR) // char* SYSCALL3(ioctl, SYS_IOCTL) // int, int, void* diff --git a/Usermode/Libraries/ld-acess.so_src/export.c b/Usermode/Libraries/ld-acess.so_src/export.c index 32f70d22..1cec11ef 100644 --- a/Usermode/Libraries/ld-acess.so_src/export.c +++ b/Usermode/Libraries/ld-acess.so_src/export.c @@ -16,66 +16,25 @@ extern uint32_t __umodsi3(uint32_t Num, uint32_t Den); #define STR(x) _STR(x) #define EXP(sym) {&sym, STR(sym)} +#define SYSCALL0(name,num) EXP(name), +#define SYSCALL1(name,num) EXP(name), +#define SYSCALL2(name,num) EXP(name), +#define SYSCALL3(name,num) EXP(name), +#define SYSCALL4(name,num) EXP(name), +#define SYSCALL5(name,num) EXP(name), +#define SYSCALL6(name,num) EXP(name), + // === CONSTANTS === const struct { void *Value; char *Name; } caLocalExports[] = { EXP(gLoadedLibraries), - EXP(_exit), EXP(_errno), - EXP(clone), - EXP(kill), - EXP(yield), - EXP(sleep), - EXP(_SysWaitEvent), - EXP(waittid), - EXP(gettid), - EXP(getpid), - EXP(getuid), - EXP(getgid), - - EXP(setuid), - EXP(setgid), - - EXP(SysSetName), - //EXP(SysGetName), - - EXP(_SysTimestamp), - - //EXP(SysSetPri), - - EXP(SysSendMessage), - EXP(SysGetMessage), - - EXP(_SysSpawn), - EXP(execve), - EXP(SysLoadBin), - EXP(SysUnloadBin), - - EXP(_SysSetFaultHandler), - EXP(open), - EXP(reopen), - EXP(close), - EXP(read), - EXP(write), - EXP(seek), - EXP(tell), - EXP(finfo), - EXP(readdir), - EXP(_SysGetACL), - EXP(chdir), - EXP(ioctl), - EXP(_SysMount), - EXP(_SysSelect), - - EXP(_SysOpenChild), - - EXP(_SysGetPhys), - EXP(_SysAllocate), - EXP(_SysDebug), - + #define __ASSEMBLER__ + #include "arch/syscalls.s.h" + #undef __ASSEMBLER__ #if 0 EXP(__umoddi3), EXP(__udivdi3), diff --git a/Usermode/Libraries/ld-acess.so_src/include_exp/acess/sys.h b/Usermode/Libraries/ld-acess.so_src/include_exp/acess/sys.h index 368f2cc1..25a91be9 100644 --- a/Usermode/Libraries/ld-acess.so_src/include_exp/acess/sys.h +++ b/Usermode/Libraries/ld-acess.so_src/include_exp/acess/sys.h @@ -52,7 +52,8 @@ extern int gettid(void); extern int getpid(void); extern int _SysSetFaultHandler(int (*Handler)(int)); extern void SysSetName(const char *Name); -//extern int SysGetName(const char *Name); +extern int SysGetName(char *NameDest); +extern int SysSetPri(int Priority); extern int64_t _SysTimestamp(void); // --- Permissions --- @@ -72,8 +73,8 @@ extern int seek(int fd, int64_t offset, int whence); extern uint64_t tell(int fd); extern int ioctl(int fd, int id, void *data); extern int finfo(int fd, t_sysFInfo *info, int maxacls); -extern int readdir(int fd, char *dest); -extern int _SysOpenChild(int fd, char *name, int flags); +extern int SysReadDir(int fd, char *dest); +extern int _SysOpenChild(int fd, const char *name, int flags); extern int _SysGetACL(int fd, t_sysACL *dest); extern int _SysMount(const char *Device, const char *Directory, const char *Type, const char *Options); extern int _SysSelect(int nfds, fd_set *read, fd_set *write, fd_set *err, int64_t *timeout, unsigned int extraevents); diff --git a/Usermode/Libraries/libc.so_src/heap.c b/Usermode/Libraries/libc.so_src/heap.c index 779b0048..d529f658 100644 --- a/Usermode/Libraries/libc.so_src/heap.c +++ b/Usermode/Libraries/libc.so_src/heap.c @@ -448,7 +448,7 @@ LOCAL uint brk(uintptr_t newpos) void Heap_Dump(void) { heap_head *cur = _heap_start; - while( cur < _heap_end ) + while( cur < (heap_head*)_heap_end ) { switch( cur->magic ) {