Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/tty_pts.c
Show First 20 Lines • Show All 275 Lines • ▼ Show 20 Lines | case FIONREAD: | ||||
if (psc->pts_flags & PTS_FINISHED) { | if (psc->pts_flags & PTS_FINISHED) { | ||||
/* Force read() to be called. */ | /* Force read() to be called. */ | ||||
*(int *)data = 1; | *(int *)data = 1; | ||||
} else { | } else { | ||||
*(int *)data = ttydisc_getc_poll(tp); | *(int *)data = ttydisc_getc_poll(tp); | ||||
} | } | ||||
tty_unlock(tp); | tty_unlock(tp); | ||||
return (0); | return (0); | ||||
case FIODGNAME: { | case FIODGNAME: | ||||
#ifdef COMPAT_FREEBSD32 | |||||
case FIODGNAME_32: | |||||
#endif | |||||
{ | |||||
struct fiodgname_arg *fgn; | struct fiodgname_arg *fgn; | ||||
const char *p; | const char *p; | ||||
int i; | int i; | ||||
/* Reverse device name lookups, for ptsname() and ttyname(). */ | /* Reverse device name lookups, for ptsname() and ttyname(). */ | ||||
fgn = data; | fgn = data; | ||||
p = tty_devname(tp); | p = tty_devname(tp); | ||||
i = strlen(p) + 1; | i = strlen(p) + 1; | ||||
if (i > fgn->len) | if (i > fgn->len) | ||||
return (EINVAL); | return (EINVAL); | ||||
return copyout(p, fgn->buf, i); | return (copyout(p, fiodgname_buf_get_ptr(fgn, cmd), i)); | ||||
} | } | ||||
/* | /* | ||||
* We need to implement TIOCGPGRP and TIOCGSID here again. When | * We need to implement TIOCGPGRP and TIOCGSID here again. When | ||||
* called on the pseudo-terminal master, it should not check if | * called on the pseudo-terminal master, it should not check if | ||||
* the terminal is the foreground terminal of the calling | * the terminal is the foreground terminal of the calling | ||||
* process. | * process. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 569 Lines • Show Last 20 Lines |