Print this page
Build fixes.
code review feeback, close open comment
Ensured various XPG7 stuff are declared properly in sys/stat.h (and cleanup)
New documentation for wcslen, wcsnlen, wcscasecmp (and friends), wcsdup.
Various other tweaks and markup improvements.


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.

  24  */
  25 
  26 /*      Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
  27 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T       */
  28 /*      All Rights Reserved     */
  29 
  30 #ifndef _SYS_STAT_H
  31 #define _SYS_STAT_H
  32 
  33 #include <sys/feature_tests.h>
  34 #include <sys/types.h>
  35 
  36 #ifdef  __cplusplus
  37 extern "C" {
  38 #endif
  39 
  40 /*
  41  * The implementation specific header <sys/time_impl.h> includes a
  42  * definition for timestruc_t needed by the stat structure.  However,
  43  * including either <time.h>, which includes <sys/time_impl.h>, or


 453 /* POSIX.4 macros */
 454 #define S_TYPEISMQ(_buf)        (0)
 455 #define S_TYPEISSEM(_buf)       (0)
 456 #define S_TYPEISSHM(_buf)       (0)
 457 
 458 #if defined(__i386) || (defined(__i386_COMPAT) && defined(_KERNEL))
 459 
 460 /*
 461  * A version number is included in the x86 SVR4 stat and mknod interfaces
 462  * so that SVR4 binaries can be supported.  An LP64 kernel that supports
 463  * the i386 ABI need to be aware of this too.
 464  */
 465 
 466 #define _R3_MKNOD_VER   1       /* SVR3.0 mknod */
 467 #define _MKNOD_VER      2       /* current version of mknod */
 468 #define _R3_STAT_VER    1       /* SVR3.0 stat */
 469 #define _STAT_VER       2       /* current version of stat */
 470 
 471 #endif  /* __i386 || (__i386_COMPAT && _KERNEL) */
 472 
 473 #if defined(__EXTENSIONS__) || \
 474         (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
 475         /* || defined(_XPG7) */
 476 /* for use with futimens() and utimensat() */
 477 #define UTIME_NOW       -1L
 478 #define UTIME_OMIT      -2L
 479 #endif  /* defined(__EXTENSIONS__) ... */
 480 
 481 #if !defined(_KERNEL) || defined(_BOOT)
 482 
 483 #if defined(__STDC__)
 484 
 485 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
 486         defined(_XPG4_2) || defined(__EXTENSIONS__)
 487 extern int fchmod(int, mode_t);
 488 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
 489 
 490 extern int chmod(const char *, mode_t);
 491 extern int mkdir(const char *, mode_t);
 492 extern int mkfifo(const char *, mode_t);
 493 extern mode_t umask(mode_t);
 494 
 495 /* transitional large file interfaces */
 496 #if     defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
 497             !defined(__PRAGMA_REDEFINE_EXTNAME))
 498 extern int fstat64(int, struct stat64 *);
 499 extern int stat64(const char *_RESTRICT_KYWD, struct stat64 *_RESTRICT_KYWD);
 500 extern int lstat64(const char *_RESTRICT_KYWD, struct stat64 *_RESTRICT_KYWD);
 501 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \
 502         defined(_ATFILE_SOURCE)
 503 extern int fstatat64(int, const char *, struct stat64 *, int);
 504 #endif /* defined (_ATFILE_SOURCE) */
 505 #endif
 506 
 507 #if defined(__EXTENSIONS__) || defined(_ATFILE_SOURCE) || \
 508         (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
 509         /* || defined(_XPG7) */
 510 extern int mkdirat(int, const char *, mode_t);
 511 extern int mkfifoat(int, const char *, mode_t);
 512 extern int mknodat(int, const char *, mode_t, dev_t);
 513 extern int fchmodat(int, const char *, mode_t, int);



 514 extern int futimens(int, const struct timespec[2]);
 515 extern int utimensat(int, const char *, const struct timespec[2], int);
 516 #endif  /* defined(__EXTENSIONS__) ... */
 517 
 518 #else /* !__STDC__ */
 519 
 520 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
 521         defined(_XPG4_2) || defined(__EXTENSIONS__)
 522 extern int fchmod();
 523 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
 524 
 525 extern int chmod();
 526 extern int mkdir();
 527 extern int mkfifo();
 528 extern mode_t umask();
 529 
 530 /* transitional large file interfaces */
 531 #if     defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
 532             !defined(__PRAGMA_REDEFINE_EXTNAME))
 533 extern int fstat64();
 534 extern int stat64();
 535 extern int lstat64();
 536 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \
 537         defined(_ATFILE_SOURCE)
 538 extern int fstatat64();
 539 #endif /* defined (_ATFILE_SOURCE) */
 540 #endif
 541 
 542 #if defined(__EXTENSIONS__) || defined(_ATFILE_SOURCE) || \
 543         (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
 544         /* || defined(_XPG7) */
 545 extern int mkdirat();
 546 extern int mkfifoat();
 547 extern int mknodat();
 548 extern int fchmodat();
 549 extern int futimens();
 550 extern int utimensat();
 551 #endif  /* defined(__EXTENSIONS__) ... */
 552 
 553 #endif /* defined(__STDC__) */
 554 
 555 #include <sys/stat_impl.h>
 556 
 557 #endif /* !defined(_KERNEL) */
 558 
 559 #ifdef  __cplusplus
 560 }
 561 #endif
 562 
 563 #endif  /* _SYS_STAT_H */


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  25  */
  26 
  27 /*      Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
  28 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T       */
  29 /*      All Rights Reserved     */
  30 
  31 #ifndef _SYS_STAT_H
  32 #define _SYS_STAT_H
  33 
  34 #include <sys/feature_tests.h>
  35 #include <sys/types.h>
  36 
  37 #ifdef  __cplusplus
  38 extern "C" {
  39 #endif
  40 
  41 /*
  42  * The implementation specific header <sys/time_impl.h> includes a
  43  * definition for timestruc_t needed by the stat structure.  However,
  44  * including either <time.h>, which includes <sys/time_impl.h>, or


 454 /* POSIX.4 macros */
 455 #define S_TYPEISMQ(_buf)        (0)
 456 #define S_TYPEISSEM(_buf)       (0)
 457 #define S_TYPEISSHM(_buf)       (0)
 458 
 459 #if defined(__i386) || (defined(__i386_COMPAT) && defined(_KERNEL))
 460 
 461 /*
 462  * A version number is included in the x86 SVR4 stat and mknod interfaces
 463  * so that SVR4 binaries can be supported.  An LP64 kernel that supports
 464  * the i386 ABI need to be aware of this too.
 465  */
 466 
 467 #define _R3_MKNOD_VER   1       /* SVR3.0 mknod */
 468 #define _MKNOD_VER      2       /* current version of mknod */
 469 #define _R3_STAT_VER    1       /* SVR3.0 stat */
 470 #define _STAT_VER       2       /* current version of stat */
 471 
 472 #endif  /* __i386 || (__i386_COMPAT && _KERNEL) */
 473 
 474 #if defined(_XPG7) || !defined(_STRICT_SYMBOLS)



 475 #define UTIME_NOW       -1L
 476 #define UTIME_OMIT      -2L
 477 #endif
 478 
 479 #if !defined(_KERNEL) || defined(_BOOT)
 480 


 481 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
 482         defined(_XPG4_2) || defined(__EXTENSIONS__)
 483 extern int fchmod(int, mode_t);
 484 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
 485 
 486 extern int chmod(const char *, mode_t);
 487 extern int mkdir(const char *, mode_t);
 488 extern int mkfifo(const char *, mode_t);
 489 extern mode_t umask(mode_t);
 490 
 491 /* transitional large file interfaces */
 492 #if     defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
 493             !defined(__PRAGMA_REDEFINE_EXTNAME))
 494 extern int fstat64(int, struct stat64 *);
 495 extern int stat64(const char *_RESTRICT_KYWD, struct stat64 *_RESTRICT_KYWD);
 496 extern int lstat64(const char *_RESTRICT_KYWD, struct stat64 *_RESTRICT_KYWD);
 497 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \
 498         defined(_ATFILE_SOURCE)
 499 extern int fstatat64(int, const char *, struct stat64 *, int);
 500 #endif /* defined (_ATFILE_SOURCE) */
 501 #endif
 502 
 503 #if defined(_XPG7) || defined(_ATFILE_SOURCE) || !defined(_STRICT_SYMBOLS)


 504 extern int mkdirat(int, const char *, mode_t);
 505 extern int mkfifoat(int, const char *, mode_t);
 506 extern int mknodat(int, const char *, mode_t, dev_t);
 507 extern int fchmodat(int, const char *, mode_t, int);
 508 #endif
 509 
 510 #if defined(_XPG7) || !defined(_STRICT_SYMBOLS)
 511 extern int futimens(int, const struct timespec[2]);
 512 extern int utimensat(int, const char *, const struct timespec[2], int);
























 513 #endif
 514 













 515 #include <sys/stat_impl.h>
 516 
 517 #endif /* !defined(_KERNEL) */
 518 
 519 #ifdef  __cplusplus
 520 }
 521 #endif
 522 
 523 #endif  /* _SYS_STAT_H */