The time(2) man page conflicts with glibc

H.J. Lu hjl.tools@gmail.com
Tue Dec 15 13:58:00 GMT 2015


TIME(2)                    Linux Programmer's Manual                   TIME(2)

NAME
       time - get time in seconds

SYNOPSIS
       #include <time.h>

       time_t time(time_t *t);

DESCRIPTION
       time()  returns  the  time  as  the  number of seconds since the Epoch,
       1970-01-01 00:00:00 +0000 (UTC).

       If t is non-NULL, the return value is also stored in the memory pointed
       to by t.

RETURN VALUE
       On  success,  the value of time in seconds since the Epoch is returned.
       On error, ((time_t) -1) is returned, and errno is set appropriately.

ERRORS
       EFAULT t points outside your accessible address space.

CONFORMING TO
       SVr4, 4.3BSD, C89, C99, POSIX.1-2001.  POSIX does not specify any error
       conditions.

But x86-64 glibc has

0000000000000000 <time>:
   0: b8 c9 00 00 00       mov    $0xc9,%eax
   5: 0f 05                 syscall
   7: c3                   retq

I didn't check what kernel returns when memory is invalid.


H.J.



More information about the Libc-alpha mailing list