zsh-workers
 help / color / mirror / code / Atom feed
* Re: ulimit strangeness
       [not found] <1021114164332.ZM7641@candle.brasslantern.com>
@ 2002-11-15 11:55 ` Peter Stephenson
  2002-11-15 12:57   ` jarausch
  2002-11-16  3:13   ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Stephenson @ 2002-11-15 11:55 UTC (permalink / raw)
  To: Zsh hackers list

"Bart Schaefer" wrote:
> zsh% ulimit -v $[200*1024]; limit
> cputime         unlimited
> filesize        unlimited
> datasize        unlimited
> stacksize       8MB
> coredumpsize    unlimited
> memoryuse       unlimited
> maxproc         2040
> descriptors     1024
> memorylocked    unlimited
> addressspace    200kB		<-- Note, not 200 megabytes!
>
> It looks like this has something to do with the convoluted #ifdef that
> prevents duplicate case labels in rlimits.c when both RLIMIT_RSS and
> RLIMIT_VMEM are defined, but I haven't yet figured out what to fix.

My guess is the test `RLIMIT_RSS != RLIMIT_VMEM' is incorrectly failing
in the preprocessor, i.e. it thinks RLIMIT_RSS == RLIMIT_VMEM owing to
the way the definitions are laid out.  Checking
/usr/include/sys/resource.h or carefully hidden equivalent should
confirm or refute this.  The following programme might help.

  #include <stdio.h>
  #include <sys/resource.h>

  int main(int argc, char **argv)
  {
  #if defined(RLIMIT_RSS) && defined(RLIMIT_VMEM)
      printf("You have both definitions.\n");
      if (RLIMIT_RSS == RLIMIT_VMEM)
      {
	  printf("Both have the same value.\n");
      }
      else
      {
	  printf("They have different values.\n");
  #if RLIMIT_RSS == RLIMIT_VMEM
	  printf("!!!You should never see this message!!!\n");
  #endif
      }
  #else
  #ifdef RLIMIT_RSS
      printf("You only have RSS\n");
  #else
  #ifdef RLIMIT_VMEM
      printf("You only have VMEM\n");
  #else
      printf("You have neither definition.\n");
  #endif
  #endif
  #endif

      return 0;
  }

We could probe this more reliably than at present in configure.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ulimit strangeness
  2002-11-15 11:55 ` ulimit strangeness Peter Stephenson
@ 2002-11-15 12:57   ` jarausch
  2002-11-16  3:13   ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: jarausch @ 2002-11-15 12:57 UTC (permalink / raw)
  To: pws; +Cc: zsh-workers

On 15 Nov, Peter Stephenson wrote:
> "Bart Schaefer" wrote:
>> zsh% ulimit -v $[200*1024]; limit
>> cputime         unlimited
>> filesize        unlimited
>> datasize        unlimited
>> stacksize       8MB
>> coredumpsize    unlimited
>> memoryuse       unlimited
>> maxproc         2040
>> descriptors     1024
>> memorylocked    unlimited
>> addressspace    200kB		<-- Note, not 200 megabytes!
>>
>> It looks like this has something to do with the convoluted #ifdef that
>> prevents duplicate case labels in rlimits.c when both RLIMIT_RSS and
>> RLIMIT_VMEM are defined, but I haven't yet figured out what to fix.
> 
> My guess is the test `RLIMIT_RSS != RLIMIT_VMEM' is incorrectly failing
> in the preprocessor, i.e. it thinks RLIMIT_RSS == RLIMIT_VMEM owing to
> the way the definitions are laid out.  Checking
> /usr/include/sys/resource.h or carefully hidden equivalent should
> confirm or refute this.  The following programme might help.
> 
>   #include <stdio.h>
>   #include <sys/resource.h>
> 
>   int main(int argc, char **argv)
>   {
>   #if defined(RLIMIT_RSS) && defined(RLIMIT_VMEM)
>       printf("You have both definitions.\n");
>       if (RLIMIT_RSS == RLIMIT_VMEM)
>       {
> 	  printf("Both have the same value.\n");
>       }
>       else
>       {
> 	  printf("They have different values.\n");
>   #if RLIMIT_RSS == RLIMIT_VMEM
> 	  printf("!!!You should never see this message!!!\n");
>   #endif
>       }
>   #else
>   #ifdef RLIMIT_RSS
>       printf("You only have RSS\n");
>   #else
>   #ifdef RLIMIT_VMEM
>       printf("You only have VMEM\n");
>   #else
>       printf("You have neither definition.\n");
>   #endif
>   #endif
>   #endif
> 
>       return 0;
>   }
> 
> We could probe this more reliably than at present in configure.
> 

Here on my machine (Linux-From-Scratch   2.4.20-rc1 glibc 2.2.5) I get
You only have RSS.

Thanks,

Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
Aachen University
D 52056 Aachen, Germany



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ulimit strangeness
  2002-11-15 11:55 ` ulimit strangeness Peter Stephenson
  2002-11-15 12:57   ` jarausch
@ 2002-11-16  3:13   ` Bart Schaefer
  2002-11-18 10:31     ` Peter Stephenson
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2002-11-16  3:13 UTC (permalink / raw)
  To: Zsh hackers list

On Nov 15, 11:55am, Peter Stephenson wrote:
} Subject: Re: ulimit strangeness
}
} "Bart Schaefer" wrote:
} > It looks like this has something to do with the convoluted #ifdef that
} > prevents duplicate case labels in rlimits.c when both RLIMIT_RSS and
} > RLIMIT_VMEM are defined, but I haven't yet figured out what to fix.
} 
} My guess is the test `RLIMIT_RSS != RLIMIT_VMEM' is incorrectly failing
} in the preprocessor, i.e. it thinks RLIMIT_RSS == RLIMIT_VMEM owing to
} the way the definitions are laid out.

No, it's this, in Src/system.h:

/* we use the SVR4 constant instead of the BSD one */
#if !defined(RLIMIT_NOFILE) && defined(RLIMIT_OFILE)
# define RLIMIT_NOFILE RLIMIT_OFILE
#endif
#if !defined(RLIMIT_VMEM) && defined(RLIMIT_AS)
# define RLIMIT_VMEM RLIMIT_AS
#endif

So RLIMIT_VMEM *is* defined, and is not the same as RLIMIT_RSS, and ...

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ulimit strangeness
  2002-11-16  3:13   ` Bart Schaefer
@ 2002-11-18 10:31     ` Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2002-11-18 10:31 UTC (permalink / raw)
  To: Zsh hackers list

"Bart Schaefer" wrote:
> #if !defined(RLIMIT_VMEM) && defined(RLIMIT_AS)
> # define RLIMIT_VMEM RLIMIT_AS
> #endif
> 
> So RLIMIT_VMEM *is* defined, and is not the same as RLIMIT_RSS, and ...

Then it shouldn't trigger the problem --- the 1024 factor should be
applied.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-11-18 10:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1021114164332.ZM7641@candle.brasslantern.com>
2002-11-15 11:55 ` ulimit strangeness Peter Stephenson
2002-11-15 12:57   ` jarausch
2002-11-16  3:13   ` Bart Schaefer
2002-11-18 10:31     ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).