koyamanx / os-1 Goto Github PK
View Code? Open in Web Editor NEWA toy UNIX-like Operating System Version 1
A toy UNIX-like Operating System Version 1
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.
Limitations or features not implemented in kernel must use unimplemented() macros to panic.
int fstat(int fildes, struct stat *buf);
int stat(const char *restrict, struct stat *restrict);
Currently, we use struct type for dev_t, POSIX system call expect it as type of integer(u32).
Fix dev_t type declaration to comply standard.
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.
struct buf {
dev_t dev;
u64 blkno;
u8 *data;
bool dirty;
struct buf *next;
};
#include <unistd.h>
int truncate(const char *path, off_t length);
strncat, strcat関数をstring.h, string.cファイルに実装してください。
プロトタイプ宣言
char *strcat(char *dest, const char *src);
char *strncat(char *dest, const char *src, size_t n);
文字型配列destの末尾に文字列srcをn要素分コピーします。
destとsrcが重なっている場合には動作は未定義となります。
destの値
strncat(dest, src, strlen(src));を内部で呼び出してください。
destの値
int link(const char *path1, const char *path2);
path1 is existing file.
path2 is newly created file.
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.