Print this page
13111 Want futimes() and lutimes() functions
Change-ID: I3be82d4242255a4100f8c35db373eb9140402fc4

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/time.h
          +++ new/usr/src/uts/common/sys/time.h
↓ open down ↓ 7 lines elided ↑ open up ↑
   8    8   * specifies the terms and conditions for redistribution.
   9    9   */
  10   10  
  11   11  /*
  12   12   * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  13   13   *
  14   14   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  15   15   * Use is subject to license terms.
  16   16   *
  17   17   * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
       18 + *
       19 + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
  18   20   */
  19   21  
  20   22  /*
  21   23   * Copyright (c) 2013, 2016 by Delphix. All rights reserved.
  22   24   */
  23   25  
  24   26  #ifndef _SYS_TIME_H
  25   27  #define _SYS_TIME_H
  26   28  
  27   29  #include <sys/feature_tests.h>
↓ open down ↓ 321 lines elided ↑ open up ↑
 349  351  extern  int64_t         hrestime_adj;
 350  352  extern  uint_t          adj_shift;
 351  353  
 352  354  extern  timestruc_t     tod_get(void);
 353  355  extern  void            tod_set(timestruc_t);
 354  356  extern  void            set_hrestime(timestruc_t *);
 355  357  extern  todinfo_t       utc_to_tod(time_t);
 356  358  extern  time_t          tod_to_utc(todinfo_t);
 357  359  extern  int             hr_clock_lock(void);
 358  360  extern  void            hr_clock_unlock(int);
 359      -extern  hrtime_t        gethrtime(void);
 360      -extern  hrtime_t        gethrtime_unscaled(void);
      361 +extern  hrtime_t        gethrtime(void);
      362 +extern  hrtime_t        gethrtime_unscaled(void);
 361  363  extern  hrtime_t        gethrtime_max(void);
 362  364  extern  hrtime_t        gethrtime_waitfree(void);
 363  365  extern  void            scalehrtime(hrtime_t *);
 364  366  extern  uint64_t        unscalehrtime(hrtime_t);
 365      -extern  void            gethrestime(timespec_t *);
 366      -extern  time_t          gethrestime_sec(void);
      367 +extern  void            gethrestime(timespec_t *);
      368 +extern  time_t          gethrestime_sec(void);
 367  369  extern  void            gethrestime_lasttick(timespec_t *);
 368  370  extern  void            hrt2ts(hrtime_t, timestruc_t *);
 369  371  extern  hrtime_t        ts2hrt(const timestruc_t *);
 370  372  extern  void            hrt2tv(hrtime_t, struct timeval *);
 371  373  extern  hrtime_t        tv2hrt(struct timeval *);
 372  374  extern  int             itimerfix(struct timeval *, int);
 373  375  extern  int             itimerdecr(struct itimerval *, int);
 374  376  extern  void            timevaladd(struct timeval *, struct timeval *);
 375  377  extern  void            timevalsub(struct timeval *, struct timeval *);
 376  378  extern  void            timevalfix(struct timeval *);
↓ open down ↓ 15 lines elided ↑ open up ↑
 392  394  #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || \
 393  395          defined(_ATFILE_SOURCE) || defined(__EXTENSIONS__)
 394  396  int futimesat(int, const char *, const struct timeval *);
 395  397  #endif /* defined(__ATFILE_SOURCE) */
 396  398  
 397  399  #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
 398  400          defined(__EXTENSIONS__)
 399  401  
 400  402  int getitimer(int, struct itimerval *);
 401  403  int utimes(const char *, const struct timeval *);
      404 +
 402  405  #if defined(_XPG4_2)
 403  406  int setitimer(int, const struct itimerval *_RESTRICT_KYWD,
 404  407          struct itimerval *_RESTRICT_KYWD);
 405  408  #else
 406  409  int setitimer(int, struct itimerval *_RESTRICT_KYWD,
 407  410          struct itimerval *_RESTRICT_KYWD);
 408  411  #endif /* defined(_XPG2_2) */
 409  412  
 410  413  #endif /* !defined(_KERNEL) ... defined(_XPG4_2) */
 411  414  
      415 +#if !defined(_KERNEL) && !defined(_STRICT_SYMBOLS)
      416 +int futimes(int, const struct timeval *);
      417 +int lutimes(const char *, const struct timeval *);
      418 +
      419 +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
      420 +        (tv)->tv_sec = (ts)->tv_sec; \
      421 +        (tv)->tv_usec = (ts)->tv_nsec / 1000; \
      422 +}
      423 +
      424 +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
      425 +        (ts)->tv_sec = (tv)->tv_sec; \
      426 +        (ts)->tv_nsec = (tv)->tv_usec * 1000; \
      427 +}
      428 +
      429 +#endif /* !defined(_KERNEL) && !defined(_STRICT_SYMBOLS) */
      430 +
 412  431  /*
 413  432   * gettimeofday() and settimeofday() were included in SVr4 due to their
 414  433   * common use in BSD based applications.  They were to be included exactly
 415  434   * as in BSD, with two parameters.  However, AT&T/USL noted that the second
 416  435   * parameter was unused and deleted it, thereby making a routine included
 417  436   * for compatibility, incompatible.
 418  437   *
 419  438   * XSH4.2 (spec 1170) defines gettimeofday and settimeofday to have two
 420  439   * parameters.
 421  440   *
↓ open down ↓ 63 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX