posix_openpt

Elliott Hughes EHughes@bluearc.com
Wed Feb 22 02:32:00 GMT 2006


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


More information about the Cygwin mailing list