4 #include <msp/core/systemerror.h>
6 #include "handle_private.h"
11 void sys_set_blocking(Handle &handle, bool b)
13 int flags = fcntl(*handle, F_GETFL);
14 fcntl(*handle, F_SETFL, (flags&~O_NONBLOCK)|(b?0:O_NONBLOCK));
17 void sys_set_inherit(Handle &handle, bool i)
19 int flags = fcntl(*handle, F_GETFD);
20 fcntl(*handle, F_SETFD, (flags&~O_CLOEXEC)|(i?O_CLOEXEC:0));
23 unsigned sys_read(Handle &handle, char *buf, unsigned size)
25 int ret = read(*handle, buf, size);
31 throw system_error("read");
37 unsigned sys_write(Handle &handle, const char *buf, unsigned size)
39 int ret = write(*handle, buf, size);
45 throw system_error("write");
51 void sys_close(Handle &handle)
56 *handle = INVALID_HANDLE_VALUE;