[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
getdtablesize on MSVC
From: |
Bruno Haible |
Subject: |
getdtablesize on MSVC |
Date: |
Sat, 24 Sep 2011 01:49:05 +0200 |
User-agent: |
KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; ) |
getdtablesize always crashes, because gnulib's implementation is playing games
with _setmaxstdio.
This fixes it.
2011-09-23 Bruno Haible <address@hidden>
getdtablesize: Support for MSVC 9.
* lib/getdtablesize.c: Include msvc-inval.h.
(_setmaxstdio_nothrow): New function.
(_setmaxstdio): Redefine it.
* m4/getdtablesize.m4 (gl_PREREQ_GETDTABLESIZE): New macro.
* modules/getdtablesize (Depends-on): Add msvc-inval.
(configure.ac): Invoke gl_PREREQ_GETDTABLESIZE.
--- lib/getdtablesize.c.orig Sat Sep 24 01:43:07 2011
+++ lib/getdtablesize.c Sat Sep 24 01:40:44 2011
@@ -24,6 +24,29 @@
#include <stdio.h>
+#include "msvc-inval.h"
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static inline int
+_setmaxstdio_nothrow (int newmax)
+{
+ int result;
+
+ TRY_MSVC_INVAL
+ {
+ result = _setmaxstdio (newmax);
+ }
+ CATCH_MSVC_INVAL
+ {
+ result = -1;
+ }
+ DONE_MSVC_INVAL;
+
+ return result;
+}
+# define _setmaxstdio _setmaxstdio_nothrow
+#endif
+
/* Cache for the previous getdtablesize () result. */
static int dtablesize;
--- m4/getdtablesize.m4.orig Sat Sep 24 01:43:07 2011
+++ m4/getdtablesize.m4 Sat Sep 24 01:42:43 2011
@@ -1,4 +1,4 @@
-# getdtablesize.m4 serial 2
+# getdtablesize.m4 serial 3
dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -12,3 +12,8 @@
HAVE_GETDTABLESIZE=0
fi
])
+
+# Prerequisites of lib/getdtablesize.c.
+AC_DEFUN([gl_PREREQ_GETDTABLESIZE], [
+ AC_REQUIRE([AC_C_INLINE])
+])
--- modules/getdtablesize.orig Sat Sep 24 01:43:07 2011
+++ modules/getdtablesize Sat Sep 24 01:42:43 2011
@@ -7,11 +7,13 @@
Depends-on:
unistd
+msvc-inval [test $HAVE_GETDTABLESIZE = 0]
configure.ac:
gl_FUNC_GETDTABLESIZE
if test $HAVE_GETDTABLESIZE = 0; then
AC_LIBOBJ([getdtablesize])
+ gl_PREREQ_GETDTABLESIZE
fi
gl_UNISTD_MODULE_INDICATOR([getdtablesize])
--
In memoriam Ghazala Khan <http://en.wikipedia.org/wiki/Ghazala_Khan>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- getdtablesize on MSVC,
Bruno Haible <=