2017-05-23 05:16:08 +00:00
|
|
|
/* -*-comment-start: "//";comment-end:""-*-
|
2018-07-22 12:24:36 +00:00
|
|
|
* GNU Mes --- Maxwell Equations of Software
|
2017-11-21 18:22:26 +00:00
|
|
|
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
2022-01-01 18:38:38 +00:00
|
|
|
* Copyright © 2022 Dor Askayo <dor.askayo@gmail.com>
|
2017-05-23 05:16:08 +00:00
|
|
|
*
|
2018-07-22 12:24:36 +00:00
|
|
|
* This file is part of GNU Mes.
|
2017-05-23 05:16:08 +00:00
|
|
|
*
|
2018-07-22 12:24:36 +00:00
|
|
|
* GNU Mes is free software; you can redistribute it and/or modify it
|
2017-05-23 05:16:08 +00:00
|
|
|
* under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
2018-07-22 12:24:36 +00:00
|
|
|
* GNU Mes is distributed in the hope that it will be useful, but
|
2017-05-23 05:16:08 +00:00
|
|
|
* 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
|
2018-07-22 12:24:36 +00:00
|
|
|
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
2017-05-23 05:16:08 +00:00
|
|
|
*/
|
|
|
|
#ifndef __MES_SYS_STAT_H
|
lib: stat: Use SYS_stat64 for 32bit platforms.
This fixes <https://debbugs.gnu.org/41264>.
* include/linux/arm/syscall.h (SYS_stat64, SYS_lstat64,
SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]:
New defines.
(SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them.
* include/linux/x86/syscall.h (SYS_stat64, SYS_lstat64,
SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]:
New defines.
(SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them.
* include/sys/stat.h (struct stat): Move definition to...
* include/linux/arm/kernel-stat.h,
include/linux/m2/kernel-stat.h,
include/linux/x86/kernel-stat.h,
include/linux/x86_64/kernel-stat.h: These new files.
* include/gnu/x86/kernel-stat.h: New file.
* configure (main): Copy <srcdest>include/<kernel>/<arch>/*.h to
include/.
* configure.sh: Likewise.
* .gitignore: Ignore them. Add copyright header.
* build-aux/GNUmakefile.in (X86_ARCH_HEADERS, ARCH_HEADERS): New
variables.
(build): Use them.
(include/arch/%.h, arch-dir): New targets.
* build-aux/bootstrap.sh.in (AM_CPPFLAGS): Replace
<srcdest>include/<kernel>/<cpu> with built ../include.
* build-aux/build.sh.in (AM_CPPFLAGS): Likewise.
* build-aux/install.sh.in: Also install built include.
* include/m2/types.h: New file.
* kaem.run: Use it.
* simple.sh: Copy kernel-stat.h, syscall.h for kernel/cpu to
include/arch.
2022-10-29 11:17:58 +00:00
|
|
|
#define __MES_SYS_STAT_H 1
|
2017-05-23 05:16:08 +00:00
|
|
|
|
2019-05-29 14:15:12 +00:00
|
|
|
#if SYSTEM_LIBC
|
2017-07-23 13:49:03 +00:00
|
|
|
#undef __MES_SYS_STAT_H
|
2017-05-23 05:16:08 +00:00
|
|
|
#include_next <sys/stat.h>
|
2018-04-29 10:01:25 +00:00
|
|
|
|
2019-05-29 14:15:12 +00:00
|
|
|
#else // ! SYSTEM_LIBC
|
2018-04-29 10:01:25 +00:00
|
|
|
|
2018-06-19 18:23:38 +00:00
|
|
|
#include <time.h>
|
2018-05-30 19:55:39 +00:00
|
|
|
#include <sys/types.h>
|
lib: stat: Use SYS_stat64 for 32bit platforms.
This fixes <https://debbugs.gnu.org/41264>.
* include/linux/arm/syscall.h (SYS_stat64, SYS_lstat64,
SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]:
New defines.
(SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them.
* include/linux/x86/syscall.h (SYS_stat64, SYS_lstat64,
SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]:
New defines.
(SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them.
* include/sys/stat.h (struct stat): Move definition to...
* include/linux/arm/kernel-stat.h,
include/linux/m2/kernel-stat.h,
include/linux/x86/kernel-stat.h,
include/linux/x86_64/kernel-stat.h: These new files.
* include/gnu/x86/kernel-stat.h: New file.
* configure (main): Copy <srcdest>include/<kernel>/<arch>/*.h to
include/.
* configure.sh: Likewise.
* .gitignore: Ignore them. Add copyright header.
* build-aux/GNUmakefile.in (X86_ARCH_HEADERS, ARCH_HEADERS): New
variables.
(build): Use them.
(include/arch/%.h, arch-dir): New targets.
* build-aux/bootstrap.sh.in (AM_CPPFLAGS): Replace
<srcdest>include/<kernel>/<cpu> with built ../include.
* build-aux/build.sh.in (AM_CPPFLAGS): Likewise.
* build-aux/install.sh.in: Also install built include.
* include/m2/types.h: New file.
* kaem.run: Use it.
* simple.sh: Copy kernel-stat.h, syscall.h for kernel/cpu to
include/arch.
2022-10-29 11:17:58 +00:00
|
|
|
#include <arch/kernel-stat.h>
|
2018-05-30 19:55:39 +00:00
|
|
|
|
2018-04-29 10:01:25 +00:00
|
|
|
#ifndef __MES_MODE_T
|
|
|
|
#define __MES_MODE_T
|
|
|
|
typedef int mode_t;
|
|
|
|
#endif
|
|
|
|
|
2018-05-30 19:55:39 +00:00
|
|
|
int chmod (char const *file_name, mode_t mode);
|
2019-06-08 13:36:22 +00:00
|
|
|
int fstat (int filedes, struct stat *buf);
|
2018-05-30 19:55:39 +00:00
|
|
|
int mkdir (char const *file_name, mode_t mode);
|
2019-07-12 09:56:58 +00:00
|
|
|
int mknod (char const *file_name, mode_t mode, dev_t dev);
|
2018-05-30 19:55:39 +00:00
|
|
|
int chown (char const *file_name, uid_t owner, gid_t group);
|
|
|
|
int rmdir (char const *file_name);
|
2018-06-06 20:14:35 +00:00
|
|
|
int stat (char const *file_name, struct stat *buf);
|
2018-05-30 19:55:39 +00:00
|
|
|
|
2019-07-09 09:53:16 +00:00
|
|
|
#define S_IFIFO 0010000
|
2018-06-06 13:55:03 +00:00
|
|
|
#define S_IFCHR 0020000
|
2018-05-30 19:55:39 +00:00
|
|
|
#define S_IFDIR 0040000
|
2018-06-06 13:55:03 +00:00
|
|
|
#define S_IFBLK 0060000
|
2018-05-30 19:55:39 +00:00
|
|
|
#define S_IFREG 0100000
|
|
|
|
#define S_IFLNK 0120000
|
2018-06-06 13:55:03 +00:00
|
|
|
#define S_IFMT 0170000
|
2018-05-30 19:55:39 +00:00
|
|
|
|
2019-07-09 09:53:16 +00:00
|
|
|
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
2018-05-30 19:55:39 +00:00
|
|
|
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
|
|
|
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
|
|
|
|
|
|
|
#define S_IRWXU 00700
|
|
|
|
#define S_IXUSR 00100
|
|
|
|
#define S_IWUSR 00200
|
|
|
|
#define S_IRUSR 00400
|
|
|
|
|
2022-01-01 18:38:38 +00:00
|
|
|
#define S_ISUID 04000
|
mescc: Support GNU Bash.
* include/errno.h (EACCES, ENOSPC, ESPIPE): New macro.
* include/linux/x86/syscall.h (SYS_setuid, SYS_geteuid, SYS_getegid,
SYS_setgid): New macro.
* include/linux/x86_64/syscall.h: Likewise.
* include/stdint.h (LLONG_MIN, LLONG_MAX, SIZE_MAX): New macro.
* include/sys/stat.h (S_ISUID, S_ISGID, S_IXGRP, S_IXOTH, S_IRGRP,
S_IROTH, S_IWGRP, S_IWOTH, S_IRWXG, S_IRWXO): New macro.
* include/termio.h: New file.
* include/unistd.h (_POSIX_VERSION): New macro.
* lib/linux/gnu.c (geteuid, getegid, setuid, setgid): New function.
* lib/string/memchr.c: New file.
* lib/stub/getpwuid.c: New file.
* lib/stub/rand.c: New file.
* lib/stub/ttyname.c: New file.
* include/string.h (memchr): Declare.
* include/unistd.h (geteuid, getegid, setuid, setgid): Declare.
2018-11-09 20:26:10 +00:00
|
|
|
#define S_ISGID 02000
|
|
|
|
#define S_IXGRP 00010
|
|
|
|
#define S_IXOTH 00001
|
|
|
|
#define S_IRGRP 00040
|
|
|
|
#define S_IROTH 00004
|
|
|
|
#define S_IWGRP 00020
|
|
|
|
#define S_IWOTH 00002
|
|
|
|
#define S_IRWXG 00070
|
|
|
|
#define S_IRWXO 00007
|
|
|
|
|
2019-05-29 14:15:12 +00:00
|
|
|
#endif // ! SYSTEM_LIBC
|
2018-04-29 10:01:25 +00:00
|
|
|
|
2017-05-23 05:16:08 +00:00
|
|
|
#endif // __MES_SYS_STAT_H
|