From: Bruno Haible Date: Thu, 12 Apr 2012 18:59:22 +0000 (+0200) Subject: New module 'sys_resource'. X-Git-Tag: v0.1~751 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=ab2b3f6d0f52f0509361cbe7e5d61565cac00508;p=gnulib.git New module 'sys_resource'. * lib/sys_resource.in.h: New file. * m4/sys_resource_h.m4: New file. * modules/sys_resource: New file. * doc/posix-headers/sys_resource.texi: Mention the new module. --- diff --git a/ChangeLog b/ChangeLog index 84bdeee13..697f8008b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-04-12 Bruno Haible + + New module 'sys_resource'. + * lib/sys_resource.in.h: New file. + * m4/sys_resource_h.m4: New file. + * modules/sys_resource: New file. + * doc/posix-headers/sys_resource.texi: Mention the new module. + 2012-04-12 LRN (tiny change) ioctl: Fix compilation error on mingw. diff --git a/doc/posix-headers/sys_resource.texi b/doc/posix-headers/sys_resource.texi index bcd9cc53e..afcf3b462 100644 --- a/doc/posix-headers/sys_resource.texi +++ b/doc/posix-headers/sys_resource.texi @@ -3,20 +3,19 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_resource.h.html} -Gnulib module: --- +Gnulib module: sys_resource Portability problems fixed by Gnulib: @itemize -@end itemize - -Portability problems not fixed by Gnulib: -@itemize @item This header file is missing on some platforms: mingw, MSVC 9. - @item On some platforms, this header file requires that and already be included: FreeBSD 5.0. @end itemize + +Portability problems not fixed by Gnulib: +@itemize +@end itemize diff --git a/lib/sys_resource.in.h b/lib/sys_resource.in.h new file mode 100644 index 000000000..59bfc6f80 --- /dev/null +++ b/lib/sys_resource.in.h @@ -0,0 +1,85 @@ +/* Substitute for . + Copyright (C) 2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . */ + +# if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +# endif +@PRAGMA_COLUMNS@ + +#ifndef _@GUARD_PREFIX@_SYS_RESOURCE_H + +#if @HAVE_SYS_RESOURCE_H@ + +/* On FreeBSD 5.0, assumes prior inclusion of + and . */ +# include +# include + +/* The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_SYS_RESOURCE_H@ + +#endif + +#ifndef _@GUARD_PREFIX@_SYS_RESOURCE_H +#define _@GUARD_PREFIX@_SYS_RESOURCE_H + +#if !@HAVE_SYS_RESOURCE_H@ +/* A platform that lacks . */ + +/* Get 'struct timeval'. */ +# include + +/* Define the RUSAGE_* constants. */ +# define RUSAGE_SELF 0 +# define RUSAGE_CHILDREN -1 + +# ifdef __cplusplus +extern "C" { +# endif + +# if !GNULIB_defined_struct_rusage +/* All known platforms that lack also lack any declaration + of struct rusage in any other header. */ +struct rusage +{ + struct timeval ru_utime; /* CPU time used in user mode */ + struct timeval ru_stime; /* CPU time used in system mode (kernel) */ + long ru_maxrss; + long ru_ixrss; + long ru_idrss; + long ru_isrss; + long ru_minflt; + long ru_majflt; + long ru_nswap; + long ru_inblock; + long ru_oublock; + long ru_msgsnd; + long ru_msgrcv; + long ru_nsignals; + long ru_nvcsw; + long ru_nivcsw; +}; +# define GNULIB_defined_struct_rusage 1 +# endif + +# ifdef __cplusplus +} +# endif + +#endif + +#endif /* _@GUARD_PREFIX@_SYS_RESOURCE_H */ +#endif /* _@GUARD_PREFIX@_SYS_RESOURCE_H */ diff --git a/m4/sys_resource_h.m4 b/m4/sys_resource_h.m4 new file mode 100644 index 000000000..cb6a03568 --- /dev/null +++ b/m4/sys_resource_h.m4 @@ -0,0 +1,31 @@ +# sys_resource_h.m4 serial 1 +dnl Copyright (C) 2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_HEADER_SYS_RESOURCE], +[ + AC_REQUIRE([gl_SYS_RESOURCE_H_DEFAULTS]) + dnl is always overridden, because of GNULIB_POSIXCHECK. + gl_CHECK_NEXT_HEADERS([sys/resource.h]) + if test $ac_cv_header_sys_resource_h = yes; then + HAVE_SYS_RESOURCE_H=1 + else + HAVE_SYS_RESOURCE_H=0 + fi + AC_SUBST([HAVE_SYS_RESOURCE_H]) +]) + +AC_DEFUN([gl_SYS_RESOURCE_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_SYS_RESOURCE_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_SYS_RESOURCE_H_DEFAULTS], +[ +]) diff --git a/modules/sys_resource b/modules/sys_resource new file mode 100644 index 000000000..d45ac2a15 --- /dev/null +++ b/modules/sys_resource @@ -0,0 +1,44 @@ +Description: +A POSIX-like . + +Files: +lib/sys_resource.in.h +m4/sys_resource_h.m4 + +Depends-on: +include_next +sys_time + +configure.ac: +gl_HEADER_SYS_RESOURCE +AC_PROG_MKDIR_P + +Makefile.am: +BUILT_SOURCES += sys/resource.h + +# We need the following in order to create when the system +# doesn't have one. +sys/resource.h: sys_resource.in.h $(top_builddir)/config.status + $(AM_V_at)$(MKDIR_P) sys + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_SYS_RESOURCE_H''@|$(NEXT_SYS_RESOURCE_H)|g' \ + -e 's|@''HAVE_SYS_RESOURCE_H''@|$(HAVE_SYS_RESOURCE_H)|g' \ + < $(srcdir)/sys_resource.in.h; \ + } > $@-t && \ + mv -f $@-t $@ +MOSTLYCLEANFILES += sys/resource.h sys/resource.h-t +MOSTLYCLEANDIRS += sys + +Include: + + +License: +LGPL + +Maintainer: +Bruno Haible