mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
return the number of transfered bytes in send, recv, read, write & co.
This commit is contained in:
parent
8bfd63ef7f
commit
08403461a9
2 changed files with 9 additions and 27 deletions
|
@ -47,15 +47,6 @@ extern int32_t isle;
|
|||
extern int32_t possible_isles;
|
||||
extern int libc_sd;
|
||||
|
||||
|
||||
int* __getreent(void);
|
||||
|
||||
static inline int* libc_errno(void)
|
||||
{
|
||||
|
||||
return __getreent();
|
||||
}
|
||||
|
||||
tid_t sys_getpid(void)
|
||||
{
|
||||
task_t* task = per_core(current_task);
|
||||
|
@ -116,13 +107,10 @@ ssize_t sys_read(int fd, char* buf, size_t len)
|
|||
// do we have an LwIP file descriptor?
|
||||
if (fd & LWIP_FD_BIT) {
|
||||
ret = lwip_read(fd & ~LWIP_FD_BIT, buf, len);
|
||||
if (ret)
|
||||
{
|
||||
*libc_errno() = errno;
|
||||
return -1;
|
||||
}
|
||||
if (ret < 0)
|
||||
return -errno;
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (libc_sd < 0)
|
||||
|
@ -171,13 +159,10 @@ ssize_t sys_write(int fd, const char* buf, size_t len)
|
|||
// do we have an LwIP file descriptor?
|
||||
if (fd & LWIP_FD_BIT) {
|
||||
ret = lwip_write(fd & ~LWIP_FD_BIT, buf, len);
|
||||
if (ret)
|
||||
{
|
||||
*libc_errno() = errno;
|
||||
return -1;
|
||||
}
|
||||
if (ret < 0)
|
||||
return -errno;
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (libc_sd < 0)
|
||||
|
@ -311,11 +296,8 @@ int sys_close(int fd)
|
|||
// do we have an LwIP file descriptor?
|
||||
if (fd & LWIP_FD_BIT) {
|
||||
ret = lwip_close(fd & ~LWIP_FD_BIT);
|
||||
if (ret)
|
||||
{
|
||||
*libc_errno() = errno;
|
||||
return -1;
|
||||
}
|
||||
if (ret < 0)
|
||||
return -errno;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 9e76e0b89f21173c1a311be6789360c1054eb269
|
||||
Subproject commit 0791e0abfdb8f1144e34adfc463b45a5033c421f
|
Loading…
Add table
Reference in a new issue