public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Samuel Thibault <sthibaul@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc] Rearrange bsd_getpt vs bsd_openpt and implement posix_openpt on BSD Date: Sun, 8 Nov 2020 14:09:52 +0000 (GMT) [thread overview] Message-ID: <20201108140952.AB61A385700E@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=aa11ab99530aea57fa2b8fa934a7c9dd0bfa9131 commit aa11ab99530aea57fa2b8fa934a7c9dd0bfa9131 Author: Samuel Thibault <samuel.thibault@ens-lyon.org> Date: Tue May 26 22:20:10 2020 +0200 Rearrange bsd_getpt vs bsd_openpt and implement posix_openpt on BSD * sysdeps/unix/bsd/getpt.c (__getpt): Add oflag parameter, pass it to the _open call and rename to... (__bsd_openpt): ... new function. (__getpt): Reimplement on top of __bsd_openpt. (__posix_openpt): Replace stub with implementation on top of __bsd_openpt. (posix_openpt): Remove stub warning. Diff: --- sysdeps/unix/bsd/getpt.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/sysdeps/unix/bsd/getpt.c b/sysdeps/unix/bsd/getpt.c index 75489aef28..cdc3518fd7 100644 --- a/sysdeps/unix/bsd/getpt.c +++ b/sysdeps/unix/bsd/getpt.c @@ -41,7 +41,7 @@ const char __libc_ptyname2[] attribute_hidden = PTYNAME2; /* Open a master pseudo terminal and return its file descriptor. */ int -__getpt (void) +__bsd_openpt (int oflag) { char buf[sizeof (_PATH_PTY) + 2]; const char *p, *q; @@ -61,7 +61,7 @@ __getpt (void) s[1] = *q; - fd = __open (buf, O_RDWR); + fd = __open (buf, oflag); if (fd != -1) return fd; @@ -74,18 +74,16 @@ __getpt (void) return -1; } -#undef __getpt +int +__getpt (void) +{ + return __bsd_openpt (O_RDWR); +} weak_alias (__getpt, getpt) -#ifndef HAVE_POSIX_OPENPT -/* We cannot define posix_openpt in general for BSD systems. */ int __posix_openpt (int oflag) { - __set_errno (ENOSYS); - return -1; + return __bsd_openpt (oflag); } weak_alias (__posix_openpt, posix_openpt) - -stub_warning (posix_openpt) -#endif
reply other threads:[~2020-11-08 14:09 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201108140952.AB61A385700E@sourceware.org \ --to=sthibaul@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).