2008-04-11 19:24:04 +00:00
|
|
|
/* sys/stat.h supplied with MSVCRT uses too narrow data types for
|
|
|
|
inode and user/group id, so we replace them with our own.
|
|
|
|
|
2012-01-05 01:46:05 -08:00
|
|
|
Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
2008-04-11 19:24:04 +00:00
|
|
|
|
|
|
|
This file is part of GNU Emacs.
|
|
|
|
|
2008-05-09 05:14:16 +00:00
|
|
|
GNU Emacs is free software: you can redistribute it and/or modify
|
2008-04-11 19:24:04 +00:00
|
|
|
it under the terms of the GNU General Public License as published by
|
2008-05-09 05:14:16 +00:00
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
2008-04-11 19:24:04 +00:00
|
|
|
|
|
|
|
GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2008-05-09 05:14:16 +00:00
|
|
|
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
2008-04-05 14:34:28 +00:00
|
|
|
|
|
|
|
#ifndef INC_SYS_STAT_H_
|
|
|
|
#define INC_SYS_STAT_H_
|
|
|
|
|
|
|
|
#ifdef __MINGW32__
|
|
|
|
# include <_mingw.h>
|
2008-04-11 19:24:04 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Only MinGW 3.13 and later has __MINGW_NOTHROW. */
|
|
|
|
#ifndef __MINGW_NOTHROW
|
2008-04-05 14:34:28 +00:00
|
|
|
# define __MINGW_NOTHROW
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#define S_IFMT 0xF000
|
|
|
|
|
|
|
|
#define S_IFREG 0x8000
|
|
|
|
#define S_IFDIR 0x4000
|
|
|
|
#define S_IFBLK 0x3000
|
|
|
|
#define S_IFCHR 0x2000
|
|
|
|
#define S_IFIFO 0x1000
|
|
|
|
|
|
|
|
#define S_IREAD 0x0100
|
|
|
|
#define S_IWRITE 0x0080
|
|
|
|
#define S_IEXEC 0x0040
|
|
|
|
|
|
|
|
#define S_IRUSR S_IREAD
|
|
|
|
#define S_IWUSR S_IWRITE
|
|
|
|
#define S_IXUSR S_IEXEC
|
|
|
|
#define S_IRWXU (S_IREAD | S_IWRITE | S_IEXEC)
|
|
|
|
|
|
|
|
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
|
|
|
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
|
|
|
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
|
|
|
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
|
|
|
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
|
|
|
|
Adapt MS-Windows build to import of filemode.c from gnulib.
nt/inc/sys/stat.h (S_ISUID, S_ISGID, S_ISVTX, S_IRGRP, S_IROTH)
(S_IWGRP, S_IWOTH, S_IXGRP, S_IXOTH, S_ISSOCK, S_ISLNK, S_ISCTG)
(S_ISDOOR, S_ISMPB, S_ISMPC, S_ISNWK, S_ISPORT, S_ISWHT)
(S_TYPEISMQ, S_TYPEISSEM, S_TYPEISSHM, S_TYPEISTMO): Define.
(lstat): Define to stat.
lib/makefile.w32-in ($(BLD)/filemode.$(O)): Move from
src/makefile.w32-in and adapt. Depend on stamp_BLD.
(GNULIBOBJS): Add $(BLD)/filemode.$(O).
src/makefile.w32-in ($(BLD)/filemode.$(O)): Move recipe to
lib/makefilw.w32-in.
($(BLD)/dired.$(O)): Depend on $(EMACS_ROOT)/lib/filemode.h.
(GLOBAL_SOURCES): Remove filemode.c.
(OBJ1): Remove $(BLD)/filemode.$(O).
lib-src/makefile.w32-in ($(BLD)/ctags.$(O), $(BLD)/emacsclient.$(O))
($(BLD)/etags.$(O), $(BLD)/movemail.$(O), $(BLD)/ntlib.$(O)):
Depend on $(EMACS_ROOT)/nt/inc/sys/stat.h.
2011-02-21 22:00:19 +02:00
|
|
|
/* These don't exist on Windows, but lib/filemode.c wants them. */
|
|
|
|
#define S_ISUID 0
|
|
|
|
#define S_ISGID 0
|
|
|
|
#define S_ISVTX 0
|
|
|
|
#define S_IRGRP (S_IRUSR >> 3)
|
|
|
|
#define S_IROTH (S_IRUSR >> 6)
|
|
|
|
#define S_IWGRP (S_IWUSR >> 3)
|
|
|
|
#define S_IWOTH (S_IWUSR >> 6)
|
|
|
|
#define S_IXGRP (S_IXUSR >> 3)
|
|
|
|
#define S_IXOTH (S_IXUSR >> 6)
|
|
|
|
|
|
|
|
#define S_ISSOCK(m) 0
|
|
|
|
#define S_ISLNK(m) 0
|
|
|
|
#define S_ISCTG(p) 0
|
|
|
|
#define S_ISDOOR(m) 0
|
|
|
|
#define S_ISMPB(m) 0
|
|
|
|
#define S_ISMPC(m) 0
|
|
|
|
#define S_ISNWK(m) 0
|
|
|
|
#define S_ISPORT(m) 0
|
|
|
|
#define S_ISWHT(m) 0
|
|
|
|
#define S_TYPEISMQ(p) 0
|
|
|
|
#define S_TYPEISSEM(p) 0
|
|
|
|
#define S_TYPEISSHM(p) 0
|
|
|
|
#define S_TYPEISTMO(p) 0
|
|
|
|
|
2008-04-05 14:34:28 +00:00
|
|
|
struct stat {
|
|
|
|
unsigned __int64 st_ino; /* ino_t in sys/types.h is too narrow */
|
2008-05-09 19:01:28 +00:00
|
|
|
dev_t st_dev;
|
2008-04-05 14:34:28 +00:00
|
|
|
unsigned short st_mode;
|
|
|
|
short st_nlink;
|
2009-03-21 11:31:50 +00:00
|
|
|
unsigned st_uid; /* Vista's TrustedInstaller has a very large RID */
|
|
|
|
unsigned st_gid;
|
2008-05-09 19:01:28 +00:00
|
|
|
unsigned __int64 st_size;
|
2008-04-05 14:34:28 +00:00
|
|
|
dev_t st_rdev;
|
|
|
|
time_t st_atime;
|
|
|
|
time_t st_mtime;
|
|
|
|
time_t st_ctime;
|
2008-05-09 19:01:28 +00:00
|
|
|
char st_uname[260];
|
|
|
|
char st_gname[260];
|
2008-04-05 14:34:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_CRTIMP int __cdecl __MINGW_NOTHROW fstat (int, struct stat*);
|
|
|
|
_CRTIMP int __cdecl __MINGW_NOTHROW chmod (const char*, int);
|
|
|
|
_CRTIMP int __cdecl __MINGW_NOTHROW stat (const char*, struct stat*);
|
|
|
|
|
Adapt MS-Windows build to import of filemode.c from gnulib.
nt/inc/sys/stat.h (S_ISUID, S_ISGID, S_ISVTX, S_IRGRP, S_IROTH)
(S_IWGRP, S_IWOTH, S_IXGRP, S_IXOTH, S_ISSOCK, S_ISLNK, S_ISCTG)
(S_ISDOOR, S_ISMPB, S_ISMPC, S_ISNWK, S_ISPORT, S_ISWHT)
(S_TYPEISMQ, S_TYPEISSEM, S_TYPEISSHM, S_TYPEISTMO): Define.
(lstat): Define to stat.
lib/makefile.w32-in ($(BLD)/filemode.$(O)): Move from
src/makefile.w32-in and adapt. Depend on stamp_BLD.
(GNULIBOBJS): Add $(BLD)/filemode.$(O).
src/makefile.w32-in ($(BLD)/filemode.$(O)): Move recipe to
lib/makefilw.w32-in.
($(BLD)/dired.$(O)): Depend on $(EMACS_ROOT)/lib/filemode.h.
(GLOBAL_SOURCES): Remove filemode.c.
(OBJ1): Remove $(BLD)/filemode.$(O).
lib-src/makefile.w32-in ($(BLD)/ctags.$(O), $(BLD)/emacsclient.$(O))
($(BLD)/etags.$(O), $(BLD)/movemail.$(O), $(BLD)/ntlib.$(O)):
Depend on $(EMACS_ROOT)/nt/inc/sys/stat.h.
2011-02-21 22:00:19 +02:00
|
|
|
/* fileio.c and dired.c want lstat. */
|
|
|
|
#define lstat stat
|
|
|
|
|
2008-04-05 14:34:28 +00:00
|
|
|
#endif /* INC_SYS_STAT_H_ */
|
2008-04-05 20:18:32 +00:00
|
|
|
|