Usermode - Fixing syscall API
authorJohn Hodge <[email protected]>
Sat, 13 Aug 2011 03:38:55 +0000 (11:38 +0800)
committerJohn Hodge <[email protected]>
Sat, 13 Aug 2011 03:38:55 +0000 (11:38 +0800)
- Removed bitfields from ACL entries
- Fixed liburi's use of read/write
- Fixed IRC client's multi-line message support

Usermode/Applications/CLIShell_src/main.c
Usermode/Applications/irc_src/main.c
Usermode/Applications/ls_src/main.c
Usermode/Libraries/liburi.so_src/main.c
Usermode/include/sys/types.h

index 4378d1d..58432da 100644 (file)
@@ -553,19 +553,19 @@ void Command_Dir(int argc, char **argv)
                \r
                // Print Mode\r
                // - Owner\r
-               acl.group = 0;  acl.id = info.uid;\r
+               acl.object = info.uid;\r
                _SysGetACL(fp, &acl);\r
                if(acl.perms & 1)       modeStr[0] = 'r';       else    modeStr[0] = '-';\r
                if(acl.perms & 2)       modeStr[1] = 'w';       else    modeStr[1] = '-';\r
                if(acl.perms & 8)       modeStr[2] = 'x';       else    modeStr[2] = '-';\r
                // - Group\r
-               acl.group = 1;  acl.id = info.gid;\r
+               acl.object = info.gid | 0x80000000;\r
                _SysGetACL(fp, &acl);\r
                if(acl.perms & 1)       modeStr[3] = 'r';       else    modeStr[3] = '-';\r
                if(acl.perms & 2)       modeStr[4] = 'w';       else    modeStr[4] = '-';\r
                if(acl.perms & 8)       modeStr[5] = 'x';       else    modeStr[5] = '-';\r
                // - World\r
-               acl.group = 1;  acl.id = -1;\r
+               acl.object = 0xFFFFFFFF;\r
                _SysGetACL(fp, &acl);\r
                if(acl.perms & 1)       modeStr[6] = 'r';       else    modeStr[6] = '-';\r
                if(acl.perms & 2)       modeStr[7] = 'w';       else    modeStr[7] = '-';\r
index a08553a..20223bb 100644 (file)
@@ -115,8 +115,8 @@ int main(int argc, const char *argv[], const char *envp[])
        \r
        // HACK: Static server entry\r
        // UCC (University [of Western Australia] Computer Club) IRC Server\r
-       gWindow_Status.Server = Server_Connect( "UCC", "130.95.13.18", 6667 );\r
-//     gWindow_Status.Server = Server_Connect( "Freenode", "89.16.176.16", 6667 );\r
+//     gWindow_Status.Server = Server_Connect( "UCC", "130.95.13.18", 6667 );\r
+       gWindow_Status.Server = Server_Connect( "Freenode", "89.16.176.16", 6667 );\r
 //     gWindow_Status.Server = Server_Connect( "Host", "10.0.2.2", 6667 );\r
 //     gWindow_Status.Server = Server_Connect( "BitlBee", "192.168.1.34", 6667 );\r
        \r
@@ -425,7 +425,6 @@ tMessage *Message_Append(tServer *Server, int Type, const char *Source, const ch
        \r
        {\r
                int pos = SetCursorPos(giTerminal_Height-2, 0);\r
-               #if 1\r
                if( win == gpCurrentWindow ) {\r
                         int    prefixlen = strlen(Source) + 3;\r
                         int    avail = giTerminal_Width - prefixlen;\r
@@ -434,17 +433,12 @@ tMessage *Message_Append(tServer *Server, int Type, const char *Source, const ch
                        printf("[%s] %.*s\n", Source, avail, Message);\r
                        while( msglen > avail ) {\r
                                msglen -= avail;\r
+                               Message += avail;\r
                                printf("\x1B[T");\r
                                SetCursorPos(giTerminal_Height-2, prefixlen);\r
                                printf("%.*s\n", avail, Message);\r
                        }\r
                }\r
-               #else\r
-               if(win->Name[0])\r
-                       printf("%s/%s [%s] %s\n", win->Server->Name, win->Name, Source, Message);\r
-               else\r
-                       printf("(status) [%s] %s\n", Source, Message);\r
-               #endif\r
                SetCursorPos(-1, pos);\r
        }\r
        \r
@@ -578,10 +572,6 @@ void ParseServerLine(tServer *Server, char *Line)
                                break;\r
                        }\r
                }\r
