Improved various syscalls.c files.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15201 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2021-12-05 11:44:58 +00:00
parent 7d76e688a7
commit cc7d41bbd6
3 changed files with 34 additions and 35 deletions

View File

@ -115,28 +115,36 @@ caddr_t _sbrk_r(struct _reent *r, int incr) {
}
__attribute__((used))
int _getpid_r(struct _reent *r) {
int _kill(struct _reent *r, int pid, int sig) {
(void)r;
(void) r;
(void) pid;
(void) sig;
return 1;
}
__attribute__((used))
int _kill_r(struct _reent *r, int pid, int sig) {
(void)pid;
(void)sig;
__errno_r(r) = EINVAL;
return -1;
chSysHalt("kill");
abort();
}
__attribute__((used))
void _exit(int code) {
sbExit((msg_t)code);
while (true);
abort();
}
__attribute__((used))
int _getpid(void) {
return 1;
abort();
}
#ifdef __cplusplus
extern "C" {
void __cxa_pure_virtual(void) {
osalSysHalt("pure virtual");
}
}
#endif
/*** EOF ***/

View File

@ -217,14 +217,9 @@ int _getpid(void) {
#ifdef __cplusplus
extern "C" {
#endif
void __cxa_pure_virtual(void) {
chSysHalt("pure virtual function call");
}
#ifdef __cplusplus
void __cxa_pure_virtual(void) {
osalSysHalt("pure virtual");
}
}
#endif

View File

@ -26,7 +26,7 @@
#define SYSCALL_MAX_FDS 10
#endif
static vfs_file_node_t fds[SYSCALL_MAX_FDS];
static vfs_file_node_c *fds[SYSCALL_MAX_FDS];
static int translate_error(msg_t err) {
@ -40,7 +40,7 @@ static int translate_error(msg_t err) {
__attribute__((used))
int _open_r(struct _reent *r, const char *p, int oflag, int mode) {
msg_t err;
vfs_file_node_t *vfnp;
vfs_file_node_c *vfnp;
int file;
(void)mode;
@ -92,7 +92,7 @@ int _read_r(struct _reent *r, int file, char *ptr, int len) {
return -1;
}
nr = vfsReadFile(fds[file], ptr, (size_t)len);
nr = vfsReadFile(fds[file], (uint8_t *)ptr, (size_t)len);
if (nr < VFS_RET_SUCCESS) {
__errno_r(r) = translate_error((msg_t)nr);
return -1;
@ -104,7 +104,7 @@ int _read_r(struct _reent *r, int file, char *ptr, int len) {
/***************************************************************************/
__attribute__((used))
int _write_r(struct _reent *r, int file, char *ptr, int len) {
int _write_r(struct _reent *r, int file, const char *ptr, int len) {
ssize_t nw;
if ((file < 0) || (file >= SYSCALL_MAX_FDS) || (fds[file] == NULL)) {
@ -112,8 +112,8 @@ int _write_r(struct _reent *r, int file, char *ptr, int len) {
return -1;
}
nw = vfsWriteFile(fds[file], ptr, (size_t)len);
if (nr < VFS_RET_SUCCESS) {
nw = vfsWriteFile(fds[file], (const uint8_t *)ptr, (size_t)len);
if (nw < VFS_RET_SUCCESS) {
__errno_r(r) = translate_error((msg_t)nw);
return -1;
}
@ -212,13 +212,9 @@ int _getpid(void) {
#ifdef __cplusplus
extern "C" {
#endif
void __cxa_pure_virtual() {
osalSysHalt("Pure virtual function call.");
}
#ifdef __cplusplus
void __cxa_pure_virtual(void) {
osalSysHalt("pure virtual");
}
}
#endif
/*** EOF ***/