From 464df1d5e5ab1322e2dd0a7796939fff1aeefa9a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 17:49:25 +0200 Subject: Adding upstream version 1.47.0. Signed-off-by: Daniel Baumann --- include/mingw/arpa/inet.h | 5 ++++ include/mingw/grp.h | 16 +++++++++++++ include/mingw/linux/types.h | 30 ++++++++++++++++++++++++ include/mingw/pwd.h | 20 ++++++++++++++++ include/mingw/sys/stat.h | 20 ++++++++++++++++ include/mingw/sys/sysmacros.h | 5 ++++ include/mingw/sys/types.h | 9 ++++++++ include/mingw/unistd.h | 54 +++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 159 insertions(+) create mode 100644 include/mingw/arpa/inet.h create mode 100644 include/mingw/grp.h create mode 100644 include/mingw/linux/types.h create mode 100644 include/mingw/pwd.h create mode 100644 include/mingw/sys/stat.h create mode 100644 include/mingw/sys/sysmacros.h create mode 100644 include/mingw/sys/types.h create mode 100644 include/mingw/unistd.h (limited to 'include/mingw') diff --git a/include/mingw/arpa/inet.h b/include/mingw/arpa/inet.h new file mode 100644 index 0000000..55dfa36 --- /dev/null +++ b/include/mingw/arpa/inet.h @@ -0,0 +1,5 @@ +#pragma once + +/* Windows is always little endian. */ +#define htonl __builtin_bswap32 +#define ntohl __builtin_bswap32 diff --git a/include/mingw/grp.h b/include/mingw/grp.h new file mode 100644 index 0000000..67f62d9 --- /dev/null +++ b/include/mingw/grp.h @@ -0,0 +1,16 @@ + +#pragma once + +#include + +__inline struct group * getgrnam(char* g){return 0;} + +struct group + { + char *gr_name; + char *gr_passwd; + __gid_t gr_gid; + char **gr_mem; + }; + +#define getgrgid(i) NULL diff --git a/include/mingw/linux/types.h b/include/mingw/linux/types.h new file mode 100644 index 0000000..9631456 --- /dev/null +++ b/include/mingw/linux/types.h @@ -0,0 +1,30 @@ +#ifndef _LINUX_TYPES_H +#define _LINUX_TYPES_H + +//#ifndef _MSC_VER +//#error _MSC_VER not defined +//#endif + +#include + +typedef unsigned __int8 __u8; +typedef signed __int8 __s8; + +typedef signed __int16 __s16; +typedef unsigned __int16 __u16; + +typedef signed __int32 __s32; +typedef unsigned __int32 __u32; + +typedef signed __int64 __s64; +typedef unsigned __int64 __u64; + + +//typedef __u32 ino_t; +typedef __u32 dev_t; +typedef __u32 uid_t; +typedef __u32 gid_t; + +#include + +#endif /* LINUX_TYPES_H */ diff --git a/include/mingw/pwd.h b/include/mingw/pwd.h new file mode 100644 index 0000000..d048842 --- /dev/null +++ b/include/mingw/pwd.h @@ -0,0 +1,20 @@ + +#pragma once + +#include + +__inline struct passwd* getpwnam (char* g){return 0;} + +struct passwd +{ + char *pw_name; + char *pw_passwd; + __uid_t pw_uid; + __gid_t pw_gid; + char *pw_gecos; + char *pw_dir; + char *pw_shell; +}; + +#define getpwuid(i) NULL + diff --git a/include/mingw/sys/stat.h b/include/mingw/sys/stat.h new file mode 100644 index 0000000..0ca1d1b --- /dev/null +++ b/include/mingw/sys/stat.h @@ -0,0 +1,20 @@ + +#pragma once + +#if HAVE_SYS_STAT_H +#include_next +#endif + +#ifndef lstat +#define lstat stat +#endif + +#ifndef S_ISLNK +#ifdef __S_IFLNK +#define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK) +#else +#define S_ISLNK(mode) 0 +#endif +#endif + +#define link(a, b) CreateHardLink((a), (b), NULL) diff --git a/include/mingw/sys/sysmacros.h b/include/mingw/sys/sysmacros.h new file mode 100644 index 0000000..a790cb2 --- /dev/null +++ b/include/mingw/sys/sysmacros.h @@ -0,0 +1,5 @@ +#pragma once + +#ifndef makedev +#define makedev(maj, min) (((maj) << 8) + (min)) +#endif diff --git a/include/mingw/sys/types.h b/include/mingw/sys/types.h new file mode 100644 index 0000000..9d048fc --- /dev/null +++ b/include/mingw/sys/types.h @@ -0,0 +1,9 @@ + +#pragma once + +#include_next + +#include + +typedef unsigned short __uid_t; +typedef unsigned short __gid_t; diff --git a/include/mingw/unistd.h b/include/mingw/unistd.h new file mode 100644 index 0000000..b201858 --- /dev/null +++ b/include/mingw/unistd.h @@ -0,0 +1,54 @@ +#pragma once + +// Copyright transferred from Raider Solutions, Inc to +// Kern Sibbald and John Walker by express permission. +// +// Copyright (C) 2004-2006 Kern Sibbald +// Copyright (C) 2014 Adam Kropelin +// +// 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. +// +// You should have received a copy of the GNU General Public +// License along with this program; if not, write to the Free +// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +#ifndef __COMPAT_UNISTD_H_ +#define __COMPAT_UNISTD_H_ + +#include_next + +#define _PC_PATH_MAX 1 +#define _PC_NAME_MAX 2 + +#ifdef __cplusplus +extern "C" { +#endif + +long pathconf(const char *, int); +#define getpid _getpid +#define getppid() 0 + +unsigned int sleep(unsigned int seconds); + +#define getuid() 0 +#define getgid() 0 +#define geteuid() 1 +#define getegid() 0 + +// no-oped sync +__inline void sync(void){}; + +#ifdef __cplusplus +}; +#endif + +#endif /* __COMPAT_UNISTD_H_ */ \ No newline at end of file -- cgit v1.2.3