ReactOS 0.4.15-dev-8348-gc1b9bb5
port.h File Reference
#include <fcntl.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <setjmp.h>
Include dependency graph for port.h:

Go to the source code of this file.

Classes

struct  statvfs
 
struct  option
 

Macros

#define _GNU_SOURCE   /* for pread/pwrite */
 
#define RTLD_LAZY   0x001
 
#define RTLD_NOW   0x002
 
#define RTLD_GLOBAL   0x100
 
#define S_ISLNK(mod)   (0)
 
#define S_ISSOCK(mod)   (0)
 
#define S_ISDIR(mod)   (((mod) & _S_IFMT) == _S_IFDIR)
 
#define S_ISCHR(mod)   (((mod) & _S_IFMT) == _S_IFCHR)
 
#define S_ISFIFO(mod)   (((mod) & _S_IFMT) == _S_IFIFO)
 
#define S_ISREG(mod)   (((mod) & _S_IFMT) == _S_IFREG)
 
#define S_IWUSR   0
 
#define O_LARGEFILE   0
 
#define O_NONBLOCK   0
 
#define O_BINARY   0
 
#define M_PI   3.14159265358979323846
 
#define M_PI_2   1.570796326794896619
 
#define __ASM_GLOBAL_FUNC(name, code)
 
#define _P_WAIT   0
 
#define _P_NOWAIT   1
 
#define _P_OVERLAY   2
 
#define _P_NOWAITO   3
 
#define _P_DETACH   4
 

Typedefs

typedef int mode_t
 
typedef long off_t
 
typedef int pid_t
 
typedef unsigned int size_t
 
typedef int ssize_t
 
typedef unsigned long fsblkcnt_t
 
typedef unsigned long fsfilcnt_t
 
typedef jmp_buf sigjmp_buf
 

Functions

int fstatvfs (int fd, struct statvfs *buf)
 
int getopt_long (int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind)
 
int getopt_long_only (int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind)
 
int ffs (int x)
 
int futimes (int fd, const struct timeval tv[2])
 
size_t getpagesize (void)
 
pid_t gettid (void)
 
int lstat (const char *file_name, struct stat *buf)
 
voidmemmove (void *dest, const void *src, size_t len)
 
ssize_t pread (int fd, void *buf, size_t count, off_t offset)
 
ssize_t pwrite (int fd, const void *buf, size_t count, off_t offset)
 
int readlink (const char *path, char *buf, size_t size)
 
int sigsetjmp (sigjmp_buf buf, int savesigs)
 
void siglongjmp (sigjmp_buf buf, int val)
 
int statvfs (const char *path, struct statvfs *buf)
 
int strncasecmp (const char *str1, const char *str2, size_t n)
 
const charstrerror (int err)
 
int strcasecmp (const char *str1, const char *str2)
 
int usleep (unsigned int useconds)
 
voidmemcpy_unaligned (void *dst, const void *src, size_t size)
 
int mkstemps (char *template, int suffix_len)
 
int spawnvp (int mode, const char *cmdname, const char *const argv[])
 
long interlocked_cmpxchg (long *dest, long xchg, long compare)
 
voidinterlocked_cmpxchg_ptr (void **dest, void *xchg, void *compare)
 
long interlocked_xchg (long *dest, long val)
 
voidinterlocked_xchg_ptr (void **dest, void *val)
 
long interlocked_xchg_add (long *dest, long incr)
 

Variables

charoptarg
 
int optind
 
int opterr
 
int optopt
 

Macro Definition Documentation

◆ __ASM_GLOBAL_FUNC

