summaryrefslogtreecommitdiffstats
path: root/include/mingw
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:49:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:49:25 +0000
commit464df1d5e5ab1322e2dd0a7796939fff1aeefa9a (patch)
tree6a403684e0978f0287d7f0ec0e5aab1fd31a59e1 /include/mingw
parentInitial commit. (diff)
downloade2fsprogs-upstream/1.47.0.tar.xz
e2fsprogs-upstream/1.47.0.zip
Adding upstream version 1.47.0.upstream/1.47.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/mingw')
-rw-r--r--include/mingw/arpa/inet.h5
-rw-r--r--include/mingw/grp.h16
-rw-r--r--include/mingw/linux/types.h30
-rw-r--r--include/mingw/pwd.h20
-rw-r--r--include/mingw/sys/stat.h20
-rw-r--r--include/mingw/sys/sysmacros.h5
-rw-r--r--include/mingw/sys/types.h9
-rw-r--r--include/mingw/unistd.h54
8 files changed, 159 insertions, 0 deletions
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 <sys/types.h>
+
+__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 <sys/types.h>
+
+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 <stdint.h>
+
+#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 <sys/types.h>
+
+__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 <sys/stat.h>
+#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 <sys/types.h>
+
+#include <linux/types.h>
+
+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 <unistd.h>
+
+#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