Ignore:
Timestamp:
Feb 3, 2017, 2:02:34 PM (8 years ago)
Author:
Silvan Scherrer
Message:

cpio: update vendor to version 2.12

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified cpio/vendor/current/gnu/getdtablesize.c

    r118 r1964  
    1 /* -*- buffer-read-only: t -*- vi: set ro: */
    2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
    31/* getdtablesize() function for platforms that don't have it.
    4    Copyright (C) 2008-2010 Free Software Foundation, Inc.
     2   Copyright (C) 2008-2015 Free Software Foundation, Inc.
    53   Written by Bruno Haible <bruno@clisp.org>, 2008.
    64
     
    2523#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
    2624
    27 #include <stdio.h>
     25# include <stdio.h>
    2826
    29 /* Cache for the previous getdtablesize () result.  */
     27# include "msvc-inval.h"
     28
     29# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
     30static int
     31_setmaxstdio_nothrow (int newmax)
     32{
     33  int result;
     34
     35  TRY_MSVC_INVAL
     36    {
     37      result = _setmaxstdio (newmax);
     38    }
     39  CATCH_MSVC_INVAL
     40    {
     41      result = -1;
     42    }
     43  DONE_MSVC_INVAL;
     44
     45  return result;
     46}
     47#  define _setmaxstdio _setmaxstdio_nothrow
     48# endif
     49
     50/* Cache for the previous getdtablesize () result.  Safe to cache because
     51   Windows also lacks setrlimit.  */
    3052static int dtablesize;
    3153
     
    6385}
    6486
     87#else
     88
     89# include <limits.h>
     90# include <sys/resource.h>
     91
     92# ifndef RLIM_SAVED_CUR
     93#  define RLIM_SAVED_CUR RLIM_INFINITY
     94# endif
     95# ifndef RLIM_SAVED_MAX
     96#  define RLIM_SAVED_MAX RLIM_INFINITY
     97# endif
     98
     99# ifdef __CYGWIN__
     100  /* Cygwin 1.7.25 auto-increases the RLIMIT_NOFILE soft limit until it
     101     hits the compile-time constant hard limit of 3200.  We might as
     102     well just report the hard limit.  */
     103#  define rlim_cur rlim_max
     104# endif
     105
     106int
     107getdtablesize (void)
     108{
     109  struct rlimit lim;
     110
     111  if (getrlimit (RLIMIT_NOFILE, &lim) == 0
     112      && 0 <= lim.rlim_cur && lim.rlim_cur <= INT_MAX
     113      && lim.rlim_cur != RLIM_INFINITY
     114      && lim.rlim_cur != RLIM_SAVED_CUR
     115      && lim.rlim_cur != RLIM_SAVED_MAX)
     116    return lim.rlim_cur;
     117
     118  return INT_MAX;
     119}
     120
    65121#endif
Note: See TracChangeset for help on using the changeset viewer.