Add posix_openpt(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2016-11-19 20:45:53 +01:00
parent 365815401b
commit 2563b926ad
3 changed files with 32 additions and 2 deletions

View File

@ -535,6 +535,7 @@ stdlib/mkostemps.o \
stdlib/mkstemp.o \
stdlib/mkstemps.o \
stdlib/on_exit.o \
stdlib/posix_openpt.o \
stdlib/rand.o \
stdlib/realpath.o \
stdlib/setenv.o \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, 2013, 2014, 2015 Jonas 'Sortie' Termansen.
* Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016 Jonas 'Sortie' Termansen.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -159,7 +159,6 @@ long lrand48(void);
long mrand48(void);
long nrand48(unsigned short[3]);
int posix_memalign(void**, size_t, size_t);
int posix_openpt(int);
char* ptsname(int);
long random(void);
int rand_r(unsigned *);
@ -171,6 +170,10 @@ void srandom(unsigned);
int unlockpt(int);
#endif
#if __USE_SORTIX || 600 <= __USE_XOPEN
int posix_openpt(int);
#endif
/* Functions copied from elsewhere. */
#if __USE_SORTIX
uint32_t arc4random(void);

View File

@ -0,0 +1,26 @@
/*
* Copyright (c) 2016 Jonas 'Sortie' Termansen.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* stdlib/posix_openpt.c
* Open a pseudoterminal master.
*/
#include <fcntl.h>
#include <stdlib.h>
int posix_openpt(int flags)
{
return open("/dev/ptmx", flags);
}