Giter Club home page Giter Club logo

fsop's Introduction

fsop - FileSystem OPerations


fsop is a command-line utility program for demonstrating various system calls for files in action. fsop allows the user to create, read, write and inspect regular, unnamed and named pipes in their target platform's filesystem.

Execution & Usage

  • For execution, ensure that either the executable provided alongside the copy of the program (see notes) or one built manually for your target architecture (see building) is available.

  • Usage

    ./fsop.out [-d DIRECTORY] [-q] [-h] {create,read,write,inspect} ...
    ./fsop.out create [-h] [-p PERMS] [-t {pipe,regular}] [-o] path
    ./fsop.out read [-h] [-p] [-b OFFSET...] [-B {CUR,END,SET}...] [-c BYTE-COUNT...] [path]
    ./fsop.out write [--lbuf] [-h] [-A] [-t] [-b OFFSET...] [-B {CUR,END,SET}...] [-p] [path]
    ./fsop.out inspect [-h] [-l] path...
  • Information about usage, flags and options can also be accessed by executing ./fsop --help on a terminal.

  • More information about actions can be accessed using the --help flag alongside the specific action, for example ./fsop.out create --help to view help on how to use create.

Examples

  • Create a new regular file, named file.txt, with permissions rwx for all users (simple creation, no data written):
    ./fsop.out create file.txt --type regular --perms ugo+rwx
  • Read the complete contents of the file myfile.txt (provided it exists):
    ./fsop.out read myfile.txt
  • Write input provided on STDIN to offset 40 from the beginning to the file myfile.txt (provided file exists):
    ./fsop.out write myfile.txt --offset 40 --offset-base SET
  • Inspect all files under the folder /dev:
    ./fsop.out inspect /dev/*

System Call Usage

Task System Call(s) Used
Create New Files creat, mknod
Access Existing Files open, read, write, lseek (lseek64), close
Manipulate the Inode chdir, chmod, stat (fstat, lstat, stat64, ...)
Advanced System Calls dup, pipe, unlink
Miscellaneous (non-fs) fork, getpid, signal, exit, getpwuid, getgrgid

Building

  • Prerequisites

    The following software is required prior compilation of the source:
    • GNU C++ Compiler (g++) version 7 or newer, or any equivalent C++ compiler with support for C++17.
    • GNU Make or equivalent to execute commands from makefiles (optional, recommended). See notes for a workaround for compilation without Make.
  • Compilation

    • Prior to compilation, clean up any remaining object and executable files from previously incomplete builds, by running make clean.
    • To generate object files and executables, run the default make recipe, using make.

Notes

  • The executable provided alongside the project has been compiled on a 64-bit (arch: x86_64) Windows machine running the Windows Subsystem for Linux (WSL) (kernel version: 5.10.102.1-microsoft-standard-WSL2), using the GNU C++ Compiler v9.3.0.
  • If GNU make is not installed on the target machine being used for compilation, then either it may be installed via sudo apt install make (recommended), or the make.bash script supplied alongside the source may be utilized to execute the equivalent Make recipes. To use the script, in the compilation steps replace the usage of make with ./make.bash (e.g.: make clean -> ./make.bash clean).

About

Created by: Kinshuk Vasisht
Roll Number: 19
M.Sc. Computer Science
Department of Computer Science, University of Delhi

Bibliography

  • The Design of the UNIX Operating System, Maurice J. Bach
  • Linux Manual Pages for System Calls and Functions: man7, linux.die.net

Reference

fsop's People

Contributors

kinshuk-h avatar

Watchers

James Cloos avatar  avatar

Forkers

abhigyan-mishra

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.