MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Standard C Library Functions                          ttyname(3C)



NAME
     ttyname, ttynamer - find pathname of a terminal

SYNOPSIS
     #include 

     char *ttyname(int fildes);


     char *ttynamer(int fildes, char *name, int namelen);


  Standard conforming
     cc [ flag...] file ... -DPOSIXPTHREADSEMANTICS [ library ... ]

     int ttynamer(int fildes, char *name, sizet namesize);


DESCRIPTION
     The ttyname() function returns a pointer to  a  string  con-
     taining the null-terminated path name of the terminal device
     associated with file descriptor  fildes.  The  return  value
     points  to thread-specific data whose content is overwritten
     by each call from the same thread.


     The ttynamer()  function  has  the  same  functionality  as
     ttyname()  except  that the caller must supply a buffer name
     with length namelen to store the result; this buffer must be
     at  least  POSIXPATHMAX  in size (defined in ).
     The  standard-conforming  version  (see   standards(5))   of
     ttynamer() takes a namesize parameter of type sizet.

RETURN VALUES
     Upon successful completion, ttyname() and ttynamer() return
     a pointer to a string. Otherwise, a null pointer is returned
     and errno is set to indicate the error.


     The standard-conforming ttynamer() returns 0 if  successful
     or the error number upon failure.

ERORS
     The ttyname() and ttynamer() functions may fail if:

     EBADF     The fildes argument is not a valid  file  descrip-
               tor. This condition is reported.


     ENOTY    The fildes argument does not refer to  a  terminal
               device. This condition is reported.




SunOS 5.11          Last change: 31 Mar 2005                    1






Standard C Library Functions                          ttyname(3C)



     The ttynamer() function may fail if:

     ERANGE    The value of namesize is smaller than  the  length
               of  the  string  to be returned including the ter-
               minating null character.


ATRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:



     
           ATRIBUTE TYPE               ATRIBUTE VALUE       
    
     Interface Stability          Standard                    
    
     MT-Level                     Safe                        
    


SEE ALSO
     Intro(3), gettext(3C), setlocale(3C),  attributes(5),  stan-
     dards(5)

NOTES
     When compiling  multithreaded  applications,  see  Intro(3),
     Notes On Multithreaded Applications.


     Messages printed  from  this  function  are  in  the  native
     language  specified  by the LCMESAGES locale category. See
     setlocale(3C).


     The return value of ttyname() points to thread-specific data
     whose  content  is  overwritten  by  each call from the same
     thread. This function is safe to use in multithreaded appli-
     cations,  but  its use is discouraged. The ttynamer() func-
     tion should used instead.


     Solaris 2.4 and earlier releases provided definitions of the
     ttynamer()  interface as specified in POSIX.1c Draft 6. The
     final POSIX.1c standard changed the interface  as  described
     above.  Support  for  the  Draft 6 interface is provided for
     compatibility only and might  not  be  supported  in  future
     releases.  New  applications  and  libraries  should use the
     standard-conforming interface.





SunOS 5.11          Last change: 31 Mar 2005                    2



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™