From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2396 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: some issues with #defines Date: Sat, 1 Dec 2012 22:26:22 -0500 Message-ID: <20121202032622.GG20323@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1354418804 14691 80.91.229.3 (2 Dec 2012 03:26:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Dec 2012 03:26:44 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2397-gllmg-musl=m.gmane.org@lists.openwall.com Sun Dec 02 04:26:56 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Tf0Cf-0007Pk-AU for gllmg-musl@plane.gmane.org; Sun, 02 Dec 2012 04:26:49 +0100 Original-Received: (qmail 28008 invoked by uid 550); 2 Dec 2012 03:26:37 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 27998 invoked from network); 2 Dec 2012 03:26:36 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2396 Archived-At: 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