From: "Michael Kerrisk (man-pages)" <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Zack Weinberg <zackw-VmQCmMdMyN0AvxtiuMwx3w@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
"H.J. Lu" <hjl.tools-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Andreas Schwab <schwab-l3A5Bk7waGM@public.gmane.org>,
libc-alpha <libc-alpha-9JcytcrH/bA+uJoB2kUjGw@public.gmane.org>,
linux-man <linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
Subject: Re: The time(2) man page conflicts with glibc
Date: Wed, 16 Dec 2015 16:04:02 +0100 [thread overview]
Message-ID: <56717D62.9090402@gmail.com> (raw)
In-Reply-To: <CAKCAbMjrKfsT7P=Q=+1zWC68552aK=ciod0HYk3=HWMvkYW26w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Hello Zack,
On 12/16/2015 03:50 PM, Zack Weinberg wrote:
> On Wed, Dec 16, 2015 at 9:07 AM, Michael Kerrisk (man-pages)
> <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>
>> Yes, but the raw system call can give us EFAULT. That needs to be
>> documented.
>>
>> By the way, what's the reason that one can't tell if it returns
>> an error when time() in libc.a is used?
>
> time() in libc.a assumes that the syscall cannot fail, so it doesn't
> set errno. And -EFAULT = (time_t) -14 = 1969-12-31T23:59:46Z is
> something that time() could return *without* its being an error. It's
> kind of the same problem as strtol() has, except I honestly don't see
> any way libc.a could tell the difference.
>
> Given what other people have said about not changing the kernel-level
> behavior, here's a new suggestion for the manpages:
>
> RETURN VALUE
>
> Time in seconds since the Epoch.
>
> ERRORS
>
> EFAULT `t` is non-NULL and points outside your accessible
> address space (but see BUGS).
>
> On systems where the C library time() wrapper function invokes
> an implementation provided by the vdso(7) (so that there is no
> trap into the kernel), an invalid address may instead trigger a
> SIGSEGV signal. Note that whether vdso(7) is used may depend
> on whether a program is statically or dynamically linked.
>
> BUGS
>
> Error returns from this system call are indistinguishable from
> successful reports that the time is a few seconds _before_ the
> Epoch, so the C library never sets `errno` as a result of this call.
>
> The `t` argument is obsolescent and should always be NULL in
> new code. When `t` is NULL, the call cannot fail.
Nice! I've added that new text.
Cheers,
Michael
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-12-16 15:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-15 13:58 The time(2) man page conflicts with glibc H.J. Lu
2015-12-15 14:14 ` Zack Weinberg
[not found] ` <CAKCAbMj-X+wLKX3=MDm9z3L9zyikemxCNggu2bfw6=o6K5PGgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-15 14:31 ` Andreas Schwab
2015-12-15 14:55 ` Mike Frysinger
[not found] ` <20151215145517.GR11489-UgUKS2FnFs9+urZeOPWqwQ@public.gmane.org>
2015-12-15 15:19 ` Zack Weinberg
[not found] ` <CAKCAbMh2ysZPQe3oOSjcPsx1_pcnCAQ6yf+gMbv6iDmvfnGXZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-15 18:38 ` Mike Frysinger
2015-12-16 7:08 ` Rich Felker
[not found] ` <20151216070839.GE238-C3MtFaGISjmo6RMmaWD+6Sb1p8zYI1N1@public.gmane.org>
2015-12-16 20:34 ` Mike Frysinger
[not found] ` <20151216203432.GR11489-UgUKS2FnFs9+urZeOPWqwQ@public.gmane.org>
2015-12-16 21:59 ` Rich Felker
[not found] ` <20151216215955.GJ238-C3MtFaGISjmo6RMmaWD+6Sb1p8zYI1N1@public.gmane.org>
2015-12-16 22:27 ` Zack Weinberg
2015-12-16 22:44 ` Rich Felker
[not found] ` <20151216224432.GK238-C3MtFaGISjmo6RMmaWD+6Sb1p8zYI1N1@public.gmane.org>
2015-12-16 22:51 ` Zack Weinberg
2015-12-17 3:15 ` Mike Frysinger
[not found] ` <CAMe9rOoJLk8VzyJKmkOvbmBxhCj4mVA2huYtHJsdxpatbkgJ1g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-15 14:16 ` Andreas Schwab
[not found] ` <mvmegen94qs.fsf-8jEJWzg51KSXcDkGTvBoYw@public.gmane.org>
2015-12-15 14:17 ` H.J. Lu
2015-12-16 13:38 ` Michael Kerrisk (man-pages)
[not found] ` <5671696B.3070203-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-12-16 13:53 ` H.J. Lu
[not found] ` <CAMe9rOqsxCEia7OWqzJ-HzZWCra5BTyYqt4japjZTw0pY=fugw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-16 14:07 ` Michael Kerrisk (man-pages)
[not found] ` <56717032.7000007-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-12-16 14:50 ` Zack Weinberg
[not found] ` <CAKCAbMjrKfsT7P=Q=+1zWC68552aK=ciod0HYk3=HWMvkYW26w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-16 15:04 ` Michael Kerrisk (man-pages) [this message]
2015-12-16 23:05 ` Paul Eggert
[not found] ` <5671EE36.1000402-764C0pRuGfqVc3sceRu5cw@public.gmane.org>
2015-12-17 5:53 ` Michael Kerrisk (man-pages)
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=56717D62.9090402@gmail.com \
--to=mtk.manpages-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=hjl.tools-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=libc-alpha-9JcytcrH/bA+uJoB2kUjGw@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=schwab-l3A5Bk7waGM@public.gmane.org \
--cc=vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org \
--cc=zackw-VmQCmMdMyN0AvxtiuMwx3w@public.gmane.org \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.