Files
player/Project/Src/MY/syscalls.c

125 lines
2.0 KiB
C
Raw Normal View History

2025-06-28 22:15:49 +08:00
#include <unistd.h>
#include <errno.h>
#include "sys/stat.h"
#include "reent.h"
2025-06-29 11:20:46 +08:00
#include "bsp_init.h"
#include "libc.h"
#include "string.h"
2025-07-05 19:47:28 +08:00
// Ѱ<><D1B0>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>
2025-06-29 11:20:46 +08:00
extern const unsigned int libc_dev_start;
extern const unsigned int libc_dev_end;
const libc_device_file *libc_find_dev(const char *name)
{
libc_device_file *start=(libc_device_file *)&libc_dev_start;
libc_device_file *end=(libc_device_file *)&libc_dev_end;
libc_device_file *ptr=0;
for(ptr=start;ptr<end;ptr++)
{
if(strcmp(ptr->name,name)==0)
return ptr;
}
return NULL;
}
2025-06-28 22:15:49 +08:00
int _close(int fd) {
(void)fd;
2025-07-05 19:47:28 +08:00
return -1; // <20><>֧<EFBFBD><D6A7><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
2025-06-28 22:15:49 +08:00
}
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;
2025-07-05 19:47:28 +08:00
return 1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ն<EFBFBD><D5B6>
2025-06-28 22:15:49 +08:00
}
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;
}