Linux-kernel mailing list archive 2000-06,: file descriptor manipulation

# file descriptor manipulation

Shay Rojansky (roji@bezeqint.net)
Wed, 9 Feb 2000 08:53:22 +0200 (IST)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Harold Oga: "Re: Problems with USB from late 2.3.x kernels and BP6 in MPS 1.4 mode"
- Previous message: Alexander Viro: "[CFT][PATCH] loopback fixes for 2.3"

Hi.

At some point I had a background process running and didn't have access to
its tty (accidentally closed the xterm). So I thought about writing a way
for a process's owner to directly control the process's file descriptor
table.

The idea is for a program to open some sort of file (say
/proc/<pid>/fdctl) and be able to say "replace <pid>'s third file
descriptor with my sixth file descriptor". The kernel would close <pid>'s
third file descriptor, and then make it point to the same file structure
as current's 6th pid.

This would be done by a user-level program (say 'fdctl') which we would
use to open an existing file and assign the file structure for that file
to any other process.

This can go the other way around - we could get a file descriptor pointing
to another running process's file structure, and be able to snoop on what
that process is doing with that file (to a very limited extent).

Again, the most useful feature that comes to mind is to assign a
background's process stdout to an xterm, but other applications might come
along.

I've already written part of this, and I was wondering whether someone has
already done it, or is interested. I am also not sure as to the /proc API
needed (writing to /proc/<pid>/fdctl? ioctl?)

Please cc to me as I'm not subscribed to the list... :)

    ---
    Shay Rojansky

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

- Next message: Harold Oga: "Re: Problems with USB from late 2.3.x kernels and BP6 in MPS 1.4 mode"
- Previous message: Alexander Viro: "[CFT][PATCH] loopback fixes for 2.3"