#define __ASM_GLOBAL_FUNC (   name,
  code 
)
Value:
void __asm_dummy_##name(void) { \
asm( ".align 4\n\t" \
".globl " __ASM_NAME(#name) "\n\t" \
__ASM_FUNC(#name) "\n" \
__ASM_NAME(#name) ":\n\t" \
code ); \
}
#define __ASM_NAME(name)
Definition: config.h:934
#define __ASM_FUNC(name)
Definition: config.h:931
Definition: inflate.c:139
Definition: name.c:39

Definition at line 201 of file port.h.

◆ _GNU_SOURCE

#define _GNU_SOURCE   /* for pread/pwrite */

Definition at line 28 of file port.h.

◆ _P_DETACH

#define _P_DETACH   4

Definition at line 374 of file port.h.

◆ _P_NOWAIT

#define _P_NOWAIT   1

Definition at line 371 of file port.h.

◆ _P_NOWAITO

#define _P_NOWAITO   3

Definition at line 373 of file port.h.

◆ _P_OVERLAY

#define _P_OVERLAY   2

Definition at line 372 of file port.h.

◆ _P_WAIT

#define _P_WAIT   0

Definition at line 370 of file port.h.

◆ M_PI

#define M_PI   3.14159265358979323846

Definition at line 181 of file port.h.

◆ M_PI_2

#define M_PI_2   1.570796326794896619

Definition at line 185 of file port.h.

◆ O_BINARY

#define O_BINARY   0

Definition at line 162 of file port.h.

◆ O_LARGEFILE

#define O_LARGEFILE   0

Definition at line 154 of file port.h.

◆ O_NONBLOCK

#define O_NONBLOCK   0

Definition at line 158 of file port.h.

◆ RTLD_GLOBAL

#define RTLD_GLOBAL   0x100

Definition at line 101 of file port.h.

◆ RTLD_LAZY

#define RTLD_LAZY   0x001

Definition at line 99 of file port.h.

◆ RTLD_NOW

#define RTLD_NOW   0x002

Definition at line 100 of file port.h.

◆ S_ISCHR

#define S_ISCHR (   mod)    (((mod) & _S_IFMT) == _S_IFCHR)

Definition at line 137 of file port.h.

◆ S_ISDIR

#define S_ISDIR (   mod)    (((mod) & _S_IFMT) == _S_IFDIR)

Definition at line 133 of file port.h.

◆ S_ISFIFO

#define S_ISFIFO (   mod)    (((mod) & _S_IFMT) == _S_IFIFO)

Definition at line 141 of file port.h.

◆ S_ISLNK

#define S_ISLNK (   mod)    (0)

Definition at line 125 of file port.h.

◆ S_ISREG

#define S_ISREG (   mod)    (((mod) & _S_IFMT) == _S_IFREG)

Definition at line 145 of file port.h.

◆ S_ISSOCK

#define S_ISSOCK (   mod)    (0)

Definition at line 129 of file port.h.

◆ S_IWUSR

#define S_IWUSR   0

Definition at line 149 of file port.h.

Typedef Documentation

◆ fsblkcnt_t

Definition at line 68 of file port.h.

◆ fsfilcnt_t

Definition at line 71 of file port.h.

◆ mode_t

typedef int mode_t

Definition at line 53 of file port.h.

◆ off_t

typedef long off_t

Definition at line 56 of file port.h.

◆ pid_t

typedef int pid_t

Definition at line 59 of file port.h.

◆ sigjmp_buf

Definition at line 324 of file port.h.

◆ size_t

typedef unsigned int size_t

Definition at line 62 of file port.h.

◆ ssize_t

typedef int ssize_t

Definition at line 65 of file port.h.

Function Documentation

◆ ffs()

int ffs ( int  x)

◆ fstatvfs()

int fstatvfs ( int  fd,
struct statvfs buf 
)

◆ futimes()

int futimes ( int  fd,
const struct timeval  tv[2] 
)

◆ getopt_long()

int getopt_long ( int  ___argc,
char *const ___argv,
const char __shortopts,
const struct option __longopts,
int __longind 
)

Definition at line 283 of file getopt.c.

289{
290 int retval;
291
292 _DIAGASSERT(nargv != NULL);
295
296 if ((retval = getopt_internal(nargc,nargv,options)) == -2) {
297 char *current_argv,*has_equal;
298 size_t current_argv_len;
299 int i,match;
300
301 current_argv = place;
302 match = -1;
303
304 optind++;
305 place = EMSG;
306
307 if (*current_argv == '\0') {
308
309 if (nonopt_end != -1) {
312 }
314 return -1;
315 }
316 if ((has_equal = strchr(current_argv,'=')) != NULL) {
317
318 current_argv_len = has_equal - current_argv;
319 has_equal++;
320 } else
321 current_argv_len = strlen(current_argv);
322
323 for (i = 0; long_options[i].name; i++) {
324
325 if (strncmp(current_argv,long_options[i].name,current_argv_len))
326 continue;
327
328 if (strlen(long_options[i].name) ==
329 (unsigned)current_argv_len) {
330
331 match = i;
332 break;
333 }
334 if (match == -1)
335 match = i;
336 else {
337
338 if (PRINT_ERROR)
339 warnx(ambig,(int)current_argv_len,current_argv);
340 optopt = 0;
341 return BADCH;
342 }
343 }
344 if (match != -1) {
345 if (long_options[match].has_arg == no_argument
346 && has_equal) {
347 if (PRINT_ERROR)
348 warnx(noarg,(int)current_argv_len,current_argv);
349
350 if (long_options[match].flag == NULL)
352 else
353 optopt = 0;
354 return BADARG;
355 }
356 if (long_options[match].has_arg == required_argument ||
358 if (has_equal)
359 optarg = has_equal;
360 else if (long_options[match].has_arg ==
362
363 optarg = nargv[optind++];
364 }
365 }
366 if ((long_options[match].has_arg == required_argument)
367 && (optarg == NULL)) {
368
369 if (PRINT_ERROR)
370 warnx(recargstring,current_argv);
371
372 if (long_options[match].flag == NULL)
374 else
375 optopt = 0;
376 --optind;
377 return BADARG;
378 }
379 } else {
380 if (PRINT_ERROR)
381 warnx(illoptstring,current_argv);
382 optopt = 0;
383 return BADCH;
384 }
385 if (long_options[match].flag) {
386 *long_options[match].flag = long_options[match].val;
387 retval = 0;
388 } else
389 retval = long_options[match].val;
390 if (idx)
391 *idx = match;
392 }
393 return retval;
394}
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 * strchr(const char *String, int ch)
Definition: utclib.c:501
#define BADCH
Definition: getopt.c:51
int optopt
Definition: getopt.c:48
#define EMSG
Definition: getopt.c:52
const char * optarg
Definition: getopt.c:49
int optind
Definition: getopt.c:47
#define NULL
Definition: types.h:112
unsigned int idx
Definition: utils.c:41
#define no_argument
Definition: getopt.h:122
#define required_argument
Definition: getopt.h:123
#define optional_argument
Definition: getopt.h:124
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
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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define warnx(...)
static const char noarg[]
Definition: getopt.c:63
static const char recargstring[]
Definition: getopt.c:61
static int getopt_internal(int, char *const *, const char *)
Definition: getopt.c:137
static const char illoptstring[]
Definition: getopt.c:65
static int nonopt_start
Definition: getopt.c:57
static char * place
Definition: getopt.c:55
static int nonopt_end
Definition: getopt.c:58
static void permute_args(int, int, int, char *const *)
Definition: getopt.c:103
#define PRINT_ERROR
Definition: getopt.c:35
#define BADARG
Definition: getopt.c:46
static const char ambig[]
Definition: getopt.c:62
#define _DIAGASSERT(x)
Definition: getopt.c:11
Definition: match.c:28
static const struct option long_options[]
Definition: widl.c:185

◆ getopt_long_only()

int getopt_long_only ( int  ___argc,
char *const ___argv,
const char __shortopts,
const struct option __longopts,
int __longind 
)

◆ getpagesize()

size_t getpagesize ( void  )

◆ gettid()

pid_t gettid ( void  )

◆ interlocked_cmpxchg()

long interlocked_cmpxchg ( long dest,
long  xchg,
long  compare 
)

◆ interlocked_cmpxchg_ptr()

void * interlocked_cmpxchg_ptr ( void **  dest,
void xchg,
void compare 
)

◆ interlocked_xchg()

long interlocked_xchg ( long dest,
long  val 
)

◆ interlocked_xchg_add()

long interlocked_xchg_add ( long dest,
long  incr 
)

◆ interlocked_xchg_ptr()

void * interlocked_xchg_ptr ( void **  dest,
void val 
)

◆ lstat()

int lstat ( const char file_name,
struct stat buf 
)

◆ memcpy_unaligned()

void * memcpy_unaligned ( void dst,
const void src,
size_t  size 
)

◆ memmove()

void * memmove ( void dest,
const void src,
size_t  len 
)

Definition at line 8 of file memmove.c.

9{
10 char *char_dest = (char *)dest;
11 char *char_src = (char *)src;
12
13 if ((char_dest <= char_src) || (char_dest >= (char_src+count)))
14 {
15 /* non-overlapping buffers */
16 while(count > 0)
17 {
18 *char_dest = *char_src;
19 char_dest++;
20 char_src++;
21 count--;
22 }
23 }
24 else
25 {
26 /* overlaping buffers */
27 char_dest = (char *)dest + count - 1;
28 char_src = (char *)src + count - 1;
29
30 while(count > 0)
31 {
32 *char_dest = *char_src;
33 char_dest--;
34 char_src--;
35 count--;
36 }
37 }
38
39 return dest;
40}
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum src
Definition: glext.h:6340
static char * dest
Definition: rtl.c:135

◆ mkstemps()

int mkstemps ( char template,
int  suffix_len 
)

Definition at line 73 of file mkstemps.c.

76{
77 static const char letters[]
78 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
79 static gcc_uint64_t value;
80#ifdef HAVE_GETTIMEOFDAY
81 struct timeval tv;
82#endif
83 char *XXXXXX;
84 size_t len;
85 int count;
86
87 len = strlen (template);
88
89 if ((int) len < 6 + suffix_len
90 || strncmp (&template[len - 6 - suffix_len], "XXXXXX", 6))
91 {
92 printf("wrong parameter\n");
93 return -1;
94 }
95
96 XXXXXX = &template[len - 6 - suffix_len];
97
98#ifdef HAVE_GETTIMEOFDAY
99 /* Get some more or less random data. */
100 gettimeofday (&tv, NULL);
101 value += ((gcc_uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
102#else
103 value += getpid ();
104#endif
105
106 for (count = 0; count < TMP_MAX; ++count)
107 {
109 int fd;
110
111 /* Fill in the random bits. */
112 XXXXXX[0] = letters[v % 62];
113 v /= 62;
114 XXXXXX[1] = letters[v % 62];
115 v /= 62;
116 XXXXXX[2] = letters[v % 62];
117 v /= 62;
118 XXXXXX[3] = letters[v % 62];
119 v /= 62;
120 XXXXXX[4] = letters[v % 62];
121 v /= 62;
122 XXXXXX[5] = letters[v % 62];
123
124#ifdef VMS
125 fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600, "fop=tmd");
126#else
127 fd = open (template, O_RDWR|O_CREAT|O_EXCL|O_BINARY, 0600);
128#endif
129 if (fd >= 0)
130 /* The file does not exist. */
131 return fd;
132
133 /* This is a random value. It is only necessary that the next
134 TMP_MAX values generated by adding 7777 to VALUE are different
135 with (module 2^32). */
136 value += 7777;
137 }
138
139 /* We return the null string if we can't find a unique file name. */
140 template[0] = '\0';
141 return -1;
142}
#define O_CREAT
Definition: acwin.h:110
#define open
Definition: acwin.h:95
#define gettimeofday(tv, tz)
Definition: adns_win32.h:159
#define printf
Definition: freeldr.h:97
const GLdouble * v
Definition: gl.h:2040
GLenum GLsizei len
Definition: glext.h:6722
#define O_EXCL
Definition: fcntl.h:40
#define O_RDWR
Definition: fcntl.h:36
#define O_BINARY
Definition: mkstemps.c:48
unsigned long gcc_uint64_t
Definition: mkstemps.c:39
#define TMP_MAX
Definition: mkstemps.c:43
static int fd
Definition: io.c:51
Definition: pdh_main.c:94
#define getpid
Definition: wintirpc.h:52

Referenced by chmc_section_create(), and main().

◆ pread()

ssize_t pread ( int  fd,
void buf,
size_t  count,
off_t  offset 
)

Referenced by fread(), and teststream_Read().

◆ pwrite()

ssize_t pwrite ( int  fd,
const void buf,
size_t  count,
off_t  offset 
)

◆ readlink()

int readlink ( const char path,
char buf,
size_t  size 
)

◆ siglongjmp()

void siglongjmp ( sigjmp_buf  buf,
int  val 
)

◆ sigsetjmp()

◆ spawnvp()

int spawnvp ( int  mode,
const char cmdname,
const char *const  argv[] 
)

◆ statvfs()

int statvfs ( const char path,
struct statvfs buf 
)

◆ strcasecmp()

int strcasecmp ( const char str1,
const char str2 
)

◆ strerror()

◆ strncasecmp()

int strncasecmp ( const char str1,
const char str2,
size_t  n 
)

◆ usleep()

int usleep ( unsigned int  useconds)

Referenced by wave_out_play().

Variable Documentation

◆ optarg

char* optarg
extern

Definition at line 49 of file getopt.c.

◆ opterr

int opterr
extern

Definition at line 46 of file getopt.c.

◆ optind

int optind
extern

Definition at line 47 of file getopt.c.

◆ optopt

int optopt
extern

Definition at line 48 of file getopt.c.