changeset 14072:706bba24f9ab

3809 Recent libc change breaks Solaris 10 Branded Zone Support Reviewed by: Andrzej Szeszo <aszeszo@gmail.com> Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com> Approved by: Gordon Ross <gwr@nexenta.com>
author Theo Schlossnagle <jesus@omniti.com>
date Sun, 09 Jun 2013 16:07:11 +0000
parents da0f6329dac3
children dc50d198fe94
files usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c usr/src/uts/common/brand/solaris10/s10_brand.c usr/src/uts/common/brand/solaris10/s10_brand.h
diffstat 3 files changed, 54 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c	Wed Jul 03 11:54:31 2013 -0800
+++ b/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c	Sun Jun 09 16:07:11 2013 +0000
@@ -20,6 +20,7 @@
  */
 
 /*
+ * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
@@ -59,6 +60,7 @@
 #include <sys/lofi.h>
 #include <atomic.h>
 #include <sys/acl.h>
+#include <sys/socket.h>
 
 #include <s10_brand.h>
 #include <brand_misc.h>
@@ -1386,6 +1388,47 @@
 	    0, 0, 0, 0, 0));
 }
 
+/*
+ * S10's socket() syscall does not split type and flags
+ */
+static int
+s10_so_socket(sysret_t *rval, int domain, int type, int protocol,
+    char *devpath, int version)
+{
+	if ((type & ~SOCK_TYPE_MASK) != 0) {
+		errno = EINVAL;
+		return (-1);
+	}
+	return (__systemcall(rval, SYS_so_socket + 1024, domain, type,
+	    protocol, devpath, version));
+}
+
+/*
+ * S10's pipe() syscall has a different calling convention
+ */
+static int
+s10_pipe(sysret_t *rval)
+{
+	int fds[2], err;
+	if ((err = __systemcall(rval, SYS_pipe + 1024, fds, 0)) != 0)
+		return (err);
+
+	rval->sys_rval1 = fds[0];
+	rval->sys_rval2 = fds[1];
+	return (0);
+}
+
+/*
+ * S10's accept() syscall takes three arguments
+ */
+static int
+s10_accept(sysret_t *rval, int sock, struct sockaddr *addr, uint_t *addrlen,
+    int version)
+{
+	return (__systemcall(rval, SYS_accept + 1024, sock, addr, addrlen,
+	    version, 0));
+}
+
 static long
 s10_uname(sysret_t *rv, uintptr_t p1)
 {
@@ -1900,7 +1943,7 @@
 	NOSYS,					/*  39 */
 	NOSYS,					/*  40 */
 	EMULATE(s10_dup, 1 | RV_DEFAULT),	/*  41 */
-	NOSYS,					/*  42 */
+	EMULATE(s10_pipe, 0 | RV_32RVAL2),	/*  42 */
 	NOSYS,					/*  43 */
 	NOSYS,					/*  44 */
 	NOSYS,					/*  45 */
@@ -2115,11 +2158,11 @@
 	EMULATE(s10_zone, 5 | RV_DEFAULT),	/* 227 */
 	NOSYS,					/* 228 */
 	NOSYS,					/* 229 */
-	NOSYS,					/* 230 */
+	EMULATE(s10_so_socket, 5 | RV_DEFAULT),	/* 230 */
 	NOSYS,					/* 231 */
 	NOSYS,					/* 232 */
 	NOSYS,					/* 233 */
-	NOSYS,					/* 234 */
+	EMULATE(s10_accept, 4 | RV_DEFAULT),	/* 234 */
 	NOSYS,					/* 235 */
 	NOSYS,					/* 236 */
 	NOSYS,					/* 237 */
--- a/usr/src/uts/common/brand/solaris10/s10_brand.c	Wed Jul 03 11:54:31 2013 -0800
+++ b/usr/src/uts/common/brand/solaris10/s10_brand.c	Sun Jun 09 16:07:11 2013 +0000
@@ -20,6 +20,7 @@
  */
 
 /*
+ * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
@@ -497,6 +498,7 @@
 	s10_emulation_table[S10_SYS_access] = 1;		/*  33 */
 	s10_emulation_table[SYS_kill] = 1;			/*  37 */
 	s10_emulation_table[S10_SYS_dup] = 1;			/*  41 */
+	s10_emulation_table[S10_SYS_pipe] = 1;			/*  42 */
 	s10_emulation_table[SYS_ioctl] = 1;			/*  54 */
 	s10_emulation_table[SYS_execve] = 1;			/*  59 */
 	s10_emulation_table[SYS_acctctl] = 1;			/*  71 */
@@ -554,6 +556,8 @@
 	s10_emulation_table[S10_SYS_creat64] = 1;		/* 224 */
 	s10_emulation_table[S10_SYS_open64] = 1;		/* 225 */
 	s10_emulation_table[SYS_zone] = 1;			/* 227 */
+	s10_emulation_table[S10_SYS_so_socket] = 1;		/* 230 */
+	s10_emulation_table[S10_SYS_accept] = 1;		/* 234 */
 	s10_emulation_table[SYS_lwp_mutex_trylock] = 1;		/* 251 */
 
 	err = mod_install(&modlinkage);
--- a/usr/src/uts/common/brand/solaris10/s10_brand.h	Wed Jul 03 11:54:31 2013 -0800
+++ b/usr/src/uts/common/brand/solaris10/s10_brand.h	Sun Jun 09 16:07:11 2013 +0000
@@ -20,6 +20,7 @@
  */
 
 /*
+ * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
@@ -119,6 +120,7 @@
 #define	S10_SYS_utime		30
 #define	S10_SYS_access		33
 #define	S10_SYS_dup		41
+#define	S10_SYS_pipe		42
 #define	S10_SYS_issetugid	75
 #define	S10_SYS_fsat		76
 #define	S10_SYS_rmdir		79
@@ -144,6 +146,8 @@
 #define	S10_SYS_fstat64		217
 #define	S10_SYS_creat64		224
 #define	S10_SYS_open64		225
+#define	S10_SYS_so_socket	230
+#define	S10_SYS_accept		234
 
 /*
  * solaris10-brand-specific attributes