ReactOS 0.4.15-dev-7934-g1dc8d80
libport.h
Go to the documentation of this file.
1/* @(#)libport.h 1.45 17/05/02 Copyright 1995-2017 J. Schilling */
2/*
3 * Prototypes for POSIX standard functions that may be missing on the
4 * local platform and thus are implemented inside libschily.
5 *
6 * Copyright (c) 1995-2017 J. Schilling
7 */
8/*
9 * The contents of this file are subject to the terms of the
10 * Common Development and Distribution License, Version 1.0 only
11 * (the "License"). You may not use this file except in compliance
12 * with the License.
13 *
14 * See the file CDDL.Schily.txt in this distribution for details.
15 * A copy of the CDDL is also available via the Internet at
16 * http://www.opensource.org/licenses/cddl1.txt
17 *
18 * When distributing Covered Code, include this CDDL HEADER in each
19 * file and include the License file CDDL.Schily.txt from this distribution.
20 */
21
22
23#ifndef _SCHILY_LIBPORT_H
24#define _SCHILY_LIBPORT_H
25
26#ifndef _SCHILY_MCONFIG_H
27#include <schily/mconfig.h>
28#endif
29#ifndef _SCHILY_TYPES_H
30#include <schily/types.h>
31#endif
32
33#ifndef _SCHILY_UNISTD_H
34#include <schily/unistd.h>
35#endif
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41#if defined(_INCL_SYS_TYPES_H) || defined(_INCL_TYPES_H) || defined(size_t)
42# ifndef FOUND_SIZE_T
43# define FOUND_SIZE_T
44# endif
45#endif
46#if defined(_MSC_VER) && !defined(_SIZE_T_DEFINED)
47# undef FOUND_SIZE_T
48#endif
49
50#ifdef OPENSERVER
51/*
52 * Don't use the usleep() from libc on SCO's OPENSERVER.
53 * It will kill our processes with SIGALRM.
54 */
55/*
56 * Don't #undef HAVE_USLEEP in this file, SCO has a
57 * usleep() prototype in unistd.h
58 */
59/* #undef HAVE_USLEEP */
60#endif
61
62#ifdef FOUND_SIZE_T
63/*
64 * We currently cannot define this here because there IRIX has a definition
65 * than violates the standard.
66 */
67#ifndef HAVE_SNPRINTF
68/*PRINTFLIKE3*/
69extern int snprintf __PR((char *, size_t, const char *, ...))
70 __printflike__(3, 4);
71#endif
72#endif
73
74#ifdef EOF /* stdio.h has been included */
75#ifdef FOUND_SIZE_T
76#ifndef HAVE_GETDELIM
77extern ssize_t getdelim __PR((char **, size_t *, int, FILE *));
78#endif
79#endif
80#endif
81
82#ifndef HAVE_GETHOSTID
83extern long gethostid __PR((void));
84#endif
85#ifndef HAVE_GETPAGESIZE
86extern int getpagesize __PR((void));
87#endif
88#ifndef HAVE_USLEEP
89extern int usleep __PR((int usec));
90#endif
91
92#ifndef HAVE_STRCASECMP
93extern int strcasecmp __PR((const char *, const char *));
94#endif
95#ifdef FOUND_SIZE_T
96#ifndef HAVE_STRNCASECMP
97extern int strncasecmp __PR((const char *, const char *,
98 size_t));
99#endif
100#endif
101
102#ifndef HAVE_STRCAT
103extern char *strcat __PR((char *s1, const char *s2));
104#endif
105#ifndef HAVE_STRCHR
106extern char *strchr __PR((const char *s1, int c));
107#endif
108#ifndef HAVE_STRCMP
109extern int strcmp __PR((const char *s1, const char *s2));
110#endif
111#ifndef HAVE_STRCPY
112extern char *strcpy __PR((char *s1, const char *s2));
113#endif
114#if !defined(HAVE_STRDUP) || defined(__SVR4)
115extern char *strdup __PR((const char *s));
116#endif
117#ifdef FOUND_SIZE_T
118#ifndef HAVE_STRNDUP
119extern char *strndup __PR((const char *s, size_t len));
120#endif
121#ifndef HAVE_STRLEN
122extern size_t strlen __PR((const char *s));
123#endif
124#ifndef HAVE_STRNLEN
125extern size_t strnlen __PR((const char *s, size_t len));
126#endif
127#ifndef HAVE_STRLCAT
128extern size_t strlcat __PR((char *s1, const char *s2,
129 size_t len));
130#endif
131#ifndef HAVE_STRLCPY
132extern size_t strlcpy __PR((char *s1, const char *s2,
133 size_t len));
134#endif
135#ifndef HAVE_STRNCAT
136extern char *strncat __PR((char *s1, const char *s2,
137 size_t len));
138#endif
139#ifndef HAVE_STRNCMP
140extern int strncmp __PR((const char *s1, const char *s2,
141 size_t len));
142#endif
143#ifndef HAVE_STRNCPY
144extern char *strncpy __PR((char *s1, const char *s2,
145 size_t len));
146#endif
147#endif /* FOUND_SIZE_T */
148#ifndef HAVE_STRRCHR
149extern char *strrchr __PR((const char *s1, int c));
150#endif
151
152#ifndef HAVE_STRSTR
153extern char *strstr __PR((const char *s1, const char *s2));
154#endif
155
156#ifdef _SCHILY_WCHAR_H
157#ifndef HAVE_WCSCAT
158extern wchar_t *wcscat __PR((wchar_t *s1, const wchar_t *s2));
159#endif
160#ifndef HAVE_WCSCHR
161extern wchar_t *wcschr __PR((const wchar_t *s1, wchar_t c));
162#endif
163#ifndef HAVE_WCSCMP
164extern int wcscmp __PR((const wchar_t *s1,
165 const wchar_t *s2));
166#endif
167#ifndef HAVE_WCSCPY
168extern wchar_t *wcscpy __PR((wchar_t *s1, const wchar_t *s2));
169#endif
170#ifndef HAVE_WCSDUP
171extern wchar_t *wcsdup __PR((const wchar_t *s));
172#endif
173#ifdef FOUND_SIZE_T
174#ifndef HAVE_WCSNDUP
175extern wchar_t *wcsndup __PR((const wchar_t *s, size_t len));
176#endif
177#ifndef HAVE_WCSLEN
178extern size_t wcslen __PR((const wchar_t *s));
179#endif
180#ifndef HAVE_WCSNLEN
181extern size_t wcsnlen __PR((const wchar_t *s, size_t len));
182#endif
183#ifndef HAVE_WCSLCAT
184extern size_t wcslcat __PR((wchar_t *s1, const wchar_t *s2,
185 size_t len));
186#endif
187#ifndef HAVE_WCSLCPY
188extern size_t wcslcpy __PR((wchar_t *s1, const wchar_t *s2,
189 size_t len));
190#endif
191#ifndef HAVE_WCSNCAT
192extern wchar_t *wcsncat __PR((wchar_t *s1, const wchar_t *s2,
193 size_t len));
194#endif
195#ifndef HAVE_WCSNCMP
196extern int wcsncmp __PR((const wchar_t *s1,
197 const wchar_t *s2,
198 size_t len));
199#endif
200#ifndef HAVE_WCSNCPY
201extern wchar_t *wcsncpy __PR((wchar_t *s1, const wchar_t *s2,
202 size_t len));
203#endif
204#endif /* FOUND_SIZE_T */
205#ifndef HAVE_WCSRCHR
206extern wchar_t *wcsrchr __PR((const wchar_t *s1, wchar_t c));
207#endif
208
209#ifndef HAVE_WCSSTR
210extern wchar_t *wcsstr __PR((const wchar_t *s1,
211 const wchar_t *s2));
212#endif
213#endif /* _SCHILY_WCHAR_H */
214
215#ifndef HAVE_RENAME
216extern int rename __PR((const char *__old,
217 const char *__new));
218#endif
219
220/*
221 * XXX Note: libgen.h / -lgen on Solaris contain eaccess()
222 */
223#ifndef HAVE_EACCESS
224extern int eaccess __PR((const char *name, int mode));
225#endif
226
227/*
228 * See also libgen.h
229 */
230#ifndef HAVE_BASENAME
231extern char *basename __PR((char *name));
232#endif
233#ifndef HAVE_DIRNAME
234extern char *dirname __PR((char *name));
235#endif
236
237#ifndef HAVE_TIMEGM
238#if defined(_SCHILY_TIME_H)
239extern time_t timegm __PR((struct tm *));
240#endif
241#endif
242
243#ifndef HAVE_GETUID
244extern uid_t getuid __PR((void));
245#endif
246#ifndef HAVE_GETEUID
247extern uid_t geteuid __PR((void));
248#endif
249#ifndef HAVE_SETUID
250extern int setuid __PR((uid_t uid));
251#endif
252#ifndef HAVE_SETEUID
253extern int seteuid __PR((uid_t uid));
254#endif
255
256#ifndef HAVE_GETGID
257extern gid_t getgid __PR((void));
258#endif
259#ifndef HAVE_GETEGID
260extern gid_t getegid __PR((void));
261#endif
262#ifndef HAVE_SETGID
263extern int setgid __PR((gid_t gid));
264#endif
265#ifndef HAVE_SETEGID
266extern int setegid __PR((gid_t gid));
267#endif
268
269#ifndef HAVE_GETPWNAM
270extern struct passwd *getpwnam __PR((const char *name));
271#endif
272#ifndef HAVE_GETPWENT
273extern struct passwd *getpwent __PR((void));
274#endif
275#ifndef HAVE_GETPWUID
276extern struct passwd *getpwuid __PR((uid_t uid));
277#endif
278#ifndef HAVE_SETPWENT
279extern void setpwent __PR((void));
280#endif
281#ifndef HAVE_ENDPWENT
282extern void endpwent __PR((void));
283#endif
284
285
286#ifndef HAVE_GETGRNAM
287extern struct group *getgrnam __PR((const char *name));
288#endif
289#ifndef HAVE_GETGRENT
290extern struct group *getgrent __PR((void));
291#endif
292#ifndef HAVE_GETGRGID
293extern struct group *getgrgid __PR((gid_t gid));
294#endif
295#ifndef HAVE_SETGRENT
296extern void setgrent __PR((void));
297#endif
298#ifndef HAVE_ENDGRENT
299extern void endgrent __PR((void));
300#endif
301
302#ifndef HAVE_FCHDIR
303extern int fchdir __PR((int fd));
304#endif
305#ifndef HAVE_OPENAT
306extern int openat __PR((int fd, const char *name, int oflag, ...));
307#endif
308
309
310#ifndef HAVE_GETTIMEOFDAY
311#ifdef _SCHILY_TIME_H
312extern int gettimeofday __PR((struct timeval *__tp, void *__tzp));
313#endif
314#endif
315
316#ifndef HAVE_FACCESSAT
317extern int faccessat __PR((int fd, const char *name,
318 int amode, int flag));
319#endif
320#ifndef HAVE_FCHMODAT
321extern int fchmodat __PR((int fd, const char *name,
322 mode_t mode, int flag));
323#endif
324#ifndef HAVE_LCHMOD
325extern int lchmod __PR((const char *name, mode_t mode));
326#endif
327
328#ifndef HAVE_FCHOWNAT
329extern int fchownat __PR((int fd, const char *name,
330 uid_t owner, gid_t group, int flag));
331#endif
332
333#ifndef HAVE_FDOPENDIR
334#ifdef _SCHILY_DIRENT_H
335extern DIR *fdopendir __PR((int fd));
336#endif
337#endif
338
339#ifdef _SCHILY_STAT_H
340#ifndef HAVE_FSTATAT
341extern int fstatat __PR((int fd, const char *name,
342 struct stat *sbuf, int flag));
343#endif
344#endif /* _SCHILY_STAT_H */
345#ifdef _SCHILY_TIME_H
346#ifndef HAVE_FUTIMENS
347extern int futimens __PR((int fd,
348 const struct timespec __times[2]));
349#endif
350#ifndef HAVE_FUTIMESAT
351extern int futimesat __PR((int fd, const char *name,
352 const struct timeval __times[2]));
353#endif
354#ifndef HAVE_LUTIMENS
355extern int lutimens __PR((const char *name,
356 const struct timespec __times[2]));
357#endif
358#endif /* _SCHILY_TIME_H */
359#ifndef HAVE_LINKAT
360extern int linkat __PR((int fd1, const char *name1,
361 int fd2, const char *name2, int flag));
362#endif
363#ifndef HAVE_MKDIRAT
364extern int mkdirat __PR((int fd, const char *name, mode_t mode));
365#endif
366#ifndef HAVE_MKFIFO
367extern int mkfifo __PR((const char *name, mode_t mode));
368#endif
369#ifndef HAVE_MKFIFOAT
370extern int mkfifoat __PR((int fd, const char *name, mode_t mode));
371#endif
372#ifndef HAVE_MKNODAT
373extern int mknodat __PR((int fd, const char *name,
374 mode_t mode, dev_t dev));
375#endif
376#ifndef HAVE_READLINKAT
377extern ssize_t readlinkat __PR((int fd, const char *name,
378 char *lbuf, size_t lbufsize));
379#endif
380#ifndef HAVE_RENAMEAT
381extern int renameat __PR((int oldfd, const char *__old,
382 int newfd, const char *__new));
383#endif
384#ifndef HAVE_SYMLINKAT
385extern int symlinkat __PR((const char *content,
386 int fd, const char *name));
387#endif
388#ifndef HAVE_UNLINKAT
389extern int unlinkat __PR((int fd, const char *name, int flag));
390#endif
391#ifdef _SCHILY_TIME_H
392#ifndef HAVE_UTIMENS
393extern int utimens __PR((const char *name,
394 const struct timespec __times[2]));
395#endif
396#ifndef HAVE_UTIMENSAT
397extern int utimensat __PR((int fd, const char *name,
398 const struct timespec __times[2],
399 int flag));
400#endif
401#endif /* _SCHILY_TIME_H */
402
403#ifdef __SUNOS4
404/*
405 * Define prototypes for POSIX standard functions that are missing on SunOS-4.x
406 * to make compilation smooth.
407 */
408#include <schily/sunos4_proto.h>
409
410#endif /* __SUNOS4 */
411
412#ifdef __cplusplus
413}
414#endif
415
416#endif /* _SCHILY_LIBPORT_H */
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
char * strncat(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:605
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define gettimeofday(tv, tz)
Definition: adns_win32.h:159
long uid_t
Definition: various.h:8
uid_t getuid()
Definition: uid.c:27
size_t strlcpy(char *d, const char *s, size_t bufsize)
Definition: compat.c:3
#define __printflike__(fmtarg, firstvararg)
Definition: ccomdefs.h:39
UINT gid_t
Definition: types.h:89
content
Definition: atl_ax.c:994
#define wcschr
Definition: compat.h:17
#define wcsrchr
Definition: compat.h:16
static void basename(LPCWSTR path, LPWSTR name)
Definition: profile.c:38
__kernel_dev_t dev_t
Definition: linux.h:197
__kernel_time_t time_t
Definition: linux.h:252
__kernel_mode_t mode_t
Definition: linux.h:199
EXPORT int eaccess(char *name, int mode) const
Definition: eaccess.c:35
#define strncasecmp
Definition: fake.h:10
#define strcasecmp
Definition: fake.h:9
EXPORT int setgid(gid_t gid)
Definition: gid.c:47
EXPORT gid_t getegid()
Definition: gid.c:37
EXPORT int setegid(gid_t gid)
Definition: gid.c:58
EXPORT gid_t getgid()
Definition: gid.c:27
GLdouble s
Definition: gl.h:2039
const GLubyte * c
Definition: glext.h:8905
GLenum mode
Definition: glext.h:6217
GLboolean GLuint group
Definition: glext.h:11120
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
char * strndup(char const *name, size_t len)
Definition: getargs.c:25
wchar_t * wcsndup(wchar_t *name, size_t len)
Definition: getargs.c:36
__cdecl __MINGW_NOTHROW char * dirname(char *)
struct S1 s1
struct S2 s2
static WCHAR name1[]
Definition: record.c:34
static WCHAR name2[]
Definition: record.c:35
int usleep(unsigned int useconds)
size_t getpagesize(void)
#define __PR(a)
Definition: prototyp.h:106
int ssize_t
Definition: rosdhcp.h:48
_Check_return_ int __cdecl rename(_In_z_ const char *_OldFilename, _In_z_ const char *_NewFilename)
_CRTIMP wchar_t *__cdecl wcsncat(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)
_Check_return_ _CRTIMP wchar_t *__cdecl wcsdup(_In_z_ const wchar_t *_Str)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
static int fd
Definition: io.c:51
EXPORT size_t strlcat(char *s1, const char *s2, size_t len)
Definition: strlcat.c:32
Definition: dirent.h:40
Definition: name.c:39
Definition: stat.h:55
Definition: time.h:88
Definition: time.h:68
EXPORT uid_t geteuid()
Definition: uid.c:37
EXPORT int setuid(uid_t uid)
Definition: uid.c:47
EXPORT int seteuid(uid_t uid)
Definition: uid.c:58
#define snprintf
Definition: wintirpc.h:48