summary refs log tree commit diff stats
path: root/lib/posix/posix.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/posix/posix.nim')
-rw-r--r--lib/posix/posix.nim993
1 files changed, 795 insertions, 198 deletions
diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim
index 38677420d..570c24980 100644
--- a/lib/posix/posix.nim
+++ b/lib/posix/posix.nim
@@ -1,15 +1,16 @@
 #

 #

 #            Nimrod's Runtime Library

-#        (c) Copyright 2008 Andreas Rumpf

+#        (c) Copyright 2009 Andreas Rumpf

 #

 #    See the file "copying.txt", included in this

 #    distribution, for details about the copyright.

 #

 

-# Until ndbm!!

+# Until std_arg!!

 # done: ipc, pwd, stat, semaphore, sys/types, sys/utsname, pthread, unistd,

-# statvfs, mman, time, wait, signal, nl_types, sched, spawn, select, ucontext

+# statvfs, mman, time, wait, signal, nl_types, sched, spawn, select, ucontext,
+# net/if, sys/socket, sys/uio, netinet/in, netinet/tcp, netdb

 

 ## This is a raw POSIX interface module. It does not not provide any

 ## convenience: cstrings are used instead of proper Nimrod strings and

@@ -60,24 +61,26 @@ const
   MM_NULLTAG* = nil

   

   STDERR_FILENO* = 2 ## File number of stderr;

-  STDIN_FILENO* = 0 ## File number of stdin;

+  STDIN_FILENO* = 0  ## File number of stdin;

   STDOUT_FILENO* = 1 ## File number of stdout; 

 

 type

   TDIR* {.importc: "DIR", header: "<dirent.h>", final, pure.} = object

     ## A type representing a directory stream. 

 

-  Tdirent* {.importc: "struct dirent", header: "<dirent.h>", final, pure.} = object

+  Tdirent* {.importc: "struct dirent", 
+             header: "<dirent.h>", final, pure.} = object ## dirent_t struct

     d_ino*: TIno  ## File serial number.

     d_name*: array [0..255, char] ## Name of entry.

 

-  Tflock* {.importc: "flock", header: "<fcntl.h>", final, pure.} = object

-    l_type*: cshort  ## Type of lock; F_RDLCK, F_WRLCK, F_UNLCK. 

+  Tflock* {.importc: "flock", final, pure,
+            header: "<fcntl.h>".} = object ## flock type

+    l_type*: cshort   ## Type of lock; F_RDLCK, F_WRLCK, F_UNLCK. 

     l_whence*: cshort ## Flag for starting offset. 

-    l_start*: Toff ## Relative offset in bytes. 

-    l_len*: Toff   ## Size; if 0 then until EOF. 

-    l_pid*: TPid   ## Process ID of the process holding the lock; 

-                   ## returned with F_GETLK. 

+    l_start*: Toff    ## Relative offset in bytes. 

+    l_len*: Toff      ## Size; if 0 then until EOF. 

+    l_pid*: TPid      ## Process ID of the process holding the lock; 

+                      ## returned with F_GETLK. 

   

   Tfenv* {.importc: "fenv_t", header: "<fenv.h>", final, pure.} = 

     object ## Represents the entire floating-point environment. The

@@ -99,14 +102,16 @@ type
     base*: cint

     level*: cint

     

-  TGlob* {.importc: "glob_t", header: "<glob.h>", final, pure.} = object

-    gl_pathc*: int ## Count of paths matched by pattern. 

+  TGlob* {.importc: "glob_t", header: "<glob.h>", 
+           final, pure.} = object ## glob_t

+    gl_pathc*: int         ## Count of paths matched by pattern. 

     gl_pathv*: ptr cstring ## Pointer to a list of matched pathnames. 

-    gl_offs*: int ##  Slots to reserve at the beginning of gl_pathv. 

+    gl_offs*: int          ## Slots to reserve at the beginning of gl_pathv. 

   

-  TGroup* {.importc: "struct group", header: "<grp.h>", final, pure.} = object

-    gr_name*: cstring ## The name of the group. 

-    gr_gid*: TGid  ## Numerical group ID. 

+  TGroup* {.importc: "struct group", header: "<grp.h>", 
+            final, pure.} = object ## struct group

+    gr_name*: cstring     ## The name of the group. 

+    gr_gid*: TGid         ## Numerical group ID. 

     gr_mem*: cstringArray ## Pointer to a null-terminated array of character 

                           ## pointers to member names. 

 

@@ -140,18 +145,21 @@ type
     thousands_sep*: cstring

 

   TMqd* {.importc: "mqd_t", header: "<mqueue.h>", final, pure.} = object

-  TMqAttr* {.importc: "struct mq_attr", header: "<mqueue.h>", final, pure.} = object

-    mq_flags*: int ##    Message queue flags. 

-    mq_maxmsg*: int ##   Maximum number of messages. 

-    mq_msgsize*: int ##  Maximum message size. 

-    mq_curmsgs*: int ##  Number of messages currently queued. 

-

-  TPasswd* {.importc: "struct passwd", header: "<pwd.h>", final, pure.} = object

-    pw_name*: cstring ##   User's login name. 

-    pw_uid*: TUid ##    Numerical user ID. 

-    pw_gid*: TGid ##    Numerical group ID. 

-    pw_dir*: cstring ## Initial working directory. 

-    pw_shell*: cstring ##  Program to use as shell. 

+  TMqAttr* {.importc: "struct mq_attr", 
+             header: "<mqueue.h>", 
+             final, pure.} = object ## message queue attribute

+    mq_flags*: int   ## Message queue flags. 

+    mq_maxmsg*: int  ## Maximum number of messages. 

+    mq_msgsize*: int ## Maximum message size. 

+    mq_curmsgs*: int ## Number of messages currently queued. 

+

+  TPasswd* {.importc: "struct passwd", header: "<pwd.h>", 
+             final, pure.} = object ## struct passwd

+    pw_name*: cstring   ## User's login name. 

+    pw_uid*: TUid       ## Numerical user ID. 

+    pw_gid*: TGid       ## Numerical group ID. 

+    pw_dir*: cstring    ## Initial working directory. 

+    pw_shell*: cstring  ## Program to use as shell. 

 

   Tblkcnt* {.importc: "blkcnt_t", header: "<sys/types.h>".} = int

     ## used for file block counts

@@ -171,30 +179,40 @@ type
   TOff* {.importc: "off_t", header: "<sys/types.h>".} = int64

   TPid* {.importc: "pid_t", header: "<sys/types.h>".} = int

   Tpthread_attr* {.importc: "pthread_attr_t", header: "<sys/types.h>".} = int

-  Tpthread_barrier* {.importc: "pthread_barrier_t", header: "<sys/types.h>".} = int

-  Tpthread_barrierattr* {.importc: "pthread_barrierattr_t", header: "<sys/types.h>".} = int

+  Tpthread_barrier* {.importc: "pthread_barrier_t", 
+                      header: "<sys/types.h>".} = int

+  Tpthread_barrierattr* {.importc: "pthread_barrierattr_t", 
+                          header: "<sys/types.h>".} = int

   Tpthread_cond* {.importc: "pthread_cond_t", header: "<sys/types.h>".} = int

-  Tpthread_condattr* {.importc: "pthread_condattr_t", header: "<sys/types.h>".} = int

+  Tpthread_condattr* {.importc: "pthread_condattr_t", 
+                       header: "<sys/types.h>".} = int

   Tpthread_key* {.importc: "pthread_key_t", header: "<sys/types.h>".} = int

   Tpthread_mutex* {.importc: "pthread_mutex_t", header: "<sys/types.h>".} = int

-  Tpthread_mutexattr* {.importc: "pthread_mutexattr_t", header: "<sys/types.h>".} = int

+  Tpthread_mutexattr* {.importc: "pthread_mutexattr_t", 
+                        header: "<sys/types.h>".} = int

   Tpthread_once* {.importc: "pthread_once_t", header: "<sys/types.h>".} = int

   Tpthread_rwlock* {.importc: "pthread_rwlock_t", header: "<sys/types.h>".} = int

-  Tpthread_rwlockattr* {.importc: "pthread_rwlockattr_t", header: "<sys/types.h>".} = int

-  Tpthread_spinlock* {.importc: "pthread_spinlock_t", header: "<sys/types.h>".} = int

+  Tpthread_rwlockattr* {.importc: "pthread_rwlockattr_t", 
+                         header: "<sys/types.h>".} = int

+  Tpthread_spinlock* {.importc: "pthread_spinlock_t", 
+                       header: "<sys/types.h>".} = int

   Tpthread* {.importc: "pthread_t", header: "<sys/types.h>".} = int

   Tsuseconds* {.importc: "suseconds_t", header: "<sys/types.h>".} = int

   Ttime* {.importc: "time_t", header: "<sys/types.h>".} = int

   Ttimer* {.importc: "timer_t", header: "<sys/types.h>".} = int

   Ttrace_attr* {.importc: "trace_attr_t", header: "<sys/types.h>".} = int

-  Ttrace_event_id* {.importc: "trace_event_id_t", header: "<sys/types.h>".} = int

-  Ttrace_event_set* {.importc: "trace_event_set_t", header: "<sys/types.h>".} = int

+  Ttrace_event_id* {.importc: "trace_event_id_t", 
+                     header: "<sys/types.h>".} = int

+  Ttrace_event_set* {.importc: "trace_event_set_t", 
+                      header: "<sys/types.h>".} = int

   Ttrace_id* {.importc: "trace_id_t", header: "<sys/types.h>".} = int

   Tuid* {.importc: "uid_t", header: "<sys/types.h>".} = int

   Tuseconds* {.importc: "useconds_t", header: "<sys/types.h>".} = int

   

-  Tutsname* {.importc: "struct utsname", header: "<sys/utsname.h>", final, pure.} = object

-    sysname*,    ## Name of this implementation of the operating system. 

+  Tutsname* {.importc: "struct utsname", 
+              header: "<sys/utsname.h>", 
+              final, pure.} = object ## struct utsname

+    sysname*,      ## Name of this implementation of the operating system. 

       nodename*,   ## Name of this node within the communications 

                    ## network to which this node is attached, if any. 

       release*,    ## Current release level of this implementation. 

@@ -203,58 +221,63 @@ type
                                      ## system is running. 

 

   TSem* {.importc: "sem_t", header: "<semaphore.h>", final, pure.} = object

-  Tipc_perm* {.importc: "struct ipc_perm", header: "<sys/ipc.h>", final, pure.} = object

+  Tipc_perm* {.importc: "struct ipc_perm", 
+               header: "<sys/ipc.h>", final, pure.} = object ## struct ipc_perm

     uid*: tuid    ## Owner's user ID. 

     gid*: tgid    ## Owner's group ID. 

     cuid*: Tuid   ## Creator's user ID. 

     cgid*: Tgid   ## Creator's group ID. 

-    mode*: TMode   ## Read/write permission. 

+    mode*: TMode  ## Read/write permission. 

   

-  TStat* {.importc: "struct stat", header: "<sys/stat.h>", final, pure.} = object

-    st_dev*: TDev  ##   Device ID of device containing file. 

