Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
ee6369a6
Commit
ee6369a6
authored
Nov 09, 1999
by
simonmar
Browse files
[project @ 1999-11-09 10:46:25 by simonmar]
Reset standard file descriptors to blocking mode on exit.
parent
b38a2d75
Changes
5
Hide whitespace changes
Inline
Side-by-side
ghc/lib/std/cbits/Makefile
View file @
ee6369a6
# $Id: Makefile,v 1.
7
1999/1
0/29 13:52:30 sof
Exp $
# $Id: Makefile,v 1.
8
1999/1
1/09 10:46:27 simonmar
Exp $
TOP
=
../../..
include
$(TOP)/mk/boilerplate.mk
...
...
@@ -16,7 +16,7 @@ C_SRCS= $(wildcard *.c)
C_OBJS
=
$
(
C_SRCS:.c
=
.
$(way_)
o
)
LIBOBJS
=
$(C_OBJS)
SRC_CC_OPTS
+=
-O
-I
$(GHC_INCLUDE_DIR)
$(GhcLibCcOpts)
SRC_CC_OPTS
+=
-O
-I
$(GHC_INCLUDE_DIR)
-I
$(GHC_RUNTIME_DIR)
$(GhcLibCcOpts)
ifneq
"$(way)" "dll"
SRC_CC_OPTS
+=
-static
...
...
ghc/lib/std/cbits/writeError.c
View file @
ee6369a6
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1998
*
* $Id: writeError.c,v 1.
3
1999/11/0
5
1
5:22:59
simonmar Exp $
* $Id: writeError.c,v 1.
4
1999/11/0
9
1
0:46:27
simonmar Exp $
*
* hPutStr Runtime Support
*/
...
...
@@ -17,6 +17,7 @@ implementation in one or two places.)
*/
#include
"Rts.h"
#include
"RtsUtils.h"
#include
"stgio.h"
#ifdef HAVE_FCNTL_H
...
...
@@ -32,13 +33,8 @@ StgInt len;
int
count
=
0
;
char
*
p
=
(
char
*
)
msg
;
char
nl
=
'\n'
;
long
fd_flags
;
#if !defined(_WIN32) || defined(__CYGWIN__) || defined(__CYGWIN32__)
/* clear the non-blocking flag on this file descriptor */
fd_flags
=
fcntl
(
2
,
F_GETFL
);
fcntl
(
2
,
F_SETFL
,
fd_flags
&
~
O_NONBLOCK
);
#endif
resetNonBlockingFd
(
2
);
/* Print error msg header */
if
(
msg_hdr
)
{
...
...
ghc/rts/RtsStartup.c
View file @
ee6369a6
/* -----------------------------------------------------------------------------
* $Id: RtsStartup.c,v 1.2
3
1999/11/0
2
1
7:19:15
simonmar Exp $
* $Id: RtsStartup.c,v 1.2
4
1999/11/0
9
1
0:46:26
simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
...
...
@@ -192,6 +192,11 @@ shutdownHaskell(void)
/* stop the ticker */
initialize_virtual_timer
(
0
);
/* reset the standard file descriptors to blocking mode */
resetNonBlockingFd
(
0
);
resetNonBlockingFd
(
1
);
resetNonBlockingFd
(
2
);
/* stop timing the shutdown, we're about to print stats */
stat_endExit
();
...
...
ghc/rts/RtsUtils.c
View file @
ee6369a6
/* -----------------------------------------------------------------------------
* $Id: RtsUtils.c,v 1.
9
1999/
08/25 16:11:51
simonmar Exp $
* $Id: RtsUtils.c,v 1.
10
1999/
11/09 10:46:26
simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
...
...
@@ -19,6 +19,10 @@
#include
<time.h>
#endif
#ifdef HAVE_FCNTL_H
#include
<fcntl.h>
#endif
#include
<stdarg.h>
/* variable-argument error function. */
...
...
@@ -183,6 +187,26 @@ time_str(void)
}
#endif
/* -----------------------------------------------------------------------------
* Reset a file handle to blocking mode. We do this for the standard
* file descriptors before exiting, because the shell doesn't always
* clean up for us.
* -------------------------------------------------------------------------- */
void
resetNonBlockingFd
(
int
fd
)
{
long
fd_flags
;
#if !defined(_WIN32) || defined(__CYGWIN__) || defined(__CYGWIN32__)
/* clear the non-blocking flag on this file descriptor */
fd_flags
=
fcntl
(
fd
,
F_GETFL
);
if
(
fd_flags
&
O_NONBLOCK
)
{
fcntl
(
fd
,
F_SETFL
,
fd_flags
&
~
O_NONBLOCK
);
}
#endif
}
/* -----------------------------------------------------------------------------
Print large numbers, with punctuation.
-------------------------------------------------------------------------- */
...
...
ghc/rts/RtsUtils.h
View file @
ee6369a6
/* -----------------------------------------------------------------------------
* $Id: RtsUtils.h,v 1.
4
1999/
03/17 13:19
:2
3
simonm Exp $
* $Id: RtsUtils.h,v 1.
5
1999/
11/09 10:46
:2
5
simonm
ar
Exp $
*
* (c) The GHC Team, 1998-1999
*
...
...
@@ -22,6 +22,8 @@ extern void raiseError( StgStablePtr handler );
extern
void
stackOverflow
(
void
);
extern
void
heapOverflow
(
void
);
void
resetNonBlockingFd
(
int
fd
);
extern
nat
stg_strlen
(
char
*
str
);
/*Defined in Main.c, but made visible here*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment