From a116fe084af552981faebd94aa18e11dd2c8e56a Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Fri, 26 Apr 2024 16:48:51 +0100 Subject: [PATCH] devout: use socket constants from anoia.net.constants --- pkgs/devout/devout.fnl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkgs/devout/devout.fnl b/pkgs/devout/devout.fnl index 4e5b8ca..368feb8 100644 --- 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))