unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* posix_openpt vs getpt??
@ 2019-12-30 21:35 Samuel Thibault
  2019-12-31 13:25 ` Florian Weimer
  0 siblings, 1 reply; 5+ messages in thread
From: Samuel Thibault @ 2019-12-30 21:35 UTC (permalink / raw)
  To: libc-alpha

Hello,

In sysdeps/unix/bsd/getpt.c we can read:

/* We cannot define posix_openpt in general for BSD systems.  */

I do not see why posix_openpt can't be defined like getpt is. Is there
a semantic difference between them beyond the open flags that could be
just passed to the open() call?  Notably, Linux' getpt() is actually
implemented as __posix_openpt (O_RDWR)...

Samuel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: posix_openpt vs getpt??
  2019-12-30 21:35 posix_openpt vs getpt?? Samuel Thibault
@ 2019-12-31 13:25 ` Florian Weimer
  2019-12-31 16:38   ` Samuel Thibault
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Weimer @ 2019-12-31 13:25 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: libc-alpha

* Samuel Thibault:

> In sysdeps/unix/bsd/getpt.c we can read:
>
> /* We cannot define posix_openpt in general for BSD systems.  */
>
> I do not see why posix_openpt can't be defined like getpt is. Is there
> a semantic difference between them beyond the open flags that could be
> just passed to the open() call?  Notably, Linux' getpt() is actually
> implemented as __posix_openpt (O_RDWR)...

We don't have an in-tree BSD port, and the BSD at the time was
probably quite different from what we have today.  I suggest to ignore
the comment and rearrange things in the way that make the most sense
for Linux and Hurd.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: posix_openpt vs getpt??
  2019-12-31 13:25 ` Florian Weimer
@ 2019-12-31 16:38   ` Samuel Thibault
  2019-12-31 16:45     ` Samuel Thibault
  0 siblings, 1 reply; 5+ messages in thread
From: Samuel Thibault @ 2019-12-31 16:38 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha

Hello,

Florian Weimer, le mar. 31 déc. 2019 14:25:37 +0100, a ecrit:
> > In sysdeps/unix/bsd/getpt.c we can read:
> >
> > /* We cannot define posix_openpt in general for BSD systems.  */
> >
> > I do not see why posix_openpt can't be defined like getpt is. Is there
> > a semantic difference between them beyond the open flags that could be
> > just passed to the open() call?  Notably, Linux' getpt() is actually
> > implemented as __posix_openpt (O_RDWR)...
> 
> We don't have an in-tree BSD port, and the BSD at the time was
> probably quite different from what we have today.  I suggest to ignore
> the comment and rearrange things in the way that make the most sense
> for Linux and Hurd.

Ok, thanks, I guess that'll to wait for 2.32, though.

And best wishes for the new year!
Samuel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: posix_openpt vs getpt??
  2019-12-31 16:38   ` Samuel Thibault
@ 2019-12-31 16:45     ` Samuel Thibault
  2019-12-31 16:53       ` Florian Weimer
  0 siblings, 1 reply; 5+ messages in thread
From: Samuel Thibault @ 2019-12-31 16:45 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha

One thing I'm unsure of: the Linux manpage says 

It is equivalent to

           open("/dev/ptmx", O_RDWR | O_NOCTTY);

But the Linux implementation is

int fd = __posix_openpt (O_RDWR);


Is getpt supposed to set the controlling tty or not?  Since the Linux
behavior has been not to set O_NOCTTY since its introduction in 1998, I
guess applications assumes !O_NOCTTY and it's the manpage which needs to
be fixed?

Samuel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: posix_openpt vs getpt??
  2019-12-31 16:45     ` Samuel Thibault
@ 2019-12-31 16:53       ` Florian Weimer
  0 siblings, 0 replies; 5+ messages in thread
From: Florian Weimer @ 2019-12-31 16:53 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: libc-alpha

* Samuel Thibault:

> One thing I'm unsure of: the Linux manpage says 
>
> It is equivalent to
>
>            open("/dev/ptmx", O_RDWR | O_NOCTTY);
>
> But the Linux implementation is
>
> int fd = __posix_openpt (O_RDWR);
>
>
> Is getpt supposed to set the controlling tty or not?  Since the Linux
> behavior has been not to set O_NOCTTY since its introduction in 1998, I
> guess applications assumes !O_NOCTTY and it's the manpage which needs to
> be fixed?

I'm not sure if O_NOCTTY actually has an impact here.  Does /dev/ptmx
actually qualify as a terminal device?

In any case, I agree that the manual page should be fixed.  Would you
submit a patch, please?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-12-31 16:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-30 21:35 posix_openpt vs getpt?? Samuel Thibault
2019-12-31 13:25 ` Florian Weimer
2019-12-31 16:38   ` Samuel Thibault
2019-12-31 16:45     ` Samuel Thibault
2019-12-31 16:53       ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).