mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Added a wrapper function which handles the thread-safe stdio stream
resolution. - In tcflush() a break signal can no longer cause the read flush loop to be quit with two semaphores still locked. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15170 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: termios_console_fdhookentry.c,v 1.4 2006-09-20 19:46:57 obarthel Exp $
|
||||
* $Id: termios_console_fdhookentry.c,v 1.5 2006-11-16 14:39:23 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -198,64 +198,7 @@ __termios_console_hook(
|
||||
|
||||
__fd_lock(fd);
|
||||
|
||||
#if defined(__THREAD_SAFE)
|
||||
{
|
||||
/* Check if this file should be dynamically bound to one of the
|
||||
three standard I/O streams. */
|
||||
if(FLAG_IS_SET(fd->fd_Flags,FDF_STDIO))
|
||||
{
|
||||
switch(fd->fd_DefaultFile)
|
||||
{
|
||||
case STDIN_FILENO:
|
||||
|
||||
file = Input();
|
||||
break;
|
||||
|
||||
case STDOUT_FILENO:
|
||||
|
||||
file = Output();
|
||||
break;
|
||||
|
||||
case STDERR_FILENO:
|
||||
|
||||
#if defined(__amigaos4__)
|
||||
{
|
||||
file = ErrorOutput();
|
||||
}
|
||||
#else
|
||||
{
|
||||
struct Process * this_process = (struct Process *)FindTask(NULL);
|
||||
|
||||
file = this_process->pr_CES;
|
||||
}
|
||||
#endif /* __amigaos4__ */
|
||||
|
||||
/* The following is rather controversial; if the standard error stream
|
||||
is unavailable, we default to reuse the standard output stream. This
|
||||
is problematic if the standard output stream was redirected and should
|
||||
not be the same as the standard error output stream. */
|
||||
if(file == ZERO)
|
||||
file = Output();
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
file = ZERO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
file = fd->fd_DefaultFile;
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
file = fd->fd_DefaultFile;
|
||||
}
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
file = __resolve_fd_file(fd);
|
||||
if(file == ZERO)
|
||||
{
|
||||
SHOWMSG("file is closed");
|
||||
@@ -493,7 +436,7 @@ __termios_console_hook(
|
||||
{
|
||||
/* Should we reset this file into line buffered mode? */
|
||||
if(FLAG_IS_SET(fd->fd_Flags,FDF_NON_BLOCKING) && FLAG_IS_SET(fd->fd_Flags,FDF_IS_INTERACTIVE))
|
||||
SetMode(fd->fd_DefaultFile,DOSFALSE);
|
||||
SetMode(fd->fd_File,DOSFALSE);
|
||||
|
||||
/* Are we allowed to close this file? */
|
||||
if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_NO_CLOSE))
|
||||
@@ -506,7 +449,7 @@ __termios_console_hook(
|
||||
|
||||
PROFILE_OFF();
|
||||
|
||||
if(CANNOT Close(fd->fd_DefaultFile))
|
||||
if(CANNOT Close(fd->fd_File))
|
||||
{
|
||||
fam->fam_Error = __translate_io_error_to_errno(IoErr());
|
||||
|
||||
@@ -515,7 +458,7 @@ __termios_console_hook(
|
||||
|
||||
PROFILE_ON();
|
||||
|
||||
fd->fd_DefaultFile = ZERO;
|
||||
fd->fd_File = ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user