[Bug 1215] _SC_PAGESIZE is defined but sysconf returns -1
rtems-bugs at rtems.org
rtems-bugs at rtems.org
Tue Jan 30 11:04:59 UTC 2007
http://www.rtems.org/bugzilla/show_bug.cgi?id=1215
------- Comment #1 from ralf.corsepius at rtems.org 2007-01-30 05:04 -------
(In reply to comment #0)
> With the port of ACE/TAO/CIAO we found a problem with _SC_PAGESIZE. The memory
> pools in ACE use the pagesize as allocation granularity. When _SC_PAGESIZE is
> defined we use sysconf to retrieve the actual pagesize. We now found that
> calling ::sysconf (_SC_PAGESIZE) returns -1 instead of a valid pagesize,
As long as RTEMS also sets errno, I don't see what's wrong with this behavior.
> the
> oroginal ACE code is below. I do see two solutions, implement _SC_PAGESIZE to
> return a correct value or remove the _SC_PAGESIZE define
Well, _SC_PAGESIZE is a key, whose presence is mandated by POSIX, to be used at
runtime to query a configuration database.
POSIX is very clear that returning -1 is a legitimate answer to such query. So
as long as RTEMS returns -1 and sets errno to EINVAL, I don't see any bug in
RTEMS.
IMO, the approach ACE is taking is broken. They draw an illegitimate conclusion
from the fact _SC_PAGESIZE is present. At run-time they should examine the
return value and fall back to something "safe".
The other problem is using sysconf at all. In general, sysconf only works at
runtime, and therefore can not be used at configuration and compile-time.
The other question lurking inside of this PR is if RTEMS's sysconf
implementation can be enhanced to return a valid page size - Yes, this
would be desirable, but doing so probably is not easy.
--
Configure bugmail: http://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the bugs
mailing list