From: Taylor R. Campbell Date: Wed, 15 Apr 2009 13:33:41 +0000 (+0000) Subject: New macro STD_FD_VOID_SYSTEM_CALL to be used after system calls that X-Git-Tag: 20090517-FFI~37 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=89648cf352fe7ab39715e2d242b77aca428aaac8;p=mit-scheme.git New macro STD_FD_VOID_SYSTEM_CALL to be used after system calls that create file descriptors but yield them in some way other than as their return values, such as pipe(2). Use this in OS_make_pipe so that the file exhaustion state is maintained correctly. --- diff --git a/v7/src/microcode/ux.h b/v7/src/microcode/ux.h index 62d3e2064..3673b02d7 100644 --- a/v7/src/microcode/ux.h +++ b/v7/src/microcode/ux.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: ux.h,v 1.92 2009/04/15 13:09:20 riastradh Exp $ +$Id: ux.h,v 1.93 2009/04/15 13:33:40 riastradh Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -880,4 +880,11 @@ extern bool UX_out_of_files_p; UX_out_of_files_p = false; \ } while (0) +#define STD_FD_VOID_SYSTEM_CALL(name, expression) \ + do { \ + while ((expression) < 0) \ + UX_prim_check_fd_errno (name); \ + UX_out_of_files_p = false; \ + } while (0) + #endif /* SCM_UX_H */ diff --git a/v7/src/microcode/uxio.c b/v7/src/microcode/uxio.c index 61de04d21..9d6739dbd 100644 --- a/v7/src/microcode/uxio.c +++ b/v7/src/microcode/uxio.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: uxio.c,v 1.64 2009/04/15 13:00:32 riastradh Exp $ +$Id: uxio.c,v 1.65 2009/04/15 13:33:41 riastradh Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -333,8 +333,7 @@ OS_make_pipe (Tchannel * readerp, Tchannel * writerp) { int pv [2]; transaction_begin (); - while ((UX_pipe (pv)) < 0) - UX_prim_check_fd_errno (syscall_pipe); + STD_FD_VOID_SYSTEM_CALL (syscall_pipe, (UX_pipe (pv))); MAKE_CHANNEL ((pv[0]), channel_type_unix_pipe, (*readerp) =); OS_channel_close_on_abort (*readerp); MAKE_CHANNEL ((pv[1]), channel_type_unix_pipe, (*writerp) =);