diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 982288702061ae9affe8ef71e0fa8e4d9cf78bb0..e59eb5afd01112f14c2acd7268d6a905988463f8 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,21 @@
+2004-01-12  Mark Mitchell  <mark@codesourcery.com>
+
+	* testsuite/testsuite_hooks.h (__gnu_test::try_mkfifo): Declare it.
+	* testsuite/testsuite_hooks.cc (__gnu_test::try_mkfifo): Define
+	it.
+	* testsuite/27_io/basic_filebuf/close/char/4879.cc: Use try_mkfifo
+	and remove Cygwin XFAIL.
+	* testsuite/27_io/basic_filebuf/close/char/9964.cc: Likewise.
+	* testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc: Likewise.
+	* testsuite/27_io/basic_filebuf/open/char/9507.cc: Likewise.
+	* testsuite/27_io/basic_filebuf/showmanyc/char/9533-1.cc:
+	Likewise.
+	* testsuite/27_io/basic_filebuf/underflow/char/10097.cc: Likewise.
+	* testsuite/27_io/objects/char/7.cc: Likewise.
+	* testsuite/27_io/objects/char/9661-1.cc: Likewise.
+	* testsuite/27_io/objects/wchar_t/7.cc: Likewise.
+	* testsuite/27_io/objects/wchar_t/9661-1.cc: Likewise.
+
 2004-01-11  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
 	* include/std/std_complex.h (std::complex<>::real): Return a
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc
index 90107cd72a904f55ef2bb26666cbc156bfa5665e..bd585443be1b62139d646e76cffb02fe87542b06 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc
@@ -23,9 +23,6 @@
 // various tests for filebuf::open() and filebuf::close() including
 // the non-portable functionality in the libstdc++-v3 IO library
 
-// XXX cygwin does not support mkfifo
-// { dg-do run { xfail *-*-cygwin* } }
-
 #include <fstream>
 #include <iostream>
 #include <unistd.h>
