Pkzd (Implementation of a UNIX-like operating system)

Source: Internet
Author: User
Tags time zones

PKZD: A simple implementation of a UNIX-like operating system, rewritten by UNIX V6
Note: The system's name is taken from the Game Pokemon and Zelda (note that Pkzd is not pmzd OH)
System Introduction:
Pkzd is a Unix-like operating system that is based on the simple request of a UNIX V6 rewrite, and the system is designed to be simple, so many designs are very rudimentary.
Simulation machine:
System Image pkzd.img can be run in Bochs, Qemu, and VirtualBox (the format of VirtualBox is HDD and the hard drive, just change pkzd.img to PKZD.HDD)
Hardware Support: x86 architecture
System pursuit Simple only support keyboard, display and IDE hard disk
System call: PKZD supports the following system calls:
pid_t fork (void);
int Execve (char *filename, Char **argv, char **envp);
int exit (int status);
pid_t Wait (int *status);
pid_t getpid (void);
pid_t getppid (void);
uid_t getuid (void);
uid_t geteuid (void);
gid_t getgid (void);
gid_t getegid (void);
int setpgid (void);
The function is System V, and the parent process should ensure that no child processes exist when calling this system call
int brk (UINT addr);
int creat (const char *pathname, mode_t mode);
int open (const char *pathname, int flags, mode_t mode);
int close (int fd);
int dup (int fd);
int read (int fd, char *buf, size_t CNT);
int write (int fd, const char *BUF, size_t CNT);
off_t lseek (int fd, off_t offset, int whence);
int Mknod (const char *pathname, mode_t mode, dev_t Dev);
int access (const char *pathname, mode_t mode);
int link (const char *oldpath, const char *newpath);
int unlink (const char *path);
int mkdir (const char *pathname, mode_t mode);
int rmdir (const char *pathname);
int chdir (char *pathname);
int stat (const char *pathname, struct stat *stbuf);
int Fstat (int fs, struct stat *stbuf);
Command: In order to save time, I did not write too many commands, currently only implemented the following command
Ls
The LS command only supports parameter-ACLU
Date
ChDir
Cat
File system: PKZD is using a simple inode-based file system
The FS directory has a subset of the simplest supporting files in the command
MKFS command:
MKFS Device Swapsize Inodenumber
Initializes a virtual disk, device is a virtual disk (pkzd.img), Swapsize is the number of blocks in swap space (at least 1024x768), Inodenumber is the number of inode (at least 100)
ls command:
LS Device directory
Lists all the files in the virtual disk device specified directory directories, directory must be an absolute path
RM command:
RM Device Pathname
Delete the specified file pathname of the virtual disk device, pathname must be an absolute path, pathname can be a file, special file, or empty directory
Cat command:
Cat Device Pathname
Displays the specified file pathname for the virtual disk device, pathname must be an absolute path, pathname can be a file or a special file
Link command:
./link Device Dest Source
Create a hard-link dest for source in the virtual disk, dest and source must be absolute paths
Mknod command:
./mknod Device Pathname Mode dev
Create a special file in the virtual disk pathname, pathname must be an absolute path, Dev is the device number
mode is the decimal of the value of the St_mode in the Linux struct struct STBUF
such as 16895 for the directory, 8630 for the character device, 33279 for the normal file
Add Command:
Add Device dest Source mode
Copy the normal file source in Linux (the pathname in Unix/linux) to the virtual disk's dest (absolute path in the virtual disk), the value of mode is the same as the mode in the Mknod command
Virtual disks:
The vdisk must contain kernel files/pkzd,/init, character device/dev/tty (device number must be 0), directory/bin (all commands are in this directory)
Signal:
System signals are only available in two cases, terminating or ignoring
Time:
Time is Beijing time, other time zones cannot display the time correctly. I do not know how to get the correct time zone information from the hardware, if you know please tell me.
System published in SourceForge: address as follows
https://sourceforge.net/projects/pkzd/

Pkzd (Implementation of a UNIX-like operating system)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.