Usermode - Renamed readdir() to SysReadDir()
authorJohn Hodge <[email protected]>
Wed, 8 Aug 2012 03:23:26 +0000 (11:23 +0800)
committerJohn Hodge <[email protected]>
Wed, 8 Aug 2012 03:23:26 +0000 (11:23 +0800)
- readdir() is a POSIX function operating on DIR* not file descriptors

Usermode/Applications/CLIShell_src/main.c
Usermode/Applications/dhcpclient_src/main.c
Usermode/Applications/ip_src/addr.c
Usermode/Applications/ip_src/routes.c
Usermode/Applications/ls_src/main.c
Usermode/Libraries/Makefile.tpl
Usermode/Libraries/ld-acess.so_src/arch/syscalls.s.h
Usermode/Libraries/ld-acess.so_src/export.c
Usermode/Libraries/ld-acess.so_src/include_exp/acess/sys.h
Usermode/Libraries/libc.so_src/heap.c

index 7abed27..24889fa 100644 (file)
@@ -352,7 +352,7 @@ void Command_Dir(int argc, char **argv)
        \r
        fileName = (char*)(tmpPath+dirLen);\r
        // Read Directory Content\r
-       while( (fp = readdir(dp, fileName)) )\r
+       while( (fp = SysReadDir(dp, fileName)) )\r
        {\r
                if(fp < 0)\r
                {\r
index 820a119..8831cd6 100644 (file)
@@ -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 ;
index 579aa47..cf5d5dc 100644 (file)
@@ -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);
index 1d60fbc..f074bff 100644 (file)
@@ -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);
index 4be8f0a..2394af6 100644 (file)
@@ -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) {
index 7687f2e..e252210 100644 (file)
@@ -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
index cd7b8fe..aef2247 100644 (file)
@@ -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*
index 32f70d2..1cec11e 100644 (file)
@@ -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),
index 368f2cc..25a91be 100644 (file)
@@ -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);
index 779b004..d529f65 100644 (file)
@@ -448,7 +448,7 @@ LOCAL uint brk(uintptr_t newpos)
 void Heap_Dump(void)\r
 {\r
        heap_head *cur = _heap_start;\r
-       while( cur < _heap_end )\r
+       while( cur < (heap_head*)_heap_end )\r
        {\r
                switch( cur->magic )\r
                {\r

UCC git Repository :: git.ucc.asn.au