diff options
Diffstat (limited to 'usr/src/lib/libc/port')
-rw-r--r-- | usr/src/lib/libc/port/gen/dup.c | 27 | ||||
-rw-r--r-- | usr/src/lib/libc/port/gen/mkstemp.c | 30 | ||||
-rw-r--r-- | usr/src/lib/libc/port/gen/pipe.c | 35 | ||||
-rw-r--r-- | usr/src/lib/libc/port/llib-lc | 8 | ||||
-rw-r--r-- | usr/src/lib/libc/port/mapfile-vers | 15 | ||||
-rw-r--r-- | usr/src/lib/libc/port/threads/scalls.c | 9 |
6 files changed, 112 insertions, 12 deletions
diff --git a/usr/src/lib/libc/port/gen/dup.c b/usr/src/lib/libc/port/gen/dup.c index 8b5db30b19..4fd562934f 100644 --- a/usr/src/lib/libc/port/gen/dup.c +++ b/usr/src/lib/libc/port/gen/dup.c @@ -19,6 +19,8 @@ * CDDL HEADER END */ +/* Copyright 2013, OmniTI Computer Consulting, Inc. All rights reserved. */ + /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -30,6 +32,7 @@ #include "lint.h" #include <sys/types.h> #include <fcntl.h> +#include <errno.h> #pragma weak _dup = dup int @@ -44,3 +47,27 @@ dup2(int fildes, int fildes2) { return (fcntl(fildes, F_DUP2FD, fildes2)); } + +int +dup3(int fildes, int fildes2, int flags) +{ + /* + * The only valid flag is O_CLOEXEC. + */ + if (flags & ~O_CLOEXEC) { + errno = EINVAL; + return (-1); + } + + /* + * This call differs from dup2 such that it is an error when + * fildes == fildes2 + */ + if (fildes == fildes2) { + errno = EINVAL; + return (-1); + } + + return (fcntl(fildes, (flags == 0) ? F_DUP2FD : F_DUP2FD_CLOEXEC, + fildes2)); +} diff --git a/usr/src/lib/libc/port/gen/mkstemp.c b/usr/src/lib/libc/port/gen/mkstemp.c index 72c79ac47f..d9de436d13 100644 --- a/usr/src/lib/libc/port/gen/mkstemp.c +++ b/usr/src/lib/libc/port/gen/mkstemp.c @@ -19,6 +19,8 @@ * CDDL HEADER END */ +/* Copyright (c) 2013 OmniTI Computer Consulting, Inc. All rights reserved. */ + /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -33,13 +35,13 @@ * California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/feature_tests.h> #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 #define mkstemp mkstemp64 #define mkstemps mkstemps64 +#define mkostemp mkostemp64 +#define mkostemps mkostemps64 #define libc_mkstemps libc_mkstemps64 /* prefer unique statics */ #pragma weak _mkstemp64 = mkstemp64 #else @@ -59,7 +61,7 @@ extern char *libc_mktemps(char *, int); static int -libc_mkstemps(char *as, int slen) +libc_mkstemps(char *as, int slen, int flags) { int fd; int len; @@ -91,11 +93,13 @@ libc_mkstemps(char *as, int slen) } } #if _FILE_OFFSET_BITS == 64 - if ((fd = open64(as, O_CREAT|O_EXCL|O_RDWR, 0600)) != -1) { + if ((fd = open64(as, O_CREAT|O_EXCL|O_RDWR|flags, + 0600)) != -1) { return (fd); } #else - if ((fd = open(as, O_CREAT|O_EXCL|O_RDWR, 0600)) != -1) { + if ((fd = open(as, O_CREAT|O_EXCL|O_RDWR|flags, + 0600)) != -1) { return (fd); } #endif /* _FILE_OFFSET_BITS == 64 */ @@ -116,11 +120,23 @@ libc_mkstemps(char *as, int slen) int mkstemp(char *as) { - return (libc_mkstemps(as, 0)); + return (libc_mkstemps(as, 0, 0)); } int mkstemps(char *as, int slen) { - return (libc_mkstemps(as, slen)); + return (libc_mkstemps(as, slen, 0)); +} + +int +mkostemp(char *as, int flags) +{ + return (libc_mkstemps(as, 0, flags)); +} + +int +mkostemps(char *as, int slen, int flags) +{ + return (libc_mkstemps(as, slen, flags)); } diff --git a/usr/src/lib/libc/port/gen/pipe.c b/usr/src/lib/libc/port/gen/pipe.c new file mode 100644 index 0000000000..66e16de083 --- /dev/null +++ b/usr/src/lib/libc/port/gen/pipe.c @@ -0,0 +1,35 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2013 OmniTI Computer Consulting, Inc. All rights reserved. + */ + +#pragma weak _pipe = pipe + +#include "lint.h" +#include <unistd.h> + +int +pipe(int *fds) +{ + return (pipe2(fds, 0)); +} diff --git a/usr/src/lib/libc/port/llib-lc b/usr/src/lib/libc/port/llib-lc index 117009a044..1781f34b2b 100644 --- a/usr/src/lib/libc/port/llib-lc +++ b/usr/src/lib/libc/port/llib-lc @@ -22,6 +22,7 @@ /* * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright 2013 OmniTI Computer Consulting, Inc. All rights reserved. */ /* LINTLIBRARY */ @@ -379,8 +380,10 @@ void lcong48(unsigned short param[7]); long nrand48(unsigned short *xsubi); long jrand48(unsigned short *xsubi); -/* dup2.c */ +/* dup.c */ +int dup(int fildes); int dup2(int fildes, int fildes2); +int dup3(int fildes, int fildes2, int flags); /* ecvt.c */ char *ecvt(double value, int ndigit, int *_RESTRICT_KYWD decpt, @@ -741,6 +744,9 @@ DIR *opendir(const char *filename); /* perror.c */ void perror(const char *s); +/* pipe.c */ +int pipe(int *fds); + /* psiginfo.c */ void psiginfo(siginfo_t *sip, char *s); diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers index c5587adf3d..469b73e9ca 100644 --- a/usr/src/lib/libc/port/mapfile-vers +++ b/usr/src/lib/libc/port/mapfile-vers @@ -26,7 +26,7 @@ # # Copyright (c) 2012, Joyent, Inc. All rights reserved. # Copyright (c) 2012 by Delphix. All rights reserved. -# +# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. # # MAPFILE HEADER START @@ -91,6 +91,19 @@ $if _x86 && _ELF64 $add amd64 $endif +SYMBOL_VERSION ILLUMOS_0.4 { # Illumos additions + protected: + pipe2; + dup3; + mkostemp; + mkostemps; + +$if lf64 + mkostemp64; + mkostemps64; +$endif +} ILLUMOS_0.3; + SYMBOL_VERSION ILLUMOS_0.3 { # Illumos additions protected: assfail3; diff --git a/usr/src/lib/libc/port/threads/scalls.c b/usr/src/lib/libc/port/threads/scalls.c index afcdb4bcaa..18b6b1c05f 100644 --- a/usr/src/lib/libc/port/threads/scalls.c +++ b/usr/src/lib/libc/port/threads/scalls.c @@ -24,6 +24,8 @@ * Use is subject to license terms. */ +/* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */ + #include "lint.h" #include "thr_uberdata.h" #include <stdarg.h> @@ -1022,12 +1024,13 @@ sigqueue(pid_t pid, int signo, const union sigval value) } int -_so_accept(int sock, struct sockaddr *addr, uint_t *addrlen, int version) +_so_accept(int sock, struct sockaddr *addr, uint_t *addrlen, int version, + int flags) { - extern int __so_accept(int, struct sockaddr *, uint_t *, int); + extern int __so_accept(int, struct sockaddr *, uint_t *, int, int); int rv; - PERFORM(__so_accept(sock, addr, addrlen, version)) + PERFORM(__so_accept(sock, addr, addrlen, version, flags)) } int |