Messages in this thread | | | Subject | Re: [PATCH] devpts: Sensible /dev/ptmx & force newinstance | From | "H. Peter Anvin" <> | Date | Fri, 11 Dec 2015 14:29:50 -0800 |
| |
On 12/11/15 14:24, Andy Lutomirski wrote: > > To do the whole shebang at once: > > ioctl(ptmx_fd, TIOCWHATEVER, fd_to_devpts_mount); > > returns the slave number if fd_to_devpts_mount points to the right > place or an error if not. > > ptsname(fd) logically does: > > fd_to_devpts_mount = open("/dev/pts", O_RDONLY | O_DIRECTORY); > int n = ioctl(fd, TIOCWHATEVER, fd_to_devpts_mount); > close(fd_to_devpts_mount); > if (n < 0) > return some error; > return "/dev/pts/" + n; > > I think that all kinds of variants are possible. >
If we're going to invent new names, any reason to not simply have TIOCPTSNAME, since we can find the pts inode from the ptm fd, and then walk the dentry tree (returning error if unreachable)?
Or does that open up entirely new issues?
-hpa
| |