From 3de635c0308c6f7c782f95d74d99898256cb274f Mon Sep 17 00:00:00 2001 From: wang904 <1234366@qq.com> Date: Tue, 16 Aug 2022 10:34:42 +0800 Subject: [PATCH 1/6] update libc documents --- docs/userland/libc/apis/api列表/ctype.rst | 41 +++++ docs/userland/libc/apis/api列表/dirent.rst | 64 +++++++ docs/userland/libc/apis/api列表/errno.rst | 184 +++++++++++++++++++++ docs/userland/libc/apis/api列表/fcntl.rst | 44 +++++ docs/userland/libc/apis/api列表/math.rst | 20 +++ docs/userland/libc/apis/api列表/printf.rst | 3 + docs/userland/libc/apis/api列表/stddef.rst | 11 ++ docs/userland/libc/apis/api列表/stdio.rst | 52 ++++++ docs/userland/libc/apis/api列表/stdlib.rst | 20 +++ docs/userland/libc/apis/api列表/string.rst | 25 +++ docs/userland/libc/apis/api列表/time.rst | 32 ++++ docs/userland/libc/apis/api列表/unistd.rst | 56 +++++++ docs/userland/libc/apis/index.rst | 20 ++- 13 files changed, 568 insertions(+), 4 deletions(-) create mode 100644 docs/userland/libc/apis/api列表/ctype.rst create mode 100644 docs/userland/libc/apis/api列表/dirent.rst create mode 100644 docs/userland/libc/apis/api列表/errno.rst create mode 100644 docs/userland/libc/apis/api列表/fcntl.rst create mode 100644 docs/userland/libc/apis/api列表/math.rst create mode 100644 docs/userland/libc/apis/api列表/printf.rst create mode 100644 docs/userland/libc/apis/api列表/stddef.rst create mode 100644 docs/userland/libc/apis/api列表/stdio.rst create mode 100644 docs/userland/libc/apis/api列表/stdlib.rst create mode 100644 docs/userland/libc/apis/api列表/string.rst create mode 100644 docs/userland/libc/apis/api列表/time.rst create mode 100644 docs/userland/libc/apis/api列表/unistd.rst diff --git a/docs/userland/libc/apis/api列表/ctype.rst b/docs/userland/libc/apis/api列表/ctype.rst new file mode 100644 index 00000000..2a1c5c4e --- /dev/null +++ b/docs/userland/libc/apis/api列表/ctype.rst @@ -0,0 +1,41 @@ +ctype.h +==================================== +函数列表(这里只列出已实现的函数): + ==== + + ``int isprint(int c)`` : 传入一个字符,判断是否可以被输出 + + ``int islower(int c)`` : 传入一个字符,判断是否是小写字母 + + ``int isupper(int c)`` : 传入一个字符,判断是否是大写字母 + + ``int isalpha(int c)`` : 传入一个字符,判断是否是字母 + + ``int isdigit(int c)`` : 传入一个字符,判断是否是数字 + + ``int toupper(int c)`` : 传入一个小写字母字符,返回这个字母的大写形式 + + ``int tolower(int c)`` : 传入一个大写字母字符,返回这个字母的小写形式 + + ``int isspace(int c)`` : 传入一个字符,判断是否是空白字符 + +宏定义: + ==== + + 暂无用处 + + ``#define _U 01`` + + ``#define _L 02`` + + ``#define _N 04`` + + ``#define _S 010`` + + ``#define _P 020`` + + ``#define _C 040`` + + ``#define _X 0100`` + + ``#define _B 0200`` \ No newline at end of file diff --git a/docs/userland/libc/apis/api列表/dirent.rst b/docs/userland/libc/apis/api列表/dirent.rst new file mode 100644 index 00000000..e0cb0f0c --- /dev/null +++ b/docs/userland/libc/apis/api列表/dirent.rst @@ -0,0 +1,64 @@ +dirent.h +==================================== +简介 + ==== + 与文件夹有关的头文件。 + +结构体列表: + =========================== + + ``struct DIR`` : + + 变量列表: + + ``int fd`` : 文件夹id(不推荐修改) + + ``int buf_pos`` : 文件夹缓冲区指针的位置 + + ``int buf_len`` : 文件夹缓冲区的大小(默认为256) + + ``struct dirent`` : + + 变量列表: + + ``ino_t(see libc/sys/types.h) ino`` : 文件序列号(不推荐修改) + + ``off_t d_off`` : dir偏移量(不推荐修改) + + ``unsigned short d_reclen`` : 文件夹中的记录数 + + ``unsigned char d_type`` : 目标的类型(有可能是文件,文件夹,磁盘) + + ``char d_name[]`` : 目标的名字 + +函数列表(这里只列出已实现的函数): + =========================== + + ``DIR opendir(const char *path)`` + + 传入文件夹的路径,返回文件夹结构体 + + ``int closedir(DIR *dirp)`` + + 传入文件夹结构体,关闭文件夹,释放内存 + + 若失败,返回-1 + + ``dirent readdir(DIR *dir)`` + + 传入文件夹结构体,读入文件夹里的内容,并打包为dirent结构体返回 + +宏定义: + =========================== + + 文件夹类型: + + ``#define VFS_ATTR_FILE (1UL << 0)`` + + ``#define VFS_ATTR_DIR (1UL << 1)`` + + ``#define VFS_ATTR_DEVICE (1UL << 2)`` + + 缓冲区长度的默认值 + + ``#define DIR_BUF_SIZE 256`` diff --git a/docs/userland/libc/apis/api列表/errno.rst b/docs/userland/libc/apis/api列表/errno.rst new file mode 100644 index 00000000..fa18bc62 --- /dev/null +++ b/docs/userland/libc/apis/api列表/errno.rst @@ -0,0 +1,184 @@ +errno.h +==================================== +简介: + =========== + 共享错误号码 +属性: + =========== + ``extern int errno`` : 通用错误代码 +宏定义(复制自代码,了解即可): + =========== + #define E2BIG 1 /* 参数列表过长,或者在输出buffer中缺少空间 或者参数比系统内建的最大值要大 Argument list too long. */ + + #define EACCES 2 /* 访问被拒绝 Permission denied */ + + #define EADDRINUSE 3 /* 地址正在被使用 Address in use.*/ + + #define EADDRNOTAVAIL 4 /* 地址不可用 Address not available.*/ + + #define EAFNOSUPPORT 5 /* 地址family不支持 Address family not supported. */ + + #define EAGAIN 6 /* 资源不可用,请重试。 Resource unavailable, try again (may be the same value as [EWOULDBLOCK]).*/ + + #define EALREADY 7 /* 连接已经在处理 Connection already in progress. */ + + #define EBADF 8 /* 错误的文件描述符 Bad file descriptor. */ + + #define EBADMSG 9 /* 错误的消息 Bad message. */ + + + #define EBUSY 10 /* 设备或资源忙 Device or resource busy. */ + + #define ECANCELED 11 /* 操作被取消 Operation canceled. */ + + #define ECHILD 12 /* 没有子进程 No child processes. */ + + #define ECONNABORTED 13 /* 连接已断开 Connection aborted. */ + + #define ECONNREFUSED 14 /* 连接被拒绝 Connection refused. */ + + #define ECONNRESET 15 /* 连接被重置 Connection reset. */ + + #define EDEADLK 16 /* 资源死锁将要发生 Resource deadlock would occur. */ + + #define EDESTADDRREQ 17 /* 需要目标地址 Destination address required.*/ + + #define EDOM 18 /* 数学参数超出作用域 Mathematics argument out of domain of function. */ + + #define EDQUOT 19 /* 保留使用 Reserved */ + + + + #define EEXIST 20 /* 文件已存在 File exists. */ + + #define EFAULT 21 /* 错误的地址 Bad address */ + + #define EFBIG 22 /* 文件太大 File too large. */ + + #define EHOSTUNREACH 23 /* 主机不可达 Host is unreachable.*/ + + #define EIDRM 24 /* 标志符被移除 Identifier removed. */ + + #define EILSEQ 25 /* 不合法的字符序列 Illegal byte sequence. */ + + #define EINPROGRESS 26 /* 操作正在处理 Operation in progress. */ + + #define EINTR 27 /* 被中断的函数 Interrupted function. */ + + #define EINVAL 28 /* 不可用的参数 Invalid argument. */ + + #define EIO 29 /* I/O错误 I/O error. */ + + + + #define EISCONN 30 /* 套接字已连接 Socket is connected. */ + + #define EISDIR 31 /* 是一个目录 Is a directory */ + + #define ELOOP 32 /* 符号链接级别过多 Too many levels of symbolic links. */ + + #define EMFILE 33 /* 文件描述符的值过大 File descriptor value too large. */ + + #define EMLINK 34 /* 链接数过多 Too many links. */ + + #define EMSGSIZE 35 /* 消息过大 Message too large. */ + + #define EMULTIHOP 36 /* 保留使用 Reserved. */ + + #define ENAMETOOLONG 37 /* 文件名过长 Filename too long. */ + + #define ENETDOWN 38 /* 网络已关闭 Network is down. */ + + #define ENETRESET 39 /* 网络连接已断开 Connection aborted by network. */ + + #define ENETUNREACH 40 /* 网络不可达 Network unreachable. */ + + #define ENFILE 41 /* 系统中打开的文件过多 Too many files open in system.*/ + + #define ENOBUFS 42 /* 缓冲区空间不足 No buffer space available. */ + + #define ENODATA 43 /* 队列头没有可读取的消息 No message is available on the STREAM head read queue. */ + + #define ENODEV 44 /* 没有指定的设备 No such device. */ + + #define ENOENT 45 /* 没有指定的文件或目录 No such file or directory. */ + + #define ENOEXEC 46 /* 可执行文件格式错误 Executable file format error. */ + + #define ENOLCK 47 /* 没有可用的锁 No locks available. */ + + #define ENOLINK 48 /* 保留 Reserved. */ + + + #define ENOMEM 49 /* 没有足够的空间 Not enough space. */ + + + #define ENOMSG 50 /* 没有期待类型的消息 No message of the desired type. */ + + #define ENOPROTOOPT 51 /* 协议不可用 Protocol not available. */ + + #define ENOSPC 52 /* 设备上没有空间 No space left on device. */ + + #define ENOSR 53 /* 没有STREAM资源 No STREAM resources.*/ + + #define ENOSTR 54 /* 不是STREAM Not a STREAM */ + + #define ENOSYS 55 /* 功能不支持 Function not supported. */ + + #define ENOTCONN 56 /* 套接字未连接 The socket is not connected. */ + + #define ENOTDIR 57 /* 不是目录 Not a directory. */ + + #define ENOTEMPTY 58 /* 目录非空 Directory not empty. */ + + #define ENOTRECOVERABLE 59 /* 状态不可覆盖 State not recoverable. */ + + + + #define ENOTSOCK 60 /* 不是一个套接字 Not a socket.*/ + + #define ENOTSUP 61 /* 不被支持 Not supported (may be the same value as [EOPNOTSUPP]). */ + + #define ENOTTY 62 /* 不正确的I/O控制操作 Inappropriate I/O control operation. */ + + #define ENXIO 63 /* 没有这样的设备或地址 No such device or address. */ + + #define EOPNOTSUPP 64 /* 套接字不支持该操作 Operation not supported on socket (may be the same value as [ENOTSUP]). */ + + #define EOVERFLOW 65 /* 数值过大,产生溢出 Value too large to be stored in data type. */ + + #define EOWNERDEAD 66 /* 之前的拥有者挂了 Previous owner died. */ + + #define EPERM 67 /* 操作不被允许 Operation not permitted. */ + + #define EPIPE 68 /* 断开的管道 Broken pipe. */ + + #define EPROTO 69 /* 协议错误 Protocol error. */ + + + + #define EPROTONOSUPPORT 70 /* 协议不被支持 Protocol not supported. */ + + #define EPROTOTYPE 71 /* 对于套接字而言,错误的协议 Protocol wrong type for socket. */ + + #define ERANGE 72 /* 结果过大 Result too large. */ + + #define EROFS 73 /* 只读的文件系统 Read-only file system. */ + + #define ESPIPE 74 /* 错误的寻道 Invalid seek. */ + + #define ESRCH 75 /* 没有这样的进程 No such process. */ + + #define ESTALE 76 /* 保留 Reserved. */ + + #define ETIME 77 /* 流式ioctl()超时 Stream ioctl() timeout */ + + #define ETIMEDOUT 78 /* 连接超时 Connection timed out.*/ + + #define ETXTBSY 79 /* 文本文件忙 Text file busy. */ + + + + #define EWOULDBLOCK 80 /* 操作将被禁止 Operation would block (may be the same value as [EAGAIN]). */ + + #define EXDEV 81 /* 跨设备连接 Cross-device link. */ diff --git a/docs/userland/libc/apis/api列表/fcntl.rst b/docs/userland/libc/apis/api列表/fcntl.rst new file mode 100644 index 00000000..c6967a43 --- /dev/null +++ b/docs/userland/libc/apis/api列表/fcntl.rst @@ -0,0 +1,44 @@ +fcntl.h +==================================== +简介 + ======== + 文件操作 +函数列表: + ======== + ``int open(const char * path,int options, ...)`` + + 传入文件路径,和文件类型(详细请看下面的宏定义),将文件打开并返回文件id。 + +宏定义(粘贴自代码,了解即可): + ======== + #define O_RDONLY 00000000 // Open Read-only + + #define O_WRONLY 00000001 // Open Write-only + + #define O_RDWR 00000002 // Open read/write + + #define O_ACCMODE 00000003 // Mask for file access modes + + + #define O_CREAT 00000100 // Create file if it does not exist + + #define O_EXCL 00000200 // Fail if file already exists + + #define O_NOCTTY 00000400 // Do not assign controlling terminal + + #define O_TRUNC 00001000 // 文件存在且是普通文件,并以O_RDWR或O_WRONLY打开,则它会被清空 + + #define O_APPEND 00002000 // 文件指针会被移动到文件末尾 + + #define O_NONBLOCK 00004000 // 非阻塞式IO模式 + + + #define O_EXEC 00010000 // 以仅执行的方式打开(非目录文件) + + #define O_SEARCH 00020000 // Open the directory for search only + + #define O_DIRECTORY 00040000 // 打开的必须是一个目录 + + #define O_NOFOLLOW 00100000 // Do not follow symbolic links + + diff --git a/docs/userland/libc/apis/api列表/math.rst b/docs/userland/libc/apis/api列表/math.rst new file mode 100644 index 00000000..74f763a9 --- /dev/null +++ b/docs/userland/libc/apis/api列表/math.rst @@ -0,0 +1,20 @@ +math.h +==================================== +简介: + ====== + 数学库 + +函数列表: + ``double fabs(double x)`` : 返回 x 的绝对值 + + ``float fabsf(float x)`` : 返回 x 的绝对值 + + ``long double fabsl(long double x)``: 返回 x 的绝对值 + + ``double round(double x)`` 四舍五入 x + + ``float roundf(float x)`` 四舍五入 x + + ``long double roundl(long double x)`` 四舍五入 x + + ``int64_t pow(int64_t x,int y)`` 返回 x 的 y 次方 \ No newline at end of file diff --git a/docs/userland/libc/apis/api列表/printf.rst b/docs/userland/libc/apis/api列表/printf.rst new file mode 100644 index 00000000..eb6e4cd3 --- /dev/null +++ b/docs/userland/libc/apis/api列表/printf.rst @@ -0,0 +1,3 @@ +printf.h +==================================== +不建议引用,需要 ``printf`` 函数请引用 ``stdio.h`` \ No newline at end of file diff --git a/docs/userland/libc/apis/api列表/stddef.rst b/docs/userland/libc/apis/api列表/stddef.rst new file mode 100644 index 00000000..d9dad7c5 --- /dev/null +++ b/docs/userland/libc/apis/api列表/stddef.rst @@ -0,0 +1,11 @@ +stddef.h +==================================== +简介: + ====== + 定义了关于指针的常用类型 + +定义: + ===== + ``typedef __PTDIFF_TYPE__ ptrdiff_t`` : 两个指针相减的结果类型 + + ``NULL ((void *) 0)`` : 空指针 \ No newline at end of file diff --git a/docs/userland/libc/apis/api列表/stdio.rst b/docs/userland/libc/apis/api列表/stdio.rst new file mode 100644 index 00000000..c75910f1 --- /dev/null +++ b/docs/userland/libc/apis/api列表/stdio.rst @@ -0,0 +1,52 @@ +stdio.h +==================================== +简介: + ======= + 向标准输入输出里操作 +函数列表: + ====== + ``int64_t put_string(char *str, uint64_t front_color, uint64_t bg_color)`` + + 输出字符串(带有前景色,背景色) + + ``int printf(const char *fmt, ...)`` + + 就是正常的 ``printf`` + + ``int sprintf(char *buf,const char *fmt,...)``` + + 就是正常的 ``sprintf`` + + ``int vsprintf(char *buf,const char *fmt,va_list args)`` + + 格式化,不建议调用,请用 printf 或 sprintf 替代。 +宏定义 + ======= + 字体颜色的宏定义 + ========= + ``#define COLOR_WHITE 0x00ffffff //白`` + + ``#define COLOR_BLACK 0x00000000 //黑`` + + ``#define COLOR_RED 0x00ff0000 //红`` + + ``#define COLOR_ORANGE 0x00ff8000 //橙`` + + ``#define COLOR_YELLOW 0x00ffff00 //黄`` + + ``#define COLOR_GREEN 0x0000ff00 //绿`` + + ``#define COLOR_BLUE 0x000000ff //蓝`` + + ``#define COLOR_INDIGO 0x0000ffff //靛`` + + ``#define COLOR_PURPLE 0x008000ff //紫`` + 无需使用 + ======= + ``#define SEEK_SET 0 /* Seek relative to start-of-file */`` + + ``#define SEEK_CUR 1 /* Seek relative to current position */`` + + ``#define SEEK_END 2 /* Seek relative to end-of-file */`` + + ``#define SEEK_MAX 3`` \ No newline at end of file diff --git a/docs/userland/libc/apis/api列表/stdlib.rst b/docs/userland/libc/apis/api列表/stdlib.rst new file mode 100644 index 00000000..38b95185 --- /dev/null +++ b/docs/userland/libc/apis/api列表/stdlib.rst @@ -0,0 +1,20 @@ +stdlib.h +==================================== +简介: + ===== + 一些常用函数 +函数列表: + ====== + ``void *malloc(ssize_t size)`` : 普通的 ``malloc`` + + ``void free(void *ptr)`` : 释放内存 + + ``int abs(int x)`` : x 的绝对值 + + ``long labs(long x)`` : x 的绝对值 + + ``long long llabs(long long x)`` : x 的绝对值 + + ``int atoi(const char *str)`` 字符串转数字 + + ``void exit(int status)`` : 普通的 ``exit`` \ No newline at end of file diff --git a/docs/userland/libc/apis/api列表/string.rst b/docs/userland/libc/apis/api列表/string.rst new file mode 100644 index 00000000..3062608f --- /dev/null +++ b/docs/userland/libc/apis/api列表/string.rst @@ -0,0 +1,25 @@ +string.h +==================================== +简介: + ==== + 字符串操作 + +函数列表: + ===== + ``size_t strlen(const char *s)`` : 返回字符串长度 + + ``int strcmp(const char *a,const char *b)`` 比较字符串的字典序 + + ``char* strncpy(char *dst,const char *src,size_t count)`` + + 拷贝制定字节数的字符串 + + dst: 目标地址 + + src: 原字符串 + + count: 字节数 + + ``char* strcpy(char *dst,const char *src)`` : 复制整个字符串 + + ``char* strcat(char *dest,const char* src)`` : 拼接两个字符串 \ No newline at end of file diff --git a/docs/userland/libc/apis/api列表/time.rst b/docs/userland/libc/apis/api列表/time.rst new file mode 100644 index 00000000..3920f3a7 --- /dev/null +++ b/docs/userland/libc/apis/api列表/time.rst @@ -0,0 +1,32 @@ +time.h +==================================== +简介: + ===== + 时间相关 + +时刻以纳秒为单位 + +结构体: + ==== + ``struct timespec`` : 时间戳 + + 变量列表: + ===== + ``long int tv_sec`` : 秒 + + ``long int tv_nsec`` : 纳秒 +宏定义: + ==== + ``#define CLOCKS_PER_SEC 1000000`` 每一秒有1000000个时刻(纳秒) + +函数列表: + ===== + ``int nanosleep(const struct timespec *rdtp,struct timespec *rmtp)`` + + 休眠指定时间 + + rdtp : 指定休眠的时间 + + rmtp : 返回剩余时间 + + ``clock_t clock()`` : 获得当前系统时间 \ No newline at end of file diff --git a/docs/userland/libc/apis/api列表/unistd.rst b/docs/userland/libc/apis/api列表/unistd.rst new file mode 100644 index 00000000..1fb8f78d --- /dev/null +++ b/docs/userland/libc/apis/api列表/unistd.rst @@ -0,0 +1,56 @@ +unistd.h +==================================== +简介: + ===== + 也是一些常用函数 + +函数列表: + ====== + ``int close(int fd)`` : 关闭文件 + + ``ssize_t read(int fd,void *buf,size_t count)`` : 从文件读取 + + 传入文件id,缓冲区,以及字节数 + + 返回成功读取的字节数 + + ``ssize_t write(int fd,void const *buf,size_t count)`` : 写入文件 + + 传入文件id,缓冲区,字节数 + + 返回成功写入的字节数 + + ``off_t lseek(int fd,off_t offset,int whence)`` : 调整文件访问位置 + + 传入文件id,偏移量,调整模式 + + 返回结束后的文件访问位置 + + ``pid_t fork(void)`` : fork 当前进程 + + ``pid_t vfork(void)`` : fork 当前进程,与父进程共享 VM,flags,fd + + ``uint64_t brk(uint64_t end_brk)`` : 将堆内存调整为end_brk + + 若end_brk 为 -1,返回堆区域的起始地址 + + 若end_brk 为 -2,返回堆区域的结束地址 + + 否则调整堆区的结束地址域,并返回错误码 + + ``void *sbrk(int64_t increment)`` : + + 将堆内存空间加上offset(注意,该系统调用只应在普通进程中调用,而不能是内核线程) + + increment : 偏移量 + + ``int64_t chdir(char *dest_path)`` + + 切换工作目录(传入目录路径) + + ``int execv(const char* path,char * const argv[])`` : 执行文件 + path : 路径 + argv : 执行参数列表 + + ``extern int usleep(useconds_t usec)`` : 睡眠usec微秒 + diff --git a/docs/userland/libc/apis/index.rst b/docs/userland/libc/apis/index.rst index 8b5bdd9e..6ac8ee30 100644 --- a/docs/userland/libc/apis/index.rst +++ b/docs/userland/libc/apis/index.rst @@ -1,9 +1,21 @@ API文档 ==================================== - .. toctree:: :maxdepth: 1 :caption: 目录 - - -[内容待完善] \ No newline at end of file + + api列表/ctype + api列表/dirent + api列表/errno + api列表/fcntl + api列表/math + api列表/stdio + api列表/printf + api列表/stddef + api列表/stdlib + api列表/string + api列表/time + api列表/unistd + +这里是所有libc头文件的集合,在代码里可以这样引用: +``#include`` From 6480d573136ae1f1f4a971849c3307919b2edac7 Mon Sep 17 00:00:00 2001 From: wang904 <1234366@qq.com> Date: Tue, 16 Aug 2022 11:01:37 +0800 Subject: [PATCH 2/6] :fix path --- .../libc/apis/{api列表 => api-list}/ctype.rst | 0 .../apis/{api列表 => api-list}/dirent.rst | 0 .../libc/apis/{api列表 => api-list}/errno.rst | 2 +- .../libc/apis/{api列表 => api-list}/fcntl.rst | 0 .../libc/apis/{api列表 => api-list}/math.rst | 0 .../apis/{api列表 => api-list}/printf.rst | 0 .../apis/{api列表 => api-list}/stddef.rst | 0 .../libc/apis/{api列表 => api-list}/stdio.rst | 0 .../apis/{api列表 => api-list}/stdlib.rst | 0 .../apis/{api列表 => api-list}/string.rst | 0 .../libc/apis/{api列表 => api-list}/time.rst | 0 .../apis/{api列表 => api-list}/unistd.rst | 0 docs/userland/libc/apis/index.rst | 24 +++++++++---------- 13 files changed, 13 insertions(+), 13 deletions(-) rename docs/userland/libc/apis/{api列表 => api-list}/ctype.rst (100%) rename docs/userland/libc/apis/{api列表 => api-list}/dirent.rst (100%) rename docs/userland/libc/apis/{api列表 => api-list}/errno.rst (99%) rename docs/userland/libc/apis/{api列表 => api-list}/fcntl.rst (100%) rename docs/userland/libc/apis/{api列表 => api-list}/math.rst (100%) rename docs/userland/libc/apis/{api列表 => api-list}/printf.rst (100%) rename docs/userland/libc/apis/{api列表 => api-list}/stddef.rst (100%) rename docs/userland/libc/apis/{api列表 => api-list}/stdio.rst (100%) rename docs/userland/libc/apis/{api列表 => api-list}/stdlib.rst (100%) rename docs/userland/libc/apis/{api列表 => api-list}/string.rst (100%) rename docs/userland/libc/apis/{api列表 => api-list}/time.rst (100%) rename docs/userland/libc/apis/{api列表 => api-list}/unistd.rst (100%) diff --git a/docs/userland/libc/apis/api列表/ctype.rst b/docs/userland/libc/apis/api-list/ctype.rst similarity index 100% rename from docs/userland/libc/apis/api列表/ctype.rst rename to docs/userland/libc/apis/api-list/ctype.rst diff --git a/docs/userland/libc/apis/api列表/dirent.rst b/docs/userland/libc/apis/api-list/dirent.rst similarity index 100% rename from docs/userland/libc/apis/api列表/dirent.rst rename to docs/userland/libc/apis/api-list/dirent.rst diff --git a/docs/userland/libc/apis/api列表/errno.rst b/docs/userland/libc/apis/api-list/errno.rst similarity index 99% rename from docs/userland/libc/apis/api列表/errno.rst rename to docs/userland/libc/apis/api-list/errno.rst index fa18bc62..0afbcc68 100644 --- a/docs/userland/libc/apis/api列表/errno.rst +++ b/docs/userland/libc/apis/api-list/errno.rst @@ -10,7 +10,7 @@ errno.h =========== #define E2BIG 1 /* 参数列表过长,或者在输出buffer中缺少空间 或者参数比系统内建的最大值要大 Argument list too long. */ - #define EACCES 2 /* 访问被拒绝 Permission denied */ + #define EACCES 2 /* 访问被拒绝 Permission denied */ #define EADDRINUSE 3 /* 地址正在被使用 Address in use.*/ diff --git a/docs/userland/libc/apis/api列表/fcntl.rst b/docs/userland/libc/apis/api-list/fcntl.rst similarity index 100% rename from docs/userland/libc/apis/api列表/fcntl.rst rename to docs/userland/libc/apis/api-list/fcntl.rst diff --git a/docs/userland/libc/apis/api列表/math.rst b/docs/userland/libc/apis/api-list/math.rst similarity index 100% rename from docs/userland/libc/apis/api列表/math.rst rename to docs/userland/libc/apis/api-list/math.rst diff --git a/docs/userland/libc/apis/api列表/printf.rst b/docs/userland/libc/apis/api-list/printf.rst similarity index 100% rename from docs/userland/libc/apis/api列表/printf.rst rename to docs/userland/libc/apis/api-list/printf.rst diff --git a/docs/userland/libc/apis/api列表/stddef.rst b/docs/userland/libc/apis/api-list/stddef.rst similarity index 100% rename from docs/userland/libc/apis/api列表/stddef.rst rename to docs/userland/libc/apis/api-list/stddef.rst diff --git a/docs/userland/libc/apis/api列表/stdio.rst b/docs/userland/libc/apis/api-list/stdio.rst similarity index 100% rename from docs/userland/libc/apis/api列表/stdio.rst rename to docs/userland/libc/apis/api-list/stdio.rst diff --git a/docs/userland/libc/apis/api列表/stdlib.rst b/docs/userland/libc/apis/api-list/stdlib.rst similarity index 100% rename from docs/userland/libc/apis/api列表/stdlib.rst rename to docs/userland/libc/apis/api-list/stdlib.rst diff --git a/docs/userland/libc/apis/api列表/string.rst b/docs/userland/libc/apis/api-list/string.rst similarity index 100% rename from docs/userland/libc/apis/api列表/string.rst rename to docs/userland/libc/apis/api-list/string.rst diff --git a/docs/userland/libc/apis/api列表/time.rst b/docs/userland/libc/apis/api-list/time.rst similarity index 100% rename from docs/userland/libc/apis/api列表/time.rst rename to docs/userland/libc/apis/api-list/time.rst diff --git a/docs/userland/libc/apis/api列表/unistd.rst b/docs/userland/libc/apis/api-list/unistd.rst similarity index 100% rename from docs/userland/libc/apis/api列表/unistd.rst rename to docs/userland/libc/apis/api-list/unistd.rst diff --git a/docs/userland/libc/apis/index.rst b/docs/userland/libc/apis/index.rst index 6ac8ee30..d924a7c5 100644 --- a/docs/userland/libc/apis/index.rst +++ b/docs/userland/libc/apis/index.rst @@ -4,18 +4,18 @@ API文档 :maxdepth: 1 :caption: 目录 - api列表/ctype - api列表/dirent - api列表/errno - api列表/fcntl - api列表/math - api列表/stdio - api列表/printf - api列表/stddef - api列表/stdlib - api列表/string - api列表/time - api列表/unistd + api-list/ctype + api-list/dirent + api-list/errno + api-list/fcntl + api-list/math + api-list/stdio + api-list/printf + api-list/stddef + api-list/stdlib + api-list/string + api-list/time + api-list/unistd 这里是所有libc头文件的集合,在代码里可以这样引用: ``#include`` From db475d3eafceca9408dd045eed2c24e93f110b99 Mon Sep 17 00:00:00 2001 From: wang904 <1234366@qq.com> Date: Tue, 16 Aug 2022 15:56:08 +0800 Subject: [PATCH 3/6] fix warnings --- .../libc/apis/api-list/.vscode/settings.json | 3 + docs/userland/libc/apis/api-list/errno.rst | 144 +++++++++--------- 2 files changed, 75 insertions(+), 72 deletions(-) create mode 100644 docs/userland/libc/apis/api-list/.vscode/settings.json diff --git a/docs/userland/libc/apis/api-list/.vscode/settings.json b/docs/userland/libc/apis/api-list/.vscode/settings.json new file mode 100644 index 00000000..73dc9f31 --- /dev/null +++ b/docs/userland/libc/apis/api-list/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "restructuredtext.preview.name": "docutils" +} \ No newline at end of file diff --git a/docs/userland/libc/apis/api-list/errno.rst b/docs/userland/libc/apis/api-list/errno.rst index 0afbcc68..d2cba82c 100644 --- a/docs/userland/libc/apis/api-list/errno.rst +++ b/docs/userland/libc/apis/api-list/errno.rst @@ -8,177 +8,177 @@ errno.h ``extern int errno`` : 通用错误代码 宏定义(复制自代码,了解即可): =========== - #define E2BIG 1 /* 参数列表过长,或者在输出buffer中缺少空间 或者参数比系统内建的最大值要大 Argument list too long. */ + #define E2BIG 1 /* 参数列表过长,或者在输出buffer中缺少空间 或者参数比系统内建的最大值要大 Argument list too long.*/ - #define EACCES 2 /* 访问被拒绝 Permission denied */ + #define EACCES 2 /* 访问被拒绝 Permission denied*/ #define EADDRINUSE 3 /* 地址正在被使用 Address in use.*/ #define EADDRNOTAVAIL 4 /* 地址不可用 Address not available.*/ - #define EAFNOSUPPORT 5 /* 地址family不支持 Address family not supported. */ + #define EAFNOSUPPORT 5 /* 地址family不支持 Address family not supported.*/ #define EAGAIN 6 /* 资源不可用,请重试。 Resource unavailable, try again (may be the same value as [EWOULDBLOCK]).*/ - #define EALREADY 7 /* 连接已经在处理 Connection already in progress. */ + #define EALREADY 7 /* 连接已经在处理 Connection already in progress.*/ - #define EBADF 8 /* 错误的文件描述符 Bad file descriptor. */ + #define EBADF 8 /* 错误的文件描述符 Bad file descriptor.*/ - #define EBADMSG 9 /* 错误的消息 Bad message. */ + #define EBADMSG 9 /* 错误的消息 Bad message.*/ - #define EBUSY 10 /* 设备或资源忙 Device or resource busy. */ + #define EBUSY 10 /* 设备或资源忙 Device or resource busy.*/ - #define ECANCELED 11 /* 操作被取消 Operation canceled. */ + #define ECANCELED 11 /* 操作被取消 Operation canceled.*/ - #define ECHILD 12 /* 没有子进程 No child processes. */ + #define ECHILD 12 /* 没有子进程 No child processes.*/ - #define ECONNABORTED 13 /* 连接已断开 Connection aborted. */ + #define ECONNABORTED 13 /* 连接已断开 Connection aborted.*/ - #define ECONNREFUSED 14 /* 连接被拒绝 Connection refused. */ + #define ECONNREFUSED 14 /* 连接被拒绝 Connection refused.*/ - #define ECONNRESET 15 /* 连接被重置 Connection reset. */ + #define ECONNRESET 15 /* 连接被重置 Connection reset.*/ - #define EDEADLK 16 /* 资源死锁将要发生 Resource deadlock would occur. */ + #define EDEADLK 16 /* 资源死锁将要发生 Resource deadlock would occur.*/ #define EDESTADDRREQ 17 /* 需要目标地址 Destination address required.*/ - #define EDOM 18 /* 数学参数超出作用域 Mathematics argument out of domain of function. */ + #define EDOM 18 /* 数学参数超出作用域 Mathematics argument out of domain of function.*/ - #define EDQUOT 19 /* 保留使用 Reserved */ + #define EDQUOT 19 /* 保留使用 Reserved*/ - #define EEXIST 20 /* 文件已存在 File exists. */ + #define EEXIST 20 /* 文件已存在 File exists.*/ - #define EFAULT 21 /* 错误的地址 Bad address */ + #define EFAULT 21 /* 错误的地址 Bad address*/ - #define EFBIG 22 /* 文件太大 File too large. */ + #define EFBIG 22 /* 文件太大 File too large.*/ #define EHOSTUNREACH 23 /* 主机不可达 Host is unreachable.*/ - #define EIDRM 24 /* 标志符被移除 Identifier removed. */ + #define EIDRM 24 /* 标志符被移除 Identifier removed.*/ - #define EILSEQ 25 /* 不合法的字符序列 Illegal byte sequence. */ + #define EILSEQ 25 /* 不合法的字符序列 Illegal byte sequence.*/ - #define EINPROGRESS 26 /* 操作正在处理 Operation in progress. */ + #define EINPROGRESS 26 /* 操作正在处理 Operation in progress.*/ - #define EINTR 27 /* 被中断的函数 Interrupted function. */ + #define EINTR 27 /* 被中断的函数 Interrupted function.*/ - #define EINVAL 28 /* 不可用的参数 Invalid argument. */ + #define EINVAL 28 /* 不可用的参数 Invalid argument.*/ - #define EIO 29 /* I/O错误 I/O error. */ + #define EIO 29 /* I/O错误 I/O error.*/ - #define EISCONN 30 /* 套接字已连接 Socket is connected. */ + #define EISCONN 30 /* 套接字已连接 Socket is connected.*/ - #define EISDIR 31 /* 是一个目录 Is a directory */ + #define EISDIR 31 /* 是一个目录 Is a directory*/ - #define ELOOP 32 /* 符号链接级别过多 Too many levels of symbolic links. */ + #define ELOOP 32 /* 符号链接级别过多 Too many levels of symbolic links.*/ - #define EMFILE 33 /* 文件描述符的值过大 File descriptor value too large. */ + #define EMFILE 33 /* 文件描述符的值过大 File descriptor value too large.*/ - #define EMLINK 34 /* 链接数过多 Too many links. */ + #define EMLINK 34 /* 链接数过多 Too many links.*/ - #define EMSGSIZE 35 /* 消息过大 Message too large. */ + #define EMSGSIZE 35 /* 消息过大 Message too large.*/ - #define EMULTIHOP 36 /* 保留使用 Reserved. */ + #define EMULTIHOP 36 /* 保留使用 Reserved.*/ - #define ENAMETOOLONG 37 /* 文件名过长 Filename too long. */ + #define ENAMETOOLONG 37 /* 文件名过长 Filename too long.*/ - #define ENETDOWN 38 /* 网络已关闭 Network is down. */ + #define ENETDOWN 38 /* 网络已关闭 Network is down.*/ - #define ENETRESET 39 /* 网络连接已断开 Connection aborted by network. */ + #define ENETRESET 39 /* 网络连接已断开 Connection aborted by network.*/ - #define ENETUNREACH 40 /* 网络不可达 Network unreachable. */ + #define ENETUNREACH 40 /* 网络不可达 Network unreachable.*/ #define ENFILE 41 /* 系统中打开的文件过多 Too many files open in system.*/ - #define ENOBUFS 42 /* 缓冲区空间不足 No buffer space available. */ + #define ENOBUFS 42 /* 缓冲区空间不足 No buffer space available.*/ - #define ENODATA 43 /* 队列头没有可读取的消息 No message is available on the STREAM head read queue. */ + #define ENODATA 43 /* 队列头没有可读取的消息 No message is available on the STREAM head read queue.*/ - #define ENODEV 44 /* 没有指定的设备 No such device. */ + #define ENODEV 44 /* 没有指定的设备 No such device.*/ - #define ENOENT 45 /* 没有指定的文件或目录 No such file or directory. */ + #define ENOENT 45 /* 没有指定的文件或目录 No such file or directory.*/ - #define ENOEXEC 46 /* 可执行文件格式错误 Executable file format error. */ + #define ENOEXEC 46 /* 可执行文件格式错误 Executable file format error.*/ - #define ENOLCK 47 /* 没有可用的锁 No locks available. */ + #define ENOLCK 47 /* 没有可用的锁 No locks available.*/ - #define ENOLINK 48 /* 保留 Reserved. */ + #define ENOLINK 48 /* 保留 Reserved.*/ - #define ENOMEM 49 /* 没有足够的空间 Not enough space. */ + #define ENOMEM 49 /* 没有足够的空间 Not enough space.*/ - #define ENOMSG 50 /* 没有期待类型的消息 No message of the desired type. */ + #define ENOMSG 50 /* 没有期待类型的消息 No message of the desired type.*/ - #define ENOPROTOOPT 51 /* 协议不可用 Protocol not available. */ + #define ENOPROTOOPT 51 /* 协议不可用 Protocol not available.*/ - #define ENOSPC 52 /* 设备上没有空间 No space left on device. */ + #define ENOSPC 52 /* 设备上没有空间 No space left on device.*/ #define ENOSR 53 /* 没有STREAM资源 No STREAM resources.*/ - #define ENOSTR 54 /* 不是STREAM Not a STREAM */ + #define ENOSTR 54 /* 不是STREAM Not a STREAM*/ - #define ENOSYS 55 /* 功能不支持 Function not supported. */ + #define ENOSYS 55 /* 功能不支持 Function not supported.*/ - #define ENOTCONN 56 /* 套接字未连接 The socket is not connected. */ + #define ENOTCONN 56 /* 套接字未连接 The socket is not connected.*/ - #define ENOTDIR 57 /* 不是目录 Not a directory. */ + #define ENOTDIR 57 /* 不是目录 Not a directory.*/ - #define ENOTEMPTY 58 /* 目录非空 Directory not empty. */ + #define ENOTEMPTY 58 /* 目录非空 Directory not empty.*/ - #define ENOTRECOVERABLE 59 /* 状态不可覆盖 State not recoverable. */ + #define ENOTRECOVERABLE 59 /* 状态不可覆盖 State not recoverable.*/ #define ENOTSOCK 60 /* 不是一个套接字 Not a socket.*/ - #define ENOTSUP 61 /* 不被支持 Not supported (may be the same value as [EOPNOTSUPP]). */ + #define ENOTSUP 61 /* 不被支持 Not supported (may be the same value as [EOPNOTSUPP]).*/ - #define ENOTTY 62 /* 不正确的I/O控制操作 Inappropriate I/O control operation. */ + #define ENOTTY 62 /* 不正确的I/O控制操作 Inappropriate I/O control operation.*/ - #define ENXIO 63 /* 没有这样的设备或地址 No such device or address. */ + #define ENXIO 63 /* 没有这样的设备或地址 No such device or address.*/ - #define EOPNOTSUPP 64 /* 套接字不支持该操作 Operation not supported on socket (may be the same value as [ENOTSUP]). */ + #define EOPNOTSUPP 64 /* 套接字不支持该操作 Operation not supported on socket (may be the same value as [ENOTSUP]).*/ - #define EOVERFLOW 65 /* 数值过大,产生溢出 Value too large to be stored in data type. */ + #define EOVERFLOW 65 /* 数值过大,产生溢出 Value too large to be stored in data type.*/ - #define EOWNERDEAD 66 /* 之前的拥有者挂了 Previous owner died. */ + #define EOWNERDEAD 66 /* 之前的拥有者挂了 Previous owner died.*/ - #define EPERM 67 /* 操作不被允许 Operation not permitted. */ + #define EPERM 67 /* 操作不被允许 Operation not permitted.*/ - #define EPIPE 68 /* 断开的管道 Broken pipe. */ + #define EPIPE 68 /* 断开的管道 Broken pipe.*/ - #define EPROTO 69 /* 协议错误 Protocol error. */ + #define EPROTO 69 /* 协议错误 Protocol error.*/ - #define EPROTONOSUPPORT 70 /* 协议不被支持 Protocol not supported. */ + #define EPROTONOSUPPORT 70 /* 协议不被支持 Protocol not supported.*/ - #define EPROTOTYPE 71 /* 对于套接字而言,错误的协议 Protocol wrong type for socket. */ + #define EPROTOTYPE 71 /* 对于套接字而言,错误的协议 Protocol wrong type for socket.*/ - #define ERANGE 72 /* 结果过大 Result too large. */ + #define ERANGE 72 /* 结果过大 Result too large.*/ - #define EROFS 73 /* 只读的文件系统 Read-only file system. */ + #define EROFS 73 /* 只读的文件系统 Read-only file system.*/ - #define ESPIPE 74 /* 错误的寻道 Invalid seek. */ + #define ESPIPE 74 /* 错误的寻道 Invalid seek.*/ - #define ESRCH 75 /* 没有这样的进程 No such process. */ + #define ESRCH 75 /* 没有这样的进程 No such process.*/ - #define ESTALE 76 /* 保留 Reserved. */ + #define ESTALE 76 /* 保留 Reserved.*/ - #define ETIME 77 /* 流式ioctl()超时 Stream ioctl() timeout */ + #define ETIME 77 /* 流式ioctl()超时 Stream ioctl() timeout*/ #define ETIMEDOUT 78 /* 连接超时 Connection timed out.*/ - #define ETXTBSY 79 /* 文本文件忙 Text file busy. */ + #define ETXTBSY 79 /* 文本文件忙 Text file busy.*/ - #define EWOULDBLOCK 80 /* 操作将被禁止 Operation would block (may be the same value as [EAGAIN]). */ + #define EWOULDBLOCK 80 /* 操作将被禁止 Operation would block (may be the same value as [EAGAIN]).*/ - #define EXDEV 81 /* 跨设备连接 Cross-device link. */ + #define EXDEV 81 /* 跨设备连接 Cross-device link.*/ From b4695bdb72c54b21d9acf9ae0591ed4d60fb1f6a Mon Sep 17 00:00:00 2001 From: wang904 <1234366@qq.com> Date: Tue, 16 Aug 2022 15:56:32 +0800 Subject: [PATCH 4/6] fix warnings --- docs/userland/libc/apis/api-list/.vscode/settings.json | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 docs/userland/libc/apis/api-list/.vscode/settings.json diff --git a/docs/userland/libc/apis/api-list/.vscode/settings.json b/docs/userland/libc/apis/api-list/.vscode/settings.json deleted file mode 100644 index 73dc9f31..00000000 --- a/docs/userland/libc/apis/api-list/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "restructuredtext.preview.name": "docutils" -} \ No newline at end of file From a1d3af9201c9ad15e5d349087cc7723e06030628 Mon Sep 17 00:00:00 2001 From: wang904 <1234366@qq.com> Date: Wed, 17 Aug 2022 07:54:33 +0800 Subject: [PATCH 5/6] fix warnings(markdown rebuild) --- docs/introduction/intro.md | 2 +- .../libc/apis/api-list/.vscode/settings.json | 3 +++ .../apis/api-list/{ctype.rst => ctype.md} | 11 ++++----- .../apis/api-list/{dirent.rst => dirent.md} | 15 ++++-------- .../apis/api-list/{errno.rst => errno.md} | 17 ++++++------- .../apis/api-list/{fcntl.rst => fcntl.md} | 16 ++++++------- .../libc/apis/api-list/{math.rst => math.md} | 11 +++++---- .../apis/api-list/{printf.rst => printf.md} | 4 ++-- .../apis/api-list/{stddef.rst => stddef.md} | 12 +++++----- .../apis/api-list/{stdio.rst => stdio.md} | 24 +++++++++---------- .../apis/api-list/{stdlib.rst => stdlib.md} | 12 +++++----- .../apis/api-list/{string.rst => string.md} | 12 +++++----- .../libc/apis/api-list/{time.rst => time.md} | 24 +++++++++---------- .../apis/api-list/{unistd.rst => unistd.md} | 12 +++++----- 14 files changed, 86 insertions(+), 89 deletions(-) create mode 100644 docs/userland/libc/apis/api-list/.vscode/settings.json rename docs/userland/libc/apis/api-list/{ctype.rst => ctype.md} (85%) rename docs/userland/libc/apis/api-list/{dirent.rst => dirent.md} (84%) rename docs/userland/libc/apis/api-list/{errno.rst => errno.md} (97%) rename docs/userland/libc/apis/api-list/{fcntl.rst => fcntl.md} (88%) rename docs/userland/libc/apis/api-list/{math.rst => math.md} (83%) rename docs/userland/libc/apis/api-list/{printf.rst => printf.md} (58%) rename docs/userland/libc/apis/api-list/{stddef.rst => stddef.md} (64%) rename docs/userland/libc/apis/api-list/{stdio.rst => stdio.md} (86%) rename docs/userland/libc/apis/api-list/{stdlib.rst => stdlib.md} (80%) rename docs/userland/libc/apis/api-list/{string.rst => string.md} (85%) rename docs/userland/libc/apis/api-list/{time.rst => time.md} (74%) rename docs/userland/libc/apis/api-list/{unistd.rst => unistd.md} (94%) diff --git a/docs/introduction/intro.md b/docs/introduction/intro.md index 5f361909..59834167 100644 --- a/docs/introduction/intro.md +++ b/docs/introduction/intro.md @@ -1,3 +1,3 @@ # DragonOS简介 -DragonOS龙操作系统(以下简称“DragonOS”)是一个基于x86-64体系结构开发的,基于GPLv2协议开放源代码的64位操作系统。 \ No newline at end of file +DragonOS龙操作系统(以下简称“DragonOS”)是一个基于x86-64体系结构开发的,基于GPLv2协议开放源代码的64位操作系统。 diff --git a/docs/userland/libc/apis/api-list/.vscode/settings.json b/docs/userland/libc/apis/api-list/.vscode/settings.json new file mode 100644 index 00000000..73dc9f31 --- /dev/null +++ b/docs/userland/libc/apis/api-list/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "restructuredtext.preview.name": "docutils" +} \ No newline at end of file diff --git a/docs/userland/libc/apis/api-list/ctype.rst b/docs/userland/libc/apis/api-list/ctype.md similarity index 85% rename from docs/userland/libc/apis/api-list/ctype.rst rename to docs/userland/libc/apis/api-list/ctype.md index 2a1c5c4e..35cb3725 100644 --- a/docs/userland/libc/apis/api-list/ctype.rst +++ b/docs/userland/libc/apis/api-list/ctype.md @@ -1,7 +1,5 @@ -ctype.h -==================================== -函数列表(这里只列出已实现的函数): - ==== +# ctype.h +## 函数列表(这里只列出已实现的函数): ``int isprint(int c)`` : 传入一个字符,判断是否可以被输出 @@ -19,10 +17,9 @@ ctype.h ``int isspace(int c)`` : 传入一个字符,判断是否是空白字符 -宏定义: - ==== +## 宏定义: - 暂无用处 + ### 暂无用处 ``#define _U 01`` diff --git a/docs/userland/libc/apis/api-list/dirent.rst b/docs/userland/libc/apis/api-list/dirent.md similarity index 84% rename from docs/userland/libc/apis/api-list/dirent.rst rename to docs/userland/libc/apis/api-list/dirent.md index e0cb0f0c..58f02731 100644 --- a/docs/userland/libc/apis/api-list/dirent.rst +++ b/docs/userland/libc/apis/api-list/dirent.md @@ -1,11 +1,8 @@ -dirent.h -==================================== -简介 - ==== +# dirent.h +## 简介 与文件夹有关的头文件。 -结构体列表: - =========================== +## 结构体列表: ``struct DIR`` : @@ -31,8 +28,7 @@ dirent.h ``char d_name[]`` : 目标的名字 -函数列表(这里只列出已实现的函数): - =========================== +## 函数列表(这里只列出已实现的函数): ``DIR opendir(const char *path)`` @@ -48,8 +44,7 @@ dirent.h 传入文件夹结构体,读入文件夹里的内容,并打包为dirent结构体返回 -宏定义: - =========================== +## 宏定义: 文件夹类型: diff --git a/docs/userland/libc/apis/api-list/errno.rst b/docs/userland/libc/apis/api-list/errno.md similarity index 97% rename from docs/userland/libc/apis/api-list/errno.rst rename to docs/userland/libc/apis/api-list/errno.md index d2cba82c..017c7450 100644 --- a/docs/userland/libc/apis/api-list/errno.rst +++ b/docs/userland/libc/apis/api-list/errno.md @@ -1,13 +1,14 @@ -errno.h -==================================== -简介: - =========== +# errno.h + +## 简介: + 共享错误号码 -属性: - =========== +## 属性: + ``extern int errno`` : 通用错误代码 -宏定义(复制自代码,了解即可): - =========== + +## 宏定义(复制自代码,了解即可): + #define E2BIG 1 /* 参数列表过长,或者在输出buffer中缺少空间 或者参数比系统内建的最大值要大 Argument list too long.*/ #define EACCES 2 /* 访问被拒绝 Permission denied*/ diff --git a/docs/userland/libc/apis/api-list/fcntl.rst b/docs/userland/libc/apis/api-list/fcntl.md similarity index 88% rename from docs/userland/libc/apis/api-list/fcntl.rst rename to docs/userland/libc/apis/api-list/fcntl.md index c6967a43..3c8cb6dd 100644 --- a/docs/userland/libc/apis/api-list/fcntl.rst +++ b/docs/userland/libc/apis/api-list/fcntl.md @@ -1,16 +1,16 @@ -fcntl.h -==================================== -简介 - ======== +# fcntl.h + +## 简介 + 文件操作 -函数列表: - ======== +## 函数列表: + ``int open(const char * path,int options, ...)`` 传入文件路径,和文件类型(详细请看下面的宏定义),将文件打开并返回文件id。 -宏定义(粘贴自代码,了解即可): - ======== +## 宏定义(粘贴自代码,了解即可): + #define O_RDONLY 00000000 // Open Read-only #define O_WRONLY 00000001 // Open Write-only diff --git a/docs/userland/libc/apis/api-list/math.rst b/docs/userland/libc/apis/api-list/math.md similarity index 83% rename from docs/userland/libc/apis/api-list/math.rst rename to docs/userland/libc/apis/api-list/math.md index 74f763a9..69abc25d 100644 --- a/docs/userland/libc/apis/api-list/math.rst +++ b/docs/userland/libc/apis/api-list/math.md @@ -1,10 +1,11 @@ -math.h -==================================== -简介: - ====== +# math.h + +## 简介: + 数学库 -函数列表: +## 函数列表: + ``double fabs(double x)`` : 返回 x 的绝对值 ``float fabsf(float x)`` : 返回 x 的绝对值 diff --git a/docs/userland/libc/apis/api-list/printf.rst b/docs/userland/libc/apis/api-list/printf.md similarity index 58% rename from docs/userland/libc/apis/api-list/printf.rst rename to docs/userland/libc/apis/api-list/printf.md index eb6e4cd3..04103add 100644 --- a/docs/userland/libc/apis/api-list/printf.rst +++ b/docs/userland/libc/apis/api-list/printf.md @@ -1,3 +1,3 @@ -printf.h -==================================== +# printf.h + 不建议引用,需要 ``printf`` 函数请引用 ``stdio.h`` \ No newline at end of file diff --git a/docs/userland/libc/apis/api-list/stddef.rst b/docs/userland/libc/apis/api-list/stddef.md similarity index 64% rename from docs/userland/libc/apis/api-list/stddef.rst rename to docs/userland/libc/apis/api-list/stddef.md index d9dad7c5..b9c445ad 100644 --- a/docs/userland/libc/apis/api-list/stddef.rst +++ b/docs/userland/libc/apis/api-list/stddef.md @@ -1,11 +1,11 @@ -stddef.h -==================================== -简介: - ====== +# stddef.h + +## 简介: + 定义了关于指针的常用类型 -定义: - ===== +## 定义: + ``typedef __PTDIFF_TYPE__ ptrdiff_t`` : 两个指针相减的结果类型 ``NULL ((void *) 0)`` : 空指针 \ No newline at end of file diff --git a/docs/userland/libc/apis/api-list/stdio.rst b/docs/userland/libc/apis/api-list/stdio.md similarity index 86% rename from docs/userland/libc/apis/api-list/stdio.rst rename to docs/userland/libc/apis/api-list/stdio.md index c75910f1..becd2039 100644 --- a/docs/userland/libc/apis/api-list/stdio.rst +++ b/docs/userland/libc/apis/api-list/stdio.md @@ -1,10 +1,10 @@ -stdio.h -==================================== -简介: - ======= +# stdio.h + +## 简介: + 向标准输入输出里操作 -函数列表: - ====== +## 函数列表: + ``int64_t put_string(char *str, uint64_t front_color, uint64_t bg_color)`` 输出字符串(带有前景色,背景色) @@ -20,10 +20,10 @@ stdio.h ``int vsprintf(char *buf,const char *fmt,va_list args)`` 格式化,不建议调用,请用 printf 或 sprintf 替代。 -宏定义 - ======= - 字体颜色的宏定义 - ========= +## 宏定义 + + ### 字体颜色的宏定义 + ``#define COLOR_WHITE 0x00ffffff //白`` ``#define COLOR_BLACK 0x00000000 //黑`` @@ -41,8 +41,8 @@ stdio.h ``#define COLOR_INDIGO 0x0000ffff //靛`` ``#define COLOR_PURPLE 0x008000ff //紫`` - 无需使用 - ======= + ### 无需使用 + ``#define SEEK_SET 0 /* Seek relative to start-of-file */`` ``#define SEEK_CUR 1 /* Seek relative to current position */`` diff --git a/docs/userland/libc/apis/api-list/stdlib.rst b/docs/userland/libc/apis/api-list/stdlib.md similarity index 80% rename from docs/userland/libc/apis/api-list/stdlib.rst rename to docs/userland/libc/apis/api-list/stdlib.md index 38b95185..afa75093 100644 --- a/docs/userland/libc/apis/api-list/stdlib.rst +++ b/docs/userland/libc/apis/api-list/stdlib.md @@ -1,10 +1,10 @@ -stdlib.h -==================================== -简介: - ===== +# stdlib.h + +## 简介: + 一些常用函数 -函数列表: - ====== +## 函数列表: + ``void *malloc(ssize_t size)`` : 普通的 ``malloc`` ``void free(void *ptr)`` : 释放内存 diff --git a/docs/userland/libc/apis/api-list/string.rst b/docs/userland/libc/apis/api-list/string.md similarity index 85% rename from docs/userland/libc/apis/api-list/string.rst rename to docs/userland/libc/apis/api-list/string.md index 3062608f..88b137b5 100644 --- a/docs/userland/libc/apis/api-list/string.rst +++ b/docs/userland/libc/apis/api-list/string.md @@ -1,11 +1,11 @@ -string.h -==================================== -简介: - ==== +# string.h + +## 简介: + 字符串操作 -函数列表: - ===== +## 函数列表: + ``size_t strlen(const char *s)`` : 返回字符串长度 ``int strcmp(const char *a,const char *b)`` 比较字符串的字典序 diff --git a/docs/userland/libc/apis/api-list/time.rst b/docs/userland/libc/apis/api-list/time.md similarity index 74% rename from docs/userland/libc/apis/api-list/time.rst rename to docs/userland/libc/apis/api-list/time.md index 3920f3a7..c2f49386 100644 --- a/docs/userland/libc/apis/api-list/time.rst +++ b/docs/userland/libc/apis/api-list/time.md @@ -1,26 +1,26 @@ -time.h -==================================== -简介: - ===== +# time.h + +## 简介: + 时间相关 时刻以纳秒为单位 -结构体: - ==== +## 结构体: + ``struct timespec`` : 时间戳 - 变量列表: - ===== + ### 变量列表: + ``long int tv_sec`` : 秒 ``long int tv_nsec`` : 纳秒 -宏定义: - ==== +## 宏定义: + ``#define CLOCKS_PER_SEC 1000000`` 每一秒有1000000个时刻(纳秒) -函数列表: - ===== +## 函数列表: + ``int nanosleep(const struct timespec *rdtp,struct timespec *rmtp)`` 休眠指定时间 diff --git a/docs/userland/libc/apis/api-list/unistd.rst b/docs/userland/libc/apis/api-list/unistd.md similarity index 94% rename from docs/userland/libc/apis/api-list/unistd.rst rename to docs/userland/libc/apis/api-list/unistd.md index 1fb8f78d..e6cdacde 100644 --- a/docs/userland/libc/apis/api-list/unistd.rst +++ b/docs/userland/libc/apis/api-list/unistd.md @@ -1,11 +1,11 @@ -unistd.h -==================================== -简介: - ===== +# unistd.h + +## 简介: + 也是一些常用函数 -函数列表: - ====== +## 函数列表: + ``int close(int fd)`` : 关闭文件 ``ssize_t read(int fd,void *buf,size_t count)`` : 从文件读取 From 737759d7534805068b4a3312579c130dec07adbb Mon Sep 17 00:00:00 2001 From: login Date: Wed, 17 Aug 2022 22:14:40 +0800 Subject: [PATCH 6/6] Delete settings.json --- docs/userland/libc/apis/api-list/.vscode/settings.json | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 docs/userland/libc/apis/api-list/.vscode/settings.json diff --git a/docs/userland/libc/apis/api-list/.vscode/settings.json b/docs/userland/libc/apis/api-list/.vscode/settings.json deleted file mode 100644 index 73dc9f31..00000000 --- a/docs/userland/libc/apis/api-list/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "restructuredtext.preview.name": "docutils" -} \ No newline at end of file