]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/posix-pipe: Give name to opened pipes
authorAndrei Tatar <andrei@unikraft.io>
Wed, 25 Sep 2024 15:35:41 +0000 (17:35 +0200)
committerUnikraft Bot <monkey@unikraft.io>
Tue, 25 Feb 2025 07:58:01 +0000 (07:58 +0000)
This change names newly opened pipes "pipe:read" or "pipe:write",
depending on which end it is.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
GitHub-Closes: #1592

lib/posix-pipe/pipe.c

index dc8006600ea2fd88d1ac09e931cf4c30c201218c..3ee53cf2aa4d8c1e332282a8fc9e0edab6aab0c0 100644 (file)
 
 static const char PIPE_VOLID[] = "pipe_vol";
 
+#define PIPE_R_FNAME "pipe:read"
+#define PIPE_R_FNAME_LEN (sizeof(PIPE_R_FNAME) - 1)
+
+#define PIPE_W_FNAME "pipe:write"
+#define PIPE_W_FNAME_LEN (sizeof(PIPE_W_FNAME) - 1)
+
 typedef __u32 pipeidx;
 
 struct pipe_msg {
@@ -428,13 +434,15 @@ int uk_sys_pipe(int pipefd[2], int flags)
                return r;
 
        oflags = (flags & _OPEN_FLAGS) | UKFD_O_NOSEEK;
-       r = uk_fdtab_open(pipes[0], O_RDONLY|oflags);
+       r = uk_fdtab_open_named(pipes[0], O_RDONLY | oflags,
+                               PIPE_R_FNAME, PIPE_R_FNAME_LEN);
        if (unlikely(r < 0))
                goto err_free;
 
        rpipe = r;
 
-       r = uk_fdtab_open(pipes[1], O_WRONLY|oflags);
+       r = uk_fdtab_open_named(pipes[1], O_WRONLY | oflags,
+                               PIPE_W_FNAME, PIPE_W_FNAME_LEN);
        if (unlikely(r < 0))
                goto err_close;