diff options
| author | Paul Eggert | 2011-02-21 09:56:37 -0800 |
|---|---|---|
| committer | Paul Eggert | 2011-02-21 09:56:37 -0800 |
| commit | 5c185672d66dc89bfd2c7889a5f0a6984c0ec607 (patch) | |
| tree | 0c3f95cac8c6d7258525c1e47db22f49e9d311f1 /lib | |
| parent | 06b840e0d96538cfa879eb524c9b030988f8e7c5 (diff) | |
| parent | 2763cfc26857991fc4ccde9ff837c06032ac1008 (diff) | |
| download | emacs-5c185672d66dc89bfd2c7889a5f0a6984c0ec607.tar.gz emacs-5c185672d66dc89bfd2c7889a5f0a6984c0ec607.zip | |
Import filemode module from gnulib.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Makefile.am | 1 | ||||
| -rw-r--r-- | lib/Makefile.in | 120 | ||||
| -rw-r--r-- | lib/filemode.c | 180 | ||||
| -rw-r--r-- | lib/filemode.h | 44 | ||||
| -rw-r--r-- | lib/gnulib.mk | 70 | ||||
| -rw-r--r-- | lib/sys_stat.in.h | 646 |
6 files changed, 1044 insertions, 17 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index 6a014f6057b..220ba713d4e 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | BUILT_SOURCES = | 1 | BUILT_SOURCES = |
| 2 | EXTRA_DIST = | 2 | EXTRA_DIST = |
| 3 | MOSTLYCLEANDIRS = | ||
| 3 | MOSTLYCLEANFILES = | 4 | MOSTLYCLEANFILES = |
| 4 | noinst_LIBRARIES = | 5 | noinst_LIBRARIES = |
| 5 | 6 | ||
diff --git a/lib/Makefile.in b/lib/Makefile.in index 0029719373a..b16587bbddc 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | # the same distribution terms as the rest of that program. | 24 | # the same distribution terms as the rest of that program. |
| 25 | # | 25 | # |
| 26 | # Generated by gnulib-tool. | 26 | # Generated by gnulib-tool. |
| 27 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr getloadavg getopt-gnu ignore-value mktime strftime | 27 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime |
| 28 | 28 | ||
| 29 | VPATH = @srcdir@ | 29 | VPATH = @srcdir@ |
| 30 | pkgdatadir = $(datadir)/@PACKAGE@ | 30 | pkgdatadir = $(datadir)/@PACKAGE@ |
| @@ -51,13 +51,15 @@ subdir = lib | |||
| 51 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | 51 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
| 52 | am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ | 52 | am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ |
| 53 | $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/extensions.m4 \ | 53 | $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/extensions.m4 \ |
| 54 | $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getopt.m4 \ | 54 | $(top_srcdir)/m4/filemode.m4 $(top_srcdir)/m4/getloadavg.m4 \ |
| 55 | $(top_srcdir)/m4/gl-comp.m4 $(top_srcdir)/m4/gnulib-common.m4 \ | 55 | $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gl-comp.m4 \ |
| 56 | $(top_srcdir)/m4/gnulib-common.m4 \ | ||
| 56 | $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/longlong.m4 \ | 57 | $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/longlong.m4 \ |
| 57 | $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/mktime.m4 \ | 58 | $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/mktime.m4 \ |
| 58 | $(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/stdbool.m4 \ | 59 | $(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/st_dm_mode.m4 \ |
| 59 | $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \ | 60 | $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ |
| 60 | $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strftime.m4 \ | 61 | $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdlib_h.m4 \ |
| 62 | $(top_srcdir)/m4/strftime.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ | ||
| 61 | $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \ | 63 | $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \ |
| 62 | $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \ | 64 | $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \ |
| 63 | $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.in | 65 | $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.in |
| @@ -152,9 +154,12 @@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ | |||
| 152 | GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ | 154 | GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ |
| 153 | GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ | 155 | GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ |
| 154 | GNULIB_FCHDIR = @GNULIB_FCHDIR@ | 156 | GNULIB_FCHDIR = @GNULIB_FCHDIR@ |
| 157 | GNULIB_FCHMODAT = @GNULIB_FCHMODAT@ | ||
| 155 | GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ | 158 | GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ |
| 159 | GNULIB_FSTATAT = @GNULIB_FSTATAT@ | ||
| 156 | GNULIB_FSYNC = @GNULIB_FSYNC@ | 160 | GNULIB_FSYNC = @GNULIB_FSYNC@ |
| 157 | GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ | 161 | GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ |
| 162 | GNULIB_FUTIMENS = @GNULIB_FUTIMENS@ | ||
| 158 | GNULIB_GETCWD = @GNULIB_GETCWD@ | 163 | GNULIB_GETCWD = @GNULIB_GETCWD@ |
| 159 | GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ | 164 | GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ |
| 160 | GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ | 165 | GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ |
| @@ -167,12 +172,19 @@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ | |||
| 167 | GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ | 172 | GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ |
| 168 | GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ | 173 | GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ |
| 169 | GNULIB_GRANTPT = @GNULIB_GRANTPT@ | 174 | GNULIB_GRANTPT = @GNULIB_GRANTPT@ |
| 175 | GNULIB_LCHMOD = @GNULIB_LCHMOD@ | ||
| 170 | GNULIB_LCHOWN = @GNULIB_LCHOWN@ | 176 | GNULIB_LCHOWN = @GNULIB_LCHOWN@ |
| 171 | GNULIB_LINK = @GNULIB_LINK@ | 177 | GNULIB_LINK = @GNULIB_LINK@ |
| 172 | GNULIB_LINKAT = @GNULIB_LINKAT@ | 178 | GNULIB_LINKAT = @GNULIB_LINKAT@ |
| 173 | GNULIB_LSEEK = @GNULIB_LSEEK@ | 179 | GNULIB_LSEEK = @GNULIB_LSEEK@ |
| 180 | GNULIB_LSTAT = @GNULIB_LSTAT@ | ||
| 174 | GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ | 181 | GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ |
| 182 | GNULIB_MKDIRAT = @GNULIB_MKDIRAT@ | ||
| 175 | GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ | 183 | GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ |
| 184 | GNULIB_MKFIFO = @GNULIB_MKFIFO@ | ||
| 185 | GNULIB_MKFIFOAT = @GNULIB_MKFIFOAT@ | ||
| 186 | GNULIB_MKNOD = @GNULIB_MKNOD@ | ||
| 187 | GNULIB_MKNODAT = @GNULIB_MKNODAT@ | ||
| 176 | GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@ | 188 | GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@ |
| 177 | GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@ | 189 | GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@ |
| 178 | GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ | 190 | GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ |
| @@ -194,6 +206,7 @@ GNULIB_RMDIR = @GNULIB_RMDIR@ | |||
| 194 | GNULIB_RPMATCH = @GNULIB_RPMATCH@ | 206 | GNULIB_RPMATCH = @GNULIB_RPMATCH@ |
| 195 | GNULIB_SETENV = @GNULIB_SETENV@ | 207 | GNULIB_SETENV = @GNULIB_SETENV@ |
| 196 | GNULIB_SLEEP = @GNULIB_SLEEP@ | 208 | GNULIB_SLEEP = @GNULIB_SLEEP@ |
| 209 | GNULIB_STAT = @GNULIB_STAT@ | ||
| 197 | GNULIB_STRPTIME = @GNULIB_STRPTIME@ | 210 | GNULIB_STRPTIME = @GNULIB_STRPTIME@ |
| 198 | GNULIB_STRTOD = @GNULIB_STRTOD@ | 211 | GNULIB_STRTOD = @GNULIB_STRTOD@ |
| 199 | GNULIB_STRTOLL = @GNULIB_STRTOLL@ | 212 | GNULIB_STRTOLL = @GNULIB_STRTOLL@ |
| @@ -211,6 +224,7 @@ GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ | |||
| 211 | GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@ | 224 | GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@ |
| 212 | GNULIB_UNSETENV = @GNULIB_UNSETENV@ | 225 | GNULIB_UNSETENV = @GNULIB_UNSETENV@ |
| 213 | GNULIB_USLEEP = @GNULIB_USLEEP@ | 226 | GNULIB_USLEEP = @GNULIB_USLEEP@ |
| 227 | GNULIB_UTIMENSAT = @GNULIB_UTIMENSAT@ | ||
| 214 | GNULIB_WRITE = @GNULIB_WRITE@ | 228 | GNULIB_WRITE = @GNULIB_WRITE@ |
| 215 | GNULIB__EXIT = @GNULIB__EXIT@ | 229 | GNULIB__EXIT = @GNULIB__EXIT@ |
| 216 | GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@ | 230 | GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@ |
| @@ -239,9 +253,12 @@ HAVE_DUP3 = @HAVE_DUP3@ | |||
| 239 | HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ | 253 | HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ |
| 240 | HAVE_FACCESSAT = @HAVE_FACCESSAT@ | 254 | HAVE_FACCESSAT = @HAVE_FACCESSAT@ |
| 241 | HAVE_FCHDIR = @HAVE_FCHDIR@ | 255 | HAVE_FCHDIR = @HAVE_FCHDIR@ |
| 256 | HAVE_FCHMODAT = @HAVE_FCHMODAT@ | ||
| 242 | HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ | 257 | HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ |
| 258 | HAVE_FSTATAT = @HAVE_FSTATAT@ | ||
| 243 | HAVE_FSYNC = @HAVE_FSYNC@ | 259 | HAVE_FSYNC = @HAVE_FSYNC@ |
| 244 | HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ | 260 | HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ |
| 261 | HAVE_FUTIMENS = @HAVE_FUTIMENS@ | ||
| 245 | HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ | 262 | HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ |
| 246 | HAVE_GETGROUPS = @HAVE_GETGROUPS@ | 263 | HAVE_GETGROUPS = @HAVE_GETGROUPS@ |
| 247 | HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ | 264 | HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ |
| @@ -251,12 +268,19 @@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ | |||
| 251 | HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ | 268 | HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ |
| 252 | HAVE_GRANTPT = @HAVE_GRANTPT@ | 269 | HAVE_GRANTPT = @HAVE_GRANTPT@ |
| 253 | HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ | 270 | HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ |
| 271 | HAVE_LCHMOD = @HAVE_LCHMOD@ | ||
| 254 | HAVE_LCHOWN = @HAVE_LCHOWN@ | 272 | HAVE_LCHOWN = @HAVE_LCHOWN@ |
| 255 | HAVE_LINK = @HAVE_LINK@ | 273 | HAVE_LINK = @HAVE_LINK@ |
| 256 | HAVE_LINKAT = @HAVE_LINKAT@ | 274 | HAVE_LINKAT = @HAVE_LINKAT@ |
| 257 | HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ | 275 | HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ |
| 276 | HAVE_LSTAT = @HAVE_LSTAT@ | ||
| 258 | HAVE_MAKEINFO = @HAVE_MAKEINFO@ | 277 | HAVE_MAKEINFO = @HAVE_MAKEINFO@ |
| 278 | HAVE_MKDIRAT = @HAVE_MKDIRAT@ | ||
| 259 | HAVE_MKDTEMP = @HAVE_MKDTEMP@ | 279 | HAVE_MKDTEMP = @HAVE_MKDTEMP@ |
| 280 | HAVE_MKFIFO = @HAVE_MKFIFO@ | ||
| 281 | HAVE_MKFIFOAT = @HAVE_MKFIFOAT@ | ||
| 282 | HAVE_MKNOD = @HAVE_MKNOD@ | ||
| 283 | HAVE_MKNODAT = @HAVE_MKNODAT@ | ||
| 260 | HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ | 284 | HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ |
| 261 | HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ | 285 | HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ |
| 262 | HAVE_MKSTEMP = @HAVE_MKSTEMP@ | 286 | HAVE_MKSTEMP = @HAVE_MKSTEMP@ |
| @@ -298,6 +322,7 @@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ | |||
| 298 | HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ | 322 | HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ |
| 299 | HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ | 323 | HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ |
| 300 | HAVE_USLEEP = @HAVE_USLEEP@ | 324 | HAVE_USLEEP = @HAVE_USLEEP@ |
| 325 | HAVE_UTIMENSAT = @HAVE_UTIMENSAT@ | ||
| 301 | HAVE_WCHAR_H = @HAVE_WCHAR_H@ | 326 | HAVE_WCHAR_H = @HAVE_WCHAR_H@ |
| 302 | HAVE_WCHAR_T = @HAVE_WCHAR_T@ | 327 | HAVE_WCHAR_T = @HAVE_WCHAR_T@ |
| 303 | HAVE_XSERVER = @HAVE_XSERVER@ | 328 | HAVE_XSERVER = @HAVE_XSERVER@ |
| @@ -369,12 +394,14 @@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ | |||
| 369 | NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ | 394 | NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ |
| 370 | NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ | 395 | NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ |
| 371 | NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ | 396 | NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ |
| 397 | NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@ | ||
| 372 | NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ | 398 | NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ |
| 373 | NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ | 399 | NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ |
| 374 | NEXT_GETOPT_H = @NEXT_GETOPT_H@ | 400 | NEXT_GETOPT_H = @NEXT_GETOPT_H@ |
| 375 | NEXT_STDDEF_H = @NEXT_STDDEF_H@ | 401 | NEXT_STDDEF_H = @NEXT_STDDEF_H@ |
| 376 | NEXT_STDINT_H = @NEXT_STDINT_H@ | 402 | NEXT_STDINT_H = @NEXT_STDINT_H@ |
| 377 | NEXT_STDLIB_H = @NEXT_STDLIB_H@ | 403 | NEXT_STDLIB_H = @NEXT_STDLIB_H@ |
| 404 | NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ | ||
| 378 | NEXT_TIME_H = @NEXT_TIME_H@ | 405 | NEXT_TIME_H = @NEXT_TIME_H@ |
| 379 | NEXT_UNISTD_H = @NEXT_UNISTD_H@ | 406 | NEXT_UNISTD_H = @NEXT_UNISTD_H@ |
| 380 | NS_OBJ = @NS_OBJ@ | 407 | NS_OBJ = @NS_OBJ@ |
| @@ -410,6 +437,9 @@ REPLACE_CLOSE = @REPLACE_CLOSE@ | |||
| 410 | REPLACE_DUP = @REPLACE_DUP@ | 437 | REPLACE_DUP = @REPLACE_DUP@ |
| 411 | REPLACE_DUP2 = @REPLACE_DUP2@ | 438 | REPLACE_DUP2 = @REPLACE_DUP2@ |
| 412 | REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ | 439 | REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ |
| 440 | REPLACE_FSTAT = @REPLACE_FSTAT@ | ||
| 441 | REPLACE_FSTATAT = @REPLACE_FSTATAT@ | ||
| 442 | REPLACE_FUTIMENS = @REPLACE_FUTIMENS@ | ||
| 413 | REPLACE_GETCWD = @REPLACE_GETCWD@ | 443 | REPLACE_GETCWD = @REPLACE_GETCWD@ |
| 414 | REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@ | 444 | REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@ |
| 415 | REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ | 445 | REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ |
| @@ -420,7 +450,11 @@ REPLACE_LINK = @REPLACE_LINK@ | |||
| 420 | REPLACE_LINKAT = @REPLACE_LINKAT@ | 450 | REPLACE_LINKAT = @REPLACE_LINKAT@ |
| 421 | REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ | 451 | REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ |
| 422 | REPLACE_LSEEK = @REPLACE_LSEEK@ | 452 | REPLACE_LSEEK = @REPLACE_LSEEK@ |
| 453 | REPLACE_LSTAT = @REPLACE_LSTAT@ | ||
| 423 | REPLACE_MALLOC = @REPLACE_MALLOC@ | 454 | REPLACE_MALLOC = @REPLACE_MALLOC@ |
| 455 | REPLACE_MKDIR = @REPLACE_MKDIR@ | ||
| 456 | REPLACE_MKFIFO = @REPLACE_MKFIFO@ | ||
| 457 | REPLACE_MKNOD = @REPLACE_MKNOD@ | ||
| 424 | REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ | 458 | REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ |
| 425 | REPLACE_MKTIME = @REPLACE_MKTIME@ | 459 | REPLACE_MKTIME = @REPLACE_MKTIME@ |
| 426 | REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ | 460 | REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ |
| @@ -434,6 +468,7 @@ REPLACE_REALPATH = @REPLACE_REALPATH@ | |||
| 434 | REPLACE_RMDIR = @REPLACE_RMDIR@ | 468 | REPLACE_RMDIR = @REPLACE_RMDIR@ |
| 435 | REPLACE_SETENV = @REPLACE_SETENV@ | 469 | REPLACE_SETENV = @REPLACE_SETENV@ |
| 436 | REPLACE_SLEEP = @REPLACE_SLEEP@ | 470 | REPLACE_SLEEP = @REPLACE_SLEEP@ |
| 471 | REPLACE_STAT = @REPLACE_STAT@ | ||
| 437 | REPLACE_STRTOD = @REPLACE_STRTOD@ | 472 | REPLACE_STRTOD = @REPLACE_STRTOD@ |
| 438 | REPLACE_SYMLINK = @REPLACE_SYMLINK@ | 473 | REPLACE_SYMLINK = @REPLACE_SYMLINK@ |
| 439 | REPLACE_TIMEGM = @REPLACE_TIMEGM@ | 474 | REPLACE_TIMEGM = @REPLACE_TIMEGM@ |
| @@ -442,6 +477,7 @@ REPLACE_UNLINK = @REPLACE_UNLINK@ | |||
| 442 | REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ | 477 | REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ |
| 443 | REPLACE_UNSETENV = @REPLACE_UNSETENV@ | 478 | REPLACE_UNSETENV = @REPLACE_UNSETENV@ |
| 444 | REPLACE_USLEEP = @REPLACE_USLEEP@ | 479 | REPLACE_USLEEP = @REPLACE_USLEEP@ |
| 480 | REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@ | ||
| 445 | REPLACE_WRITE = @REPLACE_WRITE@ | 481 | REPLACE_WRITE = @REPLACE_WRITE@ |
| 446 | RSVG_CFLAGS = @RSVG_CFLAGS@ | 482 | RSVG_CFLAGS = @RSVG_CFLAGS@ |
| 447 | RSVG_LIBS = @RSVG_LIBS@ | 483 | RSVG_LIBS = @RSVG_LIBS@ |
| @@ -559,25 +595,27 @@ x_default_search_path = @x_default_search_path@ | |||
| 559 | # present in all Makefile.am that need it. This is ensured by the applicability | 595 | # present in all Makefile.am that need it. This is ensured by the applicability |
| 560 | # 'all' defined above. | 596 | # 'all' defined above. |
| 561 | BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \ | 597 | BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \ |
| 562 | $(STDDEF_H) $(STDINT_H) stdlib.h time.h unistd.h warn-on-use.h | 598 | $(STDDEF_H) $(STDINT_H) stdlib.h sys/stat.h time.h unistd.h \ |
| 599 | warn-on-use.h | ||
| 563 | EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \ | 600 | EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \ |
| 564 | md5.c md5.h ftoastr.c ftoastr.h getloadavg.c getopt.c \ | 601 | md5.c md5.h ftoastr.c ftoastr.h filemode.c filemode.h \ |
| 565 | getopt.in.h getopt1.c getopt_int.h intprops.h \ | 602 | getloadavg.c getopt.c getopt.in.h getopt1.c getopt_int.h \ |
| 566 | mktime-internal.h mktime.c stdbool.in.h stddef.in.h \ | 603 | intprops.h mktime-internal.h mktime.c stdbool.in.h stddef.in.h \ |
| 567 | stdint.in.h stdlib.in.h strftime.c strftime.h time.in.h \ | 604 | stdint.in.h stdlib.in.h strftime.c strftime.h sys_stat.in.h \ |
| 568 | time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h | 605 | time.in.h time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h |
| 606 | MOSTLYCLEANDIRS = sys | ||
| 569 | MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ | 607 | MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ |
| 570 | c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \ | 608 | c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \ |
| 571 | stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t stdlib.h \ | 609 | stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t stdlib.h \ |
| 572 | stdlib.h-t time.h time.h-t unistd.h unistd.h-t warn-on-use.h \ | 610 | stdlib.h-t sys/stat.h sys/stat.h-t time.h time.h-t unistd.h \ |
| 573 | warn-on-use.h-t | 611 | unistd.h-t warn-on-use.h warn-on-use.h-t |
| 574 | noinst_LIBRARIES = libgnu.a | 612 | noinst_LIBRARIES = libgnu.a |
| 575 | DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src | 613 | DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src |
| 576 | libgnu_a_SOURCES = dtoastr.c gettext.h ignore-value.h | 614 | libgnu_a_SOURCES = dtoastr.c gettext.h ignore-value.h |
| 577 | libgnu_a_LIBADD = $(gl_LIBOBJS) | 615 | libgnu_a_LIBADD = $(gl_LIBOBJS) |
| 578 | libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) | 616 | libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) |
| 579 | EXTRA_libgnu_a_SOURCES = md5.c ftoastr.c getloadavg.c getopt.c \ | 617 | EXTRA_libgnu_a_SOURCES = md5.c ftoastr.c filemode.c getloadavg.c \ |
| 580 | getopt1.c mktime.c strftime.c time_r.c | 618 | getopt.c getopt1.c mktime.c strftime.c time_r.c |
| 581 | ARG_NONNULL_H = arg-nonnull.h | 619 | ARG_NONNULL_H = arg-nonnull.h |
| 582 | CXXDEFS_H = c++defs.h | 620 | CXXDEFS_H = c++defs.h |
| 583 | WARN_ON_USE_H = warn-on-use.h | 621 | WARN_ON_USE_H = warn-on-use.h |
| @@ -631,6 +669,7 @@ distclean-compile: | |||
| 631 | -rm -f *.tab.c | 669 | -rm -f *.tab.c |
| 632 | 670 | ||
| 633 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtoastr.Po@am__quote@ | 671 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtoastr.Po@am__quote@ |
| 672 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filemode.Po@am__quote@ | ||
| 634 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftoastr.Po@am__quote@ | 673 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftoastr.Po@am__quote@ |
| 635 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@ | 674 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@ |
| 636 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ | 675 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ |
| @@ -1021,6 +1060,55 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | |||
| 1021 | } > $@-t && \ | 1060 | } > $@-t && \ |
| 1022 | mv $@-t $@ | 1061 | mv $@-t $@ |
| 1023 | 1062 | ||
| 1063 | # We need the following in order to create <sys/stat.h> when the system | ||
| 1064 | # has one that is incomplete. | ||
| 1065 | sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | ||
| 1066 | $(AM_V_at)$(MKDIR_P) sys | ||
| 1067 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 1068 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 1069 | sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ | ||
| 1070 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 1071 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ | ||
| 1072 | -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ | ||
| 1073 | -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \ | ||
| 1074 | -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \ | ||
| 1075 | -e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \ | ||
| 1076 | -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \ | ||
| 1077 | -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \ | ||
| 1078 | -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \ | ||
| 1079 | -e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \ | ||
| 1080 | -e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \ | ||
| 1081 | -e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \ | ||
| 1082 | -e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \ | ||
| 1083 | -e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \ | ||
| 1084 | -e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \ | ||
| 1085 | -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ | ||
| 1086 | -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ | ||
| 1087 | -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ | ||
| 1088 | -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \ | ||
| 1089 | -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ | ||
| 1090 | -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \ | ||
| 1091 | -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \ | ||
| 1092 | -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \ | ||
| 1093 | -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \ | ||
| 1094 | -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \ | ||
| 1095 | -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \ | ||
| 1096 | -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \ | ||
| 1097 | -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \ | ||
| 1098 | -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \ | ||
| 1099 | -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \ | ||
| 1100 | -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \ | ||
| 1101 | -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \ | ||
| 1102 | -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \ | ||
| 1103 | -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \ | ||
| 1104 | -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \ | ||
| 1105 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | ||
| 1106 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | ||
| 1107 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ | ||
| 1108 | < $(srcdir)/sys_stat.in.h; \ | ||
| 1109 | } > $@-t && \ | ||
| 1110 | mv $@-t $@ | ||
| 1111 | |||
| 1024 | # We need the following in order to create <time.h> when the system | 1112 | # We need the following in order to create <time.h> when the system |
| 1025 | # doesn't have one that works with the given compiler. | 1113 | # doesn't have one that works with the given compiler. |
| 1026 | time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | 1114 | time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) |
diff --git a/lib/filemode.c b/lib/filemode.c new file mode 100644 index 00000000000..0f6641ace6a --- /dev/null +++ b/lib/filemode.c | |||
| @@ -0,0 +1,180 @@ | |||
| 1 | /* filemode.c -- make a string describing file modes | ||
| 2 | |||
| 3 | Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2011 Free | ||
| 4 | Software Foundation, Inc. | ||
| 5 | |||
| 6 | This program is free software: you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation; either version 3 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | This program is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 18 | |||
| 19 | #include <config.h> | ||
| 20 | |||
| 21 | #include "filemode.h" | ||
| 22 | |||
| 23 | /* The following is for Cray DMF (Data Migration Facility), which is a | ||
| 24 | HSM file system. A migrated file has a `st_dm_mode' that is | ||
| 25 | different from the normal `st_mode', so any tests for migrated | ||
| 26 | files should use the former. */ | ||
| 27 | #if HAVE_ST_DM_MODE | ||
| 28 | # define IS_MIGRATED_FILE(statp) \ | ||
| 29 | (S_ISOFD (statp->st_dm_mode) || S_ISOFL (statp->st_dm_mode)) | ||
| 30 | #else | ||
| 31 | # define IS_MIGRATED_FILE(statp) 0 | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #if ! HAVE_DECL_STRMODE | ||
| 35 | |||
| 36 | /* Return a character indicating the type of file described by | ||
| 37 | file mode BITS: | ||
| 38 | '-' regular file | ||
| 39 | 'b' block special file | ||
| 40 | 'c' character special file | ||
| 41 | 'C' high performance ("contiguous data") file | ||
| 42 | 'd' directory | ||
| 43 | 'D' door | ||
| 44 | 'l' symbolic link | ||
| 45 | 'm' multiplexed file (7th edition Unix; obsolete) | ||
| 46 | 'n' network special file (HP-UX) | ||
| 47 | 'p' fifo (named pipe) | ||
| 48 | 'P' port | ||
| 49 | 's' socket | ||
| 50 | 'w' whiteout (4.4BSD) | ||
| 51 | '?' some other file type */ | ||
| 52 | |||
| 53 | static char | ||
| 54 | ftypelet (mode_t bits) | ||
| 55 | { | ||
| 56 | /* These are the most common, so test for them first. */ | ||
| 57 | if (S_ISREG (bits)) | ||
| 58 | return '-'; | ||
| 59 | if (S_ISDIR (bits)) | ||
| 60 | return 'd'; | ||
| 61 | |||
| 62 | /* Other letters standardized by POSIX 1003.1-2004. */ | ||
| 63 | if (S_ISBLK (bits)) | ||
| 64 | return 'b'; | ||
| 65 | if (S_ISCHR (bits)) | ||
| 66 | return 'c'; | ||
| 67 | if (S_ISLNK (bits)) | ||
| 68 | return 'l'; | ||
| 69 | if (S_ISFIFO (bits)) | ||
| 70 | return 'p'; | ||
| 71 | |||
| 72 | /* Other file types (though not letters) standardized by POSIX. */ | ||
| 73 | if (S_ISSOCK (bits)) | ||
| 74 | return 's'; | ||
| 75 | |||
| 76 | /* Nonstandard file types. */ | ||
| 77 | if (S_ISCTG (bits)) | ||
| 78 | return 'C'; | ||
| 79 | if (S_ISDOOR (bits)) | ||
| 80 | return 'D'; | ||
| 81 | if (S_ISMPB (bits) || S_ISMPC (bits)) | ||
| 82 | return 'm'; | ||
| 83 | if (S_ISNWK (bits)) | ||
| 84 | return 'n'; | ||
| 85 | if (S_ISPORT (bits)) | ||
| 86 | return 'P'; | ||
| 87 | if (S_ISWHT (bits)) | ||
| 88 | return 'w'; | ||
| 89 | |||
| 90 | return '?'; | ||
| 91 | } | ||
| 92 | |||
| 93 | /* Like filemodestring, but rely only on MODE. */ | ||
| 94 | |||
| 95 | void | ||
| 96 | strmode (mode_t mode, char *str) | ||
| 97 | { | ||
| 98 | str[0] = ftypelet (mode); | ||
| 99 | str[1] = mode & S_IRUSR ? 'r' : '-'; | ||
| 100 | str[2] = mode & S_IWUSR ? 'w' : '-'; | ||
| 101 | str[3] = (mode & S_ISUID | ||
| 102 | ? (mode & S_IXUSR ? 's' : 'S') | ||
| 103 | : (mode & S_IXUSR ? 'x' : '-')); | ||
| 104 | str[4] = mode & S_IRGRP ? 'r' : '-'; | ||
| 105 | str[5] = mode & S_IWGRP ? 'w' : '-'; | ||
| 106 | str[6] = (mode & S_ISGID | ||
| 107 | ? (mode & S_IXGRP ? 's' : 'S') | ||
| 108 | : (mode & S_IXGRP ? 'x' : '-')); | ||
| 109 | str[7] = mode & S_IROTH ? 'r' : '-'; | ||
| 110 | str[8] = mode & S_IWOTH ? 'w' : '-'; | ||
| 111 | str[9] = (mode & S_ISVTX | ||
| 112 | ? (mode & S_IXOTH ? 't' : 'T') | ||
| 113 | : (mode & S_IXOTH ? 'x' : '-')); | ||
| 114 | str[10] = ' '; | ||
| 115 | str[11] = '\0'; | ||
| 116 | } | ||
| 117 | |||
| 118 | #endif /* ! HAVE_DECL_STRMODE */ | ||
| 119 | |||
| 120 | /* filemodestring - fill in string STR with an ls-style ASCII | ||
| 121 | representation of the st_mode field of file stats block STATP. | ||
| 122 | 12 characters are stored in STR. | ||
| 123 | The characters stored in STR are: | ||
| 124 | |||
| 125 | 0 File type, as in ftypelet above, except that other letters are used | ||
| 126 | for files whose type cannot be determined solely from st_mode: | ||
| 127 | |||
| 128 | 'F' semaphore | ||
| 129 | 'M' migrated file (Cray DMF) | ||
| 130 | 'Q' message queue | ||
| 131 | 'S' shared memory object | ||
| 132 | 'T' typed memory object | ||
| 133 | |||
| 134 | 1 'r' if the owner may read, '-' otherwise. | ||
| 135 | |||
| 136 | 2 'w' if the owner may write, '-' otherwise. | ||
| 137 | |||
| 138 | 3 'x' if the owner may execute, 's' if the file is | ||
| 139 | set-user-id, '-' otherwise. | ||
| 140 | 'S' if the file is set-user-id, but the execute | ||
| 141 | bit isn't set. | ||
| 142 | |||
| 143 | 4 'r' if group members may read, '-' otherwise. | ||
| 144 | |||
| 145 | 5 'w' if group members may write, '-' otherwise. | ||
| 146 | |||
| 147 | 6 'x' if group members may execute, 's' if the file is | ||
| 148 | set-group-id, '-' otherwise. | ||
| 149 | 'S' if it is set-group-id but not executable. | ||
| 150 | |||
| 151 | 7 'r' if any user may read, '-' otherwise. | ||
| 152 | |||
| 153 | 8 'w' if any user may write, '-' otherwise. | ||
| 154 | |||
| 155 | 9 'x' if any user may execute, 't' if the file is "sticky" | ||
| 156 | (will be retained in swap space after execution), '-' | ||
| 157 | otherwise. | ||
| 158 | 'T' if the file is sticky but not executable. | ||
| 159 | |||
| 160 | 10 ' ' for compatibility with 4.4BSD strmode, | ||
| 161 | since this interface does not support ACLs. | ||
| 162 | |||
| 163 | 11 '\0'. */ | ||
| 164 | |||
| 165 | void | ||
| 166 | filemodestring (struct stat const *statp, char *str) | ||
| 167 | { | ||
| 168 | strmode (statp->st_mode, str); | ||
| 169 | |||
| 170 | if (S_TYPEISSEM (statp)) | ||
| 171 | str[0] = 'F'; | ||
| 172 | else if (IS_MIGRATED_FILE (statp)) | ||
| 173 | str[0] = 'M'; | ||
| 174 | else if (S_TYPEISMQ (statp)) | ||
| 175 | str[0] = 'Q'; | ||
| 176 | else if (S_TYPEISSHM (statp)) | ||
| 177 | str[0] = 'S'; | ||
| 178 | else if (S_TYPEISTMO (statp)) | ||
| 179 | str[0] = 'T'; | ||
| 180 | } | ||
diff --git a/lib/filemode.h b/lib/filemode.h new file mode 100644 index 00000000000..1a50302704c --- /dev/null +++ b/lib/filemode.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | /* Make a string describing file modes. | ||
| 2 | |||
| 3 | Copyright (C) 1998-1999, 2003, 2006, 2009-2011 Free Software Foundation, | ||
| 4 | Inc. | ||
| 5 | |||
| 6 | This program is free software: you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation; either version 3 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | This program is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 18 | |||
| 19 | #ifndef FILEMODE_H_ | ||
| 20 | |||
| 21 | # include <sys/types.h> | ||
| 22 | # include <sys/stat.h> | ||
| 23 | |||
| 24 | /* Get the declaration of strmode. */ | ||
| 25 | # if HAVE_DECL_STRMODE | ||
| 26 | # include <string.h> /* MacOS X, FreeBSD, OpenBSD */ | ||
| 27 | # include <unistd.h> /* NetBSD */ | ||
| 28 | # endif | ||
| 29 | |||
| 30 | # ifdef __cplusplus | ||
| 31 | extern "C" { | ||
| 32 | # endif | ||
| 33 | |||
| 34 | # if !HAVE_DECL_STRMODE | ||
| 35 | extern void strmode (mode_t mode, char *str); | ||
| 36 | # endif | ||
| 37 | |||
| 38 | extern void filemodestring (struct stat const *statp, char *str); | ||
| 39 | |||
| 40 | # ifdef __cplusplus | ||
| 41 | } | ||
| 42 | # endif | ||
| 43 | |||
| 44 | #endif | ||
diff --git a/lib/gnulib.mk b/lib/gnulib.mk index 3e93e12d9bf..bdba2e9c1bb 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | # the same distribution terms as the rest of that program. | 9 | # the same distribution terms as the rest of that program. |
| 10 | # | 10 | # |
| 11 | # Generated by gnulib-tool. | 11 | # Generated by gnulib-tool. |
| 12 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr getloadavg getopt-gnu ignore-value mktime strftime | 12 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | MOSTLYCLEANFILES += core *.stackdump | 15 | MOSTLYCLEANFILES += core *.stackdump |
| @@ -88,6 +88,15 @@ EXTRA_libgnu_a_SOURCES += ftoastr.c | |||
| 88 | 88 | ||
| 89 | ## end gnulib module dtoastr | 89 | ## end gnulib module dtoastr |
| 90 | 90 | ||
| 91 | ## begin gnulib module filemode | ||
| 92 | |||
| 93 | |||
| 94 | EXTRA_DIST += filemode.c filemode.h | ||
| 95 | |||
| 96 | EXTRA_libgnu_a_SOURCES += filemode.c | ||
| 97 | |||
| 98 | ## end gnulib module filemode | ||
| 99 | |||
| 91 | ## begin gnulib module getloadavg | 100 | ## begin gnulib module getloadavg |
| 92 | 101 | ||
| 93 | 102 | ||
| @@ -331,6 +340,65 @@ EXTRA_libgnu_a_SOURCES += strftime.c | |||
| 331 | 340 | ||
| 332 | ## end gnulib module strftime | 341 | ## end gnulib module strftime |
| 333 | 342 | ||
| 343 | ## begin gnulib module sys_stat | ||
| 344 | |||
| 345 | BUILT_SOURCES += sys/stat.h | ||
| 346 | |||
| 347 | # We need the following in order to create <sys/stat.h> when the system | ||
| 348 | # has one that is incomplete. | ||
| 349 | sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | ||
| 350 | $(AM_V_at)$(MKDIR_P) sys | ||
| 351 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 352 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 353 | sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ | ||
| 354 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 355 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ | ||
| 356 | -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ | ||
| 357 | -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \ | ||
| 358 | -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \ | ||
| 359 | -e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \ | ||
| 360 | -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \ | ||
| 361 | -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \ | ||
| 362 | -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \ | ||
| 363 | -e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \ | ||
| 364 | -e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \ | ||
| 365 | -e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \ | ||
| 366 | -e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \ | ||
| 367 | -e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \ | ||
| 368 | -e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \ | ||
| 369 | -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ | ||
| 370 | -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ | ||
| 371 | -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ | ||
| 372 | -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \ | ||
| 373 | -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ | ||
| 374 | -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \ | ||
| 375 | -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \ | ||
| 376 | -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \ | ||
| 377 | -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \ | ||
| 378 | -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \ | ||
| 379 | -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \ | ||
| 380 | -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \ | ||
| 381 | -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \ | ||
| 382 | -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \ | ||
| 383 | -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \ | ||
| 384 | -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \ | ||
| 385 | -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \ | ||
| 386 | -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \ | ||
| 387 | -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \ | ||
| 388 | -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \ | ||
| 389 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | ||
| 390 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | ||
| 391 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ | ||
| 392 | < $(srcdir)/sys_stat.in.h; \ | ||
| 393 | } > $@-t && \ | ||
| 394 | mv $@-t $@ | ||
| 395 | MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t | ||
| 396 | MOSTLYCLEANDIRS += sys | ||
| 397 | |||
| 398 | EXTRA_DIST += sys_stat.in.h | ||
| 399 | |||
| 400 | ## end gnulib module sys_stat | ||
| 401 | |||
| 334 | ## begin gnulib module time | 402 | ## begin gnulib module time |
| 335 | 403 | ||
| 336 | BUILT_SOURCES += time.h | 404 | BUILT_SOURCES += time.h |
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h new file mode 100644 index 00000000000..61cdcc53928 --- /dev/null +++ b/lib/sys_stat.in.h | |||
| @@ -0,0 +1,646 @@ | |||
| 1 | /* Provide a more complete sys/stat header file. | ||
| 2 | Copyright (C) 2005-2011 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This program is free software; you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation; either version 3, or (at your option) | ||
| 7 | any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program; if not, write to the Free Software Foundation, | ||
| 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
| 17 | |||
| 18 | /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ | ||
| 19 | |||
| 20 | /* This file is supposed to be used on platforms where <sys/stat.h> is | ||
| 21 | incomplete. It is intended to provide definitions and prototypes | ||
| 22 | needed by an application. Start with what the system provides. */ | ||
| 23 | |||
| 24 | #if __GNUC__ >= 3 | ||
| 25 | @PRAGMA_SYSTEM_HEADER@ | ||
| 26 | #endif | ||
| 27 | @PRAGMA_COLUMNS@ | ||
| 28 | |||
| 29 | #if defined __need_system_sys_stat_h | ||
| 30 | /* Special invocation convention. */ | ||
| 31 | |||
| 32 | #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ | ||
| 33 | |||
| 34 | #else | ||
| 35 | /* Normal invocation convention. */ | ||
| 36 | |||
| 37 | #ifndef _GL_SYS_STAT_H | ||
| 38 | |||
| 39 | /* Get nlink_t. */ | ||
| 40 | #include <sys/types.h> | ||
| 41 | |||
| 42 | /* Get struct timespec. */ | ||
| 43 | #include <time.h> | ||
| 44 | |||
| 45 | /* The include_next requires a split double-inclusion guard. */ | ||
| 46 | #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ | ||
| 47 | |||
| 48 | #ifndef _GL_SYS_STAT_H | ||
| 49 | #define _GL_SYS_STAT_H | ||
| 50 | |||
| 51 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | ||
| 52 | |||
| 53 | /* The definition of _GL_ARG_NONNULL is copied here. */ | ||
| 54 | |||
| 55 | /* The definition of _GL_WARN_ON_USE is copied here. */ | ||
| 56 | |||
| 57 | /* Before doing "#define mkdir rpl_mkdir" below, we need to include all | ||
| 58 | headers that may declare mkdir(). */ | ||
| 59 | #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ | ||
| 60 | # include <io.h> /* mingw32, mingw64 */ | ||
| 61 | # include <direct.h> /* mingw64 */ | ||
| 62 | #endif | ||
| 63 | |||
| 64 | #ifndef S_IFMT | ||
| 65 | # define S_IFMT 0170000 | ||
| 66 | #endif | ||
| 67 | |||
| 68 | #if STAT_MACROS_BROKEN | ||
| 69 | # undef S_ISBLK | ||
| 70 | # undef S_ISCHR | ||
| 71 | # undef S_ISDIR | ||
| 72 | # undef S_ISFIFO | ||
| 73 | # undef S_ISLNK | ||
| 74 | # undef S_ISNAM | ||
| 75 | # undef S_ISMPB | ||
| 76 | # undef S_ISMPC | ||
| 77 | # undef S_ISNWK | ||
| 78 | # undef S_ISREG | ||
| 79 | # undef S_ISSOCK | ||
| 80 | #endif | ||
| 81 | |||
| 82 | #ifndef S_ISBLK | ||
| 83 | # ifdef S_IFBLK | ||
| 84 | # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) | ||
| 85 | # else | ||
| 86 | # define S_ISBLK(m) 0 | ||
| 87 | # endif | ||
| 88 | #endif | ||
| 89 | |||
| 90 | #ifndef S_ISCHR | ||
| 91 | # ifdef S_IFCHR | ||
| 92 | # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) | ||
| 93 | # else | ||
| 94 | # define S_ISCHR(m) 0 | ||
| 95 | # endif | ||
| 96 | #endif | ||
| 97 | |||
| 98 | #ifndef S_ISDIR | ||
| 99 | # ifdef S_IFDIR | ||
| 100 | # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) | ||
| 101 | # else | ||
| 102 | # define S_ISDIR(m) 0 | ||
| 103 | # endif | ||
| 104 | #endif | ||
| 105 | |||
| 106 | #ifndef S_ISDOOR /* Solaris 2.5 and up */ | ||
| 107 | # define S_ISDOOR(m) 0 | ||
| 108 | #endif | ||
| 109 | |||
| 110 | #ifndef S_ISFIFO | ||
| 111 | # ifdef S_IFIFO | ||
| 112 | # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) | ||
| 113 | # else | ||
| 114 | # define S_ISFIFO(m) 0 | ||
| 115 | # endif | ||
| 116 | #endif | ||
| 117 | |||
| 118 | #ifndef S_ISLNK | ||
| 119 | # ifdef S_IFLNK | ||
| 120 | # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) | ||
| 121 | # else | ||
| 122 | # define S_ISLNK(m) 0 | ||
| 123 | # endif | ||
| 124 | #endif | ||
| 125 | |||
| 126 | #ifndef S_ISMPB /* V7 */ | ||
| 127 | # ifdef S_IFMPB | ||
| 128 | # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) | ||
| 129 | # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) | ||
| 130 | # else | ||
| 131 | # define S_ISMPB(m) 0 | ||
| 132 | # define S_ISMPC(m) 0 | ||
| 133 | # endif | ||
| 134 | #endif | ||
| 135 | |||
| 136 | #ifndef S_ISNAM /* Xenix */ | ||
| 137 | # ifdef S_IFNAM | ||
| 138 | # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) | ||
| 139 | # else | ||
| 140 | # define S_ISNAM(m) 0 | ||
| 141 | # endif | ||
| 142 | #endif | ||
| 143 | |||
| 144 | #ifndef S_ISNWK /* HP/UX */ | ||
| 145 | # ifdef S_IFNWK | ||
| 146 | # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) | ||
| 147 | # else | ||
| 148 | # define S_ISNWK(m) 0 | ||
| 149 | # endif | ||
| 150 | #endif | ||
| 151 | |||
| 152 | #ifndef S_ISPORT /* Solaris 10 and up */ | ||
| 153 | # define S_ISPORT(m) 0 | ||
| 154 | #endif | ||
| 155 | |||
| 156 | #ifndef S_ISREG | ||
| 157 | # ifdef S_IFREG | ||
| 158 | # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | ||
| 159 | # else | ||
| 160 | # define S_ISREG(m) 0 | ||
| 161 | # endif | ||
| 162 | #endif | ||
| 163 | |||
| 164 | #ifndef S_ISSOCK | ||
| 165 | # ifdef S_IFSOCK | ||
| 166 | # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) | ||
| 167 | # else | ||
| 168 | # define S_ISSOCK(m) 0 | ||
| 169 | # endif | ||
| 170 | #endif | ||
| 171 | |||
| 172 | |||
| 173 | #ifndef S_TYPEISMQ | ||
| 174 | # define S_TYPEISMQ(p) 0 | ||
| 175 | #endif | ||
| 176 | |||
| 177 | #ifndef S_TYPEISTMO | ||
| 178 | # define S_TYPEISTMO(p) 0 | ||
| 179 | #endif | ||
| 180 | |||
| 181 | |||
| 182 | #ifndef S_TYPEISSEM | ||
| 183 | # ifdef S_INSEM | ||
| 184 | # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) | ||
| 185 | # else | ||
| 186 | # define S_TYPEISSEM(p) 0 | ||
| 187 | # endif | ||
| 188 | #endif | ||
| 189 | |||
| 190 | #ifndef S_TYPEISSHM | ||
| 191 | # ifdef S_INSHD | ||
| 192 | # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) | ||
| 193 | # else | ||
| 194 | # define S_TYPEISSHM(p) 0 | ||
| 195 | # endif | ||
| 196 | #endif | ||
| 197 | |||
| 198 | /* high performance ("contiguous data") */ | ||
| 199 | #ifndef S_ISCTG | ||
| 200 | # define S_ISCTG(p) 0 | ||
| 201 | #endif | ||
| 202 | |||
| 203 | /* Cray DMF (data migration facility): off line, with data */ | ||
| 204 | #ifndef S_ISOFD | ||
| 205 | # define S_ISOFD(p) 0 | ||
| 206 | #endif | ||
| 207 | |||
| 208 | /* Cray DMF (data migration facility): off line, with no data */ | ||
| 209 | #ifndef S_ISOFL | ||
| 210 | # define S_ISOFL(p) 0 | ||
| 211 | #endif | ||
| 212 | |||
| 213 | /* 4.4BSD whiteout */ | ||
| 214 | #ifndef S_ISWHT | ||
| 215 | # define S_ISWHT(m) 0 | ||
| 216 | #endif | ||
| 217 | |||
| 218 | /* If any of the following are undefined, | ||
| 219 | define them to their de facto standard values. */ | ||
| 220 | #if !S_ISUID | ||
| 221 | # define S_ISUID 04000 | ||
| 222 | #endif | ||
| 223 | #if !S_ISGID | ||
| 224 | # define S_ISGID 02000 | ||
| 225 | #endif | ||
| 226 | |||
| 227 | /* S_ISVTX is a common extension to POSIX. */ | ||
| 228 | #ifndef S_ISVTX | ||
| 229 | # define S_ISVTX 01000 | ||
| 230 | #endif | ||
| 231 | |||
| 232 | #if !S_IRUSR && S_IREAD | ||
| 233 | # define S_IRUSR S_IREAD | ||
| 234 | #endif | ||
| 235 | #if !S_IRUSR | ||
| 236 | # define S_IRUSR 00400 | ||
| 237 | #endif | ||
| 238 | #if !S_IRGRP | ||
| 239 | # define S_IRGRP (S_IRUSR >> 3) | ||
| 240 | #endif | ||
| 241 | #if !S_IROTH | ||
| 242 | # define S_IROTH (S_IRUSR >> 6) | ||
| 243 | #endif | ||
| 244 | |||
| 245 | #if !S_IWUSR && S_IWRITE | ||
| 246 | # define S_IWUSR S_IWRITE | ||
| 247 | #endif | ||
| 248 | #if !S_IWUSR | ||
| 249 | # define S_IWUSR 00200 | ||
| 250 | #endif | ||
| 251 | #if !S_IWGRP | ||
| 252 | # define S_IWGRP (S_IWUSR >> 3) | ||
| 253 | #endif | ||
| 254 | #if !S_IWOTH | ||
| 255 | # define S_IWOTH (S_IWUSR >> 6) | ||
| 256 | #endif | ||
| 257 | |||
| 258 | #if !S_IXUSR && S_IEXEC | ||
| 259 | # define S_IXUSR S_IEXEC | ||
| 260 | #endif | ||
| 261 | #if !S_IXUSR | ||
| 262 | # define S_IXUSR 00100 | ||
| 263 | #endif | ||
| 264 | #if !S_IXGRP | ||
| 265 | # define S_IXGRP (S_IXUSR >> 3) | ||
| 266 | #endif | ||
| 267 | #if !S_IXOTH | ||
| 268 | # define S_IXOTH (S_IXUSR >> 6) | ||
| 269 | #endif | ||
| 270 | |||
| 271 | #if !S_IRWXU | ||
| 272 | # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) | ||
| 273 | #endif | ||
| 274 | #if !S_IRWXG | ||
| 275 | # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) | ||
| 276 | #endif | ||
| 277 | #if !S_IRWXO | ||
| 278 | # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) | ||
| 279 | #endif | ||
| 280 | |||
| 281 | /* S_IXUGO is a common extension to POSIX. */ | ||
| 282 | #if !S_IXUGO | ||
| 283 | # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) | ||
| 284 | #endif | ||
| 285 | |||
| 286 | #ifndef S_IRWXUGO | ||
| 287 | # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) | ||
| 288 | #endif | ||
| 289 | |||
| 290 | /* Macros for futimens and utimensat. */ | ||
| 291 | #ifndef UTIME_NOW | ||
| 292 | # define UTIME_NOW (-1) | ||
| 293 | # define UTIME_OMIT (-2) | ||
| 294 | #endif | ||
| 295 | |||
| 296 | |||
| 297 | #if @GNULIB_FCHMODAT@ | ||
| 298 | # if !@HAVE_FCHMODAT@ | ||
| 299 | _GL_FUNCDECL_SYS (fchmodat, int, | ||
| 300 | (int fd, char const *file, mode_t mode, int flag) | ||
| 301 | _GL_ARG_NONNULL ((2))); | ||
| 302 | # endif | ||
| 303 | _GL_CXXALIAS_SYS (fchmodat, int, | ||
| 304 | (int fd, char const *file, mode_t mode, int flag)); | ||
| 305 | _GL_CXXALIASWARN (fchmodat); | ||
| 306 | #elif defined GNULIB_POSIXCHECK | ||
| 307 | # undef fchmodat | ||
| 308 | # if HAVE_RAW_DECL_FCHMODAT | ||
| 309 | _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " | ||
| 310 | "use gnulib module openat for portability"); | ||
| 311 | # endif | ||
| 312 | #endif | ||
| 313 | |||
| 314 | |||
| 315 | #if @REPLACE_FSTAT@ | ||
| 316 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 317 | # define fstat rpl_fstat | ||
| 318 | # endif | ||
| 319 | _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); | ||
| 320 | _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); | ||
| 321 | #else | ||
| 322 | _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); | ||
| 323 | #endif | ||
| 324 | _GL_CXXALIASWARN (fstat); | ||
| 325 | |||
| 326 | |||
| 327 | #if @GNULIB_FSTATAT@ | ||
| 328 | # if @REPLACE_FSTATAT@ | ||
| 329 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 330 | # undef fstatat | ||
| 331 | # define fstatat rpl_fstatat | ||
| 332 | # endif | ||
| 333 | _GL_FUNCDECL_RPL (fstatat, int, | ||
| 334 | (int fd, char const *name, struct stat *st, int flags) | ||
| 335 | _GL_ARG_NONNULL ((2, 3))); | ||
| 336 | _GL_CXXALIAS_RPL (fstatat, int, | ||
| 337 | (int fd, char const *name, struct stat *st, int flags)); | ||
| 338 | # else | ||
| 339 | # if !@HAVE_FSTATAT@ | ||
| 340 | _GL_FUNCDECL_SYS (fstatat, int, | ||
| 341 | (int fd, char const *name, struct stat *st, int flags) | ||
| 342 | _GL_ARG_NONNULL ((2, 3))); | ||
| 343 | # endif | ||
| 344 | _GL_CXXALIAS_SYS (fstatat, int, | ||
| 345 | (int fd, char const *name, struct stat *st, int flags)); | ||
| 346 | # endif | ||
| 347 | _GL_CXXALIASWARN (fstatat); | ||
| 348 | #elif defined GNULIB_POSIXCHECK | ||
| 349 | # undef fstatat | ||
| 350 | # if HAVE_RAW_DECL_FSTATAT | ||
| 351 | _GL_WARN_ON_USE (fstatat, "fstatat is not portable - " | ||
| 352 | "use gnulib module openat for portability"); | ||
| 353 | # endif | ||
| 354 | #endif | ||
| 355 | |||
| 356 | |||
| 357 | #if @GNULIB_FUTIMENS@ | ||
| 358 | # if @REPLACE_FUTIMENS@ | ||
| 359 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 360 | # undef futimens | ||
| 361 | # define futimens rpl_futimens | ||
| 362 | # endif | ||
| 363 | _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2])); | ||
| 364 | _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2])); | ||
| 365 | # else | ||
| 366 | # if !@HAVE_FUTIMENS@ | ||
| 367 | _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2])); | ||
| 368 | # endif | ||
| 369 | _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); | ||
| 370 | # endif | ||
| 371 | _GL_CXXALIASWARN (futimens); | ||
| 372 | #elif defined GNULIB_POSIXCHECK | ||
| 373 | # undef futimens | ||
| 374 | # if HAVE_RAW_DECL_FUTIMENS | ||
| 375 | _GL_WARN_ON_USE (futimens, "futimens is not portable - " | ||
| 376 | "use gnulib module futimens for portability"); | ||
| 377 | # endif | ||
| 378 | #endif | ||
| 379 | |||
| 380 | |||
| 381 | #if @GNULIB_LCHMOD@ | ||
| 382 | /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME | ||
| 383 | denotes a symbolic link. */ | ||
| 384 | # if !@HAVE_LCHMOD@ | ||
| 385 | /* The lchmod replacement follows symbolic links. Callers should take | ||
| 386 | this into account; lchmod should be applied only to arguments that | ||
| 387 | are known to not be symbolic links. On hosts that lack lchmod, | ||
| 388 | this can lead to race conditions between the check and the | ||
| 389 | invocation of lchmod, but we know of no workarounds that are | ||
| 390 | reliable in general. You might try requesting support for lchmod | ||
| 391 | from your operating system supplier. */ | ||
| 392 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 393 | # define lchmod chmod | ||
| 394 | # endif | ||
| 395 | /* Need to cast, because on mingw, the second parameter of chmod is | ||
| 396 | int mode. */ | ||
| 397 | _GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int, | ||
| 398 | (const char *filename, mode_t mode)); | ||
| 399 | # else | ||
| 400 | # if 0 /* assume already declared */ | ||
| 401 | _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode) | ||
| 402 | _GL_ARG_NONNULL ((1))); | ||
| 403 | # endif | ||
| 404 | _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); | ||
| 405 | # endif | ||
| 406 | # if @HAVE_LCHMOD@ | ||
| 407 | _GL_CXXALIASWARN (lchmod); | ||
| 408 | # endif | ||
| 409 | #elif defined GNULIB_POSIXCHECK | ||
| 410 | # undef lchmod | ||
| 411 | # if HAVE_RAW_DECL_LCHMOD | ||
| 412 | _GL_WARN_ON_USE (lchmod, "lchmod is unportable - " | ||
| 413 | "use gnulib module lchmod for portability"); | ||
| 414 | # endif | ||
| 415 | #endif | ||
| 416 | |||
| 417 | |||
| 418 | #if @GNULIB_LSTAT@ | ||
| 419 | # if ! @HAVE_LSTAT@ | ||
| 420 | /* mingw does not support symlinks, therefore it does not have lstat. But | ||
| 421 | without links, stat does just fine. */ | ||
| 422 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 423 | # define lstat stat | ||
| 424 | # endif | ||
| 425 | _GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf)); | ||
| 426 | # elif @REPLACE_LSTAT@ | ||
| 427 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 428 | # undef lstat | ||
| 429 | # define lstat rpl_lstat | ||
| 430 | # endif | ||
| 431 | _GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf) | ||
| 432 | _GL_ARG_NONNULL ((1, 2))); | ||
| 433 | _GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf)); | ||
| 434 | # else | ||
| 435 | _GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf)); | ||
| 436 | # endif | ||
| 437 | # if @HAVE_LSTAT@ | ||
| 438 | _GL_CXXALIASWARN (lstat); | ||
| 439 | # endif | ||
| 440 | #elif defined GNULIB_POSIXCHECK | ||
| 441 | # undef lstat | ||
| 442 | # if HAVE_RAW_DECL_LSTAT | ||
| 443 | _GL_WARN_ON_USE (lstat, "lstat is unportable - " | ||
| 444 | "use gnulib module lstat for portability"); | ||
| 445 | # endif | ||
| 446 | #endif | ||
| 447 | |||
| 448 | |||
| 449 | #if @REPLACE_MKDIR@ | ||
| 450 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 451 | # undef mkdir | ||
| 452 | # define mkdir rpl_mkdir | ||
| 453 | # endif | ||
| 454 | _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode) | ||
| 455 | _GL_ARG_NONNULL ((1))); | ||
| 456 | _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); | ||
| 457 | #else | ||
| 458 | /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. | ||
| 459 | Additionally, it declares _mkdir (and depending on compile flags, an | ||
| 460 | alias mkdir), only in the nonstandard includes <direct.h> and <io.h>, | ||
| 461 | which are included above. */ | ||
| 462 | # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ | ||
| 463 | |||
| 464 | # if !GNULIB_defined_rpl_mkdir | ||
| 465 | static inline int | ||
| 466 | rpl_mkdir (char const *name, mode_t mode) | ||
| 467 | { | ||
| 468 | return _mkdir (name); | ||
| 469 | } | ||
| 470 | # define GNULIB_defined_rpl_mkdir 1 | ||
| 471 | # endif | ||
| 472 | |||
| 473 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 474 | # define mkdir rpl_mkdir | ||
| 475 | # endif | ||
| 476 | _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); | ||
| 477 | # else | ||
| 478 | _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); | ||
| 479 | # endif | ||
| 480 | #endif | ||
| 481 | _GL_CXXALIASWARN (mkdir); | ||
| 482 | |||
| 483 | |||
| 484 | #if @GNULIB_MKDIRAT@ | ||
| 485 | # if !@HAVE_MKDIRAT@ | ||
| 486 | _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode) | ||
| 487 | _GL_ARG_NONNULL ((2))); | ||
| 488 | # endif | ||
| 489 | _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)); | ||
| 490 | _GL_CXXALIASWARN (mkdirat); | ||
| 491 | #elif defined GNULIB_POSIXCHECK | ||
| 492 | # undef mkdirat | ||
| 493 | # if HAVE_RAW_DECL_MKDIRAT | ||
| 494 | _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - " | ||
| 495 | "use gnulib module openat for portability"); | ||
| 496 | # endif | ||
| 497 | #endif | ||
| 498 | |||
| 499 | |||
| 500 | #if @GNULIB_MKFIFO@ | ||
| 501 | # if @REPLACE_MKFIFO@ | ||
| 502 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 503 | # undef mkfifo | ||
| 504 | # define mkfifo rpl_mkfifo | ||
| 505 | # endif | ||
| 506 | _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode) | ||
| 507 | _GL_ARG_NONNULL ((1))); | ||
| 508 | _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode)); | ||
| 509 | # else | ||
| 510 | # if !@HAVE_MKFIFO@ | ||
| 511 | _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode) | ||
| 512 | _GL_ARG_NONNULL ((1))); | ||
| 513 | # endif | ||
| 514 | _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); | ||
| 515 | # endif | ||
| 516 | _GL_CXXALIASWARN (mkfifo); | ||
| 517 | #elif defined GNULIB_POSIXCHECK | ||
| 518 | # undef mkfifo | ||
| 519 | # if HAVE_RAW_DECL_MKFIFO | ||
| 520 | _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - " | ||
| 521 | "use gnulib module mkfifo for portability"); | ||
| 522 | # endif | ||
| 523 | #endif | ||
| 524 | |||
| 525 | |||
| 526 | #if @GNULIB_MKFIFOAT@ | ||
| 527 | # if !@HAVE_MKFIFOAT@ | ||
| 528 | _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode) | ||
| 529 | _GL_ARG_NONNULL ((2))); | ||
| 530 | # endif | ||
| 531 | _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); | ||
| 532 | _GL_CXXALIASWARN (mkfifoat); | ||
| 533 | #elif defined GNULIB_POSIXCHECK | ||
| 534 | # undef mkfifoat | ||
| 535 | # if HAVE_RAW_DECL_MKFIFOAT | ||
| 536 | _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - " | ||
| 537 | "use gnulib module mkfifoat for portability"); | ||
| 538 | # endif | ||
| 539 | #endif | ||
| 540 | |||
| 541 | |||
| 542 | #if @GNULIB_MKNOD@ | ||
| 543 | # if @REPLACE_MKNOD@ | ||
| 544 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 545 | # undef mknod | ||
| 546 | # define mknod rpl_mknod | ||
| 547 | # endif | ||
| 548 | _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev) | ||
| 549 | _GL_ARG_NONNULL ((1))); | ||
| 550 | _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)); | ||
| 551 | # else | ||
| 552 | # if !@HAVE_MKNOD@ | ||
| 553 | _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev) | ||
| 554 | _GL_ARG_NONNULL ((1))); | ||
| 555 | # endif | ||
| 556 | /* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */ | ||
| 557 | _GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev)); | ||
| 558 | # endif | ||
| 559 | _GL_CXXALIASWARN (mknod); | ||
| 560 | #elif defined GNULIB_POSIXCHECK | ||
| 561 | # undef mknod | ||
| 562 | # if HAVE_RAW_DECL_MKNOD | ||
| 563 | _GL_WARN_ON_USE (mknod, "mknod is not portable - " | ||
| 564 | "use gnulib module mknod for portability"); | ||
| 565 | # endif | ||
| 566 | #endif | ||
| 567 | |||
| 568 | |||
| 569 | #if @GNULIB_MKNODAT@ | ||
| 570 | # if !@HAVE_MKNODAT@ | ||
| 571 | _GL_FUNCDECL_SYS (mknodat, int, | ||
| 572 | (int fd, char const *file, mode_t mode, dev_t dev) | ||
| 573 | _GL_ARG_NONNULL ((2))); | ||
| 574 | # endif | ||
| 575 | _GL_CXXALIAS_SYS (mknodat, int, | ||
| 576 | (int fd, char const *file, mode_t mode, dev_t dev)); | ||
| 577 | _GL_CXXALIASWARN (mknodat); | ||
| 578 | #elif defined GNULIB_POSIXCHECK | ||
| 579 | # undef mknodat | ||
| 580 | # if HAVE_RAW_DECL_MKNODAT | ||
| 581 | _GL_WARN_ON_USE (mknodat, "mknodat is not portable - " | ||
| 582 | "use gnulib module mkfifoat for portability"); | ||
| 583 | # endif | ||
| 584 | #endif | ||
| 585 | |||
| 586 | |||
| 587 | #if @GNULIB_STAT@ | ||
| 588 | # if @REPLACE_STAT@ | ||
| 589 | /* We can't use the object-like #define stat rpl_stat, because of | ||
| 590 | struct stat. This means that rpl_stat will not be used if the user | ||
| 591 | does (stat)(a,b). Oh well. */ | ||
| 592 | # undef stat | ||
| 593 | # ifdef _LARGE_FILES | ||
| 594 | /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, | ||
| 595 | so we have to replace stat64() instead of stat(). */ | ||
| 596 | # define stat stat64 | ||
| 597 | # undef stat64 | ||
| 598 | # define stat64(name, st) rpl_stat (name, st) | ||
| 599 | # else /* !_LARGE_FILES */ | ||
| 600 | # define stat(name, st) rpl_stat (name, st) | ||
| 601 | # endif /* !_LARGE_FILES */ | ||
| 602 | _GL_EXTERN_C int stat (const char *name, struct stat *buf) | ||
| 603 | _GL_ARG_NONNULL ((1, 2)); | ||
| 604 | # endif | ||
| 605 | #elif defined GNULIB_POSIXCHECK | ||
| 606 | # undef stat | ||
| 607 | # if HAVE_RAW_DECL_STAT | ||
| 608 | _GL_WARN_ON_USE (stat, "stat is unportable - " | ||
| 609 | "use gnulib module stat for portability"); | ||
| 610 | # endif | ||
| 611 | #endif | ||
| 612 | |||
| 613 | |||
| 614 | #if @GNULIB_UTIMENSAT@ | ||
| 615 | # if @REPLACE_UTIMENSAT@ | ||
| 616 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 617 | # undef utimensat | ||
| 618 | # define utimensat rpl_utimensat | ||
| 619 | # endif | ||
| 620 | _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name, | ||
| 621 | struct timespec const times[2], int flag) | ||
| 622 | _GL_ARG_NONNULL ((2))); | ||
| 623 | _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name, | ||
| 624 | struct timespec const times[2], int flag)); | ||
| 625 | # else | ||
| 626 | # if !@HAVE_UTIMENSAT@ | ||
| 627 | _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, | ||
| 628 | struct timespec const times[2], int flag) | ||
| 629 | _GL_ARG_NONNULL ((2))); | ||
| 630 | # endif | ||
| 631 | _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, | ||
| 632 | struct timespec const times[2], int flag)); | ||
| 633 | # endif | ||
| 634 | _GL_CXXALIASWARN (utimensat); | ||
| 635 | #elif defined GNULIB_POSIXCHECK | ||
| 636 | # undef utimensat | ||
| 637 | # if HAVE_RAW_DECL_UTIMENSAT | ||
| 638 | _GL_WARN_ON_USE (utimensat, "utimensat is not portable - " | ||
| 639 | "use gnulib module utimensat for portability"); | ||
| 640 | # endif | ||
| 641 | #endif | ||
| 642 | |||
| 643 | |||
| 644 | #endif /* _GL_SYS_STAT_H */ | ||
| 645 | #endif /* _GL_SYS_STAT_H */ | ||
| 646 | #endif | ||