delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1996/12/02/19:24:40

From: fabio AT billie DOT Colorado DOT EDU (Fabio Somenzi)
Subject: getrlimit
2 Dec 1996 19:24:40 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199612030126.SAA10998.cygnus.gnu-win32@billie.Colorado.EDU>
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

If I'm not mistaken, there is not getrlimit and no ulimit in beta 16.
Is this going to change in beta 17?  Maybe a trivial implementation that
always returns RLIM_INFINITY like the one below would be better than
not having getrlimit at all.

Fabio

#include <errno.h>
#include <sys/time.h>
#include <sys/resource.h>

int getrlimit(int resource, struct rlimit *rlim)
{
    switch (resource) {
      case RLIMIT_CPU:
      case RLIMIT_FSIZE:
      case RLIMIT_DATA:
      case RLIMIT_STACK:
      case RLIMIT_CORE:
      case RLIMIT_RSS:
      case RLIMIT_MEMLOCK:
      case RLIMIT_NPROC:
      case RLIMIT_OFILE:
	/* return RLIM_INFINITY here */
	rlim->rlim_cur = RLIM_INFINITY;
	rlim->rlim_max = RLIM_INFINITY;
	return(0);
      default:
	errno = EINVAL;
	return(-1);
    }
}
--
Fabio Somenzi          | Phone: 303-492-3466
University of Colorado | Fax:   303-492-2758
ECE Dept.              | Email: Fabio AT Colorado DOT EDU
Boulder CO 80309-0425  | WWW:   http://vlsi.colorado.edu/~fabio

-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019