Print this page
13111 Want futimes() and lutimes() functions
Change-ID: I3be82d4242255a4100f8c35db373eb9140402fc4
   1 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
   2 /*        All Rights Reserved   */
   3 
   4 
   5 /*
   6  * Copyright (c) 1982, 1986, 1993 Regents of the University of California.
   7  * All rights reserved.  The Berkeley software License Agreement
   8  * specifies the terms and conditions for redistribution.
   9  */
  10 
  11 /*
  12  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  13  *
  14  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  15  * Use is subject to license terms.
  16  *
  17  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.


  18  */
  19 
  20 /*
  21  * Copyright (c) 2013, 2016 by Delphix. All rights reserved.
  22  */
  23 
  24 #ifndef _SYS_TIME_H
  25 #define _SYS_TIME_H
  26 
  27 #include <sys/feature_tests.h>
  28 
  29 /*
  30  * Structure returned by gettimeofday(2) system call,
  31  * and used in other calls.
  32  */
  33 
  34 #ifdef  __cplusplus
  35 extern "C" {
  36 #endif
  37 


 382 #if defined(_SYSCALL32)
 383 extern  void            hrt2ts32(hrtime_t, timestruc32_t *);
 384 #endif
 385 
 386 #endif /* _KERNEL */
 387 
 388 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
 389 int adjtime(struct timeval *, struct timeval *);
 390 #endif /* !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) ... */
 391 
 392 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || \
 393         defined(_ATFILE_SOURCE) || defined(__EXTENSIONS__)
 394 int futimesat(int, const char *, const struct timeval *);
 395 #endif /* defined(__ATFILE_SOURCE) */
 396 
 397 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
 398         defined(__EXTENSIONS__)
 399 
 400 int getitimer(int, struct itimerval *);
 401 int utimes(const char *, const struct timeval *);

 402 #if defined(_XPG4_2)
 403 int setitimer(int, const struct itimerval *_RESTRICT_KYWD,
 404         struct itimerval *_RESTRICT_KYWD);
 405 #else
 406 int setitimer(int, struct itimerval *_RESTRICT_KYWD,
 407         struct itimerval *_RESTRICT_KYWD);
 408 #endif /* defined(_XPG2_2) */
 409 
 410 #endif /* !defined(_KERNEL) ... defined(_XPG4_2) */
 411 
















 412 /*
 413  * gettimeofday() and settimeofday() were included in SVr4 due to their
 414  * common use in BSD based applications.  They were to be included exactly
 415  * as in BSD, with two parameters.  However, AT&T/USL noted that the second
 416  * parameter was unused and deleted it, thereby making a routine included
 417  * for compatibility, incompatible.
 418  *
 419  * XSH4.2 (spec 1170) defines gettimeofday and settimeofday to have two
 420  * parameters.
 421  *
 422  * This has caused general disagreement in the application community as to
 423  * the syntax of these routines.  Solaris defaults to the XSH4.2 definition.
 424  * The flag _SVID_GETTOD may be used to force the SVID version.
 425  */
 426 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
 427 
 428 #if defined(_SVID_GETTOD)
 429 int settimeofday(struct timeval *);
 430 #else
 431 int settimeofday(struct timeval *, void *);


   1 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
   2 /*        All Rights Reserved   */
   3 
   4 
   5 /*
   6  * Copyright (c) 1982, 1986, 1993 Regents of the University of California.
   7  * All rights reserved.  The Berkeley software License Agreement
   8  * specifies the terms and conditions for redistribution.
   9  */
  10 
  11 /*
  12  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  13  *
  14  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  15  * Use is subject to license terms.
  16  *
  17  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  18  *
  19  * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
  20  */
  21 
  22 /*
  23  * Copyright (c) 2013, 2016 by Delphix. All rights reserved.
  24  */
  25 
  26 #ifndef _SYS_TIME_H
  27 #define _SYS_TIME_H
  28 
  29 #include <sys/feature_tests.h>
  30 
  31 /*
  32  * Structure returned by gettimeofday(2) system call,
  33  * and used in other calls.
  34  */
  35 
  36 #ifdef  __cplusplus
  37 extern "C" {
  38 #endif
  39 


 384 #if defined(_SYSCALL32)
 385 extern  void            hrt2ts32(hrtime_t, timestruc32_t *);
 386 #endif
 387 
 388 #endif /* _KERNEL */
 389 
 390 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
 391 int adjtime(struct timeval *, struct timeval *);
 392 #endif /* !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) ... */
 393 
 394 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || \
 395         defined(_ATFILE_SOURCE) || defined(__EXTENSIONS__)
 396 int futimesat(int, const char *, const struct timeval *);
 397 #endif /* defined(__ATFILE_SOURCE) */
 398 
 399 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
 400         defined(__EXTENSIONS__)
 401 
 402 int getitimer(int, struct itimerval *);
 403 int utimes(const char *, const struct timeval *);
 404 
 405 #if defined(_XPG4_2)
 406 int setitimer(int, const struct itimerval *_RESTRICT_KYWD,
 407         struct itimerval *_RESTRICT_KYWD);
 408 #else
 409 int setitimer(int, struct itimerval *_RESTRICT_KYWD,
 410         struct itimerval *_RESTRICT_KYWD);
 411 #endif /* defined(_XPG2_2) */
 412 
 413 #endif /* !defined(_KERNEL) ... defined(_XPG4_2) */
 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 
 431 /*
 432  * gettimeofday() and settimeofday() were included in SVr4 due to their
 433  * common use in BSD based applications.  They were to be included exactly
 434  * as in BSD, with two parameters.  However, AT&T/USL noted that the second
 435  * parameter was unused and deleted it, thereby making a routine included
 436  * for compatibility, incompatible.
 437  *
 438  * XSH4.2 (spec 1170) defines gettimeofday and settimeofday to have two
 439  * parameters.
 440  *
 441  * This has caused general disagreement in the application community as to
 442  * the syntax of these routines.  Solaris defaults to the XSH4.2 definition.
 443  * The flag _SVID_GETTOD may be used to force the SVID version.
 444  */
 445 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
 446 
 447 #if defined(_SVID_GETTOD)
 448 int settimeofday(struct timeval *);
 449 #else
 450 int settimeofday(struct timeval *, void *);