@@ -40,12 +37,14 @@
 void
 test_04()
 {
+  using namespace __gnu_test;
+
   bool test __attribute__((unused)) = true;
   const char* name = "tmp_fifo1";
   signal(SIGPIPE, SIG_IGN);
   
   unlink(name);
-  if (0 != mkfifo(name, S_IRWXU))
+  if (0 != try_mkfifo(name, S_IRWXU))
     {
       std::cerr << "failed to create fifo" << std::endl;
       exit(-1);
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc
index 895c0956e2347fc3c567b288b38d6b499ff456c3..d51a5b1167bbd90406c87e673f9ec43fc3c45895 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc
@@ -23,9 +23,6 @@
 // various tests for filebuf::open() and filebuf::close() including
 // the non-portable functionality in the libstdc++-v3 IO library
 
-// XXX cygwin does not support mkfifo
-// { dg-do run { xfail *-*-cygwin* } }
-
 #include <fstream>
 #include <unistd.h>
 #include <signal.h>
@@ -38,6 +35,7 @@
 void test_07()
 {
   using namespace std;
+  using namespace __gnu_test;
   bool test __attribute__((unused)) = true;
 
   const char* name = "tmp_fifo3";
@@ -45,7 +43,7 @@ void test_07()
   signal(SIGPIPE, SIG_IGN);
 
   unlink(name);  
-  mkfifo(name, S_IRWXU);
+  try_mkfifo(name, S_IRWXU);
   
   int child = fork();
   VERIFY( child != -1 );
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc
index 74aa1fc0dfa65cd4836e6d86cb9180e86d41027c..367017a3bfef6ac5ae11a33f1ef30afca849ecba 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc
@@ -31,13 +31,14 @@ void test01()
 {
   bool test __attribute__((unused)) = true;
   using namespace std;
+  using namespace __gnu_test;
 
   locale loc_fr(__gnu_test::try_named_locale("fr_FR"));
   locale loc_en(__gnu_test::try_named_locale("en_US"));
 
   const char* name = "tmp_fifo_13171-2";
   unlink(name);
-  mkfifo(name, S_IRWXU);
+  try_mkfifo(name, S_IRWXU);
   
   int child = fork();
   if (child == 0)
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc
index 85eeededdd21f4d59dec35afa0ea57307e7e6872..601e570ae25ec4fbb0dc83bd82b681ff2cbc38e3 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc
@@ -23,9 +23,6 @@
 // various tests for filebuf::open() and filebuf::close() including
 // the non-portable functionality in the libstdc++-v3 IO library
 
-// XXX cygwin does not support mkfifo
-// { dg-do run { xfail *-*-cygwin* } }
-
 #include <fstream>
 #include <unistd.h>
 #include <signal.h>
@@ -37,13 +34,14 @@
 // libstdc++/9507
 void test_06()
 {
+  using namespace __gnu_test;
   bool test __attribute__((unused)) = true;
   const char* name = "tmp_fifo2";
 
   signal(SIGPIPE, SIG_IGN);
 
   unlink(name);
-  mkfifo(name, S_IRWXU);
+  try_mkfifo(name, S_IRWXU);
 	
   if (!fork())
     {
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/showmanyc/char/9533-1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/showmanyc/char/9533-1.cc
index 057f72de32cfb231c0c402e3d7c47a92a4974f0e..2839e2f722c805013b43f95dd2286db2ee5f28db 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/showmanyc/char/9533-1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/showmanyc/char/9533-1.cc
@@ -18,9 +18,6 @@
 
 // 27.8.1.4 Overridden virtual functions
 
-// XXX cygwin does not support mkfifo
-// { dg-do run { xfail *-*-cygwin* } }
-
 #include <unistd.h>
 #include <signal.h>
 #include <fcntl.h>
@@ -33,6 +30,7 @@
 void test_01()
 {
   using namespace std;
+  using namespace __gnu_test;
   bool test __attribute__((unused)) = true;
   const char* name = "tmp_fifo1";
 
@@ -41,7 +39,7 @@ void test_01()
   signal(SIGPIPE, SIG_IGN);
   unlink(name);
   
-  if (0 != mkfifo(name, S_IRWXU))
+  if (0 != try_mkfifo(name, S_IRWXU))
     {
       VERIFY( false );
     }
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc
index 156421092dd00976cbdc334c5a510f35d20c3baf..c3c3cf19048ebac49f606ac5b7ab16ea153bf716 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc
@@ -20,9 +20,6 @@
 
 // 27.8.1.4 Overridden virtual functions
 
-// XXX cygwin does not support mkfifo
-// { dg-do run { xfail *-*-cygwin* } }
-
 #include <fstream>
 #include <unistd.h>
 #include <signal.h>
@@ -48,6 +45,7 @@ public:
 void test16()
 {
   using namespace std;
+  using namespace __gnu_test;
   bool test __attribute__((unused)) = true;
 
   const char* name = "tmp_fifo1";
@@ -55,7 +53,7 @@ void test16()
   signal(SIGPIPE, SIG_IGN);
   unlink(name);
   
-  if (0 != mkfifo(name, S_IRWXU))
+  if (0 != try_mkfifo(name, S_IRWXU))
     {
       VERIFY( false );
     }
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/7.cc b/libstdc++-v3/testsuite/27_io/objects/char/7.cc
index 21a7b49c47962524ce39f5f6c2f3d51f67b08d07..06983d9fb7a703fe30c42010d6f7ee0621a11696 100644
--- a/libstdc++-v3/testsuite/27_io/objects/char/7.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/char/7.cc
@@ -20,9 +20,6 @@
 
 // 27.3 Standard iostream objects
 
-// XXX cygwin does not support mkfifo
-// { dg-do run { xfail *-*-cygwin* } }
-
 #include <fstream>
 #include <iostream>
 #include <unistd.h>
@@ -36,6 +33,7 @@
 void test07()
 {
   using namespace std;
+  using namespace __gnu_test;
   bool test __attribute__((unused)) = true;
 
   const char* name = "tmp_fifo4";
@@ -43,7 +41,7 @@ void test07()
   signal(SIGPIPE, SIG_IGN);
 
   unlink(name);  
-  mkfifo(name, S_IRWXU);
+  try_mkfifo(name, S_IRWXU);
   
   int child = fork();
   VERIFY( child != -1 );
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc b/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc
index 61855064277b2f6d456b89707f6d222f1ef40ddd..5b1780e1f0d8c764df671223ad7c2772fae09059 100644
--- a/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc
@@ -18,9 +18,6 @@
 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 // USA.
 
-// XXX cygwin does not support mkfifo
-// { dg-do run { xfail *-*-cygwin* } }
-
 #include <testsuite_hooks.h>
 #include <cstdio>
 #include <iostream>
@@ -36,6 +33,7 @@
 void test01()
 {
   using namespace std;
+  using namespace __gnu_test;
 
   bool test __attribute__((unused)) = true;
 
@@ -44,7 +42,7 @@ void test01()
   signal(SIGPIPE, SIG_IGN);
 
   unlink(name);  
-  mkfifo(name, S_IRWXU);
+  try_mkfifo(name, S_IRWXU);
   
   int child = fork();
   VERIFY( child != -1 );
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc
index 004687af01f920e315dd50b53dee8513d2060bea..a1c97670038aea3e42b1f4446517a6fa6788354a 100644
--- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc
@@ -33,6 +33,7 @@
 void test07()
 {
   using namespace std;
+  using namespace __gnu_test;
   bool test __attribute__((unused)) = true;
 
   const char* name = "tmp_fifo4";
@@ -40,7 +41,7 @@ void test07()
   signal(SIGPIPE, SIG_IGN);
 
   unlink(name);  
-  mkfifo(name, S_IRWXU);
+  try_mkfifo(name, S_IRWXU);
   
   int child = fork();
   VERIFY( child != -1 );
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc
index 9c9d082546d5f7bbef671db87f77152547c6f162..38b832049b873a4efde834fa874e43152ebb5d72 100644
--- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc
@@ -33,6 +33,7 @@
 void test01()
 {
   using namespace std;
+  using namespace __gnu_test;
 
   bool test __attribute__((unused)) = true;
 
@@ -41,7 +42,7 @@ void test01()
   signal(SIGPIPE, SIG_IGN);
 
   unlink(name);  
-  mkfifo(name, S_IRWXU);
+  try_mkfifo(name, S_IRWXU);
   
   int child = fork();
   VERIFY( child != -1 );
diff --git a/libstdc++-v3/testsuite/testsuite_hooks.cc b/libstdc++-v3/testsuite/testsuite_hooks.cc
index 2f4add63f4331fd8f1cb098f9f64ee4ec7d42d87..21c0c0c77e7094f69b7a050e855276e2b024a4f4 100644
--- a/libstdc++-v3/testsuite/testsuite_hooks.cc
+++ b/libstdc++-v3/testsuite/testsuite_hooks.cc
@@ -208,6 +208,17 @@ namespace __gnu_test
       }
   }
 
+  int
+  try_mkfifo (const char* filename, mode_t mode)
+  {
+#ifdef _NEWLIB_VERSION
+    /* Newlib does not have mkfifo.  */
+    exit(0);
+#else
+    return mkfifo(filename, mode);
+#endif
+  }
+
   counter::size_type  counter::count = 0;
   unsigned int copy_constructor::count_ = 0;
   unsigned int copy_constructor::throw_on_ = 0;
diff --git a/libstdc++-v3/testsuite/testsuite_hooks.h b/libstdc++-v3/testsuite/testsuite_hooks.h
index d3755c66f6e1ea461ae0d868ffb1bfa4e60a8529..efe0f85eaa104859857ec3be2c2edef50d0ff86c 100644
--- a/libstdc++-v3/testsuite/testsuite_hooks.h
+++ b/libstdc++-v3/testsuite/testsuite_hooks.h
@@ -63,6 +63,9 @@
 #include <cstddef>
 #include <locale>
 #include <ext/pod_char_traits.h>
+#ifdef _GLIBCXX_HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
 
 #ifdef _GLIBCXX_ASSERT
 # include <cassert>
@@ -141,6 +144,8 @@ namespace __gnu_test
   std::locale
   try_named_locale(const char* name);
 
+  int
+  try_mkfifo (const char* filename, mode_t mode);
 
   // Test data types.
   struct pod_char