udev works: /sys device tree, uevent netlink, datagram sockets with per-message credentials
Kernel devices (input, mem, tty, graphics, block) get /sys/devices/virtual entries with dev/uevent/subsystem, /sys/class and /sys/dev links, input capabilities, and writable uevent files that announce on the netlink socket. eudev now runs, processes a full trigger and settles. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EVRhxi9zpdW2uDUN4FVcao
This commit is contained in:
parent
a9f8cb7e0f
commit
5d4d318ebf
10 changed files with 813 additions and 37 deletions
|
|
@ -274,6 +274,25 @@ static int
|
|||
devfs_read(struct inode *ip, int u, uint64 d, uint64 o, uint n)
|
||||
{
|
||||
int x = extra_of(ip->inum);
|
||||
// mkdir lays down the "." and ".." of a v1-style directory by reading and
|
||||
// rewriting its first two entries (build_dir_tree). A directory here has
|
||||
// none stored, so the read gives zeros and the write is swallowed.
|
||||
if (x >= 0 && ip->type == T_DIR) {
|
||||
char z[64];
|
||||
memset(z, 0, sizeof z);
|
||||
for (uint done = 0; done < n; ) {
|
||||
uint c = n - done < sizeof z ? n - done : (uint)sizeof z;
|
||||
if (u) {
|
||||
if (copy_to_user(d + done, z, c) < 0)
|
||||
return -EFAULT;
|
||||
} else {
|
||||
memmove((char *)d + done, z, c);
|
||||
}
|
||||
done += c;
|
||||
}
|
||||
(void)o;
|
||||
return (int)n;
|
||||
}
|
||||
if (x < 0 || ip->type != T_SYMLINK)
|
||||
return -1;
|
||||
extras_init();
|
||||
|
|
@ -300,6 +319,8 @@ static int
|
|||
devfs_write(struct inode *ip, int u, uint64 s, uint64 o, uint n)
|
||||
{
|
||||
int x = extra_of(ip->inum);
|
||||
if (x >= 0 && ip->type == T_DIR)
|
||||
return (int)n; // see devfs_read
|
||||
if (x < 0 || ip->type != T_SYMLINK || o != 0 || n >= EXTRA_TARGET)
|
||||
return -1;
|
||||
extras_init();
|
||||
|
|
|
|||
Loading…
Reference in a new issue