From: John Hodge Date: Sat, 13 Aug 2011 03:38:55 +0000 (+0800) Subject: Usermode - Fixing syscall API X-Git-Tag: rel0.11~152 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=ad39285c100ee2c5e5a34a9c1010d10fcea77067;p=tpg%2Facess2.git Usermode - Fixing syscall API - Removed bitfields from ACL entries - Fixed liburi's use of read/write - Fixed IRC client's multi-line message support --- diff --git a/Usermode/Applications/CLIShell_src/main.c b/Usermode/Applications/CLIShell_src/main.c index 4378d1db..58432daf 100644 --- a/Usermode/Applications/CLIShell_src/main.c +++ b/Usermode/Applications/CLIShell_src/main.c @@ -553,19 +553,19 @@ void Command_Dir(int argc, char **argv) // Print Mode // - Owner - acl.group = 0; acl.id = info.uid; + acl.object = info.uid; _SysGetACL(fp, &acl); if(acl.perms & 1) modeStr[0] = 'r'; else modeStr[0] = '-'; if(acl.perms & 2) modeStr[1] = 'w'; else modeStr[1] = '-'; if(acl.perms & 8) modeStr[2] = 'x'; else modeStr[2] = '-'; // - Group - acl.group = 1; acl.id = info.gid; + acl.object = info.gid | 0x80000000; _SysGetACL(fp, &acl); if(acl.perms & 1) modeStr[3] = 'r'; else modeStr[3] = '-'; if(acl.perms & 2) modeStr[4] = 'w'; else modeStr[4] = '-'; if(acl.perms & 8) modeStr[5] = 'x'; else modeStr[5] = '-'; // - World - acl.group = 1; acl.id = -1; + acl.object = 0xFFFFFFFF; _SysGetACL(fp, &acl); if(acl.perms & 1) modeStr[6] = 'r'; else modeStr[6] = '-'; if(acl.perms & 2) modeStr[7] = 'w'; else modeStr[7] = '-'; diff --git a/Usermode/Applications/irc_src/main.c b/Usermode/Applications/irc_src/main.c index a08553a0..20223bbf 100644 --- a/Usermode/Applications/irc_src/main.c +++ b/Usermode/Applications/irc_src/main.c @@ -115,8 +115,8 @@ int main(int argc, const char *argv[], const char *envp[]) // HACK: Static server entry // UCC (University [of Western Australia] Computer Club) IRC Server - gWindow_Status.Server = Server_Connect( "UCC", "130.95.13.18", 6667 ); -// gWindow_Status.Server = Server_Connect( "Freenode", "89.16.176.16", 6667 ); +// gWindow_Status.Server = Server_Connect( "UCC", "130.95.13.18", 6667 ); + gWindow_Status.Server = Server_Connect( "Freenode", "89.16.176.16", 6667 ); // gWindow_Status.Server = Server_Connect( "Host", "10.0.2.2", 6667 ); // gWindow_Status.Server = Server_Connect( "BitlBee", "192.168.1.34", 6667 ); @@ -425,7 +425,6 @@ tMessage *Message_Append(tServer *Server, int Type, const char *Source, const ch { int pos = SetCursorPos(giTerminal_Height-2, 0); - #if 1 if( win == gpCurrentWindow ) { int prefixlen = strlen(Source) + 3; int avail = giTerminal_Width - prefixlen; @@ -434,17 +433,12 @@ tMessage *Message_Append(tServer *Server, int Type, const char *Source, const ch printf("[%s] %.*s\n", Source, avail, Message); while( msglen > avail ) { msglen -= avail; + Message += avail; printf("\x1B[T"); SetCursorPos(giTerminal_Height-2, prefixlen); printf("%.*s\n", avail, Message); } } - #else - if(win->Name[0]) - printf("%s/%s [%s] %s\n", win->Server->Name, win->Name, Source, Message); - else - printf("(status) [%s] %s\n", Source, Message); - #endif SetCursorPos(-1, pos); } @@ -578,10 +572,6 @@ void ParseServerLine(tServer *Server, char *Line) break; } } - else if( strcmp(cmd, "PING") == 0 ) - { - writef(Server->FD, "PONG %s\n", gsHostname); - } else if( strcmp(cmd, "NOTICE") == 0 ) { char *class, *message; @@ -623,10 +613,17 @@ void ParseServerLine(tServer *Server, char *Line) Message_AppendF(Server, MSG_TYPE_SERVER, "", "", "Unknown message %s (%s)\n", cmd, Line+pos); } } - else { + else { + cmd = GetValue(Line, &pos); - // Command to client - Message_AppendF(NULL, MSG_TYPE_UNK, "", "", "Client Command: %s", Line); + if( strcmp(cmd, "PING") == 0 ) { + writef(Server->FD, "PONG %s\n", gsHostname); + + } + else { + // Command to client + Message_AppendF(NULL, MSG_TYPE_UNK, "", "", "Client Command: %s", Line); + } } } diff --git a/Usermode/Applications/ls_src/main.c b/Usermode/Applications/ls_src/main.c index db516130..6ea4da0c 100644 --- a/Usermode/Applications/ls_src/main.c +++ b/Usermode/Applications/ls_src/main.c @@ -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 diff --git a/Usermode/Libraries/liburi.so_src/main.c b/Usermode/Libraries/liburi.so_src/main.c index 57de6f6a..419e05bc 100644 --- a/Usermode/Libraries/liburi.so_src/main.c +++ b/Usermode/Libraries/liburi.so_src/main.c @@ -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) { diff --git a/Usermode/include/sys/types.h b/Usermode/include/sys/types.h index 0d53cf03..84fb497d 100644 --- a/Usermode/include/sys/types.h +++ b/Usermode/include/sys/types.h @@ -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;