diff options
author | Dominik Picheta <dominikpicheta@gmail.com> | 2016-05-30 09:38:37 +0100 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@gmail.com> | 2016-05-30 09:38:37 +0100 |
commit | a484e3f8c214145eb36759792f8052a7f01ed396 (patch) | |
tree | 5af34245a1657888d89b9aeed57abe539fdc704d /lib/posix | |
parent | 3e8413d2a19410769e87290c6b7379c2b9dabc2d (diff) | |
parent | b662d22ad181fae7fb0e9efc44fe3563406b236e (diff) | |
download | Nim-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.nim | 13 |
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 |