-               else if( strcmp(cmd, "PING") == 0 )\r
-               {\r
-                       writef(Server->FD, "PONG %s\n", gsHostname);\r
-               }\r
                else if( strcmp(cmd, "NOTICE") == 0 )\r
                {\r
                        char    *class, *message;\r
@@ -623,10 +613,17 @@ void ParseServerLine(tServer *Server, char *Line)
                        Message_AppendF(Server, MSG_TYPE_SERVER, "", "", "Unknown message %s (%s)\n", cmd, Line+pos);\r
                }\r
        }\r
-       else {\r
+       else {          \r
+               cmd = GetValue(Line, &pos);\r
                \r
-               // Command to client\r
-               Message_AppendF(NULL, MSG_TYPE_UNK, "", "", "Client Command: %s", Line);\r
+               if( strcmp(cmd, "PING") == 0 ) {\r
+                       writef(Server->FD, "PONG %s\n", gsHostname);\r
+                       \r
+               }\r
+               else {\r
+                       // Command to client\r
+                       Message_AppendF(NULL, MSG_TYPE_UNK, "", "", "Client Command: %s", Line);\r
+               }\r
        }\r
 }\r
 \r
index db51613..6ea4da0 100644 (file)
@@ -243,19 +243,19 @@ void DisplayFile(char *Filename)
                
                // Get Permissions
                // - Owner
-               acl.group = 0;  acl.id = info.uid;
+               acl.object = info.uid;
                _SysGetACL(fd, &acl);
                if(acl.perms & 1)       perms |= 0400;  // R
                if(acl.perms & 2)       perms |= 0200;  // W
                if(acl.perms & 8)       perms |= 0100;  // X
                // - Group
-               acl.group = 1;  acl.id = info.gid;
+               acl.object = info.gid | 0x80000000;
                _SysGetACL(fd, &acl);
                if(acl.perms & 1)       perms |= 0040;  // R
                if(acl.perms & 2)       perms |= 0020;  // W
                if(acl.perms & 8)       perms |= 0010;  // X
                // - World
-               acl.group = 1;  acl.id = -1;
+               acl.object = 0xFFFFFFFF;
                _SysGetACL(fd, &acl);
                if(acl.perms & 1)       perms |= 0004;  // R
                if(acl.perms & 2)       perms |= 0002;  // W
index 57de6f6..419e05b 100644 (file)
@@ -324,13 +324,13 @@ int URI_file_Open(char *Host, int Port, char *Path, int Mode)
 }
 size_t URI_file_Read(int Handle, size_t Bytes, void *Buffer)
 {
-       printf("URI_file_Read: (Handle=%i, Bytes=%i, Buffer=%p)\n",
-               Handle, Bytes, Buffer);
-       return read(Handle, Bytes, Buffer);
+       printf("URI_file_Read: (Handle=%i, Buffer=%p, Bytes=%i)\n",
+               Handle, Buffer, Bytes);
+       return read(Handle, Buffer, Bytes);
 }
 size_t URI_file_Write(int Handle, size_t Bytes, void *Buffer)
 {
-       return write(Handle, Bytes, Buffer);
+       return write(Handle, Buffer, Bytes);
 }
 void URI_file_Close(int Handle)
 {
index 0d53cf0..84fb497 100644 (file)
@@ -41,7 +41,7 @@ typedef struct
 
 struct s_sysACL {
        unsigned long   object; //!< Group or user (bit 31 determines)
-       unsigned long   rawperms;       //!< Inverted by bit 31
+       unsigned long   perms;  //!< Inverted by bit 31
 };
 struct s_sysFInfo {
        unsigned int    uid;

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