GithubHelp home page GithubHelp logo

os-1's Introduction

Hi there 👋

koyamanX's GitHub stats

os-1's People

Contributors

koyamanx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

rei0515reten

os-1's Issues

Copy arguments of system calls from user space to kernel space

Copy arguments of system calls from user space to kernel space

Currently, arguments of system calls is modified directly in user space by translating virtual address.
It may destroy user space context if implementation of system calls in kernel space destroy argument by modifying them.
We need to fix them by coping user data in user space when argument is passed by references via pointer.

Support newlib for userland program

Support newlib for userland program

Steps

  • Port newlib for user program.
  • Support link and include libraries for cmake.
  • Replace all of libc function to newlib.

Implement stat and fstat system call

Implement stat and fstat system call

Prototype declarations

int fstat(int fildes, struct stat *buf);
int stat(const char *restrict, struct stat *restrict);

Implement system calls for minix3 file system

Implement write system call for minix3 filesystem

Features

  • Enlarge inode cache
  • Read from file in user mode
  • Write to file (zone allocation)
  • Open system call with flag other than O_CREAT.
  • O_TRUNC for open.
  • Indirect zone

Implement buffered I/O for block device

Implement buffered I/O for block device

Abstract

Requesting every reads operation for device will significantly lower the performances.
So read to in-memory buffer first, then use that buffer for operation.
On write, firstly read out to buffer, then write to buffer then do I/O operation so that
next read will hit in buffer.

Buffer struct

struct buf {
  dev_t dev;
  u64 blkno;
  u8 *data;
  bool dirty;
  struct buf *next;
};

Function

  • getblk(dev, blkno)
    • Get block associated to device(dev) and blkno pair, if not exist, allocate new entry.
  • brelse(buf)
    • Release buffer.
  • binit()
    • Init buffer freelist head.
  • bwrite(buf)
    • Write buffer to device. buf is not released.
  • bread(dev, blkno)
    • Read blk from dev at blkno. If buf is exist, use that entry, otherwise allocate new one.
  • bflush(dev)
    • Flush buffer associated to dev.

Implement truncate system call

Implement truncate system call

Prototype declaration

#include <unistd.h>
int truncate(const char *path, off_t length);

Description

  • The truncate() function shall cause the regular file named by path to have a size which shall be equal to length bytes.
  • If the file previously was larger than length, the extra data is discarded. If the file was previously shorter than length, its size is increased, and the extended area appears as if it were zero-filled.
  • Path should have write permissions.

strncat, strcatを実装する。

strncat, strcat関数をstring.h, string.cファイルに実装してください。

プロトタイプ宣言

char *strcat(char *dest, const char *src);
char *strncat(char *dest, const char *src, size_t n);

strncat説明

文字型配列destの末尾に文字列srcをn要素分コピーします。
destとsrcが重なっている場合には動作は未定義となります。

戻り値

destの値

strcat説明

strncat(dest, src, strlen(src));を内部で呼び出してください。

戻り値

destの値

Implement link system call

Implement link system call

Prototype declaration

int link(const char *path1, const char *path2);

path1 is existing file.
path2 is newly created file.

Description

The link function shall create a new directory entry for existing file, path1.
It share same inode, and reference counter in inode is incremented by one.

If path1 is directory, link fails.

Support interrupts in kernel

Support interrupts in kernel

Kernel can be lead to deadlock if all of processes enter sleep state.
For example, init process can be set to sleep state by calling waitpid for waiting its child to exit, and all of its children is also enter sleep. In this case, scheduler tries to find processes to run, but none is found, leading to deadlock in kernel.
To avoid this situation, we need to support traps in kernel.
For now, we use waitpid for polling mode in init process to avoid this situation.

Fix doxygen comments for fs.h

Fix doxygen comments for fs.h

  • doxygen comments in fs.h does not has brief, details annotation, so it may break render result.

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.