⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unix.c

📁 GEEKOS是一个免费的操作系统内核
💻 C
字号:
/* * Emulation of Unix system calls and C library functions * Copyright (c) 2004, David H. Hovemeyer <daveho@cs.umd.edu> * $Revision: 1.2 $ *  * This is free software.  You are permitted to use, * redistribute, and modify it as specified in the file "COPYING". */#include <conio.h>#include <process.h>#include <fileio.h>#include <unix.h>int errno;static int Wrap(int rc){    if (rc < 0)	errno = rc;    else	errno = 0;    return rc;}int read(int fd, void *buf, size_t sz){    return Wrap(Read(fd, buf, sz));}int write(int fd, void *buf, size_t sz){    return Wrap(Write(fd, buf, sz));}int creat(const char *path, int flags){    return Wrap(Open(path, flags|O_CREATE));}int open(const char *path, int flags){    return Wrap(Open(path, flags|O_CREATE));}int close(int fd){    return Wrap(Close(fd));}int exit(int exitCode){    Exit(exitCode);    while (1);}const char *strerror(int errc){    return Get_Error_String(errc);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -