fa.netbsd.tech.kern
[Top] [All Lists]

SEM_VALUE_MAX too big?

Subject: SEM_VALUE_MAX too big?
From: Klaus Heinz <k.heinz@xxxxxxxxxxxxxxxx>
Date: Sun, 27 Jul 2008 09:22:46 UTC
Newsgroups: fa.netbsd.tech.kern

Hi,

I needed sysconf(_SC_SEM_VALUE_MAX) and found that it is not yet
supported in NetBSD-current but that there is SEM_VALUE_MAX defined in
/usr/include/semaphore.h.
  #define SEM_VALUE_MAX   (~0U)

If we ever want to support sysconf(_SC_SEM_VALUE_MAX), there will be the
slight difficulty that sysconf() returns "long" and our value for
SEM_VALUE_MAX is too big for a long.

As far as I could find, some other systems use a lower value for
SEM_VALUE_MAX (found through a web search):

  Linux uses "(int) (~0U >>1)" (according to the LSB definition)
  Solaris seems to use 2147483647 (= INT_MAX)
  OpenSolaris uses INT_MAX
  Darwin uses 32767


  FreeBSD uses the same value as NetBSD, (~0U)
  OpenBSD uses UINT_MAX

At the moment, the high value prevents us from supporting
sysconf(_SC_SEM_VALUE_MAX), assuming that we do _not_ want to have two
different values for the same thing.
What would we loose if we lowered the value of SEM_VALUE_MAX by half?

ciao
     Klaus

<Prev in Thread] Current Thread [Next in Thread>