92 lines
1.5 KiB
C
92 lines
1.5 KiB
C
|
|
#include <unistd.h>
|
||
|
|
#include <errno.h>
|
||
|
|
#include "sys/stat.h"
|
||
|
|
#include "reent.h"
|
||
|
|
|
||
|
|
int _close(int fd) {
|
||
|
|
(void)fd;
|
||
|
|
return -1; // 不支持文件操作
|
||
|
|
}
|
||
|
|
|
||
|
|
int _read(int fd, char *buf, int nbytes) {
|
||
|
|
(void)fd; (void)buf; (void)nbytes;
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
int _write(int fd, const char *buf, int nbytes) {
|
||
|
|
(void)fd; (void)buf; (void)nbytes;
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
off_t _lseek(int fd, off_t offset, int whence) {
|
||
|
|
(void)fd; (void)offset; (void)whence;
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
int _isatty(int fd) {
|
||
|
|
(void)fd;
|
||
|
|
return 1; // 假设是终端设备
|
||
|
|
}
|
||
|
|
|
||
|
|
int _open(const char *path, int flags, ...) {
|
||
|
|
(void)path; (void)flags;
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
int _fstat(int fd, struct stat *st) {
|
||
|
|
(void)fd; (void)st;
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
int _stat(const char *path, struct stat *st) {
|
||
|
|
(void)path; (void)st;
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
int _unlink(const char *name) {
|
||
|
|
(void)name;
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
int _link(const char *old, const char *new) {
|
||
|
|
(void)old; (void)new;
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
int _execve(const char *name, char *const *argv, char *const *env) {
|
||
|
|
(void)name; (void)argv; (void)env;
|
||
|
|
errno = ENOSYS;
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
int _fork(void) {
|
||
|
|
errno = ENOSYS;
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
int _getpid(void) {
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
int _wait(int *status) {
|
||
|
|
(void)status;
|
||
|
|
errno = ECHILD;
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
int _times(struct tms *buf) {
|
||
|
|
(void)buf;
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
int _kill(int pid, int sig) {
|
||
|
|
(void)pid; (void)sig;
|
||
|
|
errno = EINVAL;
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
void *_sbrk(ptrdiff_t incr) {
|
||
|
|
(void)incr;
|
||
|
|
errno = ENOMEM;
|
||
|
|
return (void *)-1;
|
||
|
|
}
|