Put X11 and EGL into the kernel leaving ES 2.0 only in driver
[cilux] / src / platform / linux / kernelplat.h
1
2 /* -------------------------------------------------------------------------- */
3
4 #include <ctype.h>
5 #include <unistd.h>
6 #include <pwd.h>
7 #include <grp.h>
8 #include <netinet/tcp.h>
9 #include <arpa/inet.h>
10 #include <X11/Xutil.h>
11 #include <EGL/egl.h>
12
13 #include <platform.h>
14
15 /* -------------------------------------------------------------------------- */
16
17 #define LOAD_MODULES_EARLY    1
18 #define LOAD_GL               0
19 #define MODULE                void*
20 #define MODPRE                "mod-"
21 #define MODPOST               ".so"
22 #define DLOPEN(n)             dlopen(n, RTLD_GLOBAL|RTLD_NOW)
23 #define DLSYM                 dlsym
24 #define DLERROR               dlerror()
25 #define LOOP_TICK             10
26 #define LINGER_LOOPS          500
27
28 #define EMPTY_IN_ADDR         { 0 }
29 #define SOCK                  fd
30 #define SOCK_T                int
31 #define SOCKET(a,t,p,s)       s=socket(a,t,p)
32 #define ACCEPT(as,a,l,s)      s=accept(as,a,l)
33 #define BIND                  bind
34 #define LISTEN                listen
35 #define CONNECT               connect
36 #define SOCKET_READ( s,b,l)   recv(s,b,l,MSG_NOSIGNAL)
37 #define SOCKET_WRITE(s,b,l)   send(s,b,l,MSG_NOSIGNAL)
38 #define SOCKET_CLOSE          close
39 #define SET_NON_BLOCKING(s)   int f=fcntl(s, F_GETFL); if(f!=-1) fcntl(s, F_SETFL, f|O_NONBLOCK)
40 #define SET_NO_DELAY(s)       int arg=1; r=setsockopt(s, SOL_TCP,    TCP_NODELAY,  (char*)&arg, sizeof(arg))
41 #define SET_REUSEADDR(s)      int arg=1; r=setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char*)&arg, sizeof(arg))
42 #define GETERRNO(n)
43 #define ERRNO                 errno
44 #define INTERRUPTED           EINTR
45 #define NOTACTIVE             EWOULDBLOCK
46 #define ISCONNECTING(e)       (e==EINPROGRESS || e==EALREADY)
47 #define ISNOTACTIVE(e)        (e==EAGAIN || e==EWOULDBLOCK)
48
49 #define FILEP                 FILE*
50 #define FILE_T                int
51 #define FOPEN                 fopen
52 #define READFILE              read
53 #define WRITEFILE             write
54 #define MKDIR(n)              mkdir(n, 0777)
55 #define FPRINTF               fprintf
56 #define FFLUSH(f)             fflush(f)
57 #define FCLOSE(f)             close(f)
58 #define PRINTFOUT(f)          printf(f)
59 #define PRINTFERR(f)          fprintf(stderr,f)
60 #define VPRINTFOUT(f,ap)      vprintf(f,ap)
61 #define VPRINTFERR(f,ap)      vfprintf(stderr,f,ap)
62 #define FERRNO(n)             errno
63 #define EXIT(n)               exit(n)
64 #define LOG_TO_STD            0
65
66 #define TIMEZONE(tm)          tm->tm_gmtoff
67 #define SLEEP_MS(x)           do{struct timeval t;t.tv_sec=0;t.tv_usec=(x)*1000;select(0,0,0,0,&t);}while(0)
68 #define MKTIME                mktime
69
70 #define C_RUN_RV   int
71 #define C_RUN_ARG  void*
72
73 /* -------------------------------------------------------------------------- */
74