This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v4] sysdeps/nanosleep: Use clock_nanosleep_time64 if avaliable


On Wed, Nov 6, 2019 at 10:57 AM Paul Eggert <eggert@cs.ucla.edu> wrote:
>
> On 11/6/19 10:01 AM, Alistair Francis wrote:
> >>> +  ts32 = valid_timespec64_to_timespec (*req);
> >> The man pages for clock_nanosleep (e.g. [2], [3]) do not mention about
> >> the possibility to have *req equal to NULL, hence I do assume that we
> >> don't need to do it here as well...
> > I really don't like accessing a pointer without first checking it.
> > __clock_nanosleep is going to be called from inside glibc so I think
> > it makes sense to keep the check in.
>
> Sorry, I'm not understanding this part of the discussion. req is a
> pointer to a structure, so I assumed that "*req equal to NULL" was
> intended to read "req equal to NULL" and Lukasz was commenting that he

Yes, I think we both mean "req equal to NULL"

> was assuming that the code was correct as-is and does not need a "req !=
> NULL" test. But your reply makes it sound like there's already such a
> test, which is not something that I see in the proposed patch.

You are correct, I got confused between req and rem.

I am happy leaving no checks for req as it should always be set, my
worry was removing the check for rem, which Lukasz wasn't talking
about. I am happy with the checking as is and it sounds like others
are as well. Sorry for the confusion here.

>
> As I understand it, the glibc tradition generally is as Lukasz
> suggested, in that if there's no requirement to check for null pointers
> we generally don't add one. (Of course there are exceptions for
> historical reasons etc.)

Understood!

Alistair


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]