#include <fcntl.h>
#include <sched.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
Go to the source code of this file.
|
| #define | O_LARGEFILE 0 |
| |
| #define | xcom_close(fd) close(fd) |
| |
| #define | xcom_fclose(f) fclose(f) |
| |
| #define | xcom_chdir(s) chdir(s) |
| |
| #define | xcom_dup(s) dup(s) |
| |
| #define | xcom_dup2(s, t) dup2(s, t) |
| |
| #define | xcom_lseek(fd, of, h) lseek(fd, of, h) |
| |
| #define | xcom_open(n, f, m) open(n, f, m) |
| |
| #define | xcom_fopen(n, m) fopen(n, m) |
| |
| #define | xcom_fstat(f, b) fstat(f, b) |
| |
| #define | XCOM_F_TLOCK F_TLOCK |
| |
| #define | xcom_lockf(fd, f, sz) lockf(fd, f, sz) |
| |
| #define | xcom_lrand48() lrand48() |
| |
| #define | xcom_srand48(x) srand48(x) |
| |
| #define | xcom_drand48() drand48() |
| |
| #define | xcom_write(fd, buf, l) write(fd, buf, l) |
| |
| #define | xcom_read(fd, buf, c) read(fd, buf, c) |
| |
| #define | xcom_execv execv |
| |
| #define | xcom_mktemp(s) mktemp(s) |
| |
| #define | xcom_strdup(x) strdup(x) |
| |
| #define | xcom_strtok(b, d, c) strtok_r(b, d, c) |
| |
| #define | xcom_strcasecmp(a, b) strcasecmp(a, b) |
| |
| #define | XCOM_O_CREAT O_CREAT |
| |
| #define | XCOM_O_WRONLY O_WRONLY |
| |
| #define | XCOM_O_APPEND O_APPEND |
| |
| #define | XCOM_O_LARGEFILE O_LARGEFILE |
| |
| #define | XCOM_O_EXCL O_EXCL |
| |
| #define | XCOM_O_RDWR O_RDWR |
| |
| #define | XCOM_O_RDONLY O_RDONLY |
| |
| #define | XCOM_O_RSYNC O_RSYNC |
| |
| #define | XCOM_O_BINARY 0 /** Empty define - applicable WIN32 only */ |
| |
| #define | XCOM_S_IRUSR S_IRUSR |
| |
| #define | XCOM_S_IWUSR S_IWUSR |
| |
| #define | XCOM_S_IXUSR S_IXUSR |
| |
| #define | XCOM_S_IWRXU XCOM_S_IRUSR | XCOM_S_IWUSR | XCOM_S_IXUSR |
| |
| #define | XCOM_S_IRGRP S_IRGRP |
| |
| #define | XCOM_S_IWGRP S_IWGRP |
| |
| #define | XCOM_S_IROTH S_IROTH |
| |
| #define | XCOM_S_IWOTH S_IWOTH |
| |
| #define | XCOM_FILE_WRITE_MODE "wF" |
| |
| #define | SOCKET_ERROR -1 |
| |
| #define | XCOM_CLRSYSERR errno = 0 |
| |
| #define | XCOM_ISSYSERR (errno != 0) |
| |
| #define | XCOM_SYSERRNUM ((errno) + 0) |
| |
| #define | XCOM_SYSERRSTR g_strerror(errno) |
| |
| #define | xcom_gmtime_r(time, res) gmtime_r(time, res) |
| |
| #define | xcom_localtime_r(time, res) localtime_r(time, res) |
| |
| #define | thread_yield sched_yield |
| |
| #define | NEWLINE "\n" |
| |
| #define | xcom_buf void |
| |
|
| typedef void * | xcom_sockoptptr_t |
| | Posix states that the optval argument should be (const) void*, but on Windows it is (const) char* and since we normally pass in int* a cast is required on Windows. More...
|
| |
◆ NEWLINE
◆ O_LARGEFILE
◆ SOCKET_ERROR
◆ thread_yield
| #define thread_yield sched_yield |
◆ xcom_buf
◆ xcom_chdir
| #define xcom_chdir |
( |
|
s | ) |
chdir(s) |
◆ xcom_close
| #define xcom_close |
( |
|
fd | ) |
close(fd) |
◆ XCOM_CLRSYSERR
| #define XCOM_CLRSYSERR errno = 0 |
◆ xcom_drand48
| #define xcom_drand48 |
( |
| ) |
drand48() |
◆ xcom_dup
| #define xcom_dup |
( |
|
s | ) |
dup(s) |
◆ xcom_dup2
| #define xcom_dup2 |
( |
|
s, |
|
|
|
t |
|
) |
| dup2(s, t) |
◆ xcom_execv
◆ XCOM_F_TLOCK
| #define XCOM_F_TLOCK F_TLOCK |
◆ xcom_fclose
| #define xcom_fclose |
( |
|
f | ) |
fclose(f) |
◆ XCOM_FILE_WRITE_MODE
| #define XCOM_FILE_WRITE_MODE "wF" |
◆ xcom_fopen
| #define xcom_fopen |
( |
|
n, |
|
|
|
m |
|
) |
| fopen(n, m) |
◆ xcom_fstat
| #define xcom_fstat |
( |
|
f, |
|
|
|
b |
|
) |
| fstat(f, b) |
◆ xcom_gmtime_r
| #define xcom_gmtime_r |
( |
|
time, |
|
|
|
res |
|
) |
| gmtime_r(time, res) |
◆ XCOM_ISSYSERR
| #define XCOM_ISSYSERR (errno != 0) |
◆ xcom_localtime_r
| #define xcom_localtime_r |
( |
|
time, |
|
|
|
res |
|
) |
| localtime_r(time, res) |
◆ xcom_lockf
| #define xcom_lockf |
( |
|
fd, |
|
|
|
f, |
|
|
|
sz |
|
) |
| lockf(fd, f, sz) |
◆ xcom_lrand48
| #define xcom_lrand48 |
( |
| ) |
lrand48() |
◆ xcom_lseek
| #define xcom_lseek |
( |
|
fd, |
|
|
|
of, |
|
|
|
h |
|
) |
| lseek(fd, of, h) |
◆ xcom_mktemp
| #define xcom_mktemp |
( |
|
s | ) |
mktemp(s) |
◆ XCOM_O_APPEND
| #define XCOM_O_APPEND O_APPEND |
◆ XCOM_O_BINARY
| #define XCOM_O_BINARY 0 /** Empty define - applicable WIN32 only */ |
◆ XCOM_O_CREAT
| #define XCOM_O_CREAT O_CREAT |
◆ XCOM_O_EXCL
| #define XCOM_O_EXCL O_EXCL |
◆ XCOM_O_LARGEFILE
◆ XCOM_O_RDONLY
| #define XCOM_O_RDONLY O_RDONLY |
◆ XCOM_O_RDWR
| #define XCOM_O_RDWR O_RDWR |
◆ XCOM_O_RSYNC
| #define XCOM_O_RSYNC O_RSYNC |
◆ XCOM_O_WRONLY
| #define XCOM_O_WRONLY O_WRONLY |
◆ xcom_open
| #define xcom_open |
( |
|
n, |
|
|
|
f, |
|
|
|
m |
|
) |
| open(n, f, m) |
◆ xcom_read
| #define xcom_read |
( |
|
fd, |
|
|
|
buf, |
|
|
|
c |
|
) |
| read(fd, buf, c) |
◆ XCOM_S_IRGRP
| #define XCOM_S_IRGRP S_IRGRP |
◆ XCOM_S_IROTH
| #define XCOM_S_IROTH S_IROTH |
◆ XCOM_S_IRUSR
| #define XCOM_S_IRUSR S_IRUSR |
◆ XCOM_S_IWGRP
| #define XCOM_S_IWGRP S_IWGRP |
◆ XCOM_S_IWOTH
| #define XCOM_S_IWOTH S_IWOTH |
◆ XCOM_S_IWRXU
◆ XCOM_S_IWUSR
| #define XCOM_S_IWUSR S_IWUSR |
◆ XCOM_S_IXUSR
| #define XCOM_S_IXUSR S_IXUSR |
◆ xcom_srand48
| #define xcom_srand48 |
( |
|
x | ) |
srand48(x) |
◆ xcom_strcasecmp
| #define xcom_strcasecmp |
( |
|
a, |
|
|
|
b |
|
) |
| strcasecmp(a, b) |
◆ xcom_strdup
| #define xcom_strdup |
( |
|
x | ) |
strdup(x) |
◆ xcom_strtok
| #define xcom_strtok |
( |
|
b, |
|
|
|
d, |
|
|
|
c |
|
) |
| strtok_r(b, d, c) |
◆ XCOM_SYSERRNUM
| #define XCOM_SYSERRNUM ((errno) + 0) |
◆ XCOM_SYSERRSTR
◆ xcom_write
| #define xcom_write |
( |
|
fd, |
|
|
|
buf, |
|
|
|
l |
|
) |
| write(fd, buf, l) |
◆ xcom_sockoptptr_t
Posix states that the optval argument should be (const) void*, but on Windows it is (const) char* and since we normally pass in int* a cast is required on Windows.
With this typedef we can call xsockopt functions uniformly across platorms, allbeit with an unnecessary cast to void* on *nix.