add more stubs.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@674 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
61e66e376b
commit
c2b29a3e31
@ -1,22 +1,45 @@
|
|||||||
#include <reent.h>
|
#include <reent.h>
|
||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
|
#include <rtthread.h>
|
||||||
|
|
||||||
int _fork_r (struct _reent *r)
|
int
|
||||||
|
_fork_r (struct _reent *r)
|
||||||
{
|
{
|
||||||
/* return "not supported" */
|
/* return "not supported" */
|
||||||
r->_errno = ENOTSUP;
|
r->_errno = ENOTSUP;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* I/O routine stub
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
_isatty_r(struct _reent *r, int fd)
|
||||||
|
{
|
||||||
|
_ssize_t rc;
|
||||||
|
|
||||||
|
rc = -1;
|
||||||
|
/* return "not supported" */
|
||||||
|
r->_errno = ENOTSUP;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
_open_r(struct _reent *r, const char *file, int flags, int mode)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
rc = open(file, flags, mode);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
_ssize_t
|
_ssize_t
|
||||||
_read_r (struct _reent *r, int fd, void *buf, size_t nbytes)
|
_read_r (struct _reent *r, int fd, void *buf, size_t nbytes)
|
||||||
{
|
{
|
||||||
_ssize_t rc;
|
_ssize_t rc;
|
||||||
|
|
||||||
rc = -1;
|
rc = read(fd, buf, nbytes);
|
||||||
|
|
||||||
/* return "not supported" */
|
|
||||||
r->_errno = ENOTSUP;
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,33 +48,54 @@ _write_r (struct _reent *r, int fd, const void *buf, size_t nbytes)
|
|||||||
{
|
{
|
||||||
_ssize_t rc;
|
_ssize_t rc;
|
||||||
|
|
||||||
rc = -1;
|
rc = write(fd, buf, nbytes);
|
||||||
|
|
||||||
/* return "not supported" */
|
|
||||||
r->_errno = ENOTSUP;
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_close_r (struct _reent *r, int fd)
|
_close_r (struct _reent *r, int fd)
|
||||||
{
|
{
|
||||||
_ssize_t rc;
|
return close(fd);
|
||||||
|
|
||||||
rc = -1;
|
|
||||||
|
|
||||||
/* return "not supported" */
|
|
||||||
r->_errno = ENOTSUP;
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_off_t
|
_off_t
|
||||||
_lseek_r (struct _reent *r, int fd, _off_t offset, int whence)
|
_lseek_r (struct _reent *r, int fd, _off_t offset, int whence)
|
||||||
{
|
{
|
||||||
_ssize_t rc;
|
_off_t rc;
|
||||||
|
|
||||||
rc = -1;
|
rc = lseek(fd, offset, whence);
|
||||||
|
|
||||||
/* return "not supported" */
|
|
||||||
r->_errno = ENOTSUP;
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _fstat_r (struct _reent *r, int fd, struct stat *pstat)
|
||||||
|
{
|
||||||
|
/* return "not supported" */
|
||||||
|
r->_errno = ENOTSUP;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* memory routine stub
|
||||||
|
*/
|
||||||
|
void *
|
||||||
|
_malloc_r (struct _reent *ptr, size_t size)
|
||||||
|
{
|
||||||
|
return (void*)rt_malloc (size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
_realloc_r (struct _reent *ptr, void *old, size_t newlen)
|
||||||
|
{
|
||||||
|
return (void*)rt_realloc (old, newlen);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *_calloc_r (struct _reent *ptr, size_t size, size_t len)
|
||||||
|
{
|
||||||
|
return (void*)rt_calloc (size, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_free_r (struct _reent *ptr, void *addr)
|
||||||
|
{
|
||||||
|
rt_free (addr);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user