diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,29 @@
+Copyright (c) <2009>, <Maurício C. Antunes>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the author nor the names of contributors
+    may be used to endorse or promote products derived from this
+    software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,6 @@
+#!/usr/bin/env runhaskell
+
+module Main (main) where
+import Distribution.Simple
+
+main = defaultMain
diff --git a/bindings-posix.cabal b/bindings-posix.cabal
new file mode 100644
--- /dev/null
+++ b/bindings-posix.cabal
@@ -0,0 +1,57 @@
+cabal-version: >= 1.8
+name: bindings-posix
+synopsis:
+  Project bindings-* raw interface to Posix
+description:
+  Low level bindings to Posix standard library, part
+  of the @bindings-*@ project. See:
+  .
+  <https://github.com/jwiegley/bindings-dsl>
+  .
+  <http://pubs.opengroup.org/onlinepubs/9699919799/idx/headers.html>
+version: 1.2.7
+license: BSD3
+license-file: LICENSE
+maintainer: John Wiegley <johnw@newartisans.com>
+author: Maurício C. Antunes
+bug-reports: https://github.com/jwiegley/bindings-dsl/issues
+build-type: Simple
+category: FFI
+library
+  hs-source-dirs: src
+  extensions:
+    ForeignFunctionInterface
+  build-depends:
+    base >= 3 && < 5,
+    bindings-DSL >= 1.0.16 && < 1.1
+  exposed-modules:
+    Bindings.Posix
+    Bindings.Posix.Errno
+    Bindings.Posix.Fcntl
+    Bindings.Posix.Locale
+    Bindings.Posix.Regex
+    Bindings.Posix.Signal
+    Bindings.Posix.Sys
+    Bindings.Posix.Sys.Mman
+    Bindings.Posix.Sys.Select
+    Bindings.Posix.Sys.Types
+    Bindings.Posix.Sys.Utsname
+    Bindings.Posix.Time
+    Bindings.Posix.Unistd
+  c-sources:
+    src/Bindings/Posix/Sys/Select.c
+    src/Bindings/Posix/Time.c
+  cc-options:
+    "-D_ISOC99_SOURCE"
+    "-D_POSIX_C_SOURCE=200809L"
+    "-D_XOPEN_SOURCE=600"
+  extra-libraries: pthread
+  if !os(osx)
+    exposed-modules:
+      Bindings.Posix.Mqueue
+    extra-libraries: rt
+source-repository head
+  type: git
+  location: git://github.com/jwiegley/bindings-dsl
+  branch: master
+  subdir: bindings-posix
diff --git a/src/Bindings/Posix.hs b/src/Bindings/Posix.hs
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix.hs
@@ -0,0 +1,18 @@
+module Bindings.Posix (
+  module Bindings.Posix.Errno,
+  module Bindings.Posix.Fcntl,
+  module Bindings.Posix.Locale,
+  module Bindings.Posix.Regex,
+  module Bindings.Posix.Signal,
+  module Bindings.Posix.Sys,
+  module Bindings.Posix.Time,
+  module Bindings.Posix.Unistd)
+ where
+import Bindings.Posix.Errno
+import Bindings.Posix.Fcntl
+import Bindings.Posix.Locale
+import Bindings.Posix.Regex
+import Bindings.Posix.Signal
+import Bindings.Posix.Sys
+import Bindings.Posix.Time
+import Bindings.Posix.Unistd
diff --git a/src/Bindings/Posix/Errno.hsc b/src/Bindings/Posix/Errno.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix/Errno.hsc
@@ -0,0 +1,85 @@
+#include <bindings.dsl.h>
+#include <errno.h>
+
+-- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html>
+
+module Bindings.Posix.Errno where
+#strict_import
+
+#num E2BIG
+#num EACCES
+#num EADDRINUSE
+#num EADDRNOTAVAIL
+#num EAFNOSUPPORT
+#num EAGAIN
+#num EALREADY
+#num EBADF
+#num EBADMSG
+#num EBUSY
+#num ECANCELED
+#num ECHILD
+#num ECONNABORTED
+#num ECONNREFUSED
+#num ECONNRESET
+#num EDEADLK
+#num EDESTADDRREQ
+#num EDOM
+#num EDQUOT
+#num EEXIST
+#num EFAULT
+#num EFBIG
+#num EHOSTUNREACH
+#num EIDRM
+#num EILSEQ
+#num EINPROGRESS
+#num EINTR
+#num EINVAL
+#num EIO
+#num EISCONN
+#num EISDIR
+#num ELOOP
+#num EMFILE
+#num EMLINK
+#num EMSGSIZE
+#num EMULTIHOP
+#num ENAMETOOLONG
+#num ENETDOWN
+#num ENETRESET
+#num ENETUNREACH
+#num ENFILE
+#num ENOBUFS
+#num ENODEV
+#num ENOENT
+#num ENOEXEC
+#num ENOLCK
+#num ENOLINK
+#num ENOMEM
+#num ENOMSG
+#num ENOPROTOOPT
+#num ENOSPC
+#num ENOSYS
+#num ENOTCONN
+#num ENOTDIR
+#num ENOTEMPTY
+#num ENOTRECOVERABLE
+#num ENOTSOCK
+#num ENOTSUP
+#num ENOTTY
+#num ENXIO
+#num EOPNOTSUPP
+#num EOVERFLOW
+#num EOWNERDEAD
+#num EPERM
+#num EPIPE
+#num EPROTO
+#num EPROTONOSUPPORT
+#num EPROTOTYPE
+#num ERANGE
+#num EROFS
+#num ESPIPE
+#num ESRCH
+#num ESTALE
+#num ETIMEDOUT
+#num ETXTBSY
+#num EWOULDBLOCK
+#num EXDEV
diff --git a/src/Bindings/Posix/Fcntl.hsc b/src/Bindings/Posix/Fcntl.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix/Fcntl.hsc
@@ -0,0 +1,44 @@
+#include <bindings.dsl.h>
+#include <fcntl.h>
+
+-- | <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html>
+
+module Bindings.Posix.Fcntl where
+#strict_import
+import Bindings.Posix.Sys.Types
+
+#num F_DUPFD
+#num F_GETFD
+#num F_SETFD
+#num F_GETFL
+#num F_SETFL
+#num F_GETLK
+#num F_SETLK
+#num F_SETLKW
+#num F_GETOWN
+#num F_SETOWN
+#num FD_CLOEXEC
+#num F_RDLCK
+#num F_UNLCK
+#num F_WRLCK
+#num O_CREAT
+#num O_EXCL
+#num O_NOCTTY
+#num O_TRUNC
+#num O_APPEND
+#num O_NONBLOCK
+#num O_SYNC
+#num O_ACCMODE
+#num O_RDONLY
+#num O_RDWR
+#num O_WRONLY
+
+#starttype struct flock
+#field l_type , CShort
+#field l_whence , CShort
+#field l_start , <off_t>
+#field l_len , <off_t>
+#field l_pid , <pid_t>
+#stoptype
+
+#ccall creat , CString -> <mode_t> -> IO CInt
diff --git a/src/Bindings/Posix/Locale.hsc b/src/Bindings/Posix/Locale.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix/Locale.hsc
@@ -0,0 +1,24 @@
+#include <bindings.dsl.h>
+#include <locale.h>
+
+-- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html>
+
+module Bindings.Posix.Locale where
+#strict_import
+
+#num LC_MESSAGES
+-- #num LC_COLLATE_MASK
+-- #num LC_CTYPE_MASK
+-- #num LC_MESSAGES_MASK
+-- #num LC_MONETARY_MASK
+-- #num LC_NUMERIC_MASK
+-- #num LC_TIME_MASK
+-- #num LC_ALL_MASK
+
+-- #integral_t locale_t
+
+-- #ccall duplocale , <locale_t> -> IO <locale_t>
+-- #ccall freelocale , <locale_t> -> IO ()
+-- #ccall newlocale , CInt -> CString -> <locale_t> -> IO <locale_t>
+-- #ccall uselocale , <locale_t> -> IO <locale_t>
+
diff --git a/src/Bindings/Posix/Mqueue.hsc b/src/Bindings/Posix/Mqueue.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix/Mqueue.hsc
@@ -0,0 +1,30 @@
+#include <bindings.dsl.h>
+#include <mqueue.h>
+
+-- | <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/mqueue.h.html>
+
+module Bindings.Posix.Mqueue where
+#strict_import
+import Bindings.Posix.Signal
+import Bindings.Posix.Sys.Types
+import Bindings.Posix.Time
+
+#integral_t mqd_t
+
+#starttype struct mq_attr
+#field mq_flags, CLong
+#field mq_maxmsg, CLong
+#field mq_msgsize, CLong
+#field mq_curmsgs, CLong
+#stoptype
+
+#ccall mq_close, <mqd_t> -> IO CInt
+#ccall mq_getattr, <mqd_t> -> Ptr <mq_attr> -> IO CInt
+#ccall mq_notify, <mqd_t> -> Ptr <sigevent> -> IO CInt
+#ccall mq_open, Ptr CChar -> CInt -> <mode_t> -> Ptr <mq_attr> -> IO <mqd_t>
+#ccall mq_receive, <mqd_t> -> Ptr CChar -> <size_t> -> Ptr CUInt -> IO <ssize_t>
+#ccall mq_send, <mqd_t> -> Ptr <mq_attr> -> <size_t> -> CUInt -> IO CInt
+#ccall mq_setattr, <mqd_t> -> Ptr <mq_attr> -> Ptr <mq_attr> -> IO CInt
+#ccall mq_timedreceive, <mqd_t> -> Ptr CChar -> <size_t> -> Ptr CUInt -> Ptr <timespec> -> IO <ssize_t>
+#ccall mq_timedsend, <mqd_t> -> Ptr CChar -> <size_t> -> CUInt -> Ptr <timespec> -> IO CInt
+#ccall mq_unlink, Ptr CChar -> IO CInt
diff --git a/src/Bindings/Posix/Regex.hsc b/src/Bindings/Posix/Regex.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix/Regex.hsc
@@ -0,0 +1,46 @@
+#include <bindings.dsl.h>
+#include <regex.h>
+
+-- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/regex.h.html>
+
+module Bindings.Posix.Regex where
+#strict_import
+import Bindings.Posix.Sys.Types
+
+#starttype regex_t
+#field re_nsub , CSize
+#stoptype
+
+#integral_t regoff_t
+
+#starttype regmatch_t
+#field rm_so , <regoff_t>
+#field rm_eo , <regoff_t>
+#stoptype
+
+#num REG_EXTENDED
+#num REG_ICASE
+#num REG_NOSUB
+#num REG_NEWLINE
+
+#num REG_NOTBOL
+#num REG_NOTEOL
+
+#num REG_NOMATCH
+#num REG_BADPAT
+#num REG_ECOLLATE
+#num REG_ECTYPE
+#num REG_EESCAPE
+#num REG_ESUBREG
+#num REG_EBRACK
+#num REG_EPAREN
+#num REG_EBRACE
+#num REG_BADBR
+#num REG_ERANGE
+#num REG_ESPACE
+#num REG_BADRPT
+
+#ccall regcomp , Ptr <regex_t> -> CString -> CInt -> IO CInt
+#ccall regerror , CInt -> Ptr <regex_t> -> CString -> CSize -> IO CSize
+#ccall regexec , Ptr <regex_t> -> CString -> CSize -> Ptr <regmatch_t> -> CInt -> IO CInt
+#ccall regfree , Ptr <regex_t> -> IO ()
diff --git a/src/Bindings/Posix/Signal.hsc b/src/Bindings/Posix/Signal.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix/Signal.hsc
@@ -0,0 +1,156 @@
+#include <bindings.dsl.h>
+#include <signal.h>
+
+-- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html>
+
+module Bindings.Posix.Signal where
+#strict_import
+import Bindings.Posix.Sys.Types
+
+#starttype sigset_t
+#stoptype
+
+#starttype struct sigevent
+#field sigev_notify , CInt
+#field sigev_signo , CInt
+#field sigev_value , <sigval>
+#field sigev_notify_function , FunPtr (<sigval> -> IO ())
+#field sigev_notify_attributes , Ptr <pthread_attr_t>
+#stoptype
+
+#num SIGEV_NONE
+#num SIGEV_SIGNAL
+#num SIGEV_THREAD
+
+#starttype union sigval
+#field sival_int , CInt
+#field sival_ptr , Ptr ()
+#stoptype
+
+#ifndef __MACH__
+#num SIGRTMIN
+#num SIGRTMAX
+#endif
+
+#num SIGABRT
+#num SIGALRM
+#num SIGBUS
+#num SIGCHLD
+#num SIGCONT
+#num SIGFPE
+#num SIGHUP
+#num SIGILL
+#num SIGINT
+#num SIGKILL
+#num SIGPIPE
+#num SIGQUIT
+#num SIGSEGV
+#num SIGSTOP
+#num SIGTERM
+#num SIGTSTP
+#num SIGTTIN
+#num SIGTTOU
+#num SIGUSR1
+#num SIGUSR2
+#num SIGURG
+
+#starttype struct sigaction
+#field sa_handler , FunPtr (CInt -> IO ())
+#field sa_mask , <sigset_t>
+#field sa_flags , CInt
+#field sa_sigaction , FunPtr (CInt -> Ptr <siginfo_t> -> Ptr () -> IO ())
+#stoptype
+
+#num SIG_BLOCK
+#num SIG_UNBLOCK
+#num SIG_SETMASK
+#num SA_NOCLDSTOP
+#num SA_RESETHAND
+#num SA_RESTART
+#num SA_SIGINFO
+#num SA_NOCLDWAIT
+#num SA_NODEFER
+
+#starttype mcontext_t
+#stoptype
+
+#starttype ucontext_t
+#field uc_link , Ptr <ucontext_t>
+#field uc_sigmask , <sigset_t>
+#field uc_stack , <stack_t>
+#field uc_mcontext , <mcontext_t>
+#stoptype
+
+#starttype stack_t
+#field ss_sp , Ptr ()
+#field ss_size , CSize
+#field ss_flags , CInt
+#stoptype
+
+#starttype siginfo_t
+#field si_signo , CInt
+#field si_code , CInt
+#field si_pid , <pid_t>
+#field si_uid , <uid_t>
+#field si_addr , Ptr ()
+#field si_status , CInt
+#field si_value , <sigval>
+#stoptype
+
+#num ILL_ILLOPC
+#num ILL_ILLOPN
+#num ILL_ILLADR
+#num ILL_ILLTRP
+#num ILL_PRVOPC
+#num ILL_PRVREG
+#num ILL_COPROC
+#num ILL_BADSTK
+#num FPE_INTDIV
+#num FPE_INTOVF
+#num FPE_FLTDIV
+#num FPE_FLTOVF
+#num FPE_FLTUND
+#num FPE_FLTRES
+#num FPE_FLTINV
+#num FPE_FLTSUB
+#num SEGV_MAPERR
+#num SEGV_ACCERR
+#num BUS_ADRALN
+#num BUS_ADRERR
+#num BUS_OBJERR
+#num CLD_EXITED
+#num CLD_KILLED
+#num CLD_DUMPED
+#num CLD_TRAPPED
+#num CLD_STOPPED
+#num CLD_CONTINUED
+#num SI_USER
+#num SI_QUEUE
+#num SI_TIMER
+#num SI_ASYNCIO
+#num SI_MESGQ
+
+#ccall kill , <pid_t> -> CInt -> IO CInt
+-- ccall psiginfo ,  Ptr <siginfo_t> -> CString -> IO ()
+#ccall psignal , CInt -> CString -> IO ()
+#ccall pthread_kill , <pthread_t> -> CInt -> IO CInt
+#ccall pthread_sigmask , CInt ->  Ptr <sigset_t> -> \
+  Ptr <sigset_t> -> IO CInt
+#ccall sigaction , CInt ->  Ptr <sigaction> -> \
+  Ptr <sigaction> -> IO CInt
+#ccall sigaddset , Ptr <sigset_t> -> CInt -> IO CInt
+#ccall sigdelset , Ptr <sigset_t> -> CInt -> IO CInt
+#ccall sigemptyset , Ptr <sigset_t> -> IO CInt
+#ccall sigfillset , Ptr <sigset_t> -> IO CInt
+#ccall sigismember ,  Ptr <sigset_t> -> CInt -> IO CInt
+#ccall sigpending , Ptr <sigset_t> -> IO CInt
+#ccall sigprocmask , CInt ->  Ptr <sigset_t> -> \
+  Ptr <sigset_t> -> IO CInt
+-- ccall sigqueue , <pid_t> -> CInt ->  <sigval> -> IO CInt
+#ccall sigsuspend ,  Ptr <sigset_t> -> IO CInt
+-- ccall sigtimedwait ,  Ptr <sigset_t> -> \
+--   Ptr <siginfo_t> ->  Ptr <timespec> -> IO CInt
+#ccall sigwait ,  Ptr <sigset_t> -> Ptr CInt -> IO CInt
+#ccall sigwaitinfo ,  Ptr <sigset_t> -> Ptr <siginfo_t> -> \
+  IO CInt
+
diff --git a/src/Bindings/Posix/Sys.hs b/src/Bindings/Posix/Sys.hs
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix/Sys.hs
@@ -0,0 +1,11 @@
+module Bindings.Posix.Sys (
+  module Bindings.Posix.Sys.Mman,
+  module Bindings.Posix.Sys.Select,
+  module Bindings.Posix.Sys.Types,
+  module Bindings.Posix.Sys.Utsname
+ ) where
+import Bindings.Posix.Sys.Mman
+import Bindings.Posix.Sys.Select
+import Bindings.Posix.Sys.Types
+import Bindings.Posix.Sys.Utsname
+
diff --git a/src/Bindings/Posix/Sys/Mman.hsc b/src/Bindings/Posix/Sys/Mman.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix/Sys/Mman.hsc
@@ -0,0 +1,23 @@
+#include <bindings.dsl.h>
+#include <sys/mman.h>
+
+-- | <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_mman.h.html>
+
+module Bindings.Posix.Sys.Mman where
+#strict_import
+import Bindings.Posix.Sys.Types
+
+#num PROT_EXEC
+#num PROT_NONE
+#num PROT_READ
+#num PROT_WRITE
+#num MAP_FIXED
+#num MAP_PRIVATE
+#num MAP_SHARED
+
+#pointer MAP_FAILED
+
+#ccall mmap , Ptr () -> CSize -> CInt -> CInt-> CInt-> <off_t> -> IO (Ptr ())
+#ccall mprotect , Ptr () -> CSize -> IO CInt
+#ccall munmap , Ptr () -> CSize -> IO CInt
+
diff --git a/src/Bindings/Posix/Sys/Select.c b/src/Bindings/Posix/Sys/Select.c
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix/Sys/Select.c
@@ -0,0 +1,7 @@
+#include<bindings.cmacros.h>
+#include<sys/select.h>
+
+BC_INLINE2VOID(FD_CLR,int,fd_set*)
+BC_INLINE2(FD_ISSET,int,fd_set*,int)
+BC_INLINE2VOID(FD_SET,int,fd_set*)
+BC_INLINE1VOID(FD_ZERO,fd_set*)
diff --git a/src/Bindings/Posix/Sys/Select.hsc b/src/Bindings/Posix/Sys/Select.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix/Sys/Select.hsc
@@ -0,0 +1,31 @@
+#include <bindings.dsl.h>
+#include <sys/select.h>
+
+-- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_select.h.html>
+
+module Bindings.Posix.Sys.Select where
+#strict_import
+import Bindings.Posix.Sys.Types
+import Bindings.Posix.Time
+import Bindings.Posix.Signal
+
+#starttype struct timeval
+#field tv_sec , CTime
+#field tv_usec , <suseconds_t>
+#stoptype
+
+#starttype fd_set
+#stoptype
+
+#num FD_SETSIZE
+
+#cinline FD_CLR , CInt -> Ptr <fd_set> -> IO ()
+#cinline FD_ISSET , CInt -> Ptr <fd_set> -> IO CInt
+#cinline FD_SET , CInt -> Ptr <fd_set> -> IO ()
+#cinline FD_ZERO , Ptr <fd_set> -> IO ()
+
+#ccall pselect , CInt -> Ptr <fd_set> -> Ptr <fd_set> -> \
+  Ptr <fd_set> -> Ptr <timespec> -> Ptr <sigset_t> -> IO CInt
+#ccall select , CInt -> Ptr <fd_set> -> Ptr <fd_set> -> \
+  Ptr <fd_set> -> Ptr <timeval> -> IO CInt
+
diff --git a/src/Bindings/Posix/Sys/Types.hsc b/src/Bindings/Posix/Sys/Types.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix/Sys/Types.hsc
@@ -0,0 +1,73 @@
+#include <bindings.dsl.h>
+#include <sys/types.h>
+
+-- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html>
+
+module Bindings.Posix.Sys.Types where
+#strict_import
+
+#integral_t blkcnt_t
+#integral_t blksize_t
+#ifndef __MACH__
+#integral_t clockid_t
+#endif
+#integral_t dev_t
+#integral_t gid_t
+#integral_t id_t
+#integral_t ino_t
+#integral_t mode_t
+#integral_t nlink_t
+#integral_t off_t
+#integral_t pid_t
+
+#starttype pthread_attr_t
+#stoptype
+
+#ifndef __MACH__
+#starttype pthread_barrier_t
+#stoptype
+
+#starttype pthread_barrierattr_t
+#stoptype
+#endif
+
+#starttype pthread_cond_t
+#stoptype
+
+#starttype pthread_condattr_t
+#stoptype
+
+#starttype pthread_key_t
+#stoptype
+
+#starttype pthread_mutex_t
+#stoptype
+
+#starttype pthread_mutexattr_t
+#stoptype
+
+#starttype pthread_once_t
+#stoptype
+
+#starttype pthread_rwlock_t
+#stoptype
+
+#starttype pthread_rwlockattr_t
+#stoptype
+
+#ifndef __MACH__
+#starttype pthread_spinlock_t
+#stoptype
+#endif
+
+#integral_t pthread_t
+
+#integral_t size_t
+#integral_t ssize_t
+#integral_t suseconds_t
+#integral_t time_t
+#ifndef __MACH__
+#integral_t timer_t
+#endif
+#integral_t uid_t
+
diff --git a/src/Bindings/Posix/Sys/Utsname.hsc b/src/Bindings/Posix/Sys/Utsname.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix/Sys/Utsname.hsc
@@ -0,0 +1,17 @@
+#include <bindings.dsl.h>
+#include <sys/utsname.h>
+
+-- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_utsname.h.html>
+
+module Bindings.Posix.Sys.Utsname where
+#strict_import
+
+#starttype struct utsname
+#array_field sysname , CChar
+#array_field nodename , CChar
+#array_field release , CChar
+#array_field version , CChar
+#array_field machine , CChar
+#stoptype
+
+#ccall uname , Ptr <utsname> -> IO CInt
diff --git a/src/Bindings/Posix/Time.c b/src/Bindings/Posix/Time.c
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix/Time.c
@@ -0,0 +1,5 @@
+#include<bindings.cmacros.h>
+#include<time.h>
+
+BC_INLINE_(getdate_err,int)
+BC_GLOBALARRAY(tzname,char*)
diff --git a/src/Bindings/Posix/Time.hsc b/src/Bindings/Posix/Time.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix/Time.hsc
@@ -0,0 +1,78 @@
+#include <bindings.dsl.h>
+#include <time.h>
+
+-- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html>
+
+module Bindings.Posix.Time where
+#strict_import
+import Bindings.Posix.Sys.Types
+import Bindings.Posix.Locale
+import Bindings.Posix.Signal
+
+#starttype struct tm
+#field tm_sec , CInt
+#field tm_min , CInt
+#field tm_hour , CInt
+#field tm_mday , CInt
+#field tm_mon , CInt
+#field tm_year , CInt
+#field tm_wday , CInt
+#field tm_yday , CInt
+#field tm_isdst , CInt
+#stoptype
+
+#starttype struct timespec
+#field tv_sec , CTime
+#field tv_nsec , CLong
+#stoptype
+
+#ifndef __MACH__
+#starttype struct itimerspec
+#field it_interval , <timespec>
+#field it_value , <timespec>
+#stoptype
+#endif
+
+#num CLOCKS_PER_SEC
+#ifndef __MACH__
+#num CLOCK_REALTIME
+#num TIMER_ABSTIME
+#endif
+
+#cinline getdate_err , IO CInt
+
+#ifndef __MACH__
+#ccall clock_getres , <clockid_t> -> Ptr <timespec> -> IO CInt
+#ccall clock_gettime , <clockid_t> -> Ptr <timespec> -> IO CInt
+#ccall clock_nanosleep , <clockid_t> -> CInt -> Ptr <timespec> -> Ptr <timespec> -> IO CInt
+#ccall clock_settime , <clockid_t> -> Ptr <timespec> -> IO CInt
+#endif
+
+#ccall difftime , <time_t> -> <time_t> -> IO CDouble
+#ccall getdate ,  CString -> IO (Ptr <tm>)
+#ccall gmtime , Ptr <time_t> -> IO (Ptr <tm>)
+#ccall gmtime_r , Ptr <time_t> -> Ptr <tm> -> IO (Ptr <tm>)
+#ccall localtime , Ptr <time_t> -> IO (Ptr <tm>)
+#ccall localtime_r ,  Ptr <time_t> -> Ptr <tm> -> IO (Ptr <tm>)
+#ccall mktime , Ptr <tm> -> IO <time_t>
+#ccall nanosleep ,  Ptr <timespec> -> Ptr <timespec> -> IO CInt
+
+#ccall strftime , CString -> CSize -> CString -> Ptr <tm> -> IO CSize
+-- #ccall strftime_l , CString -> CSize -> CString -> Ptr <tm> -> <locale_t> -> IO CSize
+#ccall strptime ,  CString -> CString -> Ptr <tm> -> IO CString
+#ccall time , Ptr <time_t> -> IO <time_t>
+
+#ifndef __MACH__
+#ccall timer_create , <clockid_t> -> Ptr <sigevent> -> Ptr <timer_t> -> IO CInt
+#ccall timer_delete , <timer_t> -> IO CInt
+#ccall timer_getoverrun , <timer_t> -> IO CInt
+#ccall timer_gettime , <timer_t> -> Ptr <itimerspec> -> IO CInt
+#ccall timer_settime , <timer_t> -> CInt -> Ptr <itimerspec> -> Ptr <itimerspec> -> IO CInt
+#endif
+
+#ccall tzset , IO ()
+
+#globalvar daylight , CInt
+#globalvar timezone , CLong
+#globalarray tzname , CString
+
diff --git a/src/Bindings/Posix/Unistd.hsc b/src/Bindings/Posix/Unistd.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Posix/Unistd.hsc
@@ -0,0 +1,248 @@
+#include <bindings.dsl.h>
+#include <unistd.h>
+
+-- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html>
+
+module Bindings.Posix.Unistd where
+#strict_import
+import Bindings.Posix.Sys.Types
+
+#num _POSIX_VERSION
+#num _POSIX2_VERSION
+#num _POSIX_ASYNCHRONOUS_IO
+#num _POSIX_BARRIERS
+#num _POSIX_CHOWN_RESTRICTED
+#num _POSIX_CLOCK_SELECTION
+#num _POSIX_IPV6
+#num _POSIX_JOB_CONTROL
+#num _POSIX_MAPPED_FILES
+#num _POSIX_MEMORY_PROTECTION
+#num _POSIX_NO_TRUNC
+#num _POSIX_READER_WRITER_LOCKS
+#num _POSIX_REALTIME_SIGNALS
+#num _POSIX_REGEXP
+#num _POSIX_SAVED_IDS
+#num _POSIX_SEMAPHORES
+#num _POSIX_SHELL
+#num _POSIX_SPIN_LOCKS
+#num _POSIX_THREAD_SAFE_FUNCTIONS
+#num _POSIX_THREADS
+#num _POSIX_TIMEOUTS
+#num _POSIX_TIMERS
+#num _POSIX2_C_BIND
+#num _POSIX2_CHAR_TERM
+#num _POSIX2_LOCALEDEF
+#num F_OK
+#num R_OK
+#num W_OK
+#num X_OK
+#num F_LOCK
+#num F_TEST
+#num F_TLOCK
+#num F_ULOCK
+#num _PC_2_SYMLINKS
+#num _PC_ALLOC_SIZE_MIN
+#num _PC_ASYNC_IO
+#num _PC_CHOWN_RESTRICTED
+#num _PC_FILESIZEBITS
+#num _PC_LINK_MAX
+#num _PC_MAX_CANON
+#num _PC_MAX_INPUT
+#num _PC_NAME_MAX
+#num _PC_NO_TRUNC
+#num _PC_PATH_MAX
+#num _PC_PIPE_BUF
+#num _PC_PRIO_IO
+#num _PC_REC_INCR_XFER_SIZE
+#num _PC_REC_MAX_XFER_SIZE
+#num _PC_REC_MIN_XFER_SIZE
+#num _PC_REC_XFER_ALIGN
+#num _PC_SYMLINK_MAX
+#num _PC_SYNC_IO
+#num _PC_VDISABLE
+#num _SC_2_C_BIND
+#num _SC_2_C_DEV
+#num _SC_2_CHAR_TERM
+#num _SC_2_FORT_DEV
+#num _SC_2_FORT_RUN
+#num _SC_2_LOCALEDEF
+#num _SC_2_PBS
+#num _SC_2_PBS_ACCOUNTING
+#num _SC_2_PBS_CHECKPOINT
+#num _SC_2_PBS_LOCATE
+#num _SC_2_PBS_MESSAGE
+#num _SC_2_PBS_TRACK
+#num _SC_2_SW_DEV
+#num _SC_2_UPE
+#num _SC_2_VERSION
+#num _SC_ADVISORY_INFO
+#num _SC_AIO_LISTIO_MAX
+#num _SC_AIO_MAX
+#num _SC_AIO_PRIO_DELTA_MAX
+#num _SC_ARG_MAX
+#num _SC_ASYNCHRONOUS_IO
+#num _SC_ATEXIT_MAX
+#num _SC_BARRIERS
+#num _SC_BC_BASE_MAX
+#num _SC_BC_DIM_MAX
+#num _SC_BC_SCALE_MAX
+#num _SC_BC_STRING_MAX
+#num _SC_CHILD_MAX
+#num _SC_CLK_TCK
+#num _SC_CLOCK_SELECTION
+#num _SC_COLL_WEIGHTS_MAX
+#num _SC_CPUTIME
+#num _SC_DELAYTIMER_MAX
+#num _SC_EXPR_NEST_MAX
+#num _SC_FSYNC
+#num _SC_GETGR_R_SIZE_MAX
+#num _SC_GETPW_R_SIZE_MAX
+#num _SC_HOST_NAME_MAX
+#num _SC_IOV_MAX
+#num _SC_IPV6
+#num _SC_JOB_CONTROL
+#num _SC_LINE_MAX
+#num _SC_LOGIN_NAME_MAX
+#num _SC_MAPPED_FILES
+#num _SC_MEMLOCK
+#num _SC_MEMLOCK_RANGE
+#num _SC_MEMORY_PROTECTION
+#num _SC_MESSAGE_PASSING
+#num _SC_MONOTONIC_CLOCK
+#num _SC_MQ_OPEN_MAX
+#num _SC_MQ_PRIO_MAX
+#num _SC_NGROUPS_MAX
+#num _SC_OPEN_MAX
+#num _SC_PAGE_SIZE
+#num _SC_PAGESIZE
+#num _SC_PRIORITIZED_IO
+#num _SC_PRIORITY_SCHEDULING
+#num _SC_RAW_SOCKETS
+#num _SC_RE_DUP_MAX
+#num _SC_READER_WRITER_LOCKS
+#num _SC_REALTIME_SIGNALS
+#num _SC_REGEXP
+#num _SC_RTSIG_MAX
+#num _SC_SAVED_IDS
+#num _SC_SEM_NSEMS_MAX
+#num _SC_SEM_VALUE_MAX
+#num _SC_SEMAPHORES
+#num _SC_SHARED_MEMORY_OBJECTS
+#num _SC_SHELL
+#num _SC_SIGQUEUE_MAX
+#num _SC_SPAWN
+#num _SC_SPIN_LOCKS
+#num _SC_SPORADIC_SERVER
+#num _SC_STREAM_MAX
+#num _SC_SYMLOOP_MAX
+#num _SC_SYNCHRONIZED_IO
+#num _SC_THREAD_ATTR_STACKADDR
+#num _SC_THREAD_ATTR_STACKSIZE
+#num _SC_THREAD_CPUTIME
+#num _SC_THREAD_DESTRUCTOR_ITERATIONS
+#num _SC_THREAD_KEYS_MAX
+#num _SC_THREAD_PRIO_INHERIT
+#num _SC_THREAD_PRIO_PROTECT
+#num _SC_THREAD_PRIORITY_SCHEDULING
+#num _SC_THREAD_PROCESS_SHARED
+#num _SC_THREAD_SAFE_FUNCTIONS
+#num _SC_THREAD_SPORADIC_SERVER
+#num _SC_THREAD_STACK_MIN
+#num _SC_THREAD_THREADS_MAX
+#num _SC_THREADS
+#num _SC_TIMEOUTS
+#num _SC_TIMER_MAX
+#num _SC_TIMERS
+#num _SC_TRACE
+#num _SC_TRACE_EVENT_FILTER
+#num _SC_TRACE_INHERIT
+#num _SC_TRACE_LOG
+#num _SC_TTY_NAME_MAX
+#num _SC_TYPED_MEMORY_OBJECTS
+#num _SC_TZNAME_MAX
+#num _SC_VERSION
+#num _SC_XOPEN_CRYPT
+#num _SC_XOPEN_ENH_I18N
+#num _SC_XOPEN_REALTIME
+#num _SC_XOPEN_REALTIME_THREADS
+#num _SC_XOPEN_SHM
+#num _SC_XOPEN_UNIX
+#num _SC_XOPEN_VERSION
+#num STDERR_FILENO
+#num STDIN_FILENO
+#num STDOUT_FILENO
+#num _POSIX_VDISABLE
+
+#ccall access , CString -> CInt -> IO CInt
+#ccall alarm , CUInt -> IO CUInt
+#ccall chdir , CString -> IO CInt
+#ccall chown , CString -> <uid_t> -> <gid_t> -> IO CInt
+#ccall close , CInt -> IO CInt
+#ccall confstr , CInt -> CString -> CSize -> IO CSize
+#ccall dup , CInt -> IO CInt
+#ccall dup2 , CInt -> CInt -> IO CInt
+#ccall _exit , CInt -> IO ()
+#ccall execv , CString -> Ptr CString -> IO CInt
+#ccall execve , CString -> Ptr CString -> Ptr CString -> IO CInt
+#ccall execvp , CString -> Ptr CString -> IO CInt
+#ccall faccessat , CInt -> CString -> CInt -> CInt -> IO CInt
+#ccall fchdir , CInt -> IO CInt
+#ccall fchown , CInt -> <uid_t> -> <gid_t> -> IO CInt
+#ccall fchownat , CInt -> CString -> <uid_t> -> <gid_t> -> CInt -> IO CInt
+#ccall fexecve , CInt -> Ptr CString -> Ptr CString -> IO CInt
+#ccall fork , IO <pid_t>
+#ccall fpathconf , CInt -> CInt -> IO CLong
+#ccall ftruncate , CInt -> <off_t> -> IO CInt
+#ccall getcwd , CString -> CSize -> IO CString
+#ccall getegid , IO <gid_t>
+#ccall geteuid , IO <uid_t>
+#ccall getgid , IO <gid_t>
+#ccall getgroups , CInt -> Ptr <gid_t> -> IO CInt
+#ccall gethostname , CString -> CSize -> IO CInt
+#ccall getlogin , IO CString
+#ccall getlogin_r , CString -> CSize -> IO CInt
+#ccall getopt , CInt -> Ptr CString -> CString -> IO CInt
+#ccall getpgid , <pid_t> -> IO <pid_t>
+#ccall getpgrp , IO <pid_t>
+#ccall getpid , IO <pid_t>
+#ccall getppid , IO <pid_t>
+#ccall getsid , <pid_t> -> IO <pid_t>
+#ccall getuid , IO <uid_t>
+#ccall isatty , CInt -> IO CInt
+#ccall lchown , CString -> <uid_t> -> <gid_t> -> IO CInt
+#ccall link , CString -> CString -> IO CInt
+#ccall linkat , CInt -> CString -> CInt -> CString -> CInt -> IO CInt
+#ccall lseek , CInt -> <off_t> -> CInt -> IO <off_t>
+#ccall pathconf , CString -> CInt -> IO CLong
+#ccall pause , IO CInt
+#ccall pipe , Ptr CInt -> IO CInt
+#ccall pread , CInt -> Ptr () -> CSize -> <off_t> -> IO <ssize_t>
+#ccall pwrite , CInt -> Ptr () -> CSize -> <off_t> -> IO <ssize_t>
+#ccall read , CInt -> Ptr () -> CSize -> IO <ssize_t>
+#ccall readlink , CString -> CString -> CSize -> IO <ssize_t>
+#ccall readlinkat , CInt -> CString -> CString -> CSize -> IO <ssize_t>
+#ccall rmdir , CString -> IO CInt
+#ccall setegid , <gid_t> -> IO CInt
+#ccall seteuid , <uid_t> -> IO CInt
+#ccall setgid , <gid_t> -> IO CInt
+#ccall setpgid , <pid_t> -> <pid_t> -> IO CInt
+#ccall setsid , IO <pid_t>
+#ccall setuid , <uid_t> -> IO CInt
+#ccall sleep , CUInt -> IO CUInt
+#ccall symlink , CString -> CString -> IO CInt
+#ccall symlinkat , CString -> CInt -> CString -> IO CInt
+#ccall sysconf , CInt -> IO CLong
+#ccall tcgetpgrp , CInt -> IO <pid_t>
+#ccall tcsetpgrp , CInt -> <pid_t> -> IO CInt
+#ccall truncate , CString -> <off_t> -> IO CInt
+#ccall ttyname , CInt -> IO CString
+#ccall ttyname_r , CInt -> CString -> CSize -> IO CInt
+#ccall unlink , CString -> IO CInt
+#ccall unlinkat , CInt -> CString -> CInt -> IO CInt
+#ccall write , CInt -> Ptr () -> CSize -> IO <ssize_t>
+
+#globalvar optarg , CString
+#globalvar opterr , CInt
+#globalvar optind , CInt
+#globalvar optopt , CInt
+
