stat.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
/* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */
/* All Rights Reserved */
#ifndef _SYS_STAT_H
#define _SYS_STAT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/feature_tests.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The implementation specific header <sys/time_impl.h> includes a
* definition for timestruc_t needed by the stat structure. However,
* including either <time.h>, which includes <sys/time_impl.h>, or
* including <sys/time_impl.h> directly will break both X/Open and
* POSIX namespace. Preceeding tag, structure, and structure member
* names with underscores eliminates the namespace breakage and at the
* same time, with unique type names, eliminates the possibility of
* timespec_t or timestruct_t naming conflicts that could otherwise
* <sys/time.h>. The header <sys/time_std_impl.h> contains the
* standards namespace safe versions of these definitions.
*/
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
#include <sys/time_impl.h>
#else
#include <sys/time_std_impl.h>
#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
/*
* stat structure, used by stat(2) and fstat(2)
*/
#if defined(_KERNEL)
/* Expanded stat structure */
#if defined(_LP64)
struct stat {
char st_fstype[_ST_FSTYPSZ];
};
struct stat64 {
char st_fstype[_ST_FSTYPSZ];
};
#else /* _LP64 */
struct stat {
/* sysid definition */
long st_pad2[2];
long st_pad3; /* pad for future off_t expansion */
char st_fstype[_ST_FSTYPSZ];
};
struct stat64 {
/* sysid definition */
long st_pad2[2];
char st_fstype[_ST_FSTYPSZ];
};
#endif /* _LP64 */
#else /* !defined(_KERNEL) */
/*
* large file compilation environment setup
*/
#ifdef __PRAGMA_REDEFINE_EXTNAME
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \
defined(_ATFILE_SOURCE)
#endif /* defined (_ATFILE_SOURCE) */
#endif
#else /* __PRAGMA_REDEFINE_EXTNAME */
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \
defined(_ATFILE_SOURCE)
#endif /* defined (_ATFILE_SOURCE) */
#endif
#endif /* __PRAGMA_REDEFINE_EXTNAME */
#endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
/*
* In the LP64 compilation environment, map large file interfaces
* back to native versions where possible.
*/
#if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
#ifdef __PRAGMA_REDEFINE_EXTNAME
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \
defined(_ATFILE_SOURCE)
#endif /* defined (_ATFILE_SOURCE) */
#endif
#else /* __PRAGMA_REDEFINE_EXTNAME */
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \
defined(_ATFILE_SOURCE)
#endif /* defined (_ATFILE_SOURCE) */
#endif
#endif /* __PRAGMA_REDEFINE_EXTNAME */
#endif /* _LP64 && _LARGEFILE64_SOURCE */
/*
* User level stat structure definitions.
*/
#if defined(_LP64)
struct stat {
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
#else
#endif
char st_fstype[_ST_FSTYPSZ];
};
#else /* _LP64 */
struct stat {
long st_pad2[2];
#if _FILE_OFFSET_BITS != 64
long st_pad3; /* future off_t expansion */
#endif
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
#else
#endif
char st_fstype[_ST_FSTYPSZ];
};
#endif /* _LP64 */
/* transitional large file interface version */
!defined(__PRAGMA_REDEFINE_EXTNAME))
#if defined(_LP64)
struct stat64 {
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
#else
#endif
char st_fstype[_ST_FSTYPSZ];
};
#else /* _LP64 */
struct stat64 {
long st_pad2[2];
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
#else
#endif
char st_fstype[_ST_FSTYPSZ];
};
#endif /* _LP64 */
#endif
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
#else
#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
#endif /* end defined(_KERNEL) */
#if defined(_SYSCALL32)
/*
* Kernel's view of user ILP32 stat and stat64 structures
*/
struct stat32 {
char st_fstype[_ST_FSTYPSZ];
};
#pragma pack(4)
#endif
struct stat64_32 {
char st_fstype[_ST_FSTYPSZ];
};
#pragma pack()
#endif
#endif /* _SYSCALL32 */
/* MODE MASKS */
/* de facto standard definitions */
/* XENIX definitions are not relevant to Solaris */
/* the following macros are for POSIX conformance */
/* POSIX.4 macros */
#define S_TYPEISMQ(_buf) (0)
#define S_TYPEISSEM(_buf) (0)
#define S_TYPEISSHM(_buf) (0)
/*
* A version number is included in the x86 SVR4 stat and mknod interfaces
* so that SVR4 binaries can be supported. An LP64 kernel that supports
* the i386 ABI need to be aware of this too.
*/
#endif /* __i386 || (__i386_COMPAT && _KERNEL) */
#if defined(__STDC__)
defined(_XPG4_2) || defined(__EXTENSIONS__)
#endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
/* transitional large file interfaces */
!defined(__PRAGMA_REDEFINE_EXTNAME))
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \
defined(_ATFILE_SOURCE)
#endif /* defined (_ATFILE_SOURCE) */
#endif
#else /* !__STDC__ */
defined(_XPG4_2) || defined(__EXTENSIONS__)
extern int fchmod();
#endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
extern int chmod();
extern int mkdir();
extern int mkfifo();
/* transitional large file interfaces */
!defined(__PRAGMA_REDEFINE_EXTNAME))
extern int fstat64();
extern int stat64();
extern int lstat64();
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \
defined(_ATFILE_SOURCE)
extern int fstatat64();
#endif /* defined (_ATFILE_SOURCE) */
#endif
#endif /* defined(__STDC__) */
#include <sys/stat_impl.h>
#endif /* !defined(_KERNEL) */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_STAT_H */