Zebediah Figura (@zfigura) commented about server/named_pipe.c:
if (!name) return NULL; /* open the device itself */
- if (name->str && !name->len)
- {
/* root directory: last component is empty ("\\Device\\NamedPipe\\") */
struct named_pipe_device_file *dir = alloc_object( &named_pipe_device_file_ops );
if (!dir) return NULL;
dir->is_rootdir = 1;
dir->fd = NULL; /* defer alloc_pseudo_fd() until after we have options */
dir->device = (struct named_pipe_device *)grab_object( obj );
return &dir->obj;
This on the other hand bothers me. Maybe my intuition as to what's sensible design is off, but creating an object from lookup_name() feels wrong, especially given that we have to defer creating the fd.
I guess the right solution here is to combine lookup_name() and open_file(), presumably using OBJ_OPENIF to distinguish the two.
Or possibly the right solution is to create (ahead of time) a separate named pipe "device" that represents the root directory, but I'm not thrilled about that idea; it feels less architecturally clear to me.