summary refs log tree commit diff stats
path: root/lib/posix
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@gmail.com>2016-05-30 09:38:37 +0100
committerDominik Picheta <dominikpicheta@gmail.com>2016-05-30 09:38:37 +0100
commita484e3f8c214145eb36759792f8052a7f01ed396 (patch)
tree5af34245a1657888d89b9aeed57abe539fdc704d /lib/posix
parent3e8413d2a19410769e87290c6b7379c2b9dabc2d (diff)
parentb662d22ad181fae7fb0e9efc44fe3563406b236e (diff)
downloadNim-a484e3f8c214145eb36759792f8052a7f01ed396.tar.gz
Merge branch 'unix-sockets' of https://github.com/girvo/Nim into girvo-unix-sockets
Diffstat (limited to 'lib/posix')
-rw-r--r--lib/posix/posix.nim13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim
index e7d5ac8a6..bb42d6902 100644
--- a/lib/posix/posix.nim
+++ b/lib/posix/posix.nim
@@ -448,6 +448,14 @@ when hasSpawnH:
     Tposix_spawn_file_actions* {.importc: "posix_spawn_file_actions_t",
                                  header: "<spawn.h>", final, pure.} = object
 
+when defined(linux):
+  # from sys/un.h
+  const Sockaddr_un_path_length* = 108
+else:
+  # according to http://pubs.opengroup.org/onlinepubs/009604499/basedefs/sys/un.h.html
+  # this is >=92
+  const Sockaddr_un_path_length* = 92
+
 type
   Socklen* {.importc: "socklen_t", header: "<sys/socket.h>".} = cuint
   TSa_Family* {.importc: "sa_family_t", header: "<sys/socket.h>".} = cint
@@ -457,6 +465,11 @@ type
     sa_family*: TSa_Family         ## Address family.
     sa_data*: array [0..255, char] ## Socket address (variable-length data).
 
+  Sockaddr_un* {.importc: "struct sockaddr_un", header: "<sys/un.h>",
+              pure, final.} = object ## struct sockaddr_un
+    sun_family*: TSa_Family         ## Address family.
+    sun_path*: array [0..Sockaddr_un_path_length-1, char] ## Socket path
+
   Sockaddr_storage* {.importc: "struct sockaddr_storage",
                        header: "<sys/socket.h>",
                        pure, final.} = object ## struct sockaddr_storage