[Bug 1215] _SC_PAGESIZE is defined but sysconf returns -1

rtems-bugs at rtems.org rtems-bugs at rtems.org
Tue Jan 30 11:11:00 UTC 2007


http://www.rtems.org/bugzilla/show_bug.cgi?id=1215





------- Comment #2 from jwillemsen at remedy.nl  2007-01-30 05:11 -------
> > 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. 

Ok, you are correct, posix says that this is possible

> 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 value returned by sysconf is used as amount of memory to be allocated at
runtime. 

> 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.

Can't it just call ::getpagesize(), I have found that does work.
> 


-- 
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