-    st_ino*: TIno  ##   File serial number. 

-    st_mode*: TMode ##   Mode of file (see below). 

-    st_nlink*: tnlink ##   Number of hard links to the file. 

-    st_uid*: tuid ##   User ID of file. 

-    st_gid*: Tgid ##   Group ID of file. 

-    st_rdev*: TDev ##   Device ID (if file is character or block special). 

-    st_size*: TOff ##   For regular files, the file size in bytes. 

-                   ## For symbolic links, the length in bytes of the 

-                   ## pathname contained in the symbolic link. 

-                   ## For a shared memory object, the length in bytes. 

-                   ## For a typed memory object, the length in bytes. 

-                   ## For other file types, the use of this field is 

-                   ## unspecified. 

-    st_atime*: ttime ## Time of last access. 

-    st_mtime*: ttime ## Time of last data modification. 

-    st_ctime*: ttime ## Time of last status change. 

-    st_blksize*: Tblksize ## A file system-specific preferred I/O block size  

-                          ## for this object. In some file system types, this 

-                          ## may vary from file to file. 

-    st_blocks*: Tblkcnt ## Number of blocks allocated for this object. 

+  TStat* {.importc: "struct stat", 
+           header: "<sys/stat.h>", final, pure.} = object ## struct stat

+    st_dev*: TDev          ## Device ID of device containing file. 

+    st_ino*: TIno          ## File serial number. 

+    st_mode*: TMode        ## Mode of file (see below). 

+    st_nlink*: tnlink      ## Number of hard links to the file. 

+    st_uid*: tuid          ## User ID of file. 

+    st_gid*: Tgid          ## Group ID of file. 

+    st_rdev*: TDev         ## Device ID (if file is character or block special). 

+    st_size*: TOff         ## For regular files, the file size in bytes. 

+                           ## For symbolic links, the length in bytes of the 

+                           ## pathname contained in the symbolic link. 

+                           ## For a shared memory object, the length in bytes. 

+                           ## For a typed memory object, the length in bytes. 

+                           ## For other file types, the use of this field is 

+                           ## unspecified. 

+    st_atime*: ttime       ## Time of last access. 

+    st_mtime*: ttime       ## Time of last data modification. 

+    st_ctime*: ttime       ## Time of last status change. 

+    st_blksize*: Tblksize  ## A file system-specific preferred I/O block size  

+                           ## for this object. In some file system types, this 

+                           ## may vary from file to file. 

+    st_blocks*: Tblkcnt    ## Number of blocks allocated for this object. 

 

   

-  TStatvfs* {.importc: "struct statvfs", header: "<sys/statvfs.h>", final, pure.} = object  

-    f_bsize*: int   ## File system block size. 

-    f_frsize*: int  ## Fundamental file system block size. 

-    f_blocks*: Tfsblkcnt  ## Total number of blocks on file system in units of f_frsize. 

+  TStatvfs* {.importc: "struct statvfs", header: "<sys/statvfs.h>", 
+              final, pure.} = object ## struct statvfs

+    f_bsize*: int        ## File system block size. 

+    f_frsize*: int       ## Fundamental file system block size. 

+    f_blocks*: Tfsblkcnt ## Total number of blocks on file system
+                         ## in units of f_frsize. 

     f_bfree*: Tfsblkcnt  ## Total number of free blocks. 

     f_bavail*: Tfsblkcnt ## Number of free blocks available to 

                          ## non-privileged process. 

     f_files*: Tfsfilcnt  ## Total number of file serial numbers. 

-    f_ffree*: Tfsfilcnt   ## Total number of free file serial numbers. 

-    f_favail*: Tfsfilcnt  ## Number of file serial numbers available to 

-                          ## non-privileged process. 

-    f_fsid*: int    ## File system ID. 

-    f_flag*: int    ## Bit mask of f_flag values. 

-    f_namemax*: int ##  Maximum filename length. 

+    f_ffree*: Tfsfilcnt  ## Total number of free file serial numbers. 

+    f_favail*: Tfsfilcnt ## Number of file serial numbers available to 

+                         ## non-privileged process. 

+    f_fsid*: int         ## File system ID. 

+    f_flag*: int         ## Bit mask of f_flag values. 

+    f_namemax*: int      ## Maximum filename length. 

 

   Tposix_typed_mem_info* {.importc: "struct posix_typed_mem_info", 

                            header: "<sys/mman.h>", final, pure.} = object

     posix_tmi_length*: int

   

-  Ttm* {.importc: "struct tm", header: "<time.h>", final, pure.} = object

-    tm_sec*: cint ## Seconds [0,60]. 

+  Ttm* {.importc: "struct tm", header: "<time.h>", 
+         final, pure.} = object ## struct tm

+    tm_sec*: cint   ## Seconds [0,60]. 

     tm_min*: cint   ## Minutes [0,59]. 

     tm_hour*: cint  ## Hour [0,23]. 

     tm_mday*: cint  ## Day of month [1,31]. 

@@ -263,10 +286,12 @@ type
     tm_wday*: cint  ## Day of week [0,6] (Sunday =0). 

     tm_yday*: cint  ## Day of year [0,365]. 

     tm_isdst*: cint ## Daylight Savings flag. 

-  Ttimespec* {.importc: "struct timespec", header: "<time.h>", final, pure.} = object

+  Ttimespec* {.importc: "struct timespec", 
+               header: "<time.h>", final, pure.} = object ## struct timespec

     tv_sec*: Ttime ## Seconds. 

-    tv_nsec*: int ## Nanoseconds. 

-  titimerspec* {.importc: "struct itimerspec", header: "<time.h>", final, pure.} = object

+    tv_nsec*: int  ## Nanoseconds. 

+  titimerspec* {.importc: "struct itimerspec", header: "<time.h>", 
+                 final, pure.} = object ## struct itimerspec

     it_interval*: ttimespec ## Timer period. 

     it_value*: ttimespec    ## Timer expiration. 

   

@@ -276,17 +301,20 @@ type
     ## interrupts.

   Tsigset* {.importc: "sigset_t", header: "<signal.h>", final, pure.} = object

   

-  TsigEvent* {.importc: "struct sigevent", header: "<signal.h>", final, pure.} = object

+  TsigEvent* {.importc: "struct sigevent", 
+               header: "<signal.h>", final, pure.} = object ## struct sigevent

     sigev_notify*: cint           ## Notification type. 

     sigev_signo*: cint            ## Signal number. 

-    sigev_value*: Tsigval        ##     Signal value. 

-    sigev_notify_function*: proc (x: TSigval) {.noconv.} ##  Notification function. 

+    sigev_value*: Tsigval         ## Signal value. 

+    sigev_notify_function*: proc (x: TSigval) {.noconv.} ## Notification function. 

     sigev_notify_attributes*: ptr Tpthreadattr ## Notification attributes.

 

-  TsigVal* {.importc: "union sigval", header: "<signal.h>", final, pure.} = object

+  TsigVal* {.importc: "union sigval", 
+             header: "<signal.h>", final, pure.} = object ## struct sigval

     sival_ptr*: pointer ## pointer signal value; 

                         ## integer signal value not defined!

-  TSigaction* {.importc: "struct sigaction", header: "<signal.h>", final, pure.} = object

+  TSigaction* {.importc: "struct sigaction", 
+                header: "<signal.h>", final, pure.} = object ## struct sigaction

     sa_handler*: proc (x: cint) {.noconv.}  ## Pointer to a signal-catching

                                             ## function or one of the macros 

                                             ## SIG_IGN or SIG_DFL. 

@@ -295,70 +323,222 @@ type
     sa_flags*: cint   ## Special flags. 

     sa_sigaction*: proc (x: cint, y: var TSigInfo, z: pointer) {.noconv.}

 

-  TStack* {.importc: "stack_t", header: "<signal.h>", final, pure.} = object

-    ss_sp*: pointer ##       Stack base or pointer. 

-    ss_size*: int ##     Stack size. 

-    ss_flags*: cint ##    Flags. 

-

-  TSigStack* {.importc: "struct sigstack", header: "<signal.h>", final, pure.} = object

-    ss_onstack*: cint ##  Non-zero when signal stack is in use. 

-    ss_sp*: pointer ## Signal stack pointer. 

-

-  TsigInfo* {.importc: "siginfo_t", header: "<signal.h>", final, pure.} = object

-    si_signo*: cint ##  Signal number. 

-    si_code*: cint ##   Signal code. 

-    si_errno*: cint ##  If non-zero, an errno value associated with 

-                    ## this signal, as defined in <errno.h>. 

-    si_pid*: tpid ##    Sending process ID. 

-    si_uid*: tuid ##    Real user ID of sending process. 

-    si_addr*: pointer ##   Address of faulting instruction. 

-    si_status*: cint ## Exit value or signal. 

-    si_band*: int ##   Band event for SIGPOLL. 

+  TStack* {.importc: "stack_t",
+            header: "<signal.h>", final, pure.} = object ## stack_t

+    ss_sp*: pointer  ## Stack base or pointer. 

+    ss_size*: int    ## Stack size. 

+    ss_flags*: cint  ## Flags. 

+

+  TSigStack* {.importc: "struct sigstack", 
+               header: "<signal.h>", final, pure.} = object ## struct sigstack

+    ss_onstack*: cint ## Non-zero when signal stack is in use. 

+    ss_sp*: pointer   ## Signal stack pointer. 

+

+  TsigInfo* {.importc: "siginfo_t", 
+              header: "<signal.h>", final, pure.} = object ## siginfo_t

+    si_signo*: cint    ## Signal number. 

+    si_code*: cint     ## Signal code. 

+    si_errno*: cint    ## If non-zero, an errno value associated with 

+                       ## this signal, as defined in <errno.h>. 

+    si_pid*: tpid      ## Sending process ID. 

+    si_uid*: tuid      ## Real user ID of sending process. 

+    si_addr*: pointer  ## Address of faulting instruction. 

+    si_status*: cint   ## Exit value or signal. 

+    si_band*: int      ## Band event for SIGPOLL. 

     si_value*: TSigval ## Signal value. 

   

   Tnl_item* {.importc: "nl_item", header: "<nl_types.h>".} = cint

   Tnl_catd* {.importc: "nl_catd", header: "<nl_types.h>".} = cint

 

-  Tsched_param* {.importc: "struct sched_param", header: "<sched.h>", final, pure.} = object

+  Tsched_param* {.importc: "struct sched_param", 
+                  header: "<sched.h>", 
+                  final, pure.} = object ## struct sched_param

     sched_priority*: cint

-    sched_ss_low_priority*: cint ## Low scheduling priority for 

-                                 ## sporadic server. 

+    sched_ss_low_priority*: cint     ## Low scheduling priority for 

+                                     ## sporadic server. 

     sched_ss_repl_period*: ttimespec ## Replenishment period for 

                                      ## sporadic server. 

-    sched_ss_init_budget*: ttimespec ##  Initial budget for sporadic server. 

-    sched_ss_max_repl*: cint    ## Maximum pending replenishments for 

-                                ## sporadic server. 

-

