X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=fd.c;h=b78d266a613422f0319e4e6b4fb1d15c05cd2b60;hp=ecd87cdccb555bafea525c3a5ded0063f2b63438;hb=ddb2a14f84ace45a0faec7c3cf378751ea4ac7d8;hpb=b98061f27df8d44d1b83b842a46d94f4fe68862d diff --git a/fd.c b/fd.c index ecd87cdc..b78d266a 100644 --- a/fd.c +++ b/fd.c @@ -60,6 +60,24 @@ int para_select(int n, fd_set *readfds, fd_set *writefds, return ret; } +/** + * Set a file descriptor to blocking mode. + * + * \param fd The file descriptor. + * + * \return Standard. + */ +int mark_fd_blocking(int fd) +{ + int flags = fcntl(fd, F_GETFL); + if (flags < 0) + return -ERRNO_TO_PARA_ERROR(errno); + flags = fcntl(fd, F_SETFL, ((long)flags) & ~O_NONBLOCK); + if (flags < 0) + return -ERRNO_TO_PARA_ERROR(errno); + return 1; +} + /** * Set a file descriptor to non-blocking mode. *