1 / 11

Project 6: Implementing Message Passing, Input/Output Redirection, and Users/Permissions

This project involves implementing three main parts - message passing, input/output redirection, and users/permissions. It requires working with message queues, implementing circular queues for message passing, managing input/output redirection, and handling permissions for processes.

corbo
Download Presentation

Project 6: Implementing Message Passing, Input/Output Redirection, and Users/Permissions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Project 6 • Requires working project 5 • Three main parts • Message passing • Input/Output redirection • Users/Permissions

  2. Message Passing • Create with MessageQueueCreate(char *name) • If no message queue with name, create • Otherwise, grant access to existing • Use existing Read/Write/Close (new filesystem FS_TYPE_IPC) • vfs.c Read example: • If (PFAT) do what it does now • Else If (GOSFS) GOSFS_Read() • Else if (IPC) Message_Queue_Read() • You implement Message_Queue_Read • Read from empty blocks a process • Write to full blocks a process

  3. Message Passing • size = 4 • Implement as circular queue

  4. Input/Output Redirection • Change Spawn_Program(char *program) to Spawn_Program(char *program, int stdin, int stdout) • For every process file descriptor 0 is input • For every process file descriptor 1 is output • Make sure supplied file descriptors are valid

  5. FS_TYPE_CONSOLE • Console is a new file type in vsf • vfs.c Read • If (CONSOLE) Get_Key • vsf.c Write • If (CONSOLE) Print() • Modify Print_String to call Write(1) • Allows output redirection automatically

  6. Redirection Example • Parent process • int fd = Open(“/d/output”); • Spawn_Program(“/c/a.exe”, 0, fd); • Close(fd); • Child process (a.exe) • Write(1, “string”); // writes to file fd • Printf(“string”); // writes to file fd

  7. Permissions • Each UserContext has a new field called uid • Indicates user running this process • Superuser is uid 0 • Used to test for GOSFS operations • Open checks permissions requested versus existing • Creating file requires write on parent directory • CreateDirectory requires write on parent directory • Delete requires write to access file/directory • SetAcl requires write access to file/directory • Read, Write, Seek, Stat, and Close do not check rights (checked in Open) • Superuser (uid 0) always has all rights (independent of ACL) • Used to pass permissions to spawned process • More on this later

  8. Modifying UID • SetEffectiveUid(int uid) • Sets the uid to supplied uid for current process • Only sets if current user is superuser (uid == 0) • int GetUid() • Returns current process’ uid

  9. Spawn Modification • New elf.c can spawn a process off GOSFS drive • /d/a.exe will work • How to set spawned process uid? • Copy uid from parent process? • Some processes need more rights than parent • passwd command in UNIX • Use setUid bit in GOSFSFileNode • If setUid bit is 0 • Copy uid from parent process • If setUid bit is 1 • Use acl[0].uid as the process’ uid

  10. GOSFSFileNode Enhancements • aclEntry acl[4] • Table of aclEntries • Each entry contains a uid and permissions • acl[0] is the owner • Set when the file/directory is created set to have full rights • setUid:1; • Indicates whether program should run with permissions of parent process or of file owner

  11. SetAcl • SYS_SET_ACL • SetAcl(char *name, int uid, int permissions) • Permissions can be • O_READ, O_WRITE, O_READ | O_WRITE, 0 • Find file by name • Store permissions for supplied uid • if uid already in acl list – update • if permissions == 0 – erase rights for uid

More Related