1 | /** @file
|
---|
2 | * IPRT / No-CRT - sys/stat.h
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * The contents of this file may alternatively be used under the terms
|
---|
25 | * of the Common Development and Distribution License Version 1.0
|
---|
26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | * CDDL are applicable instead of those of the GPL.
|
---|
29 | *
|
---|
30 | * You may elect to license modified versions of this file under the
|
---|
31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | *
|
---|
33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef IPRT_INCLUDED_nocrt_sys_stat_h
|
---|
37 | #define IPRT_INCLUDED_nocrt_sys_stat_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <iprt/nocrt/time.h> /* Establish timespec and timeval before iprt/fs.h includes iprt/time.h. */
|
---|
43 | #include <iprt/fs.h>
|
---|
44 | #include <iprt/nocrt/sys/types.h>
|
---|
45 | #include <iprt/nocrt/limits.h>
|
---|
46 |
|
---|
47 | #ifdef IPRT_NO_CRT_FOR_3RD_PARTY
|
---|
48 |
|
---|
49 | struct RT_NOCRT(stat)
|
---|
50 | {
|
---|
51 | RTINODE st_ino;
|
---|
52 | RTDEV st_dev;
|
---|
53 | RTDEV st_rdev;
|
---|
54 | RTFMODE st_mode;
|
---|
55 | uint32_t st_link;
|
---|
56 | RTUID st_uid;
|
---|
57 | RTGID st_gid;
|
---|
58 | RTFOFF st_size;
|
---|
59 | RTFOFF st_blocks;
|
---|
60 | uint32_t st_blksize; /**< Not related to st_blocks! */
|
---|
61 | time_t st_birthtime;
|
---|
62 | time_t st_ctime;
|
---|
63 | time_t st_mtime;
|
---|
64 | time_t st_atime;
|
---|
65 | };
|
---|
66 |
|
---|
67 | # define _S_IFIFO RTFS_TYPE_FIFO
|
---|
68 | # define _S_IFCHR RTFS_TYPE_DEV_CHAR
|
---|
69 | # define _S_IFDIR RTFS_TYPE_DIRECTORY
|
---|
70 | # define _S_IFBLK RTFS_TYPE_DEV_BLOCK
|
---|
71 | # define _S_IFREG RTFS_TYPE_FILE
|
---|
72 | # define _S_IFLNK RTFS_TYPE_SYMLINK
|
---|
73 | # define _S_IFSOCK RTFS_TYPE_SOCKET
|
---|
74 | # define _S_IFWHT RTFS_TYPE_WHITEOUT
|
---|
75 | # define _S_IFMT RTFS_TYPE_MASK
|
---|
76 |
|
---|
77 | # define S_IFIFO _S_IFIFO
|
---|
78 | # define S_IFCHR _S_IFCHR
|
---|
79 | # define S_IFDIR _S_IFDIR
|
---|
80 | # define S_IFBLK _S_IFBLK
|
---|
81 | # define S_IFREG _S_IFREG
|
---|
82 | # define S_IFLNK _S_IFLNK
|
---|
83 | # define S_IFSOCK _S_IFSOCK
|
---|
84 | # define S_IFWHT _S_IFWHT
|
---|
85 | # define S_IFMT _S_IFMT
|
---|
86 |
|
---|
87 | # define S_ISFIFO(a_fMode) RTFS_IS_FIFO(a_fMode)
|
---|
88 | # define S_ISCHR(a_fMode) RTFS_IS_DEV_CHAR(a_fMode)
|
---|
89 | # define S_ISDIR(a_fMode) RTFS_IS_DIRECTORY(a_fMode)
|
---|
90 | # define S_ISBLK(a_fMode) RTFS_IS_DEV_BLOCK(a_fMode)
|
---|
91 | # define S_ISREG(a_fMode) RTFS_IS_FILE(a_fMode)
|
---|
92 | # define S_ISLNK(a_fMode) RTFS_IS_SYMLINK(a_fMode)
|
---|
93 | # define S_ISSOCK(a_fMode) RTFS_IS_SOCKET(a_fMode)
|
---|
94 | # define S_ISWHT(a_fMode) RTFS_IS_WHITEOUT(a_fMode)
|
---|
95 |
|
---|
96 |
|
---|
97 | RT_C_DECLS_BEGIN
|
---|
98 |
|
---|
99 | int RT_NOCRT(chmod)(const char *pszPath, RTFMODE fMode);
|
---|
100 | int RT_NOCRT(fchmod)(int fd, RTFMODE fMode);
|
---|
101 | int RT_NOCRT(fstat)(int fd, struct RT_NOCRT(stat) *pStat);
|
---|
102 | int RT_NOCRT(lstat)(const char *pszPath, struct RT_NOCRT(stat) *pStat);
|
---|
103 | int RT_NOCRT(stat)(const char *pszPath, struct RT_NOCRT(stat) *pStat);
|
---|
104 | RTFMODE RT_NOCRT(umask)(RTFMODE fMode);
|
---|
105 | int RT_NOCRT(mkdir)(const char *, RTFMODE fMode);
|
---|
106 |
|
---|
107 | int RT_NOCRT(_chmod)(const char *pszPath, RTFMODE fMode);
|
---|
108 | int RT_NOCRT(_fchmod)(int fd, RTFMODE fMode);
|
---|
109 | int RT_NOCRT(_fstat)(int fd, struct RT_NOCRT(stat) *pStat);
|
---|
110 | int RT_NOCRT(_lstat)(const char *pszPath, struct RT_NOCRT(stat) *pStat);
|
---|
111 | int RT_NOCRT(_stat)(const char *pszPath, struct RT_NOCRT(stat) *pStat);
|
---|
112 | RTFMODE RT_NOCRT(_umask)(RTFMODE fMode);
|
---|
113 | int RT_NOCRT(_mkdir)(const char *, RTFMODE fMode);
|
---|
114 |
|
---|
115 | # if !defined(RT_WITHOUT_NOCRT_WRAPPERS) && !defined(RT_WITHOUT_NOCRT_WRAPPER_ALIASES)
|
---|
116 | # define chmod RT_NOCRT(chmod)
|
---|
117 | # define fchmod RT_NOCRT(fchmod)
|
---|
118 | # define fstat RT_NOCRT(fstat)
|
---|
119 | # define lstat RT_NOCRT(lstat)
|
---|
120 | # define stat RT_NOCRT(stat)
|
---|
121 | # define umask RT_NOCRT(umask)
|
---|
122 | # define mkdir RT_NOCRT(mkdir)
|
---|
123 |
|
---|
124 | # define _chmod RT_NOCRT(chmod)
|
---|
125 | # define _fchmod RT_NOCRT(fchmod)
|
---|
126 | # define _fstat RT_NOCRT(fstat)
|
---|
127 | # define _lstat RT_NOCRT(lstat)
|
---|
128 | # define _stat RT_NOCRT(stat)
|
---|
129 | # define _umask RT_NOCRT(umask)
|
---|
130 | # define _mkdir RT_NOCRT(mkdir)
|
---|
131 | # endif
|
---|
132 |
|
---|
133 | RT_C_DECLS_END
|
---|
134 |
|
---|
135 | #endif /* IPRT_NO_CRT_FOR_3RD_PARTY */
|
---|
136 |
|
---|
137 | #endif /* !IPRT_INCLUDED_nocrt_sys_stat_h */
|
---|
138 |
|
---|