Re: Does anyone care about a race free ptsname?
From: Linus Torvalds
Date: Tue Apr 19 2016 - 20:18:37 EST
On Tue, Apr 19, 2016 at 4:39 PM, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
>
> What do you think of the idea of TIOCPTSOPEN (or whatever) to get a file
> descriptor for the slave device given the master device? Then we can
> use realpath() or a readlink on /proc/self/fd/# to get the pathname if
> needed.
That sounds reasonable to me.
> (Incidentally, we added getcwd() as a system call. Should we add
> [f]realpath() as a system call too?)
Probably a good idea. It's kind of silly to have to do a sprintf
followed by a readlink().
Linus