[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: device_read example
From: |
Neal H. Walfield |
Subject: |
Re: device_read example |
Date: |
Sun, 18 Sep 2005 12:40:08 +0100 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.4 (i386-pc-linux-gnu) MULE/5.0 (SAKAKI) |
At Sun, 18 Sep 2005 03:04:15 -0700 (PDT),
Shakthi Kannan wrote:
> I have a simple test function on GNU Hurd that
>
> 1. gets_privileged_ports from device_t
>
> error_t err;
> device_t device_master;
> err = get_privileged_ports (0, &device_master);
>
> 2. calls device_open
>
> err = device_open (device_master, D_READ | D_WRITE,
> "lpr", &lpr_dev);
My impression is that the fourth argument to device_open is a send
right to the device...
>
> But, when I try to do device_read, it doesn't print
> message in the device_read function in
> gnumach-1-branch/i386/i386at/lpr.c
>
> 3. calling device_read
>
> unsigned long result;
> mach_msg_type_number_t data_cnt = sizeof (result);
> err = device_read (device_master, 0, -1, sizeof
> (result), (void *) &result, &data_cnt);
... which is supplied as the first argument to device_read et al.
The device master port is a meta-device which is used to obtain send
rights to other devices.
Also, make sure that you add your lprread function to the lpr device
structure (i.e. along side lpropen).