| delorie.com/archives/browse.cgi | search |
| X-Spam-Check-By: | sourceware.org |
| MIME-Version: | 1.0 |
| Subject: | posix_openpt |
| Date: | Tue, 21 Feb 2006 18:22:06 -0800 |
| Message-ID: | <CECD6E8A589E8447BC6E836C8369AFF508B6786B@us-email.terastack.bluearc.com> |
| From: | "Elliott Hughes" <EHughes AT bluearc DOT com> |
| To: | <cygwin AT cygwin DOT com> |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Note-from-DJ: | This may be spam |
| X-MIME-Autoconverted: | from base64 to 8bit by delorie.com id k1M2MG3w023713 |
Cygwin doesn't seem to have POSIX's unfortunately-named "posix_openpt" function in its stdlib.h. The function's documented here:
http://www.opengroup.org/onlinepubs/000095399/functions/posix_openpt.html
I'm currently successfully using the implementation below in my application, but wondered if there was any interest in adding it to Cygwin itself?
#ifdef __CYGWIN__
// Cygwin doesn't currently have posix_openpt(3).
int posix_openpt(int oflag) {
return open("/dev/ptmx", oflag);
}
#endif
(Given the simplicity of the implementation, you might be wondering why anyone would care about this trivial little function, other than a standards pedant? The answer is that although that implementation suffices on Cygwin and Linux, OSes such as Darwin require a complicated trawl through /dev looking for suitable candidates.)
--
Elliott Hughes, BlueArc Engineering
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |