mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: Preparing for releases 1.1.0 and 1.0.1
Date: Fri, 11 Apr 2014 11:46:16 +0200	[thread overview]
Message-ID: <20140411094616.GU3034@port70.net> (raw)
In-Reply-To: <20140411013911.GQ26358@brightrain.aerifal.cx>

* Rich Felker <dalias@aerifal.cx> [2014-04-10 21:39:11 -0400]:
> On Thu, Apr 10, 2014 at 03:11:23PM +0200, Szabolcs Nagy wrote:
> > * x32 timex is broken (should use long long on x32)
> 
> Uhg, so do we need to move this to bits or do some ugly hack? Or
> rewrite it in the syscall wrapper code like for timespec?

move the struct to bits

> > * math alias issues on non-x86 archs (about +80bytes)
> > (either this or __may_alias__)
> 
> I prefer the +80 bytes; the other may_alias uses are optional and have
> a portable fallback.

ok

> > * use 1/eps for rounding check (with *4 it's nicer, ymmv)
> 
> Could you explain why? I would prefer a change that doesn't require so
> many lines changed since they're all places errors could hide. Just
> getting rid of the CONCAT hack seems preferable to me, but I don't
> mind hearing the reason you like the *4.

well integers are special (eg x87 has fld1) so a bit better code
may be generated and they are more familiar

another way to make the code better on some platforms is to use floats:
(and help valgrind)

diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c
index f6e7f38..546df28 100644
--- a/src/stdio/vfprintf.c
+++ b/src/stdio/vfprintf.c
@@ -13,8 +13,6 @@
 
 #define MAX(a,b) ((a)>(b) ? (a) : (b))
 #define MIN(a,b) ((a)<(b) ? (a) : (b))
-#define CONCAT2(x,y) x ## y
-#define CONCAT(x,y) CONCAT2(x,y)
 
 /* Convenient bit representation for modifier flags, which all fall
  * within 31 codepoints of the space character. */
@@ -343,8 +341,8 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t)
 		x = *d % i;
 		/* Are there any significant digits past j? */
 		if (x || d+1!=z) {
-			long double round = CONCAT(0x1p,LDBL_MANT_DIG);
-			long double small;
+			float_t round = 0x1p24f;
+			float_t small;
 			if (*d/i & 1) round += 2;
 			if (x<i/2) small=0x0.8p0;
 			else if (x==i/2 && d+1==z) small=0x1.0p0;
@@ -352,7 +350,12 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t)
 			if (pl && *prefix=='-') round*=-1, small*=-1;
 			*d -= x;
 			/* Decide whether to round by probing round+small */
-			if (round+small != round) {
+#if FLT_EVAL_METHOD!=0
+			/* avoiding compiler bugs */
+			volatile
+#endif
+			float sum = round+small;
+			if (sum != round) {
 				*d = *d + i;
 				while (*d > 999999999) {
 					*d--=0;


> > * only use nanosec for entropy
> 
> I just worry on some archs with bad timer, this could prevent getting
> sufficiently many temp names (of course the problem already existed).
> Is there more non-valuable entropy we could merge into it? One idea
> was the bytes of struct stat from stat() on /proc/self (this is like
> using pid, but better). But perhaps there's more we could do with just
> time.

stat is ok

if there are different clock sources then you can do more with time
or if we assume the retries take non-predictable time (open syscall
on a crowded /tmp) then that can be measured as well

using the seconds may help a bit

r = ts.tv_sec ^ ts.tv_nsec;

(all the relevant 30bits of r are used so further mixing does not help)


> > * broken legacy header..
> > 
> > diff --git a/include/sys/procfs.h b/include/sys/procfs.h
> > index f7936c4..a1fcabf 100644
> > --- a/include/sys/procfs.h
> > +++ b/include/sys/procfs.h
> > @@ -40,7 +40,7 @@ struct elf_prpsinfo
> >  	char pr_zomb;
> >  	char pr_nice;
> >  	unsigned long int pr_flag;
> > -#if UINTPTR_MAX == 0xffffffff
> > +#if UINTPTR_MAX == 0xffffffff && !defined __powerpc__
> 
> I'm ok with this hack I think.

this is probably still broken on microblaze

my guess is that nobody is actually using this header

> > * linux 3.14 stuff
> > (sched_setattr/sched_getattr syscall numbers, new sockopt flag, new arphdr type)
> 
> This should probably be held until a later release. We need to
> consider ABI issues. I believe we have sufficient room to put a union
> (rather than the kernel's silly non-union approach) over top of our
> schedparam struct and fit all the values needed without ABI breakage,
> but this requires some code to convert to/from the kernel format.

well the kernel did not export any definition for the syscalls
and the sched_attr struct so far, only the syscall numbers

i'm not sure if that was intentional, but currently they cannot
be used reasonably from userspace

> > * makefile/config changes for out-of-tree build
> 
> Last I checked you were still finding breakage in it. When I get done
> with the release and other higher-priority things I'm trying to get
> done, maybe I should look at it and give it a proper review. Sorry I
> haven't gotten around to that yet.

i'd say that there are some tradeoffs..


  reply	other threads:[~2014-04-11  9:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-10  2:40 Rich Felker
2014-04-10 13:11 ` Szabolcs Nagy
2014-04-11  1:39   ` Rich Felker
2014-04-11  9:46     ` Szabolcs Nagy [this message]
2014-04-11 13:07       ` Rich Felker
2014-04-11 15:17         ` Morten Welinder
2014-04-11 15:47           ` Szabolcs Nagy
2014-04-11 15:48           ` Rich Felker
2014-04-11 15:51             ` Rich Felker
2014-04-11 17:34               ` Morten Welinder

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=20140411094616.GU3034@port70.net \
    --to=nsz@port70.net \
    --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).