blob: e20f45c20ada5f2edb01df218153a5f908d71c2f [file] [log] [blame] [raw]
/* A part of the Native C Library for Windows NT
Copyright 2007-2015 PC GO Ld.
Copyright 2026 Rivoreo
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
This program 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.
*/
#ifndef _SYS_STAT_H
#define _SYS_STAT_H
/* All the headers include this file. */
#include <_mingw.h>
#define __need_size_t
#define __need_wchar_t
#include <stddef.h>
#include <sys/types.h>
#include <stdint.h>
#include <time.h>
/*
* Constants for the stat st_mode member.
*/
#define _S_IFIFO 0x1000 /* FIFO */
#define _S_IFCHR 0x2000 /* Character */
#define _S_IFBLK 0x3000 /* Block */
#define _S_IFDIR 0x4000 /* Directory */
#define _S_IFREG 0x8000 /* Regular */
#define _S_IFLNK 0xA000 /* SymbolicLink */
#define _S_IFSOCK 0xC000 /* Socket */
// 001100000000000000
// 0 C 0 0 0
#define _S_IFMT 0xF000 /* File type mask */
#define _S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
#define _S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO)
#define _S_ISCHR(m) (((m) & _S_IFMT) == _S_IFCHR)
#define _S_ISBLK(m) (((m) & _S_IFMT) == _S_IFBLK)
#define _S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
#define _S_IRUSR 00400
#define _S_IWUSR 00200
#define _S_IXUSR 00100
#define _S_IRWXU (_S_IRUSR | _S_IWUSR | _S_IXUSR)
#define _S_IRGRP 00040
#define _S_IWGRP 00020
#define _S_IXGRP 00010
#define _S_IRWXG (_S_IRGRP | _S_IWGRP | _S_IXGRP)
#define _S_IROTH 00004
#define _S_IWOTH 00002
#define _S_IXOTH 00001
#define _S_IRWXO (_S_IROTH | _S_IWOTH | _S_IXOTH)
#define _S_IREAD _S_IRUSR
#define _S_IWRITE _S_IWUSR
#define _S_IEXEC _S_IXUSR
#define S_IFIFO _S_IFIFO
#define S_IFCHR _S_IFCHR
#define S_IFBLK _S_IFBLK
#define S_IFDIR _S_IFDIR
#define S_IFREG _S_IFREG
#define S_IFLNK _S_IFLNK
#define S_IFSOCK _S_IFSOCK
#define S_IFMT _S_IFMT
#define S_IRUSR _S_IRUSR
#define S_IWUSR _S_IWUSR
#define S_IXUSR _S_IXUSR
#define S_IRWXU _S_IRWXU
#define S_IRGRP _S_IRGRP
#define S_IWGRP _S_IWGRP
#define S_IXGRP _S_IXGRP
#define S_IRWXG _S_IRWXG
#define S_IROTH _S_IROTH
#define S_IWOTH _S_IWOTH
#define S_IXOTH _S_IXOTH
#define S_IRWXO _S_IRWXO
#define S_IREAD _S_IREAD
#define S_IWRITE _S_IWRITE
#define S_IEXEC _S_IEXEC
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#ifndef _STAT_DEFINED
struct stat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
off_t st_size;
blkcnt_t st_blocks;
uint32_t st_flags;
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
struct timespec st_birthtim;
};
#define st_atime st_atim.tv_sec
#define st_mtime st_mtim.tv_sec
#define st_ctime st_ctim.tv_sec
#define st_birthtime st_birthtim.tv_sec
#define _STAT_DEFINED
#endif
#define UTIME_NOW ((1l << 30) - 1l)
#define UTIME_OMIT ((1l << 30) - 2l)
#ifdef __cplusplus
extern "C" {
#endif
int __cdecl __MINGW_NOTHROW lstat(const char *, struct stat *);
int __cdecl __MINGW_NOTHROW stat(const char *, struct stat *);
int __cdecl __MINGW_NOTHROW fstat(int, struct stat *);
int __cdecl __MINGW_NOTHROW fstatat(int, const char *, struct stat *, int);
int __cdecl __MINGW_NOTHROW chmod(const char *, mode_t);
int __cdecl __MINGW_NOTHROW fchmod(int, mode_t);
int __cdecl __MINGW_NOTHROW fchmodat(int, const char *, mode_t, int);
int __cdecl __MINGW_NOTHROW mkdir(const char *, mode_t);
int __cdecl __MINGW_NOTHROW mkdirat(int, const char *, mode_t);
int __cdecl __MINGW_NOTHROW utimensat(int, const char *, const struct timespec *, int);
int __cdecl __MINGW_NOTHROW futimens(int, const struct timespec *);
#ifdef __cplusplus
}
#endif
#endif