X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=fd.c;h=0adab0f2c0732862f03201119f975873211b5c38;hp=ecd87cdccb555bafea525c3a5ded0063f2b63438;hb=35bbbf736c75f13c2bf9f6d6bdc2feecd42072cb;hpb=c184f843500dd59baa95fbbbab962a1691bf0217 diff --git a/fd.c b/fd.c index ecd87cdc..0adab0f2 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. * @@ -67,7 +85,7 @@ int para_select(int n, fd_set *readfds, fd_set *writefds, * * \return Standard. */ -int mark_fd_nonblock(int fd) +int mark_fd_nonblocking(int fd) { int flags = fcntl(fd, F_GETFL); if (flags < 0)