-  Ttimeval* {.importc: "struct timeval", header: "<sys/select.h>", final, pure.} = object

-    tv_sec*: ttime ##      Seconds. 

-    tv_usec*: tsuseconds ##     Microseconds. 

-  Tfd_set* {.importc: "struct fd_set", header: "<sys/select.h>", final, pure.} = object

-  Tmcontext* {.importc: "mcontext_t", header: "<ucontext.h>", final, pure.} = object

-  Tucontext* {.importc: "ucontext_t", header: "<ucontext.h>", final, pure.} = object

+    sched_ss_init_budget*: ttimespec ## Initial budget for sporadic server. 

+    sched_ss_max_repl*: cint         ## Maximum pending replenishments for 

+                                     ## sporadic server. 

+

+  Ttimeval* {.importc: "struct timeval", header: "<sys/select.h>", 
+              final, pure.} = object ## struct timeval

+    tv_sec*: ttime       ## Seconds. 

+    tv_usec*: tsuseconds ## Microseconds. 

+  Tfd_set* {.importc: "struct fd_set", header: "<sys/select.h>", 
+             final, pure.} = object

+  Tmcontext* {.importc: "mcontext_t", header: "<ucontext.h>", 
+               final, pure.} = object

+  Tucontext* {.importc: "ucontext_t", header: "<ucontext.h>", 
+               final, pure.} = object ## ucontext_t

     uc_link*: ptr Tucontext ## Pointer to the context that is resumed 

                             ## when this context returns. 

-    uc_sigmask*: Tsigset ## The set of signals that are blocked when this 

-                         ## context is active. 

-    uc_stack*: TStack    ## The stack used by this context. 

+    uc_sigmask*: Tsigset    ## The set of signals that are blocked when this 

+                            ## context is active. 

+    uc_stack*: TStack       ## The stack used by this context. 

     uc_mcontext*: Tmcontext ## A machine-specific representation of the saved 

                             ## context. 

 

 when hasAioH:

   type

-    Taiocb* {.importc: "struct aiocb", header: "<aio.h>", final, pure.} = object

-      aio_fildes*: cint ##    File descriptor. 

-      aio_offset*: TOff ##    File offset. 

-      aio_buf*: pointer ##    Location of buffer. 

-      aio_nbytes*: int   ##  Length of transfer. 

-      aio_reqprio*: cint ##   Request priority offset. 

+    Taiocb* {.importc: "struct aiocb", header: "<aio.h>", 
+              final, pure.} = object ## struct aiocb

+      aio_fildes*: cint         ## File descriptor. 

+      aio_offset*: TOff         ## File offset. 

+      aio_buf*: pointer         ## Location of buffer. 

+      aio_nbytes*: int          ## Length of transfer. 

+      aio_reqprio*: cint        ## Request priority offset. 

       aio_sigevent*: TSigEvent  ## Signal number and value. 

-      aio_lio_opcode: cint ## Operation to be performed. 

+      aio_lio_opcode: cint      ## Operation to be performed. 

  

 when hasSpawnH:

   type

-    Tposix_spawnattr* {.importc: "posix_spawnattr_t", header: "<spawn.h>".} = cint

-    Tposix_spawn_file_actions* {.importc: "posix_spawn_file_actions_t", header: "<spawn.h>".} = cint 

-

+    Tposix_spawnattr* {.importc: "posix_spawnattr_t", 
+                        header: "<spawn.h>".} = cint

+    Tposix_spawn_file_actions* {.importc: "posix_spawn_file_actions_t", 
+                                 header: "<spawn.h>".} = cint 

+

+type
+  Tif_nameindex* {.importc: "struct if_nameindex", final, 
+                   pure, header: "<net/if.h>".} = object ## struct if_nameindex
+    if_index*: cint   ## Numeric index of the interface. 
+    if_name*: cstring ## Null-terminated name of the interface. 
+
+  TSocklen* {.importc: "socklen_t", header: "<sys/socket.h>".} = cint
+  TSa_Family* {.importc: "sa_family_t", header: "<sys/socket.h>".} = cint
+  
+  TSockAddr* {.importc: "struct sockaddr", header: "<sys/socket.h>", 
+               pure, final.} = object ## struct sockaddr
+    sa_family*: Tsa_family         ## Address family. 
+    sa_data*: array [0..255, char] ## Socket address (variable-length data). 
+  
+  Tsockaddr_storage* {.importc: "struct sockaddr_storage",
+                       header: "<sys/socket.h>", 
+                       pure, final.} = object ## struct sockaddr_storage
+    ss_family*: Tsa_family ## Address family. 
+
+  TIOVec* {.importc: "struct iovec", pure, final,
+            header: "<sys/uio.h>".} = object ## struct iovec
+    iov_base*: pointer ## Base address of a memory region for input or output. 
+    iov_len*: int    ## The size of the memory pointed to by iov_base. 
+    
+  Tmsghdr* {.importc: "struct msghdr", pure, final,
+             header: "<sys/socket.h>".} = object  ## struct msghdr
+    msg_name*: pointer  ## Optional address. 
+    msg_namelen*: TSockLen  ## Size of address. 
+    msg_iov*: ptr TIOVec    ## Scatter/gather array. 
+    msg_iovlen*: cint   ## Members in msg_iov. 
+    msg_control*: pointer  ## Ancillary data; see below. 
+    msg_controllen*: TSockLen ## Ancillary data buffer len. 
+    msg_flags*: cint ## Flags on received message. 
+
+
+  Tcmsghdr* {.importc: "struct cmsghdr", pure, final, 
+              header: "<sys/socket.h>".} = object ## struct cmsghdr
+    cmsg_len*: TSockLen ## Data byte count, including the cmsghdr. 
+    cmsg_level*: cint   ## Originating protocol. 
+    cmsg_type*: cint    ## Protocol-specific type. 
+
+  TLinger* {.importc: "struct linger", pure, final, 
+             header: "<sys/socket.h>".} = object ## struct linger
+    l_onoff*: cint  ## Indicates whether linger option is enabled. 
+    l_linger*: cint ## Linger time, in seconds. 
+  
+  TInPort* = int16 ## unsigned!
+  TInAddrScalar* = int32 ## unsigned!
+  
+  TInAddr* {.importc: "struct in_addr", pure, final, 
+             header: "<netinet/in.h>".} = object ## struct in_addr
+    s_addr*: TInAddrScalar
+
+  Tsockaddr_in* {.importc: "struct sockaddr_in", pure, final, 
+                  header: "<netinet/in.h>".} = object ## struct sockaddr_in
+    sin_family*: TSa_family ## AF_INET. 
+    sin_port*: TInPort      ## Port number. 
+    sin_addr*: TInAddr      ## IP address. 
+
+  TIn6Addr* {.importc: "struct in6_addr", pure, final,
+              header: "<netinet/in.h>".} = object ## struct in6_addr
+    s6_addr*: array [0..15, char]
+
+  Tsockaddr_in6* {.importc: "struct sockaddr_in6", pure, final,
+                   header: "<netinet/in.h>".} = object ## struct sockaddr_in6
+    sin6_family*: TSa_family ## AF_INET6. 
+    sin6_port*: TInPort      ## Port number. 
+    sin6_flowinfo*: int32    ## IPv6 traffic class and flow information. 
+    sin6_addr*: Tin6Addr     ## IPv6 address. 
+    sin6_scope_id*: int32    ## Set of interfaces for a scope. 
+  
+  Tipv6_mreq* {.importc: "struct ipv6_mreq", pure, final, 
+                header: "<netinet/in.h>".} = object ## struct ipv6_mreq
+    ipv6mr_multiaddr*: TIn6Addr ## IPv6 multicast address. 
+    ipv6mr_interface*: cint     ## Interface index. 
+
+  Thostent* {.importc: "struct hostent", pure, final, 
+              header: "<netdb.h>".} = object ## struct hostent
+    h_name*: cstring           ## Official name of the host. 
+    h_aliases*: cstringArray   ## A pointer to an array of pointers to 
+                               ## alternative host names, terminated by a 
+                               ## null pointer. 
+    h_addrtype*: cint          ## Address type. 
+    h_length*: cint            ## The length, in bytes, of the address. 
+    h_addr_list*: cstringArray ## A pointer to an array of pointers to network 
+                               ## addresses (in network byte order) for the
+                               ## host, terminated by a null pointer. 
+
+  Tnetent* {.importc: "struct netent", pure, final, 
+              header: "<netdb.h>".} = object ## struct netent
+    n_name*: cstring         ## Official, fully-qualified (including the 
+                             ## domain) name of the host. 
+    n_aliases*: cstringArray ## A pointer to an array of pointers to 
+                             ## alternative network names, terminated by a 
+                             ## null pointer. 
+    n_addrtype*: cint        ## The address type of the network. 
+    n_net*: int32            ## The network number, in host byte order. 
+
+  TProtoent* {.importc: "struct protoent", pure, final, 
+              header: "<netdb.h>".} = object ## struct protoent
+    p_name*: cstring         ## Official name of the protocol. 
+    p_aliases*: cstringArray ## A pointer to an array of pointers to 
+                             ## alternative protocol names, terminated by 
+                             ## a null pointer. 
+    p_proto*: cint           ## The protocol number. 
+
+  TServent* {.importc: "struct servent", pure, final, 
+              header: "<netdb.h>".} = object ## struct servent
+    s_name*: cstring         ## Official name of the service. 
+    s_aliases*: cstringArray ## A pointer to an array of pointers to 
+                             ## alternative service names, terminated by 
+                             ## a null pointer. 
+    s_port*: cint            ## The port number at which the service 
+                             ## resides, in network byte order. 
+    s_proto*: cstring        ## The name of the protocol to use when 
+                             ## contacting the service. 
+
+  Taddrinfo* {.importc: "struct addrinfo", pure, final, 
+              header: "<netdb.h>".} = object ## struct addrinfo
+    ai_flags*: cint         ## Input flags. 
+    ai_family*: cint        ## Address family of socket. 
+    ai_socktype*: cint      ## Socket type. 
+    ai_protocol*: cint      ## Protocol of socket. 
+    ai_addrlen*: TSockLen   ## Length of socket address. 
+    ai_addr*: ptr TSockAddr ## Socket address of socket. 
+    ai_canonname*: cstring  ## Canonical name of service location. 
+    ai_next*: ptr TAddrInfo ## Pointer to next in list. 
+  
+  TPollfd* {.importc: "struct pollfd", pure, final, 
+             header: "<poll.h>".} = object ## struct pollfd
+    fd*: cint        ## The following descriptor being polled. 
+    events*: cshort  ## The input event flags (see below). 
+    revents*: cshort ## The output event flags (see below).  
+  
+  Tnfds* {.importc: "nfds_t", header: "<poll.h>".} = cint
+
+var
+  errno* {.importc, header: "<errno.h>".}: cint ## error variable

+  daylight* {.importc, header: "<time.h>".}: cint

+  timezone* {.importc, header: "<time.h>".}: int

   

 # Constants as variables:

 when hasAioH:

@@ -399,7 +579,6 @@ var
     ## All symbols are not made available for relocation processing by 

     ## other modules. 

     

