tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: sysconf(_SC_RTSIG_MAX)



    Date:        Wed, 16 Oct 2019 20:21:09 +0000
    From:        coypu%sdf.org@localhost
    Message-ID:  <20191016202109.GA15420%SDF.ORG@localhost>

  | > and define _POSIX_RTSIG_MAX to 8 in limits.h
  |
  | What is POSIX thinking with that requirement...?

That this value is a number that simply specifies the minimum requirement
for any system (any supporting the real time extension - does NetBSD
really do that, I know that we have real time signal numbers defined, but
is the rest of the real time extension implementged?)

This isn't really intended to reflect anything that exists, and the only time
an application should ever use it would be if it wanted to write code in a
way that is guaranteed to work on all implementations (doesn't assume more
real time signals than some implementation might provide) without bothering
to write the code in a way that it adapts to the number actuallu available.

The intro to the section that defines this (and many other similar) says:

  Minimum Values

  The <limits.h> header shall define the following symbolic constants
  with the values shown.   These are the most restrictive values for
  certain features on an implementation conforming to this volume of
  POSIX.1-2017.  Related symbolic constants are defined elsewhere in this
  volume of POSIX.1-2017 which reflect the actual implementation and which
  need not be as restrictive.   For each of these limits, a conforming
  implementation shall provide a value at least this large or shall have
  no limit. A strictly conforming application must not require a larger
  value for correct operation.

The "these limits" in the penultimate sentence there refers to the
"Related symbolic constants are defined elsewhere..." definitions.

As an example of a similar value (with a similar purpose)

  {_POSIX_ARG_MAX}
      Maximum length of argument to the exec functions including environment
      data.
      Value: 4 096

And sure enough in <limits.h> we have:

  #define _POSIX_ARG_MAX          4096    

That doesn't mean we only allow 4K bytes of args, just that POSIX
guarantees that that many will work anywhere, and if an app wants.
it can simply assume that - but nothing bigger.

In general apps query the actual values allowed, rather than using
these low end required minimums.

kre



Home | Main Index | Thread Index | Old Index