summaryrefslogtreecommitdiff
path: root/os/windows/posix/include/sys
diff options
context:
space:
mode:
authorBruce Cran <bruce@cran.org.uk>2012-02-20 20:18:19 +0100
committerJens Axboe <axboe@kernel.dk>2012-02-20 20:18:19 +0100
commit93bcfd20e37cef8cec350fe06d3a086724c9f257 (patch)
treefee8b2da5b190b0d4fd940f7cef5e58cd7faa113 /os/windows/posix/include/sys
parent16de1bf91ca80e62ce257a24cae471fab140bbe0 (diff)
downloadfio-93bcfd20e37cef8cec350fe06d3a086724c9f257.tar.gz
fio-93bcfd20e37cef8cec350fe06d3a086724c9f257.tar.bz2
Move Windows port to MinGW
- Add calls to WSAStartup in the network code as required by Winsock. - Add Windows-specific init_random_state function which uses the Crypto API. - Move Windows port to MinGW and update build system to create a 64-bit binary by default. - Install text files as .rtf so they won't open in Notepad by default (Wordpad understands Unix line endings; Notepad doesn't). - Simplify WiX installer code. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'os/windows/posix/include/sys')
-rw-r--r--os/windows/posix/include/sys/ipc.h4
-rw-r--r--os/windows/posix/include/sys/mman.h36
-rw-r--r--os/windows/posix/include/sys/poll.h15
-rw-r--r--os/windows/posix/include/sys/resource.h18
-rw-r--r--os/windows/posix/include/sys/shm.h41
-rw-r--r--os/windows/posix/include/sys/socket.h4
-rw-r--r--os/windows/posix/include/sys/uio.h16
-rw-r--r--os/windows/posix/include/sys/un.h14
-rw-r--r--os/windows/posix/include/sys/wait.h12
9 files changed, 160 insertions, 0 deletions
diff --git a/os/windows/posix/include/sys/ipc.h b/os/windows/posix/include/sys/ipc.h
new file mode 100644
index 00000000..2601a539
--- /dev/null
+++ b/os/windows/posix/include/sys/ipc.h
@@ -0,0 +1,4 @@
+#ifndef SYS_IPC_H
+#define SYS_IPC_H
+
+#endif /* SYS_IPC_H */
diff --git a/os/windows/posix/include/sys/mman.h b/os/windows/posix/include/sys/mman.h
new file mode 100644
index 00000000..36480a43
--- /dev/null
+++ b/os/windows/posix/include/sys/mman.h
@@ -0,0 +1,36 @@
+#ifndef SYS_MMAN_H
+#define SYS_MMAN_H
+
+#include <sys/types.h>
+
+#define PROT_NONE 1
+#define PROT_READ 2
+#define PROT_WRITE 4
+
+#define MAP_ANON 0x1
+#define MAP_ANONYMOUS MAP_ANON
+#define MAP_FIXED 0x2
+#define MAP_HASSEMAPHORE 0x4
+#define MAP_INHERIT 0x8
+#define MAP_NOCORE 0x10
+#define MAP_NOSYNC 0x20
+#define MAP_PREFAULT_READ 0x40
+#define MAP_PRIVATE 0x80
+#define MAP_SHARED 0x100
+#define MAP_STACK 0x200
+
+#define MAP_FAILED NULL
+
+#define MS_ASYNC 0x1
+#define MS_SYNC 0x2
+#define MS_INVALIDATE 0x3
+
+int posix_madvise(void *addr, size_t len, int advice);
+void *mmap(void *addr, size_t len, int prot, int flags,
+ int fildes, off_t off);
+int munmap(void *addr, size_t len);
+int msync(void *addr, size_t len, int flags);
+int munlock(const void * addr, size_t len);
+int mlock(const void *addr, size_t len);
+
+#endif /* SYS_MMAN_H */
diff --git a/os/windows/posix/include/sys/poll.h b/os/windows/posix/include/sys/poll.h
new file mode 100644
index 00000000..e1626b25
--- /dev/null
+++ b/os/windows/posix/include/sys/poll.h
@@ -0,0 +1,15 @@
+#ifndef SYS_POLL_H
+#define SYS_POLL_H
+
+typedef int nfds_t;
+
+struct pollfd
+{
+ int fd;
+ short events;
+ short revents;
+};
+
+int poll(struct pollfd fds[], nfds_t nfds, int timeout);
+
+#endif /* SYS_POLL_H */
diff --git a/os/windows/posix/include/sys/resource.h b/os/windows/posix/include/sys/resource.h
new file mode 100644
index 00000000..837d6577
--- /dev/null
+++ b/os/windows/posix/include/sys/resource.h
@@ -0,0 +1,18 @@
+#ifndef SYS_RESOURCE_H
+#define SYS_RESOURCE_H
+
+#define RUSAGE_SELF 0
+
+struct rusage
+{
+ struct timeval ru_utime;
+ struct timeval ru_stime;
+ int ru_nvcsw;
+ int ru_minflt;
+ int ru_majflt;
+ int ru_nivcsw;
+};
+
+int getrusage(int who, struct rusage *r_usage);
+
+#endif /* SYS_RESOURCE_H */
diff --git a/os/windows/posix/include/sys/shm.h b/os/windows/posix/include/sys/shm.h
new file mode 100644
index 00000000..6f6b0328
--- /dev/null
+++ b/os/windows/posix/include/sys/shm.h
@@ -0,0 +1,41 @@
+#ifndef SYS_SHM_H
+#define SYS_SHM_H
+
+#define IPC_RMID 0x1
+#define IPC_CREAT 0x2
+#define IPC_PRIVATE 0x4
+
+typedef int uid_t;
+typedef int gid_t;
+
+typedef int shmatt_t;
+typedef int key_t;
+
+struct ipc_perm
+{
+ uid_t uid; //owner's user ID
+ gid_t gid; //owner's group ID
+ uid_t cuid; //creator's user ID
+ gid_t cgid; //creator's group ID
+ mode_t mode; //read/write permission
+};
+
+
+struct shmid_ds
+{
+ struct ipc_perm shm_perm; //operation permission structure
+ size_t shm_segsz; //size of segment in bytes
+ pid_t shm_lpid; //process ID of last shared memory operation
+ pid_t shm_cpid; //process ID of creator
+ shmatt_t shm_nattch; //number of current attaches
+ time_t shm_atime; //time of last shmat()
+ time_t shm_dtime; //time of last shmdt()
+ time_t shm_ctime; //time of last change by shmctl()
+};
+
+int shmctl(int shmid, int cmd, struct shmid_ds *buf);
+int shmget(key_t key, size_t size, int shmflg);
+void *shmat(int shmid, const void *shmaddr, int shmflg);
+int shmdt(const void *shmaddr);
+
+#endif /* SYS_SHM_H */
diff --git a/os/windows/posix/include/sys/socket.h b/os/windows/posix/include/sys/socket.h
new file mode 100644
index 00000000..eef3b45b
--- /dev/null
+++ b/os/windows/posix/include/sys/socket.h
@@ -0,0 +1,4 @@
+#ifndef SYS_SOCKET_H
+#define SYS_SOCKET_H
+
+#endif /* SYS_SOCKET_H */
diff --git a/os/windows/posix/include/sys/uio.h b/os/windows/posix/include/sys/uio.h
new file mode 100644
index 00000000..10229869
--- /dev/null
+++ b/os/windows/posix/include/sys/uio.h
@@ -0,0 +1,16 @@
+#ifndef SYS_UIO_H
+#define SYS_UIO_H
+
+#include <inttypes.h>
+#include <unistd.h>
+
+ struct iovec
+ {
+ void *iov_base; //Base address of a memory region for input or output.
+ size_t iov_len; //The size of the memory pointed to by iov_base.
+};
+
+ ssize_t readv(int fildes, const struct iovec *iov, int iovcnt);
+ ssize_t writev(int fildes, const struct iovec *iov, int iovcnt);
+
+#endif /* SYS_UIO_H */
diff --git a/os/windows/posix/include/sys/un.h b/os/windows/posix/include/sys/un.h
new file mode 100644
index 00000000..0053f328
--- /dev/null
+++ b/os/windows/posix/include/sys/un.h
@@ -0,0 +1,14 @@
+#ifndef SYS_UN_H
+#define SYS_UN_H
+
+typedef int sa_family_t;
+typedef int in_port_t;
+
+ struct sockaddr_un
+ {
+ sa_family_t sun_family; // Address family.
+ char sun_path[]; // Socket pathname.
+};
+
+
+#endif /* SYS_UN_H */
diff --git a/os/windows/posix/include/sys/wait.h b/os/windows/posix/include/sys/wait.h
new file mode 100644
index 00000000..954bd2bf
--- /dev/null
+++ b/os/windows/posix/include/sys/wait.h
@@ -0,0 +1,12 @@
+#ifndef SYS_WAIT_H
+#define SYS_WAIT_H
+
+#define WIFSIGNALED(a) 0
+#define WIFEXITED(a) 0
+#define WTERMSIG(a) 0
+#define WEXITSTATUS(a) 0
+#define WNOHANG 0
+
+pid_t waitpid(pid_t, int *stat_loc, int options);
+
+#endif /* SYS_WAIT_H */