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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
/* This file is part of the KDE project
Copyright (C) 2003-2004 Jaroslaw Staniek <js@iidea.pl>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KDEWIN_UNISTD_H
#define _KDEWIN_UNISTD_H
#include <kdecore/kdelibs_export.h>
#include <io.h> /* access(), etc.*/
#include <process.h> /* getpid(), etc.*/
/* include most headers here to avoid redefining gethostname() */
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
#define _WINSOCKAPI_ /* skip winsock */
#include <sys/stat.h>
#ifdef __cplusplus
extern "C" {
#endif
#define F_OK 0
#define R_OK 4
#define W_OK 2
#define X_OK 1
/* + from <sys/stat.h>: */
#define _IFMT 0170000 /* type of file */
#define _IFDIR 0040000 /* directory */
#define _IFCHR 0020000 /* character special */
#define _IFBLK 0060000 /* block special */
#define _IFREG 0100000 /* regular */
#define _IFLNK 0120000 /* symbolic link */
#define _IFSOCK 0140000 /* socket */
#define _IFIFO 0010000 /* fifo */
#define S_ISBLK(m) (((m)&_IFMT) == _IFBLK)
#define S_ISCHR(m) (((m)&_IFMT) == _IFCHR)
#define S_ISDIR(m) (((m)&_IFMT) == _IFDIR)
#define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO)
#define S_ISREG(m) (((m)&_IFMT) == _IFREG)
#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK)
#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK)
KDEWIN32_EXPORT int chown(const char *__path, uid_t __owner, gid_t __group);
KDEWIN32_EXPORT int fchmod(int __fd, mode_t __mode);
KDEWIN32_EXPORT int fchown(int __fd, uid_t __owner, gid_t __group );
/* Get the real user ID of the calling process. */
KDEWIN32_EXPORT uid_t getuid (void);
/* Get the effective user ID of the calling process. */
KDEWIN32_EXPORT uid_t geteuid (void);
/* Get the real group ID of the calling process. */
KDEWIN32_EXPORT gid_t getgid (void);
/* Get the effective group ID of the calling process. */
KDEWIN32_EXPORT gid_t getegid (void);
KDEWIN32_EXPORT int getgroups(int size, gid_t list[]);
/* On win32 we do not have fs-links, so simply 0 (success) is returned
when __path is accessible. It is then just copied to __buf.
*/
KDEWIN32_EXPORT int readlink(const char *__path, char *__buf, int __buflen);
/* just copies __name1 to __name2 */
KDEWIN32_EXPORT int symlink(const char *__name1, const char *__name2);
/* just copies __name1 to __name2 */
KDEWIN32_EXPORT int link(const char *__name1, const char *__name2);
KDEWIN32_EXPORT char* realpath(const char *path,char *resolved_path);
KDEWIN32_EXPORT int pipe(int *fd);
KDEWIN32_EXPORT pid_t fork(void);
KDEWIN32_EXPORT pid_t setsid(void);
#undef gethostname
#define gethostname kde_gethostname
KDEWIN32_EXPORT int kde_gethostname(char *__name, size_t __len);
KDEWIN32_EXPORT unsigned alarm(unsigned __secs );
KDEWIN32_EXPORT char* getlogin();
KDEWIN32_EXPORT int fsync (int fd);
KDEWIN32_EXPORT void usleep(unsigned int usec);
#define HAVE_USLEEP
KDEWIN32_EXPORT void sleep(unsigned int sec);
KDEWIN32_EXPORT long int random();
#define HAVE_RANDOM
#define HAVE_SETEUID
KDEWIN32_EXPORT int setreuid(uid_t ruid, uid_t euid);
#ifdef __cplusplus
}
#endif
#endif /* _KDEWIN_UNISTD_H */
|