* include/stdlib.h: Add __posix_openpt declaration.
* stdlib/stdlib.h: Add posix_openpt declaration.
* login/Versions: Add posix_openpt for GLIBC_2.2.1.
* sysdeps/generic/getpt.c: Define posix_openpt.
* sysdeps/unix/bsd/getpt.c: Likewise.
* sysdeps/unix/sysv/linux/getpt.c: Likewise.
2001-01-08 Ulrich Drepper <drepper@redhat.com>
+ * include/stdlib.h: Add __posix_openpt declaration.
+ * stdlib/stdlib.h: Add posix_openpt declaration.
+ * login/Versions: Add posix_openpt for GLIBC_2.2.1.
+ * sysdeps/generic/getpt.c: Define posix_openpt.
+ * sysdeps/unix/bsd/getpt.c: Likewise.
+ * sysdeps/unix/sysv/linux/getpt.c: Likewise.
+
* time/Makefile (tests): Add tst-mktime.
* time/tst-mktime.c: New file.
extern char *__realpath (__const char *__name, char *__resolved);
extern int __ptsname_r (int __fd, char *__buf, size_t __buflen);
extern int __getpt (void);
+extern int __posix_openpt (int __oflag);
extern int __add_to_environ (const char *name, const char *value,
const char *combines, int replace);
# g*
getutmpx; getutmp;
}
+ GLIBC_2.2.1 {
+ # p*
+ posix_openpt;
+ }
}
libutil {
-/* Copyright (C) 1991-1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#ifdef __USE_XOPEN
-
/* Setup DES tables according KEY. */
extern void setkey (__const char *__key) __THROW;
+#endif
+
/* X/Open pseudo terminal handling. */
+#ifdef __USE_XOPEN2K
+/* Return a master pseudo-terminal handle. */
+extern int posix_openpt (int __oflag) __THROW;
+#endif
+
+#ifdef __USE_XOPEN
/* The next four functions all take a master pseudo-tty fd and
perform an operation on the associated slave: */
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
}
weak_alias (__getpt, getpt)
+/* We cannot define posix_openpt in general for BSD systems. */
+int
+__posix_openpt (oflag)
+ int oflag;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__posix_openpt, posix_openpt)
+
stub_warning (getpt)
+stub_warning (posix_openpt)
#include <stub-tag.h>
-/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
#undef __getpt
weak_alias (__getpt, getpt)
+
+#ifndef HAVE_POSIX_OPENPT
+/* We cannot define posix_openpt in general for BSD systems. */
+int
+__posix_openpt (oflag)
+ int oflag;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__posix_openpt, posix_openpt)
+
+stub_warning (posix_openpt)
+# include <stub-tag.h>
+#endif
-/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
/* Open a master pseudo terminal and return its file descriptor. */
int
-__getpt (void)
+__posix_openpt (oflag)
+ int oflag;
{
static int have_no_dev_ptmx;
int fd;
if (!have_no_dev_ptmx)
{
- fd = __open (_PATH_DEVPTMX, O_RDWR);
+ fd = __open (_PATH_DEVPTMX, oflag);
if (fd != -1)
{
struct statfs fsbuf;
if (devpts_mounted
|| (__statfs (_PATH_DEVPTS, &fsbuf) == 0
&& fsbuf.f_type == DEVPTS_SUPER_MAGIC)
- || (__statfs (_PATH_DEV, &fsbuf) == 0
+ || (__statfs (_PATH_DEV, &fsbuf) == 0
&& fsbuf.f_type == DEVFS_SUPER_MAGIC))
{
/* Everything is ok. */
}
}
- return __bsd_getpt ();
+ return -1;
+}
+weak_alias (__posix_openpt, posix_openpt)
+
+
+int
+__getpt (void)
+{
+ int fd = __posix_openpt (O_RDWR);
+ if (fd == -1)
+ fd = __bsd_getpt ();
+ return fd;
}
+
#define PTYNAME1 "pqrstuvwxyzabcde";
#define PTYNAME2 "0123456789abcdef";
#define __getpt __bsd_getpt
+#define HAVE_POSIX_OPENPT
#include <sysdeps/unix/bsd/getpt.c>