mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Justin Cormack <justin@specialbusservice.com>
To: musl@lists.openwall.com
Subject: Re: some issues with #defines
Date: Sun, 2 Dec 2012 08:39:53 +0000	[thread overview]
Message-ID: <CAK4o1WxHvXLfOBYFqPUoD75-0eYseafRi=LhawupE+vc1Lxi1g@mail.gmail.com> (raw)
In-Reply-To: <20121202032622.GG20323@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 2172 bytes --]

On 2 Dec 2012 03:26, "Rich Felker" <dalias@aerifal.cx> wrote:
>
> 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.

Thanks for that. It is including it because it is also including kernel
headers which is always a mess.

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

Yes it is basically defining userspace kernel drivers so liable to be
messy. However it only seems to be a few places so will have a look at
patching it. It gives a way to run KVM without qemu and with much less code
(5k lines) so would be nice to have.

Justin

[-- Attachment #2: Type: text/html, Size: 2614 bytes --]

      reply	other threads:[~2012-12-02  8:39 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
2012-12-02  8:39   ` Justin Cormack [this message]

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='CAK4o1WxHvXLfOBYFqPUoD75-0eYseafRi=LhawupE+vc1Lxi1g@mail.gmail.com' \
    --to=justin@specialbusservice.com \
    --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).