mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: some issues with #defines
Date: Sat, 1 Dec 2012 22:26:22 -0500	[thread overview]
Message-ID: <20121202032622.GG20323@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAK4o1WzdcEd81yFTg0Rwp=eEfMJT5t7k5wVw2qZws0V_Td1bYQ@mail.gmail.com>

On Sat, Dec 01, 2012 at 11:52:19PM +0000, Justin Cormack wrote:
> PAGE_SIZE is defined in include/bits/limits.h but I am not sure it should
> be. As far as I can see glibc does not define it at all any more fo
> userspace (see man page for getpagesize).

I'm aware that glibc does not define it because they consider it
variable. musl considers it constant because increasing it just wastes
large amounts of memory. The OS is still free to use larger hardware
pages transparently when possible; all PAGE_SIZE really represents the
the granularity of mmap.

I've only run into one program which had a problem due to musl
defining PAGE_SIZE; it was using PAGE_SIZE for its own purposes. This
usage is non-portable since POSIX defines PAGE_SIZE. Per POSIX, if
PAGE_SIZE is defined it's a contant, and if it's not defined, it might
be variable, and the application must use sysconf() to query the page
size. Portable applications can always use sysconf() if desired, but
portable applications wanting to be more efficient can conditionally
use PAGE_SIZE directly if it's defined (allowing a lot of compile-time
constant propagation optimizations) and only fallback to the slower
and more bloated runtime calculations on systems that lack the macro.

> Running into other issues too with includes but suspect they are include
> bugs and need to look at them further, was looking at compiling native kvm
> tool.

There are still lots of issues with very-low-level programs that do
hackish trace/debugger/jit type stuff not liking musl's headers. I'm
working on improving the situation in some respects, but I'm not sure
how successful things will be without some help from their side too.

Rich


  reply	other threads:[~2012-12-02  3:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-01 23:52 Justin Cormack
2012-12-02  3:26 ` Rich Felker [this message]
2012-12-02  8:39   ` Justin Cormack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121202032622.GG20323@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

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