revert between 56095 -> 55830 in arch
[AROS.git] / arch / all-unix / hidd / unixio / unixio.h
blobbcaf7e8918ec1ce75da851fb10a488321f096089
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Unix filedescriptor/socket IO include file
6 */
8 #ifndef UXIO_H
9 #define UXIO_H
11 #define timeval sys_timeval
13 #include <sys/types.h>
14 #include <sys/socket.h>
15 #include <poll.h>
17 #undef timeval
19 #include <exec/tasks.h>
20 #include <exec/ports.h>
21 #include <dos/bptr.h>
22 #include <hidd/unixio.h>
23 #include <oop/oop.h>
24 #include <proto/exec.h>
26 /* Android is not a real Linux :-) */
27 #ifdef HOST_OS_android
28 #define __off_t off_t
29 #undef HOST_OS_linux
30 #endif
32 #ifdef HOST_OS_linux
33 #define LIBC_NAME "libc.so.6"
34 #endif
36 #ifdef HOST_OS_darwin
37 #define __off_t off_t
38 #define LIBC_NAME "libSystem.dylib"
39 #endif
41 #ifndef LIBC_NAME
42 #define LIBC_NAME "libc.so"
43 #endif
45 struct UnixIO_Waiter
47 struct Task *task;
48 BYTE signal;
51 struct LibCInterface
53 int (*open)(const char *path, int oflag, ...);
54 int (*close)(int filedes);
55 int (*ioctl)(int d, int request, ...);
56 int (*fcntl)(int fd, int cmd, ...);
57 int (*poll)(struct pollfd *fds, nfds_t nfds, int timeout);
58 ssize_t (*read)(int fd, void *buf, size_t count);
59 ssize_t (*write)(int fildes, const void *buf, size_t nbyte);
60 pid_t (*getpid)(void);
61 int *(*__error)(void);
62 void *(*mmap)(void *addr, size_t len, int prot, int flags, int fd, __off_t offset);
63 int (*munmap)(void *addr, size_t len);
64 int (*socket)(int domain, int type, int protocol);
65 ssize_t (*sendto)(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen);
66 ssize_t (*recvfrom)(int sockfd, void *buf, size_t len, int flags,struct sockaddr *src_addr, socklen_t *addrlen);
67 int (*bind)(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
70 /* For simplicity, our library base is our static data */
71 struct unixio_base
73 struct UnixIOBase uio_Public; /* Public portion */
74 OOP_AttrBase UnixIOAB; /* Our attribute base */
75 OOP_Class *uio_unixioclass; /* Our class */
76 OOP_Object *obj; /* Our singleton */
77 APTR irqHandle; /* SIGIO IRQ handle */
78 APTR KernelBase; /* Resource bases */
79 APTR HostLibBase;
80 STRPTR SystemArch; /* System architecture string (cached) */
81 struct LibCInterface *SysIFace; /* Our libc interface */
82 pid_t aros_PID; /* PID of AROS process (for F_SETOWN fcntl) */
83 struct MinList intList; /* User's interrupts list */
84 struct SignalSemaphore lock; /* Singleton creation lock */
87 #define UD(cl) ((struct unixio_base *)cl->UserData)
89 #endif /* UXIO */