-  errno* {.importc, header: "<errno.h>".}: cint ## error variable

   E2BIG* {.importc, header: "<errno.h>".}: cint

       ## Argument list too long.

   EACCES* {.importc, header: "<errno.h>".}: cint

@@ -1026,18 +1205,20 @@ var
   SC_XBS5_ILP32_OFF32*{.importc: "_SC_XBS5_ILP32_OFF32", header: "<unistd.h>".}: cint

   SC_XBS5_ILP32_OFFBIG*{.importc: "_SC_XBS5_ILP32_OFFBIG", header: "<unistd.h>".}: cint

   SC_XBS5_LP64_OFF64*{.importc: "_SC_XBS5_LP64_OFF64", header: "<unistd.h>".}: cint

-  SC_XBS5_LPBIG_OFFBIG*{.importc: "_SC_XBS5_LPBIG_OFFBIG", header: "<unistd.h>".}: cint

+  SC_XBS5_LPBIG_OFFBIG*{.importc: "_SC_XBS5_LPBIG_OFFBIG", 
+                         header: "<unistd.h>".}: cint

   SC_XOPEN_CRYPT*{.importc: "_SC_XOPEN_CRYPT", header: "<unistd.h>".}: cint

   SC_XOPEN_ENH_I18N*{.importc: "_SC_XOPEN_ENH_I18N", header: "<unistd.h>".}: cint

   SC_XOPEN_LEGACY*{.importc: "_SC_XOPEN_LEGACY", header: "<unistd.h>".}: cint

   SC_XOPEN_REALTIME*{.importc: "_SC_XOPEN_REALTIME", header: "<unistd.h>".}: cint

-  SC_XOPEN_REALTIME_THREADS*{.importc: "_SC_XOPEN_REALTIME_THREADS", header: "<unistd.h>".}: cint

+  SC_XOPEN_REALTIME_THREADS*{.importc: "_SC_XOPEN_REALTIME_THREADS", 
+                              header: "<unistd.h>".}: cint

   SC_XOPEN_SHM*{.importc: "_SC_XOPEN_SHM", header: "<unistd.h>".}: cint

   SC_XOPEN_STREAMS*{.importc: "_SC_XOPEN_STREAMS", header: "<unistd.h>".}: cint

   SC_XOPEN_UNIX*{.importc: "_SC_XOPEN_UNIX", header: "<unistd.h>".}: cint

   SC_XOPEN_VERSION*{.importc: "_SC_XOPEN_VERSION", header: "<unistd.h>".}: cint

   

-  SEM_FAILED* {.importc, header: "<semaphore.h>".}: cint

+  SEM_FAILED* {.importc, header: "<semaphore.h>".}: pointer

   IPC_CREAT* {.importc, header: "<sys/ipc.h>".}: cint

     ## Create entry if key does not exist.

   IPC_EXCL* {.importc, header: "<sys/ipc.h>".}: cint

@@ -1133,9 +1314,12 @@ var
     ## Lock pages that become mapped.

   MAP_FAILED* {.importc, header: "<sys/mman.h>".}: cint

   POSIX_MADV_NORMAL* {.importc, header: "<sys/mman.h>".}: cint

-    ## The application has no advice to give on its behavior with respect to the specified range. It is the default characteristic if no advice is given for a range of memory.

+    ## The application has no advice to give on its behavior with 
+    ## respect to the specified range. It is the default characteristic 
+    ## if no advice is given for a range of memory.

   POSIX_MADV_SEQUENTIAL* {.importc, header: "<sys/mman.h>".}: cint

-    ## The application expects to access the specified range sequentially from lower addresses to higher addresses.

+    ## The application expects to access the specified range sequentially
+    ## from lower addresses to higher addresses.

   POSIX_MADV_RANDOM* {.importc, header: "<sys/mman.h>".}: cint

     ## The application expects to access the specified range in a random order.

   POSIX_MADV_WILLNEED* {.importc, header: "<sys/mman.h>".}: cint

@@ -1146,20 +1330,19 @@ var
   POSIX_TYPED_MEM_MAP_ALLOCATABLE* {.importc, header: "<sys/mman.h>".}: cint

 

 

-  CLOCKS_PER_SEC* {.importc, header: "<time.h>".}: cint

+  CLOCKS_PER_SEC* {.importc, header: "<time.h>".}: int

     ## A number used to convert the value returned by the clock() function

     ## into seconds.

-  CLOCK_PROCESS_CPUTIME_ID* {.importc, header: "<time.h>".}: cstring

+  CLOCK_PROCESS_CPUTIME_ID* {.importc, header: "<time.h>".}: cint

     ## The identifier of the CPU-time clock associated with the process 

     ## making a clock() or timer*() function call.

-  CLOCK_THREAD_CPUTIME_ID* {.importc, header: "<time.h>".}: cstring

-  CLOCK_REALTIME* {.importc, header: "<time.h>".}: cstring

+  CLOCK_THREAD_CPUTIME_ID* {.importc, header: "<time.h>".}: cint

+  CLOCK_REALTIME* {.importc, header: "<time.h>".}: cint

     ## The identifier of the system-wide realtime clock.

   TIMER_ABSTIME* {.importc, header: "<time.h>".}: cint

-    ## Flag indicating time is absolute. For functions taking timer objects, this refers to the clock associated with the timer. [Option End]

+    ## Flag indicating time is absolute. For functions taking timer 
+    ## objects, this refers to the clock associated with the timer.

   CLOCK_MONOTONIC* {.importc, header: "<time.h>".}: cint

-  daylight* {.importc, header: "<time.h>".}: cint

-  timezone* {.importc, header: "<time.h>".}: int

 

   WNOHANG* {.importc, header: "<sys/wait.h>".}: cint

     ## Do not hang if no status is available; return immediately.

@@ -1258,6 +1441,213 @@ var
   SEEK_SET* {.importc, header: "<unistd.h>".}: cint

   SEEK_CUR* {.importc, header: "<unistd.h>".}: cint

   SEEK_END* {.importc, header: "<unistd.h>".}: cint

