summaryrefslogtreecommitdiff
path: root/src/uxcompat.h
blob: e735c50a3fd213c907263c7639a6391271c98765 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifndef _LIBHX_UXCOMPAT_H
#define _LIBHX_UXCOMPAT_H 1

#if defined(__cplusplus) && __cplusplus >= 201100UL
#	include <cstddef>
#	include <cstdint>
#else
#	include <stddef.h>
#	include <stdint.h>
#endif
#include <sys/stat.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef ENOSYS
#	define ENOSYS 38 /* Function not implemented */
#endif

#ifndef S_IFLNK
#	define S_IFLNK  0xA000
#endif
#ifndef S_IFSOCK
#	define S_IFSOCK 0xC000
#endif
#ifndef S_IFBLK
#	define S_IFBLK 0x6000
#endif
#ifndef S_IFCHR
#	define S_IFCHR 0x2000
#endif
#ifndef S_IFIFO
#	define S_IFIFO 0x1000
#endif
#ifndef S_ISBLK
#	define S_ISBLK(__mode) (((__mode) & S_IFMT) == S_IFBLK)
#endif
#ifndef S_ISCHR
#	define S_ISCHR(__mode) (((__mode) & S_IFMT) == S_IFCHR)
#endif
#ifndef S_ISDIR
#	define S_ISDIR(__mode) (((__mode) & S_IFMT) == S_IFDIR)
#endif
#ifndef S_ISREG
#	define S_ISREG(__mode) (((__mode) & S_IFMT) == S_IFREG)
#endif
#ifndef S_ISLNK
#	define S_ISLNK(__mode) (((__mode) & S_IFMT) == S_IFLNK)
#endif
#ifndef S_ISFIFO
#	define S_ISFIFO(__mode) (((__mode) & S_IFMT) == S_IFIFO)
#endif
#ifndef S_ISSOCK
#	define S_ISSOCK(__mode) (((__mode) & S_IFMT) == S_IFSOCK)
#endif
#ifndef S_IRGRP
#	define S_IRGRP 00040
#endif
#ifndef S_IWGRP
#	define S_IWGRP 00020
#endif
#ifndef S_IROTH
#	define S_IROTH 00004
#endif
#ifndef S_IWOTH
#	define S_IWOTH 00002
#endif

struct stat;

/*
 *	UX-FILE.C
 */
extern int chown(const char *, long, long);
extern int fchmod(int, long);
extern int fchown(int, long, long);
extern int lchown(const char *, long, long);
extern int lstat(const char *, struct stat *);
extern int mkfifo(const char *, long);
extern int mknod(const char *, long, long);
extern int readlink(const char *, char *, size_t);
extern int symlink(const char *, const char *);

/*
 *	UX-MMAP.C
 */
#ifdef _WIN32
#	define MAP_FAILED  reinterpret_cast(void *, static_cast(intptr_t, -1))
#	define PROT_NONE   0x0
#	define PROT_READ   0x1
#	define PROT_WRITE  0x2
#	define PROT_EXEC   0x4
#	define MAP_SHARED  0x1
#	define MAP_PRIVATE 0x2
extern void *mmap(void *, size_t, int, int, int, off_t);
extern int munmap(void *, size_t);
#endif

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* _LIBHX_UXCOMPAT_H */