summaryrefslogtreecommitdiff
path: root/usr/src/lib/libc
diff options
context:
space:
mode:
authorKeith M Wesolowski <wesolows@foobazco.org>2013-05-08 18:18:49 +0000
committerKeith M Wesolowski <wesolows@foobazco.org>2013-05-08 18:18:49 +0000
commit43840e901cacf50a9bb41148069e34ca307524e8 (patch)
tree2836162f69bba2534e8b9acf9797e5892f103258 /usr/src/lib/libc
parentabd43b3991c3becf4fd3cc1a370aeafdc8749a30 (diff)
parent5dbfd19ad5fcc2b779f40f80fa05c1bd28fd0b4e (diff)
downloadillumos-joyent-43840e901cacf50a9bb41148069e34ca307524e8.tar.gz
[illumos-gate merge]
commit 5dbfd19ad5fcc2b779f40f80fa05c1bd28fd0b4e 3713 Implement accept4() 3714 Implement pipe2() 3715 Implement dup3() 3716 Implement mkostemp() and mkostemps() 3719 so_socketpair syscall should preserve FD_CLOEXEC flag commit 6136c589445a3ea081bd34ab72db1060875b6bcc 3722 link-editor is over restrictive of R_AMD64_32 addends Conflicts: usr/src/lib/libc/sparcv9/Makefile.com [copyright] usr/src/lib/libc/sparc/Makefile.com [copyright] usr/src/lib/libc/i386/Makefile.com [copyright]
Diffstat (limited to 'usr/src/lib/libc')
-rw-r--r--usr/src/lib/libc/amd64/Makefile4
-rw-r--r--usr/src/lib/libc/common/sys/_so_accept.s7
-rw-r--r--usr/src/lib/libc/common/sys/pipe2.s (renamed from usr/src/lib/libc/i386/sys/pipe.s)23
-rw-r--r--usr/src/lib/libc/i386/Makefile.com4
-rw-r--r--usr/src/lib/libc/port/gen/dup.c27
-rw-r--r--usr/src/lib/libc/port/gen/mkstemp.c30
-rw-r--r--usr/src/lib/libc/port/gen/pipe.c (renamed from usr/src/lib/libc/amd64/sys/pipe.s)27
-rw-r--r--usr/src/lib/libc/port/llib-lc8
-rw-r--r--usr/src/lib/libc/port/mapfile-vers15
-rw-r--r--usr/src/lib/libc/port/threads/scalls.c9
-rw-r--r--usr/src/lib/libc/sparc/Makefile.com4
-rw-r--r--usr/src/lib/libc/sparc/sys/pipe.s52
-rw-r--r--usr/src/lib/libc/sparcv9/Makefile.com4
13 files changed, 112 insertions, 102 deletions
diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile
index 2f37212a55..396c536387 100644
--- a/usr/src/lib/libc/amd64/Makefile
+++ b/usr/src/lib/libc/amd64/Makefile
@@ -22,6 +22,7 @@
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
+# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
# Use is subject to license terms.
#
@@ -223,6 +224,7 @@ COMSYSOBJS= \
pathconf.o \
pause.o \
pcsample.o \
+ pipe2.o \
pollsys.o \
pread.o \
priocntlset.o \
@@ -279,7 +281,6 @@ SYSOBJS= \
gettimeofday.o \
lwp_private.o \
nuname.o \
- pipe.o \
syscall.o \
sysi86.o \
tls_get_addr.o \
@@ -468,6 +469,7 @@ PORTGEN= \
pfmt.o \
pfmt_data.o \
pfmt_print.o \
+ pipe.o \
plock.o \
poll.o \
posix_fadvise.o \
diff --git a/usr/src/lib/libc/common/sys/_so_accept.s b/usr/src/lib/libc/common/sys/_so_accept.s
index 75759faaad..ea5abbe5d1 100644
--- a/usr/src/lib/libc/common/sys/_so_accept.s
+++ b/usr/src/lib/libc/common/sys/_so_accept.s
@@ -27,10 +27,15 @@
* Use is subject to license terms.
*/
+/* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
+
.file "_so_accept.s"
/* C library -- __so_accept */
-/* int __so_accept(int sock, struct sockaddr *addr, int *addrlen, int vers) */
+/*
+ * int __so_accept(int sock, struct sockaddr *addr, int *addrlen, int vers,
+ * int flags)
+ */
#include "SYS.h"
diff --git a/usr/src/lib/libc/i386/sys/pipe.s b/usr/src/lib/libc/common/sys/pipe2.s
index d17b720124..939fa51f8b 100644
--- a/usr/src/lib/libc/i386/sys/pipe.s
+++ b/usr/src/lib/libc/common/sys/pipe2.s
@@ -18,24 +18,15 @@
*
* CDDL HEADER END
*/
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
- .file "pipe.s"
+/* Copyright 2013 OmniTI Computer Consulting, Inc. All rights reserved. */
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(pipe,function)
+/* int pipe2 (int *fds, int flags) */
#include "SYS.h"
- ENTRY(pipe)
- SYSTRAP_2RVALS(pipe)
- SYSCERROR
- movl 4(%esp), %ecx
- movl %eax, (%ecx)
- movl %edx, 4(%ecx)
- RETC
- SET_SIZE(pipe)
+ .file "pipe2.s"
+
+ SYSCALL2(pipe2,pipe);
+ RET
+ SET_SIZE(pipe2)
diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com
index 41721e4f3f..d5826d8e45 100644
--- a/usr/src/lib/libc/i386/Makefile.com
+++ b/usr/src/lib/libc/i386/Makefile.com
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
@@ -245,6 +246,7 @@ COMSYSOBJS= \
pathconf.o \
pause.o \
pcsample.o \
+ pipe2.o \
pollsys.o \
pread.o \
priocntlset.o \
@@ -301,7 +303,6 @@ SYSOBJS= \
gettimeofday.o \
lwp_private.o \
nuname.o \
- pipe.o \
ptrace.o \
syscall.o \
sysi86.o \
@@ -499,6 +500,7 @@ PORTGEN= \
pfmt.o \
pfmt_data.o \
pfmt_print.o \
+ pipe.o \
plock.o \
poll.o \
posix_fadvise.o \
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/amd64/sys/pipe.s b/usr/src/lib/libc/port/gen/pipe.c
index fd659bea1f..66e16de083 100644
--- a/usr/src/lib/libc/amd64/sys/pipe.s
+++ b/usr/src/lib/libc/port/gen/pipe.c
@@ -18,25 +18,18 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright 2013 OmniTI Computer Consulting, Inc. All rights reserved.
*/
- .file "pipe.s"
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(pipe,function)
+#pragma weak _pipe = pipe
-#include "SYS.h"
+#include "lint.h"
+#include <unistd.h>
- ENTRY(pipe)
- pushq %rdi /* preserve the pointer */
- SYSTRAP_2RVALS(pipe)
- popq %rdi
- SYSCERROR
- movl %eax, (%rdi)
- movl %edx, 4(%rdi)
- RETC
- SET_SIZE(pipe)
+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
diff --git a/usr/src/lib/libc/sparc/Makefile.com b/usr/src/lib/libc/sparc/Makefile.com
index 8b27e58b92..4840990414 100644
--- a/usr/src/lib/libc/sparc/Makefile.com
+++ b/usr/src/lib/libc/sparc/Makefile.com
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
@@ -266,6 +267,7 @@ COMSYSOBJS= \
pathconf.o \
pause.o \
pcsample.o \
+ pipe2.o \
pollsys.o \
pread.o \
priocntlset.o \
@@ -319,7 +321,6 @@ SYSOBJS= \
forkx.o \
forkallx.o \
gettimeofday.o \
- pipe.o \
ptrace.o \
syscall.o \
tls_get_addr.o \
@@ -532,6 +533,7 @@ PORTGEN= \
pfmt.o \
pfmt_data.o \
pfmt_print.o \
+ pipe.o \
plock.o \
poll.o \
posix_fadvise.o \
diff --git a/usr/src/lib/libc/sparc/sys/pipe.s b/usr/src/lib/libc/sparc/sys/pipe.s
deleted file mode 100644
index d9eadc070c..0000000000
--- a/usr/src/lib/libc/sparc/sys/pipe.s
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (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 (c) 1988 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .ident "%Z%%M% %I% %E% SMI"
-
-/* C library -- pipe */
-/* int pipe (int fildes[2]); */
-
- .file "pipe.s"
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(pipe,function)
-
-#include "SYS.h"
-
- ENTRY(pipe)
- mov %o0, %o2 /* save ptr to array */
- SYSTRAP_2RVALS(pipe)
- SYSCERROR
- st %o0, [%o2]
- st %o1, [%o2 + 4]
- RETC
-
- SET_SIZE(pipe)
diff --git a/usr/src/lib/libc/sparcv9/Makefile.com b/usr/src/lib/libc/sparcv9/Makefile.com
index fa727d133c..669e06395c 100644
--- a/usr/src/lib/libc/sparcv9/Makefile.com
+++ b/usr/src/lib/libc/sparcv9/Makefile.com
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
@@ -251,6 +252,7 @@ COMSYSOBJS= \
pathconf.o \
pause.o \
pcsample.o \
+ pipe2.o \
pollsys.o \
pread.o \
priocntlset.o \
@@ -304,7 +306,6 @@ SYSOBJS= \
forkx.o \
forkallx.o \
gettimeofday.o \
- pipe.o \
sparc_utrap_install.o \
syscall.o \
tls_get_addr.o \
@@ -494,6 +495,7 @@ PORTGEN= \
pfmt.o \
pfmt_data.o \
pfmt_print.o \
+ pipe.o \
plock.o \
poll.o \
posix_fadvise.o \