+
+  IF_NAMESIZE* {.importc, header: "<net/if.h>".}: cint
+
+  SCM_RIGHTS* {.importc, header: "<sys/socket.h>".}: cint
+    ## Indicates that the data array contains the access rights 
+    ## to be sent or received. 
+
+  SOCK_DGRAM* {.importc, header: "<sys/socket.h>".}: cint ## Datagram socket.
+  SOCK_RAW* {.importc, header: "<sys/socket.h>".}: cint
+    ## Raw Protocol Interface.
+  SOCK_SEQPACKET* {.importc, header: "<sys/socket.h>".}: cint
+    ## Sequenced-packet socket.
+  SOCK_STREAM* {.importc, header: "<sys/socket.h>".}: cint
+    ## Byte-stream socket. 
+    
+  SOL_SOCKET* {.importc, header: "<sys/socket.h>".}: cint
+    ## Options to be accessed at socket level, not protocol level. 
+    
+  SO_ACCEPTCONN* {.importc, header: "<sys/socket.h>".}: cint
+    ## Socket is accepting connections.
+  SO_BROADCAST* {.importc, header: "<sys/socket.h>".}: cint
+    ## Transmission of broadcast messages is supported.
+  SO_DEBUG* {.importc, header: "<sys/socket.h>".}: cint
+    ## Debugging information is being recorded.
+  SO_DONTROUTE* {.importc, header: "<sys/socket.h>".}: cint
+    ## Bypass normal routing.
+  SO_ERROR* {.importc, header: "<sys/socket.h>".}: cint
+    ## Socket error status.
+  SO_KEEPALIVE* {.importc, header: "<sys/socket.h>".}: cint
+    ## Connections are kept alive with periodic messages.
+  SO_LINGER* {.importc, header: "<sys/socket.h>".}: cint
+    ## Socket lingers on close.
+  SO_OOBINLINE* {.importc, header: "<sys/socket.h>".}: cint
+    ## Out-of-band data is transmitted in line.
+  SO_RCVBUF* {.importc, header: "<sys/socket.h>".}: cint
+    ## Receive buffer size.
+  SO_RCVLOWAT* {.importc, header: "<sys/socket.h>".}: cint
+    ## Receive *low water mark*.
+  SO_RCVTIMEO* {.importc, header: "<sys/socket.h>".}: cint
+    ## Receive timeout.
+  SO_REUSEADDR* {.importc, header: "<sys/socket.h>".}: cint
+    ## Reuse of local addresses is supported.
+  SO_SNDBUF* {.importc, header: "<sys/socket.h>".}: cint
+    ## Send buffer size.
+  SO_SNDLOWAT* {.importc, header: "<sys/socket.h>".}: cint
+    ## Send *low water mark*.
+  SO_SNDTIMEO* {.importc, header: "<sys/socket.h>".}: cint
+    ## Send timeout.
+  SO_TYPE* {.importc, header: "<sys/socket.h>".}: cint
+    ## Socket type. 
+      
+  SOMAXCONN* {.importc, header: "<sys/socket.h>".}: cint
+    ## The maximum backlog queue length. 
+    
+  MSG_CTRUNC* {.importc, header: "<sys/socket.h>".}: cint
+    ## Control data truncated.
+  MSG_DONTROUTE* {.importc, header: "<sys/socket.h>".}: cint
+    ## Send without using routing tables.
+  MSG_EOR* {.importc, header: "<sys/socket.h>".}: cint
+    ## Terminates a record (if supported by the protocol).
+  MSG_OOB* {.importc, header: "<sys/socket.h>".}: cint
+    ## Out-of-band data.
+  MSG_PEEK* {.importc, header: "<sys/socket.h>".}: cint
+    ## Leave received data in queue.
+  MSG_TRUNC* {.importc, header: "<sys/socket.h>".}: cint
+    ## Normal data truncated.
+  MSG_WAITALL* {.importc, header: "<sys/socket.h>".}: cint
+    ## Attempt to fill the read buffer. 
+
+  AF_INET* {.importc, header: "<sys/socket.h>".}: cint
+    ## Internet domain sockets for use with IPv4 addresses.
+  AF_INET6* {.importc, header: "<sys/socket.h>".}: cint
+    ## Internet domain sockets for use with IPv6 addresses.
+  AF_UNIX* {.importc, header: "<sys/socket.h>".}: cint
+    ## UNIX domain sockets.
+  AF_UNSPEC* {.importc, header: "<sys/socket.h>".}: cint
+    ## Unspecified. 
+
+  SHUT_RD* {.importc, header: "<sys/socket.h>".}: cint
+    ## Disables further receive operations.
+  SHUT_RDWR* {.importc, header: "<sys/socket.h>".}: cint
+    ## Disables further send and receive operations.
+  SHUT_WR* {.importc, header: "<sys/socket.h>".}: cint
+    ## Disables further send operations. 
+    
+  IPPROTO_IP* {.importc, header: "<netinet/in.h>".}: cint
+    ## Internet protocol.
+  IPPROTO_IPV6* {.importc, header: "<netinet/in.h>".}: cint
+    ## Internet Protocol Version 6.
+  IPPROTO_ICMP* {.importc, header: "<netinet/in.h>".}: cint
+    ## Control message protocol.
+  IPPROTO_RAW* {.importc, header: "<netinet/in.h>".}: cint
+    ## Raw IP Packets Protocol. 
+  IPPROTO_TCP* {.importc, header: "<netinet/in.h>".}: cint
+    ## Transmission control protocol.
+  IPPROTO_UDP* {.importc, header: "<netinet/in.h>".}: cint
+    ## User datagram protocol.
+
+  INADDR_ANY* {.importc, header: "<netinet/in.h>".}: TinAddrScalar
+    ## IPv4 local host address.
+  INADDR_BROADCAST* {.importc, header: "<netinet/in.h>".}: TinAddrScalar
+    ## IPv4 broadcast address.
+
+  INET_ADDRSTRLEN* {.importc, header: "<netinet/in.h>".}: cint
+    ## 16. Length of the string form for IP. 
+
+  IPV6_JOIN_GROUP* {.importc, header: "<netinet/in.h>".}: cint
+    ## Join a multicast group.
+  IPV6_LEAVE_GROUP* {.importc, header: "<netinet/in.h>".}: cint
+    ## Quit a multicast group.
+  IPV6_MULTICAST_HOPS* {.importc, header: "<netinet/in.h>".}: cint
+    ## Multicast hop limit.
+  IPV6_MULTICAST_IF* {.importc, header: "<netinet/in.h>".}: cint
+    ## Interface to use for outgoing multicast packets.
+  IPV6_MULTICAST_LOOP* {.importc, header: "<netinet/in.h>".}: cint
+    ## Multicast packets are delivered back to the local application.
+  IPV6_UNICAST_HOPS* {.importc, header: "<netinet/in.h>".}: cint
+    ## Unicast hop limit.
+  IPV6_V6ONLY* {.importc, header: "<netinet/in.h>".}: cint
+    ## Restrict AF_INET6 socket to IPv6 communications only.
+
+  TCP_NODELAY* {.importc, header: "<netinet/tcp.h>".}: cint
+    ## Avoid coalescing of small segments. 
+
+  IPPORT_RESERVED* {.importc, header: "<netdb.h>".}: cint 
+
+  HOST_NOT_FOUND* {.importc, header: "<netdb.h>".}: cint 
+  NO_DATA* {.importc, header: "<netdb.h>".}: cint 
+  NO_RECOVERY* {.importc, header: "<netdb.h>".}: cint 
+  TRY_AGAIN* {.importc, header: "<netdb.h>".}: cint 
+
+  AI_PASSIVE* {.importc, header: "<netdb.h>".}: cint 
+    ## Socket address is intended for bind().
+  AI_CANONNAME* {.importc, header: "<netdb.h>".}: cint 
+    ## Request for canonical name.
+  AI_NUMERICHOST* {.importc, header: "<netdb.h>".}: cint 
+    ## Return numeric host address as name.
+  AI_NUMERICSERV* {.importc, header: "<netdb.h>".}: cint 
+    ## Inhibit service name resolution.
+  AI_V4MAPPED* {.importc, header: "<netdb.h>".}: cint 
+     ## If no IPv6 addresses are found, query for IPv4 addresses and
+     ## return them to the caller as IPv4-mapped IPv6 addresses.
+  AI_ALL* {.importc, header: "<netdb.h>".}: cint 
+    ## Query for both IPv4 and IPv6 addresses.
+  AI_ADDRCONFIG* {.importc, header: "<netdb.h>".}: cint 
+    ## Query for IPv4 addresses only when an IPv4 address is configured; 
+    ## query for IPv6 addresses only when an IPv6 address is configured.
+
+  NI_NOFQDN* {.importc, header: "<netdb.h>".}: cint 
+    ## Only the nodename portion of the FQDN is returned for local hosts.
+  NI_NUMERICHOST* {.importc, header: "<netdb.h>".}: cint 
+    ## The numeric form of the node's address is returned instead of its name.
+  NI_NAMEREQD* {.importc, header: "<netdb.h>".}: cint 
+    ## Return an error if the node's name cannot be located in the database.
+  NI_NUMERICSERV* {.importc, header: "<netdb.h>".}: cint 
+    ## The numeric form of the service address is returned instead of its name.
+  NI_NUMERICSCOPE* {.importc, header: "<netdb.h>".}: cint 
+    ## For IPv6 addresses, the numeric form of the scope identifier is
+    ## returned instead of its name.
+  NI_DGRAM* {.importc, header: "<netdb.h>".}: cint 
+    ## Indicates that the service is a datagram service (SOCK_DGRAM). 
+
+  EAI_AGAIN* {.importc, header: "<netdb.h>".}: cint 
+    ## The name could not be resolved at this time. Future attempts may succeed.
+  EAI_BADFLAGS* {.importc, header: "<netdb.h>".}: cint 
+    ## The flags had an invalid value.
+  EAI_FAIL* {.importc, header: "<netdb.h>".}: cint 
+    ## A non-recoverable error occurred.
+  EAI_FAMILY* {.importc, header: "<netdb.h>".}: cint 
+    ## The address family was not recognized or the address length 
+    ## was invalid for the specified family.
+  EAI_MEMORY* {.importc, header: "<netdb.h>".}: cint 
+    ## There was a memory allocation failure.
+  EAI_NONAME* {.importc, header: "<netdb.h>".}: cint 
+    ## The name does not resolve for the supplied parameters.
+    ## NI_NAMEREQD is set and the host's name cannot be located, 
+    ## or both nodename and servname were null.
+  EAI_SERVICE* {.importc, header: "<netdb.h>".}: cint 
+    ## The service passed was not recognized for the specified socket type.
+  EAI_SOCKTYPE* {.importc, header: "<netdb.h>".}: cint 
+    ## The intended socket type was not recognized.
+  EAI_SYSTEM* {.importc, header: "<netdb.h>".}: cint 
+    ## A system error occurred. The error code can be found in errno.
+  EAI_OVERFLOW* {.importc, header: "<netdb.h>".}: cint 
+    ## An argument buffer overflowed.
+
+  POLLIN* {.importc, header: "<poll.h>".}: cshort
+    ## Data other than high-priority data may be read without blocking.
+  POLLRDNORM* {.importc, header: "<poll.h>".}: cshort
+    ## Normal data may be read without blocking.
+  POLLRDBAND* {.importc, header: "<poll.h>".}: cshort
+    ## Priority data may be read without blocking.
+  POLLPRI* {.importc, header: "<poll.h>".}: cshort
+    ## High priority data may be read without blocking.
+  POLLOUT* {.importc, header: "<poll.h>".}: cshort
+    ## Normal data may be written without blocking.
+  POLLWRNORM* {.importc, header: "<poll.h>".}: cshort
+    ## Equivalent to POLLOUT.
+  POLLWRBAND* {.importc, header: "<poll.h>".}: cshort
+    ## Priority data may be written.
+  POLLERR* {.importc, header: "<poll.h>".}: cshort
+    ## An error has occurred (revents only).
+  POLLHUP* {.importc, header: "<poll.h>".}: cshort
+    ## Device has been disconnected (revents only).
+  POLLNVAL* {.importc, header: "<poll.h>".}: cshort
+    ## Invalid fd member (revents only). 
+
 

 when hasSpawnh:

   var

@@ -1290,6 +1680,13 @@ proc inet_addr*(a1: cstring): int32 {.importc, header: "<arpa/inet.h>".}
 proc inet_ntoa*(a1: int32): cstring {.importc, header: "<arpa/inet.h>".}

 proc inet_ntop*(a1: cint, a2: pointer, a3: cstring, a4: int32): cstring {.importc, header: "<arpa/inet.h>".}

 proc inet_pton*(a1: cint, a2: cstring, a3: pointer): cint {.importc, header: "<arpa/inet.h>".}

+
+var
+  in6addr_any* {.importc, header: "<netinet/in.h>".}: TIn6Addr
+  in6addr_loopback* {.importc, header: "<netinet/in.h>".}: TIn6Addr
+
+proc IN6ADDR_ANY_INIT* (): TIn6Addr {.importc, header: "<netinet/in.h>".}
+proc IN6ADDR_LOOPBACK_INIT* (): TIn6Addr {.importc, header: "<netinet/in.h>".}
 

 # dirent.h

 proc closedir*(a1: ptr TDIR): cint  {.importc, header: "<dirent.h>".}

@@ -1529,13 +1926,20 @@ proc pthread_setconcurrency*(a1: cint): cint {.importc, header: "<pthread.h>".}
 proc pthread_setschedparam*(a1: Tpthread, a2: cint,

           a3: ptr Tsched_param): cint {.importc, header: "<pthread.h>".}

 

