Question about function "settimeofday"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin.Dong

    Question about function "settimeofday"

    Hi,

    Which standard does the function "settimeofd ay" belong to, ISO C or
    POSIX, or .... ??

    I have checked that the header <sys/time.hneeds to be included to
    use above function, and this header is not part of ISO C, but the XSI
    extension part of POSIX.

    But in GNU C library, it really declares above function, and what's
    more strange, the implementation of this function looks like this:

    --------------------------------------------------------------------------------------------------
    /* Set the current time of day and timezone information.
    This call is restricted to the super-user. */
    int
    __settimeofday (tv, tz)
    const struct timeval *tv;
    const struct timezone *tz;
    {
    __set_errno (ENOSYS);
    return -1;
    }
    -----------------------------------------------------------------------------------------------------

    Obviously, this function can't be used by normal user, but what if I'm
    root? If a root user writes some code of calling this function, what
    will happen? Which function will be exactly invoked, above one, or
    other inside OS?

    Appreciate your help!

    - Martin
Working...