>From 25cdd812eaacda818f770f7f380b6e04166caaca Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 22 Feb 2015 19:07:46 -0800 Subject: [PATCH] Android doesn't define RLIM_SAVED_* Portability problem reported by Kevin Cernekee in: http://lists.gnu.org/archive/html/bug-gnulib/2015-02/msg00122.html * doc/posix-headers/sys_resource.texi (sys/resource.h): Mention the portability problem. * lib/getdtablesize.c (RLIM_SAVED_CUR, RLIM_SAVED_MAX): Define if not defined. * m4/dup2.m4 (gl_FUNC_DUP2): * m4/fcntl.m4 (gl_FUNC_FCNTL): Likewise. --- ChangeLog | 13 +++++++++++++ doc/posix-headers/sys_resource.texi | 4 ++++ lib/getdtablesize.c | 7 +++++++ m4/dup2.m4 | 8 +++++++- m4/fcntl.m4 | 8 +++++++- 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ffd51be..3dccee6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2015-02-22 Paul Eggert + + Android doesn't define RLIM_SAVED_* + Portability problem reported by Kevin Cernekee in: + http://lists.gnu.org/archive/html/bug-gnulib/2015-02/msg00122.html + * doc/posix-headers/sys_resource.texi (sys/resource.h): + Mention the portability problem. + * lib/getdtablesize.c (RLIM_SAVED_CUR, RLIM_SAVED_MAX): + Define if not defined. + * m4/dup2.m4 (gl_FUNC_DUP2): + * m4/fcntl.m4 (gl_FUNC_FCNTL): + Likewise. + 2015-02-21 Paul Eggert vasnprintf-posix-tests: use consistent test diff --git a/doc/posix-headers/sys_resource.texi b/doc/posix-headers/sys_resource.texi index afcf3b4..316423f 100644 --- a/doc/posix-headers/sys_resource.texi +++ b/doc/posix-headers/sys_resource.texi @@ -18,4 +18,8 @@ FreeBSD 5.0. Portability problems not fixed by Gnulib: @itemize address@hidden +On some platforms, this header does not define some or all of the +symbolic constants required by address@hidden For example, Android does not +define @code{RLIM_SAVED_CUR} or @code{RLIM_SAVED_MAX}. @end itemize diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c index bad45f7..03eb7ef 100644 --- a/lib/getdtablesize.c +++ b/lib/getdtablesize.c @@ -89,6 +89,13 @@ getdtablesize (void) # include # include +# ifndef RLIM_SAVED_CUR +# define RLIM_SAVED_CUR RLIM_INFINITY +# endif +# ifndef RLIM_SAVED_MAX +# define RLIM_SAVED_MAX RLIM_INFINITY +# endif + # ifdef __CYGWIN__ /* Cygwin 1.7.25 auto-increases the RLIMIT_NOFILE soft limit until it hits the compile-time constant hard limit of 3200. We might as diff --git a/m4/dup2.m4 b/m4/dup2.m4 index 9aa2ea8..ae87002 100644 --- a/m4/dup2.m4 +++ b/m4/dup2.m4 @@ -1,4 +1,4 @@ -#serial 22 +#serial 23 dnl Copyright (C) 2002, 2005, 2007, 2009-2015 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -25,6 +25,12 @@ AC_DEFUN([gl_FUNC_DUP2], #include #include #include + #ifndef RLIM_SAVED_CUR + # define RLIM_SAVED_CUR RLIM_INFINITY + #endif + #ifndef RLIM_SAVED_MAX + # define RLIM_SAVED_MAX RLIM_INFINITY + #endif ]], [[int result = 0; int bad_fd = INT_MAX; diff --git a/m4/fcntl.m4 b/m4/fcntl.m4 index 218e786..76dd867 100644 --- a/m4/fcntl.m4 +++ b/m4/fcntl.m4 @@ -1,4 +1,4 @@ -# fcntl.m4 serial 7 +# fcntl.m4 serial 8 dnl Copyright (C) 2009-2015 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -34,6 +34,12 @@ AC_DEFUN([gl_FUNC_FCNTL], #include #include #include + #ifndef RLIM_SAVED_CUR + # define RLIM_SAVED_CUR RLIM_INFINITY + #endif + #ifndef RLIM_SAVED_MAX + # define RLIM_SAVED_MAX RLIM_INFINITY + #endif ]], [[int result = 0; int bad_fd = INT_MAX; -- 2.1.0