-proc pthread_setschedprio*(a1: Tpthread, a2: cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_setspecific*(a1: Tpthread_key, a2: pointer): cint {.importc, header: "<pthread.h>".}

-proc pthread_spin_destroy*(a1: ptr Tpthread_spinlock): cint {.importc, header: "<pthread.h>".}

-proc pthread_spin_init*(a1: ptr Tpthread_spinlock, a2: cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_spin_lock*(a1: ptr Tpthread_spinlock): cint {.importc, header: "<pthread.h>".}

-proc pthread_spin_trylock*(a1: ptr Tpthread_spinlock): cint{.importc, header: "<pthread.h>".}

-proc pthread_spin_unlock*(a1: ptr Tpthread_spinlock): cint {.importc, header: "<pthread.h>".}

+proc pthread_setschedprio*(a1: Tpthread, a2: cint): cint {.
+  importc, header: "<pthread.h>".}

+proc pthread_setspecific*(a1: Tpthread_key, a2: pointer): cint {.
+  importc, header: "<pthread.h>".}

+proc pthread_spin_destroy*(a1: ptr Tpthread_spinlock): cint {.
+  importc, header: "<pthread.h>".}

+proc pthread_spin_init*(a1: ptr Tpthread_spinlock, a2: cint): cint {.
+  importc, header: "<pthread.h>".}

+proc pthread_spin_lock*(a1: ptr Tpthread_spinlock): cint {.
+  importc, header: "<pthread.h>".}

+proc pthread_spin_trylock*(a1: ptr Tpthread_spinlock): cint{.
+  importc, header: "<pthread.h>".}

+proc pthread_spin_unlock*(a1: ptr Tpthread_spinlock): cint {.
+  importc, header: "<pthread.h>".}

 proc pthread_testcancel*() {.importc, header: "<pthread.h>".}

 

 

@@ -1555,7 +1959,8 @@ proc execl*(a1, a2: cstring): cint {.varargs, importc, header: "<unistd.h>".}
 proc execle*(a1, a2: cstring): cint {.varargs, importc, header: "<unistd.h>".}

 proc execlp*(a1, a2: cstring): cint {.varargs, importc, header: "<unistd.h>".}

 proc execv*(a1: cstring, a2: cstringArray): cint {.importc, header: "<unistd.h>".}

-proc execve*(a1: cstring, a2, a3: cstringArray): cint {.importc, header: "<unistd.h>".}

+proc execve*(a1: cstring, a2, a3: cstringArray): cint {.
+  importc, header: "<unistd.h>".}

 proc execvp*(a1: cstring, a2: cstringArray): cint {.importc, header: "<unistd.h>".}

 proc fchown*(a1: cint, a2: Tuid, a3: Tgid): cint {.importc, header: "<unistd.h>".}

 proc fchdir*(a1: cint): cint {.importc, header: "<unistd.h>".}

@@ -1569,13 +1974,15 @@ proc getegid*(): TGid {.importc, header: "<unistd.h>".}
 proc geteuid*(): TUid {.importc, header: "<unistd.h>".}

 proc getgid*(): TGid {.importc, header: "<unistd.h>".}

 

-proc getgroups*(a1: cint, a2: ptr array[0..255, Tgid]): cint {.importc, header: "<unistd.h>".}

+proc getgroups*(a1: cint, a2: ptr array[0..255, Tgid]): cint {.
+  importc, header: "<unistd.h>".}

 proc gethostid*(): int {.importc, header: "<unistd.h>".}

 proc gethostname*(a1: cstring, a2: int): cint {.importc, header: "<unistd.h>".}

 proc getlogin*(): cstring {.importc, header: "<unistd.h>".}

 proc getlogin_r*(a1: cstring, a2: int): cint {.importc, header: "<unistd.h>".}

 

-proc getopt*(a1: cint, a2: cstringArray, a3: cstring): cint {.importc, header: "<unistd.h>".}

+proc getopt*(a1: cint, a2: cstringArray, a3: cstring): cint {.
+  importc, header: "<unistd.h>".}

 proc getpgid*(a1: Tpid): Tpid {.importc, header: "<unistd.h>".}

 proc getpgrp*(): Tpid {.importc, header: "<unistd.h>".}

 proc getpid*(): Tpid {.importc, header: "<unistd.h>".}

@@ -1594,8 +2001,10 @@ proc pathconf*(a1: cstring, a2: cint): int {.importc, header: "<unistd.h>".}
 

 proc pause*(): cint {.importc, header: "<unistd.h>".}

 proc pipe*(a: array[0..1, cint]): cint {.importc, header: "<unistd.h>".}

-proc pread*(a1: cint, a2: pointer, a3: int, a4: Toff): int {.importc, header: "<unistd.h>".}

-proc pwrite*(a1: cint, a2: pointer, a3: int, a4: Toff): int {.importc, header: "<unistd.h>".}

+proc pread*(a1: cint, a2: pointer, a3: int, a4: Toff): int {.
+  importc, header: "<unistd.h>".}

+proc pwrite*(a1: cint, a2: pointer, a3: int, a4: Toff): int {.
+  importc, header: "<unistd.h>".}

 proc read*(a1: cint, a2: pointer, a3: int): int {.importc, header: "<unistd.h>".}

 proc readlink*(a1, a2: cstring, a3: int): int {.importc, header: "<unistd.h>".}

 

@@ -1619,7 +2028,8 @@ proc tcgetpgrp*(a1: cint): tpid {.importc, header: "<unistd.h>".}
 proc tcsetpgrp*(a1: cint, a2: Tpid): cint {.importc, header: "<unistd.h>".}

 proc truncate*(a1: cstring, a2: Toff): cint {.importc, header: "<unistd.h>".}

 proc ttyname*(a1: cint): cstring {.importc, header: "<unistd.h>".}

-proc ttyname_r*(a1: cint, a2: cstring, a3: int): cint {.importc, header: "<unistd.h>".}

+proc ttyname_r*(a1: cint, a2: cstring, a3: int): cint {.
+  importc, header: "<unistd.h>".}

 proc ualarm*(a1, a2: Tuseconds): Tuseconds {.importc, header: "<unistd.h>".}

 proc unlink*(a1: cstring): cint {.importc, header: "<unistd.h>".}

 proc usleep*(a1: Tuseconds): cint {.importc, header: "<unistd.h>".}

@@ -1628,19 +2038,25 @@ proc write*(a1: cint, a2: pointer, a3: int): int {.importc, header: "<unistd.h>"
 

 proc sem_close*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".}

 proc sem_destroy*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".}

-proc sem_getvalue*(a1: ptr Tsem, a2: var cint): cint {.importc, header: "<semaphore.h>".}

-proc sem_init*(a1: ptr Tsem, a2: cint, a3: cint): cint {.importc, header: "<semaphore.h>".}

-proc sem_open*(a1: cstring, a2: cint): ptr TSem {.varargs, importc, header: "<semaphore.h>".}

+proc sem_getvalue*(a1: ptr Tsem, a2: var cint): cint {.
+  importc, header: "<semaphore.h>".}

+proc sem_init*(a1: ptr Tsem, a2: cint, a3: cint): cint {.
+  importc, header: "<semaphore.h>".}

+proc sem_open*(a1: cstring, a2: cint): ptr TSem {.
+  varargs, importc, header: "<semaphore.h>".}

 proc sem_post*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".}

-proc sem_timedwait*(a1: ptr Tsem, a2: ptr Ttimespec): cint {.importc, header: "<semaphore.h>".}

+proc sem_timedwait*(a1: ptr Tsem, a2: ptr Ttimespec): cint {.
+  importc, header: "<semaphore.h>".}

 proc sem_trywait*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".}

 proc sem_unlink*(a1: cstring): cint {.importc, header: "<semaphore.h>".}

 proc sem_wait*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".}

 

 proc ftok*(a1: cstring, a2: cint): Tkey {.importc, header: "<sys/ipc.h>".}

 

-proc statvfs*(a1: cstring, a2: var Tstatvfs): cint {.importc, header: "<sys/statvfs.h>".}

-proc fstatvfs*(a1: cint, a2: var Tstatvfs): cint {.importc, header: "<sys/statvfs.h>".}

+proc statvfs*(a1: cstring, a2: var Tstatvfs): cint {.
+  importc, header: "<sys/statvfs.h>".}

+proc fstatvfs*(a1: cint, a2: var Tstatvfs): cint {.
+  importc, header: "<sys/statvfs.h>".}

 

 proc chmod*(a1: cstring, a2: TMode): cint {.importc, header: "<sys/stat.h>".}

 proc fchmod*(a1: cint, a2: TMode): cint {.importc, header: "<sys/stat.h>".}

@@ -1648,7 +2064,8 @@ proc fstat*(a1: cint, a2: var Tstat): cint {.importc, header: "<sys/stat.h>".}
 proc lstat*(a1: cstring, a2: var Tstat): cint {.importc, header: "<sys/stat.h>".}

 proc mkdir*(a1: cstring, a2: TMode): cint {.importc, header: "<sys/stat.h>".}

 proc mkfifo*(a1: cstring, a2: TMode): cint {.importc, header: "<sys/stat.h>".}

-proc mknod*(a1: cstring, a2: TMode, a3: Tdev): cint {.importc, header: "<sys/stat.h>".}

+proc mknod*(a1: cstring, a2: TMode, a3: Tdev): cint {.
+  importc, header: "<sys/stat.h>".}

 proc stat*(a1: cstring, a2: var Tstat): cint {.importc, header: "<sys/stat.h>".}

 proc umask*(a1: Tmode): TMode {.importc, header: "<sys/stat.h>".}

 

@@ -1679,30 +2096,40 @@ proc S_TYPEISTMO*(buf: var TStat): bool {.importc, header: "<sys/stat.h>".}
   

 proc mlock*(a1: pointer, a2: int): cint {.importc, header: "<sys/mman.h>".}

 proc mlockall*(a1: cint): cint {.importc, header: "<sys/mman.h>".}

-proc mmap*(a1: pointer, a2: int, a3, a4, a5: cint, a6: Toff): pointer {.importc, header: "<sys/mman.h>".}

-proc mprotect*(a1: pointer, a2: int, a3: cint): cint {.importc, header: "<sys/mman.h>".}

+proc mmap*(a1: pointer, a2: int, a3, a4, a5: cint, a6: Toff): pointer {.
+  importc, header: "<sys/mman.h>".}

+proc mprotect*(a1: pointer, a2: int, a3: cint): cint {.
+  importc, header: "<sys/mman.h>".}

 proc msync*(a1: pointer, a2: int, a3: cint): cint {.importc, header: "<sys/mman.h>".}

 proc munlock*(a1: pointer, a2: int): cint {.importc, header: "<sys/mman.h>".}

 proc munlockall*(): cint {.importc, header: "<sys/mman.h>".}

 proc munmap*(a1: pointer, a2: int): cint {.importc, header: "<sys/mman.h>".}

-proc posix_madvise*(a1: pointer, a2: int, a3: cint): cint {.importc, header: "<sys/mman.h>".}

+proc posix_madvise*(a1: pointer, a2: int, a3: cint): cint {.
+  importc, header: "<sys/mman.h>".}

 proc posix_mem_offset*(a1: pointer, a2: int, a3: var Toff,

            a4: var int, a5: var cint): cint {.importc, header: "<sys/mman.h>".}

-proc posix_typed_mem_get_info*(a1: cint, a2: var Tposix_typed_mem_info): cint {.importc, header: "<sys/mman.h>".}

-proc posix_typed_mem_open*(a1: cstring, a2, a3: cint): cint {.importc, header: "<sys/mman.h>".}

-proc shm_open*(a1: cstring, a2: cint, a3: Tmode): cint {.importc, header: "<sys/mman.h>".}

+proc posix_typed_mem_get_info*(a1: cint, 
+  a2: var Tposix_typed_mem_info): cint {.importc, header: "<sys/mman.h>".}

+proc posix_typed_mem_open*(a1: cstring, a2, a3: cint): cint {.
+  importc, header: "<sys/mman.h>".}

+proc shm_open*(a1: cstring, a2: cint, a3: Tmode): cint {.
+  importc, header: "<sys/mman.h>".}

 proc shm_unlink*(a1: cstring): cint {.importc, header: "<sys/mman.h>".}

 

 proc asctime*(a1: var ttm): cstring{.importc, header: "<time.h>".}

 

 proc asctime_r*(a1: var ttm, a2: cstring): cstring {.importc, header: "<time.h>".}

 proc clock*(): Tclock {.importc, header: "<time.h>".}

-proc clock_getcpuclockid*(a1: tpid, a2: var Tclockid): cint {.importc, header: "<time.h>".}

-proc clock_getres*(a1: Tclockid, a2: var Ttimespec): cint {.importc, header: "<time.h>".}

-proc clock_gettime*(a1: Tclockid, a2: var Ttimespec): cint {.importc, header: "<time.h>".}

+proc clock_getcpuclockid*(a1: tpid, a2: var Tclockid): cint {.
+  importc, header: "<time.h>".}

+proc clock_getres*(a1: Tclockid, a2: var Ttimespec): cint {.
+  importc, header: "<time.h>".}

+proc clock_gettime*(a1: Tclockid, a2: var Ttimespec): cint {.
+  importc, header: "<time.h>".}

 proc clock_nanosleep*(a1: Tclockid, a2: cint, a3: var Ttimespec,

                a4: var Ttimespec): cint {.importc, header: "<time.h>".}

-proc clock_settime*(a1: Tclockid, a2: var Ttimespec): cint {.importc, header: "<time.h>".}

+proc clock_settime*(a1: Tclockid, a2: var Ttimespec): cint {.
+  importc, header: "<time.h>".}

 

 proc ctime*(a1: var Ttime): cstring {.importc, header: "<time.h>".}

 proc ctime_r*(a1: var Ttime, a2: cstring): cstring {.importc, header: "<time.h>".}

@@ -1722,7 +2149,8 @@ proc time*(a1: var Ttime): ttime {.importc, header: "<time.h>".}
 proc timer_create*(a1: var Tclockid, a2: var Tsigevent,

                a3: var Ttimer): cint {.importc, header: "<time.h>".}

 proc timer_delete*(a1: var Ttimer): cint {.importc, header: "<time.h>".}

-proc timer_gettime*(a1: Ttimer, a2: var Titimerspec): cint {.importc, header: "<time.h>".}

+proc timer_gettime*(a1: Ttimer, a2: var Titimerspec): cint {.
+  importc, header: "<time.h>".}

 proc timer_getoverrun*(a1: Ttimer): cint {.importc, header: "<time.h>".}

 proc timer_settime*(a1: Ttimer, a2: cint, a3: var Titimerspec,

                a4: var titimerspec): cint {.importc, header: "<time.h>".}

@@ -1730,16 +2158,21 @@ proc tzset*() {.importc, header: "<time.h>".}
 

 

 proc wait*(a1: var cint): tpid {.importc, header: "<sys/wait.h>".}

-proc waitid*(a1: cint, a2: tid, a3: var Tsiginfo, a4: cint): cint {.importc, header: "<sys/wait.h>".}

-proc waitpid*(a1: tpid, a2: var cint, a3: cint): tpid  {.importc, header: "<sys/wait.h>".}

+proc waitid*(a1: cint, a2: tid, a3: var Tsiginfo, a4: cint): cint {.
+  importc, header: "<sys/wait.h>".}

+proc waitpid*(a1: tpid, a2: var cint, a3: cint): tpid  {.
+  importc, header: "<sys/wait.h>".}

 

-proc bsd_signal*(a1: cint, a2: proc (x: pointer) {.noconv.}) {.importc, header: "<signal.h>".}

+proc bsd_signal*(a1: cint, a2: proc (x: pointer) {.noconv.}) {.
+  importc, header: "<signal.h>".}

 proc kill*(a1: Tpid, a2: cint): cint {.importc, header: "<signal.h>".}

 proc killpg*(a1: Tpid, a2: cint): cint {.importc, header: "<signal.h>".}

 proc pthread_kill*(a1: tpthread, a2: cint): cint {.importc, header: "<signal.h>".}

-proc pthread_sigmask*(a1: cint, a2, a3: var Tsigset): cint {.importc, header: "<signal.h>".}

+proc pthread_sigmask*(a1: cint, a2, a3: var Tsigset): cint {.
+  importc, header: "<signal.h>".}

 proc `raise`*(a1: cint): cint {.importc, header: "<signal.h>".}

-proc sigaction*(a1: cint, a2, a3: var Tsigaction): cint {.importc, header: "<signal.h>".}

+proc sigaction*(a1: cint, a2, a3: var Tsigaction): cint {.
+  importc, header: "<signal.h>".}

 proc sigaddset*(a1: var Tsigset, a2: cint): cint {.importc, header: "<signal.h>".}

 proc sigaltstack*(a1, a2: var Tstack): cint {.importc, header: "<signal.h>".}

 proc sigdelset*(a1: var Tsigset, a2: cint): cint {.importc, header: "<signal.h>".}

@@ -1749,36 +2182,47 @@ proc sighold*(a1: cint): cint {.importc, header: "<signal.h>".}
 proc sigignore*(a1: cint): cint {.importc, header: "<signal.h>".}

 proc siginterrupt*(a1, a2: cint): cint {.importc, header: "<signal.h>".}

 proc sigismember*(a1: var Tsigset, a2: cint): cint {.importc, header: "<signal.h>".}

-proc signal*(a1: cint, a2: proc (x: cint) {.noconv.}) {.importc, header: "<signal.h>".}

+proc signal*(a1: cint, a2: proc (x: cint) {.noconv.}) {.
+  importc, header: "<signal.h>".}

 proc sigpause*(a1: cint): cint {.importc, header: "<signal.h>".}

 proc sigpending*(a1: var tsigset): cint {.importc, header: "<signal.h>".}

-proc sigprocmask*(a1: cint, a2, a3: var tsigset): cint {.importc, header: "<signal.h>".}

-proc sigqueue*(a1: tpid, a2: cint, a3: Tsigval): cint {.importc, header: "<signal.h>".}

+proc sigprocmask*(a1: cint, a2, a3: var tsigset): cint {.
+  importc, header: "<signal.h>".}

+proc sigqueue*(a1: tpid, a2: cint, a3: Tsigval): cint {.
+  importc, header: "<signal.h>".}

 proc sigrelse*(a1: cint): cint {.importc, header: "<signal.h>".}

 proc sigset*(a1: int, a2: proc (x: cint) {.noconv.}) {.importc, header: "<signal.h>".}

 proc sigsuspend*(a1: var Tsigset): cint {.importc, header: "<signal.h>".}

-proc sigtimedwait*(a1: var Tsigset, a2: var tsiginfo, a3: var ttimespec): cint {.importc, header: "<signal.h>".}

+proc sigtimedwait*(a1: var Tsigset, a2: var tsiginfo, 
+                   a3: var ttimespec): cint {.importc, header: "<signal.h>".}

 proc sigwait*(a1: var Tsigset, a2: var cint): cint {.importc, header: "<signal.h>".}

-proc sigwaitinfo*(a1: var Tsigset, a2: var tsiginfo): cint {.importc, header: "<signal.h>".}

+proc sigwaitinfo*(a1: var Tsigset, a2: var tsiginfo): cint {.
+  importc, header: "<signal.h>".}

 

 

 proc catclose*(a1: Tnl_catd): cint {.importc, header: "<nl_types.h>".}

-proc catgets*(a1: Tnl_catd, a2, a3: cint, a4: cstring): cstring {.importc, header: "<nl_types.h>".}

+proc catgets*(a1: Tnl_catd, a2, a3: cint, a4: cstring): cstring {.
+  importc, header: "<nl_types.h>".}

 proc catopen*(a1: cstring, a2: cint): Tnl_catd {.importc, header: "<nl_types.h>".}

 

 proc sched_get_priority_max*(a1: cint): cint {.importc, header: "<sched.h>".}

 proc sched_get_priority_min*(a1: cint): cint {.importc, header: "<sched.h>".}

-proc sched_getparam*(a1: tpid, a2: var Tsched_param): cint {.importc, header: "<sched.h>".}

+proc sched_getparam*(a1: tpid, a2: var Tsched_param): cint {.
+  importc, header: "<sched.h>".}

 proc sched_getscheduler*(a1: tpid): cint {.importc, header: "<sched.h>".}

-proc sched_rr_get_interval*(a1: tpid, a2: var Ttimespec): cint {.importc, header: "<sched.h>".}

-proc sched_setparam*(a1: tpid, a2: var Tsched_param): cint {.importc, header: "<sched.h>".}

-proc sched_setscheduler*(a1: tpid, a2: cint, a3: var tsched_param): cint {.importc, header: "<sched.h>".}

+proc sched_rr_get_interval*(a1: tpid, a2: var Ttimespec): cint {.
+  importc, header: "<sched.h>".}

+proc sched_setparam*(a1: tpid, a2: var Tsched_param): cint {.
+  importc, header: "<sched.h>".}

+proc sched_setscheduler*(a1: tpid, a2: cint, a3: var tsched_param): cint {.
+  importc, header: "<sched.h>".}

 proc sched_yield*(): cint {.importc, header: "<sched.h>".}

 

 proc strerror*(errnum: cint): cstring {.importc, header: "<string.h>".}

 

 proc FD_CLR*(a1: cint, a2: var Tfd_set) {.importc, header: "<sys/select.h>".}

-proc FD_ISSET*(a1: cint, a2: var Tfd_set): cint {.importc, header: "<sys/select.h>".}

+proc FD_ISSET*(a1: cint, a2: var Tfd_set): cint {.
+  importc, header: "<sys/select.h>".}

 proc FD_SET*(a1: cint, a2: var Tfd_set) {.importc, header: "<sys/select.h>".}

 proc FD_ZERO*(a1: var Tfd_set) {.importc, header: "<sys/select.h>".}

 

@@ -1790,16 +2234,21 @@ proc select*(a1: cint, a2, a3, a4: var Tfd_set, a5: var ttimeval): cint {.
 when hasSpawnH:

   proc posix_spawn*(a1: var tpid, a2: cstring,

             a3: var Tposix_spawn_file_actions,

-            a4: var Tposix_spawnattr, a5, a6: cstringArray): cint {.importc, header: "<spawn.h>".}

+            a4: var Tposix_spawnattr, 
+            a5, a6: cstringArray): cint {.importc, header: "<spawn.h>".}

   proc posix_spawn_file_actions_addclose*(a1: var tposix_spawn_file_actions,

             a2: cint): cint {.importc, header: "<spawn.h>".}

   proc posix_spawn_file_actions_adddup2*(a1: var tposix_spawn_file_actions,

             a2, a3: cint): cint {.importc, header: "<spawn.h>".}

   proc posix_spawn_file_actions_addopen*(a1: var tposix_spawn_file_actions,

-            a2: cint, a3: cstring, a4: cint, a5: tmode): cint {.importc, header: "<spawn.h>".}

-  proc posix_spawn_file_actions_destroy*(a1: var tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".}

-  proc posix_spawn_file_actions_init*(a1: var tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".}

-  proc posix_spawnattr_destroy*(a1: var tposix_spawnattr): cint {.importc, header: "<spawn.h>".}

+            a2: cint, a3: cstring, a4: cint, a5: tmode): cint {.
+            importc, header: "<spawn.h>".}

+  proc posix_spawn_file_actions_destroy*(
+    a1: var tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".}

+  proc posix_spawn_file_actions_init*(
+    a1: var tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".}

+  proc posix_spawnattr_destroy*(a1: var tposix_spawnattr): cint {.
+    importc, header: "<spawn.h>".}

   proc posix_spawnattr_getsigdefault*(a1: var tposix_spawnattr,

             a2: var Tsigset): cint {.importc, header: "<spawn.h>".}

   proc posix_spawnattr_getflags*(a1: var tposix_spawnattr,

@@ -1813,15 +2262,20 @@ when hasSpawnH:
   proc posix_spawnattr_getsigmask*(a1: var tposix_spawnattr,

             a2: var tsigset): cint {.importc, header: "<spawn.h>".}

   

-  proc posix_spawnattr_init*(a1: var tposix_spawnattr): cint {.importc, header: "<spawn.h>".}

+  proc posix_spawnattr_init*(a1: var tposix_spawnattr): cint {.
+    importc, header: "<spawn.h>".}

   proc posix_spawnattr_setsigdefault*(a1: var tposix_spawnattr,

             a2: var tsigset): cint {.importc, header: "<spawn.h>".}

-  proc posix_spawnattr_setflags*(a1: var tposix_spawnattr, a2: cshort): cint {.importc, header: "<spawn.h>".}

-  proc posix_spawnattr_setpgroup*(a1: var tposix_spawnattr, a2: tpid): cint {.importc, header: "<spawn.h>".}

+  proc posix_spawnattr_setflags*(a1: var tposix_spawnattr, a2: cshort): cint {.
+    importc, header: "<spawn.h>".}

+  proc posix_spawnattr_setpgroup*(a1: var tposix_spawnattr, a2: tpid): cint {.
+    importc, header: "<spawn.h>".}

   

   proc posix_spawnattr_setschedparam*(a1: var tposix_spawnattr,

             a2: var tsched_param): cint {.importc, header: "<spawn.h>".}

-  proc posix_spawnattr_setschedpolicy*(a1: var tposix_spawnattr, a2: cint): cint {.importc, header: "<spawn.h>".}

+  proc posix_spawnattr_setschedpolicy*(a1: var tposix_spawnattr, 
+                                       a2: cint): cint {.
+                                       importc, header: "<spawn.h>".}

   proc posix_spawnattr_setsigmask*(a1: var tposix_spawnattr,

             a2: var tsigset): cint {.importc, header: "<spawn.h>".}

   proc posix_spawnp*(a1: var tpid, a2: cstring,

@@ -1830,6 +2284,149 @@ when hasSpawnH:
             a5, a6: cstringArray): cint {.importc, header: "<spawn.h>".}

 

 proc getcontext*(a1: var Tucontext): cint {.importc, header: "<ucontext.h>".}

-proc makecontext*(a1: var Tucontext, a4: proc (){.noconv.}, a3: cint) {.varargs, importc, header: "<ucontext.h>".}

+proc makecontext*(a1: var Tucontext, a4: proc (){.noconv.}, a3: cint) {.
+  varargs, importc, header: "<ucontext.h>".}

 proc setcontext*(a1: var Tucontext): cint {.importc, header: "<ucontext.h>".}

 proc swapcontext*(a1, a2: var Tucontext): cint {.importc, header: "<ucontext.h>".}

+proc if_nametoindex*(a1: cstring): cint {.importc, header: "<net/if.h>".}
+proc if_indextoname*(a1: cint, a2: cstring): cstring {.
+  importc, header: "<net/if.h>".}
+proc if_nameindex*(): ptr Tif_nameindex {.importc, header: "<net/if.h>".}
+proc if_freenameindex*(a1: ptr Tif_nameindex) {.importc, header: "<net/if.h>".}
+
+proc readv*(a1: cint, a2: ptr TIOVec, a3: cint): int {.
+  importc, header: "<sys/uio.h>".}
+proc writev*(a1: cint, a2: ptr TIOVec, a3: cint): int {.
+  importc, header: "<sys/uio.h>".}
+
+proc CMSG_DATA*(cmsg: ptr Tcmsghdr): cstring {.
+  importc, header: "<sys/socket.h>".}
+
+proc CMSG_NXTHDR*(mhdr: ptr TMsgHdr, cmsg: ptr TCMsgHdr): ptr TCmsgHdr {.
+  importc, header: "<sys/socket.h>".}
+
+proc CMSG_FIRSTHDR*(mhdr: ptr TMsgHdr): ptr TCMsgHdr {.
+  importc, header: "<sys/socket.h>".}
+
+proc accept*(a1: cint, a2: ptr Tsockaddr, a3: ptr Tsocklen): cint {.
+  importc, header: "<sys/socket.h>".}
+
+proc bind*(a1: cint, a2: ptr Tsockaddr, a3: Tsocklen): cint {.
+  importc, header: "<sys/socket.h>".}
+  
+proc connect*(a1: cint, a2: ptr Tsockaddr, a3: Tsocklen): cint {.
+  importc, header: "<sys/socket.h>".}
+proc getpeername*(a1: cint, a2: ptr Tsockaddr, a3: ptr Tsocklen): cint {.
+  importc, header: "<sys/socket.h>".}
+proc getsockname*(a1: cint, a2: ptr Tsockaddr, a3: ptr Tsocklen): cint {.
+  importc, header: "<sys/socket.h>".}
+
+proc getsockopt*(a1, a2, a3: cint, a4: pointer, a5: ptr Tsocklen): cint {.
+  importc, header: "<sys/socket.h>".}
+
+proc listen*(a1, a2: cint): cint {.
+  importc, header: "<sys/socket.h>".}
+proc recv*(a1: cint, a2: pointer, a3: int, a4: cint): int {.
+  importc, header: "<sys/socket.h>".}
+proc recvfrom*(a1: cint, a2: pointer, a3: int, a4: cint,
+        a5: ptr Tsockaddr, a6: ptr Tsocklen): int {.
+  importc, header: "<sys/socket.h>".}
+proc recvmsg*(a1: cint, a2: ptr Tmsghdr, a3: cint): int {.
+  importc, header: "<sys/socket.h>".}
+proc send*(a1: cint, a2: pointer, a3: int, a4: cint): int {.
+  importc, header: "<sys/socket.h>".}
+proc sendmsg*(a1: cint, a2: ptr Tmsghdr, a3: cint): int {.
+  importc, header: "<sys/socket.h>".}
+proc sendto*(a1: cint, a2: pointer, a3: int, a4: cint, a5: ptr Tsockaddr,
+             a6: Tsocklen): int {.
+  importc, header: "<sys/socket.h>".}
+proc setsockopt*(a1, a2, a3: cint, a4: pointer, a5: Tsocklen): cint {.
+  importc, header: "<sys/socket.h>".}
+proc shutdown*(a1, a2: cint): cint {.
+  importc, header: "<sys/socket.h>".}
+proc socket*(a1, a2, a3: cint): cint {.
+  importc, header: "<sys/socket.h>".}
+proc sockatmark*(a1: cint): cint {.
+  importc, header: "<sys/socket.h>".}
+proc socketpair*(a1, a2, a3: cint, a4: var array[0..1, cint]): cint {.
+  importc, header: "<sys/socket.h>".}
+
+proc IN6_IS_ADDR_UNSPECIFIED* (a1: ptr TIn6Addr): cint {.
+  importc, header: "<netinet/in.h>".}
+  ## Unspecified address.
+proc IN6_IS_ADDR_LOOPBACK* (a1: ptr TIn6Addr): cint {.
+  importc, header: "<netinet/in.h>".}
+  ## Loopback address.
+proc IN6_IS_ADDR_MULTICAST* (a1: ptr TIn6Addr): cint {.
+  importc, header: "<netinet/in.h>".}
+  ## Multicast address.
+proc IN6_IS_ADDR_LINKLOCAL* (a1: ptr TIn6Addr): cint {.
+  importc, header: "<netinet/in.h>".}
+  ## Unicast link-local address.
+proc IN6_IS_ADDR_SITELOCAL* (a1: ptr TIn6Addr): cint {.
+  importc, header: "<netinet/in.h>".}
+  ## Unicast site-local address.
+proc IN6_IS_ADDR_V4MAPPED* (a1: ptr TIn6Addr): cint {.
+  importc, header: "<netinet/in.h>".}
+  ## IPv4 mapped address.
+proc IN6_IS_ADDR_V4COMPAT* (a1: ptr TIn6Addr): cint {.
+  importc, header: "<netinet/in.h>".}
+  ## IPv4-compatible address.
+proc IN6_IS_ADDR_MC_NODELOCAL* (a1: ptr TIn6Addr): cint {.
+  importc, header: "<netinet/in.h>".}
+  ## Multicast node-local address.
+proc IN6_IS_ADDR_MC_LINKLOCAL* (a1: ptr TIn6Addr): cint {.
+  importc, header: "<netinet/in.h>".}
+  ## Multicast link-local address.
+proc IN6_IS_ADDR_MC_SITELOCAL* (a1: ptr TIn6Addr): cint {.
+  importc, header: "<netinet/in.h>".}
+  ## Multicast site-local address.
+proc IN6_IS_ADDR_MC_ORGLOCAL* (a1: ptr TIn6Addr): cint {.
+  importc, header: "<netinet/in.h>".}
+  ## Multicast organization-local address.
+proc IN6_IS_ADDR_MC_GLOBAL* (a1: ptr TIn6Addr): cint {.
+  importc, header: "<netinet/in.h>".}
+  ## Multicast global address.
+
+proc endhostent*() {.importc, header: "<netdb.h>".}
+proc endnetent*() {.importc, header: "<netdb.h>".}
+proc endprotoent*() {.importc, header: "<netdb.h>".}
+proc endservent*() {.importc, header: "<netdb.h>".}
+proc freeaddrinfo*(a1: ptr Taddrinfo) {.importc, header: "<netdb.h>".}
+
+proc gai_strerror*(a1: cint): cstring {.importc, header: "<netdb.h>".}
+
+proc getaddrinfo*(a1, a2: cstring, a3: ptr TAddrInfo, 
+                  a4: var ptr TAddrInfo): cint {.importc, header: "<netdb.h>".}
+                  
+proc gethostbyaddr*(a1: pointer, a2: Tsocklen, a3: cint): ptr THostent {.
+                    importc, header: "<netdb.h>".}
+proc gethostbyname*(a1: cstring): ptr THostent {.importc, header: "<netdb.h>".}
+proc gethostent*(): ptr THostent {.importc, header: "<netdb.h>".}
+
+proc getnameinfo*(a1: ptr Tsockaddr, a2: Tsocklen,
+                  a3: cstring, a4: Tsocklen, a5: cstring,
+                  a6: Tsocklen, a7: cint): cint {.importc, header: "<netdb.h>".}
+
+proc getnetbyaddr*(a1: int32, a2: cint): ptr TNetent {.importc, header: "<netdb.h>".}
+proc getnetbyname*(a1: cstring): ptr TNetent {.importc, header: "<netdb.h>".}
+proc getnetent*(): ptr TNetent {.importc, header: "<netdb.h>".}
+
+proc getprotobyname*(a1: cstring): ptr TProtoent {.importc, header: "<netdb.h>".}
+proc getprotobynumber*(a1: cint): ptr TProtoent {.importc, header: "<netdb.h>".}
+proc getprotoent*(): ptr TProtoent {.importc, header: "<netdb.h>".}
+
+proc getservbyname*(a1, a2: cstring): ptr TServent {.importc, header: "<netdb.h>".}
+proc getservbyport*(a1: cint, a2: cstring): ptr TServent {.
+  importc, header: "<netdb.h>".}
+proc getservent*(): ptr TServent {.importc, header: "<netdb.h>".}
+
+proc sethostent*(a1: cint) {.importc, header: "<netdb.h>".}
+proc setnetent*(a1: cint) {.importc, header: "<netdb.h>".}
+proc setprotoent*(a1: cint) {.importc, header: "<netdb.h>".}
+proc setservent*(a1: cint) {.importc, header: "<netdb.h>".}
+
+proc poll*(a1: ptr Tpollfd, a2: Tnfds, a3: int): cint {.
+  importc, header: "<poll.h>".}
+
+