liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit a116fe084af552981faebd94aa18e11dd2c8e56a
parent 74cf3e0711db0bea8d02a98da37c5afd780c0aa4
Author: Daniel Barlow <dan@telent.net>
Date:   Fri, 26 Apr 2024 16:48:51 +0100

devout: use socket constants from anoia.net.constants

Diffstat:
Mpkgs/devout/devout.fnl | 15++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/pkgs/devout/devout.fnl b/pkgs/devout/devout.fnl @@ -1,4 +1,11 @@ (local ll (require :lualinux)) +(local { + : AF_LOCAL + : AF_NETLINK + : SOCK_STREAM + : SOCK_RAW + : NETLINK_KOBJECT_UEVENT + } (require :anoia.net.constants)) (local { : view } (require :fennel)) (fn trace [expr] @@ -59,15 +66,9 @@ (local POLLHUP 0x0010) (local POLLNVAL 0x0020) -(local AF_LOCAL 1) -(local AF_NETLINK 16) -(local SOCK_STREAM 1) -(local SOCK_DGRAM 2) -(local SOCK_RAW 3) -(local NETLINK_KOBJECT_UEVENT 15) (fn unix-socket [name] - (let [addr (.. "\1\0" name "\0\0\0\0\0")] + (let [addr (string.pack "=Hz" AF_LOCAL name)] (match (ll.socket AF_LOCAL SOCK_STREAM 0) fd (match (ll.bind fd addr) 0 (doto fd (ll.listen 32))