Example #1
0
char* ptsname(int fd) {
    static char buf[9 + sizeof(int) * 3 + 1];
    int err = __ptsname_r(fd, buf, sizeof buf);
    if (err) {
        errno = err;
        return 0;
    }
    return buf;
}
Example #2
0
/* Return the pathname of the pseudo terminal slave associated with
   the master FD is open on, or NULL on errors.
   The returned storage is good until the next call to this function.  */
char *
ptsname (int fd)
{
  static string_t peername;
  error_t err;

  err = __ptsname_r (fd, peername, sizeof (peername));

  return err ? NULL : peername;
}
Example #3
0
/* Unlock the slave pseudo terminal associated with the master pseudo
   terminal specified by FD.  */
int
unlockpt (int fd)
{
  char buf[sizeof (_PATH_TTY) + 2];

  /* BSD doesn't have a lock, but it does have `revoke'.  */
  if (__ptsname_r (fd, buf, sizeof (buf)))
    return -1;
  return revoke (buf);
}
Example #4
0
/* Return the pathname of the pseudo terminal slave assoicated with
   the master FD is open on, or NULL on errors.
   The returned storage is good until the next call to this function.  */
char *
ptsname (int fd)
{
  return __ptsname_r (fd, buffer, sizeof (buffer)) != 0 ? NULL : buffer;
}