Back to index

glibc  2.9
ttyname_r.c File Reference
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <hurd.h>
#include <hurd/term.h>
#include <hurd/fd.h>

Go to the source code of this file.


int __ttyname_r (int fd, char *buf, size_t buflen)

Function Documentation

int __ttyname_r ( int  fd,
char *  buf,
size_t  buflen 

Definition at line 29 of file ttyname_r.c.

  error_t err;
  char nodename[1024];      /* XXX */
  size_t len;

  nodename[0] = '\0';
  if (err = HURD_DPORT_USE (fd, __term_get_nodename (port, nodename)))
    return __hurd_dfail (fd, err), -1;

  len = strlen (nodename) + 1;
  if (len > buflen)
      errno = EINVAL;
      return -1;

  memcpy (buf, nodename, len);
  return 0;

Here is the call graph for this function: