Re: Can I open a special file with major/minor instead of name?

Dave Cinege (dcinege@psychosis.com)
Mon, 15 Jun 1998 17:54:35 -0400


Richard Gooch wrote:
>
>
> You probably should use <get_empty_filp> in fs/file_table.c
>

AHA! The kernel no longer bitches and linuxrc runs fine
....except it is not actually run on the console. : P

I just noticed it doesn't display any output, nor accept any input.
I opened it with mode 3 (RW) so I am once again lost.

static int do_linuxrc(void * shell)
{

struct inode inode;
struct file * f;
int rc;

static char *argv[] = { "linuxrc", NULL, };

close(0);close(1);close(2);
setsid();

memset(&inode, 0, sizeof(inode));

f = get_empty_filp();
inode.i_rdev = MKDEV(TTY_MAJOR,1);
f->f_mode = 3;
f->f_inode = &inode;
(void) chrdev_open(&inode, f);

(void) dup(0);
(void) dup(0);

rc = execve(shell, argv, envp_init);

if (f->f_op->release)
f->f_op->release(&inode, f);
return rc;
}

-- 
http://www.psychosis.com/emc/		Elite MicroComputers   732-541-4214 
http://www.psychosis.com/linux-router/	Linux Router Project 
 
SIC SEMPER SPAMMER!!

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu