Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140831124535.GV12888@brightrain.aerifal.cx>
Date: Sun, 31 Aug 2014 08:45:35 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH 2/8] additions to src/time

On Sun, Aug 31, 2014 at 09:15:53AM +0200, Jens Gustedt wrote:
> > Unlike __clock_gettime, your duplicate code does not handle
> > pre-clock_gettime kernels and will return an error on them.
> 
> yeah, somehow I missed the gettimeofday syscall.
> 
> Would it be acceptable by any chance to have a common core for these
> two functions that doesn't set errno? It would perhaps be appropriate
> to use such a function in other places of musl, too.

As any standard function that's not documented not to is allowed to
clobber errno, no special effort is made to preserve it except where
it's required to do so. This is the case all over the source. The
whole reason the C standard allows this clobbering is so that you can
freely use standard functions to implement each other without having
ugly (and potentially slow) code to save and restore errno all over
the place, or having alternate versions of each function that don't
set errno. So I don't see any value in having one here. There is no
cost to the errno-setting code except in code that's invoking the
error path, which should not happen anyway unless you pass an invalid
argument or have a really outdated kernel.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.