From ab01dd3748fb245fe3feacafd87f91abd1822409 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 31 Oct 2001 10:30:29 +0000 Subject: [PATCH] [project @ 2001-10-31 10:30:29 by simonmar] Add setNonBlockingFd(), for use in the SIGCONT handler in Signals.c. --- ghc/rts/RtsUtils.c | 14 +++++++++++++- ghc/rts/RtsUtils.h | 5 +++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ghc/rts/RtsUtils.c b/ghc/rts/RtsUtils.c index a8ce114..0e302a7 100644 --- a/ghc/rts/RtsUtils.c +++ b/ghc/rts/RtsUtils.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: RtsUtils.c,v 1.22 2001/08/29 15:02:02 sewardj Exp $ + * $Id: RtsUtils.c,v 1.23 2001/10/31 10:30:29 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -238,6 +238,18 @@ resetNonBlockingFd(int fd) #endif } +void +setNonBlockingFd(int fd) +{ + long fd_flags; + +#if !defined(mingw32_TARGET_OS) + /* clear the non-blocking flag on this file descriptor */ + fd_flags = fcntl(fd, F_GETFL); + fcntl(fd, F_SETFL, fd_flags | O_NONBLOCK); +#endif +} + static ullong startTime = 0; /* used in a parallel setup */ diff --git a/ghc/rts/RtsUtils.h b/ghc/rts/RtsUtils.h index cb01e32..8825460 100644 --- a/ghc/rts/RtsUtils.h +++ b/ghc/rts/RtsUtils.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: RtsUtils.h,v 1.11 2001/08/29 14:55:58 sewardj Exp $ + * $Id: RtsUtils.h,v 1.12 2001/10/31 10:30:29 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -21,7 +21,8 @@ extern void _stgAssert (char *filename, unsigned int linenum); extern void heapOverflow(void); -void resetNonBlockingFd(int fd); +extern void setNonBlockingFd(int fd); +extern void resetNonBlockingFd(int fd); extern nat stg_strlen(char *str); -- 1.7.10.4