AF_UNIX SEQPACKET/DGRAM, writable /dev overlay, uevent netlink socket; eudev packages

udevd now starts, reads its rules and listens. Still to come: the sysfs
device tree and writable uevent files so a trigger has something to replay.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EVRhxi9zpdW2uDUN4FVcao
This commit is contained in:
Nexoniarz 2026-10-26 09:51:41 +01:00
commit a9f8cb7e0f
7 changed files with 457 additions and 40 deletions

View file

@ -539,6 +539,10 @@ int socknl_copy(struct socket*, uint, char*, int);
void socknl_take(struct socket*, uint);
int sock_shutdown(struct socket*, int how);
int sockpair(struct socket **a, struct socket **b);
int sockpair_type(struct socket **a, struct socket **b, int type);
int sock_is_packet(struct socket *s);
int sock_netlink_bind(struct socket *s, uint groups);
void uevent_send(uint groups, const char *msg, int len, struct socket *from);
const char* sockname(struct socket*);
// AF_INET addressing. Separate from sockbind/sockconnect because the families
// do not name the same kind of thing; `addr` and `port` are network order.

View file

@ -24,10 +24,14 @@
#define AF_NETLINK 16
#define PF_NETLINK AF_NETLINK
#define NETLINK_ROUTE 0
#define NETLINK_KOBJECT_UEVENT 15
#define UEVENT_GROUP_KERNEL 1 // what the kernel announces
#define UEVENT_GROUP_UDEV 2 // what udevd re-announces after its rules
#define SOCK_STREAM 1
#define SOCK_DGRAM 2
#define SOCK_RAW 3
#define SOCK_SEQPACKET 5
// Flags ORed into socket()'s and accept4()'s `type`/`flags` argument. Linux's
// values, because a musl program passes Linux's constants.
@ -337,6 +341,10 @@ struct socket {
char data[SOCKBUF];
uint nread, nwrite;
// AF_NETLINK only: which protocol, and the multicast groups bound.
int nlproto;
uint nlgroups;
// Connections waiting to be accepted, on a listener.
struct socket *queue[NBACKLOG];
int nqueue;