mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Added EAGAIN and made read(1) and write(1) retry if they get it.
This commit is contained in:
parent
1ff0321400
commit
f54cb6ab94
3 changed files with 10 additions and 2 deletions
|
@ -32,6 +32,7 @@
|
||||||
#define EILSEQ 40
|
#define EILSEQ 40
|
||||||
#define ELAKE 41
|
#define ELAKE 41
|
||||||
#define EMFILE 42
|
#define EMFILE 42
|
||||||
|
#define EAGAIN 43
|
||||||
|
|
||||||
#define EOPNOTSUPP ENOTSUP
|
#define EOPNOTSUPP ENOTSUP
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@ namespace Maxsi
|
||||||
case EILSEQ: return (char*) "Illegal byte sequence";
|
case EILSEQ: return (char*) "Illegal byte sequence";
|
||||||
case ELAKE: return (char*) "Sit by a lake";
|
case ELAKE: return (char*) "Sit by a lake";
|
||||||
case EMFILE: return (char*) "Too many open files";
|
case EMFILE: return (char*) "Too many open files";
|
||||||
|
case EAGAIN: return (char*) "Resource temporarily unavailable";
|
||||||
default: return (char*) "Unknown error condition";
|
default: return (char*) "Unknown error condition";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,12 +214,18 @@ namespace Maxsi
|
||||||
|
|
||||||
extern "C" ssize_t read(int fd, void* buf, size_t count)
|
extern "C" ssize_t read(int fd, void* buf, size_t count)
|
||||||
{
|
{
|
||||||
return SysRead(fd, buf, count);
|
retry:
|
||||||
|
ssize_t result = SysRead(fd, buf, count);
|
||||||
|
if ( result < 0 && errno == EAGAIN ) { goto retry; }
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" ssize_t write(int fd, const void* buf, size_t count)
|
extern "C" ssize_t write(int fd, const void* buf, size_t count)
|
||||||
{
|
{
|
||||||
return SysWrite(fd, buf, count);
|
retry:
|
||||||
|
ssize_t result = SysWrite(fd, buf, count);
|
||||||
|
if ( result < 0 && errno == EAGAIN ) { goto retry; }
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int writeall(int fd, const void* buffer, size_t len)
|
extern "C" int writeall(int fd, const void* buffer, size_t len)
|
||||||
|
|
Loading…
Add table
Reference in a new issue