Try ttyname():
$man ttyname
TTYNAME(3) Linux Programmer's Manual TTYNAME(3)
NAME
ttyname - return name of a terminal
SYNOPSIS
#include <unistd.h>
char *ttyname ( int desc );
DESCRIPTION
Returns a pointer to the pathname of the terminal device
that is open on the file descriptor desc, or NULL on error
(for example, if desc is not connected to a terminal).
CONFORMING TO
POSIX.1
SEE ALSO
fstat(2), isatty(3)
Regards,
/Karl
-----------------------------------------------------------------------
Karl Hammar Asp� Data [EMAIL PROTECTED]
Lilla Asp� 2340 +46 173 140 57 Networks
S-742 94 �sthammar +46 70 511 97 84 Computers
Sweden Consulting
-----------------------------------------------------------------------
From: BenHanokh Gabriel <[EMAIL PROTECTED]>
Subject: Re: finding target id of a scsi device
Date: Mon, 07 Aug 2000 16:17:44 +0300
> Douglas Gilbert wrote:
>
> > BenHanokh Gabriel wrote:
> > >
> > > hi
> > >
> > > is there a way in user-space to map from the dev_t ( retrive from
> > > stat(2) ) to the scsi target & logical ids?
> > > if no can i do it in kernel-space ?
> >
> > With an open file descriptor to a SCSI device the
> > SCSI_IOCTL_GET_IDLUN ioctl() can be used.
> > The struct associated with this ioctl() is
> > described in:
> > http://www.torque.net/scsi/linux_scsi_24
> >
> > You may also be able to deduce it from looking at
> > 'cat /proc/scsi/scsi' [but that is a bit hard to
> > parse].
> >
> > Doug Gilbert
>
> hi
>
> i'm not sure if i can use that ioctl, as my program needs to tarnslate
> from a file-name into scsi target-id and logical-unit, and the ioctl you
> have mentioned can do it with a file-descriptor to an open device, but i
> don't have the device name to open.
>
> i saw that stat(2) returns info about the device at the st_dev field.
> is it possible to translate from that field to the device name, or is it
> possible to open a device using the dev field extracted by stat?
>
> please CC me for any answer as i'm not register to the mailing list
>
> THX
> /gabi
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]