This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

posix_openpt


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]