summaryrefslogtreecommitdiffstats
path: root/arch/sparc64/solaris
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-05 06:47:02 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-05 06:47:02 +0000
commit99a7e12f34b3661a0d1354eef83a0eef4df5e34c (patch)
tree3560aca9ca86792f9ab7bd87861ea143a1b3c7a3 /arch/sparc64/solaris
parente73a04659c0b8cdee4dd40e58630e2cf63afb316 (diff)
Merge with Linux 2.3.38.
Diffstat (limited to 'arch/sparc64/solaris')
-rw-r--r--arch/sparc64/solaris/fs.c30
-rw-r--r--arch/sparc64/solaris/ioctl.c94
-rw-r--r--arch/sparc64/solaris/ipc.c3
-rw-r--r--arch/sparc64/solaris/misc.c12
-rw-r--r--arch/sparc64/solaris/socket.c56
-rw-r--r--arch/sparc64/solaris/timod.c2
6 files changed, 174 insertions, 23 deletions
diff --git a/arch/sparc64/solaris/fs.c b/arch/sparc64/solaris/fs.c
index bf06fc05d..86b0df283 100644
--- a/arch/sparc64/solaris/fs.c
+++ b/arch/sparc64/solaris/fs.c
@@ -1,7 +1,10 @@
-/* $Id: fs.c,v 1.13 1999/05/14 07:24:37 davem Exp $
+/* $Id: fs.c,v 1.15 2000/01/04 23:54:47 davem Exp $
* fs.c: fs related syscall emulation for Solaris
*
* Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
+ *
+ * 1999-08-19 Implemented solaris F_FREESP (truncate)
+ * fcntl, by Jason Rappleye (rappleye@ccr.buffalo.edu)
*/
#include <linux/types.h>
@@ -572,20 +575,24 @@ out:
return error;
}
-asmlinkage int solaris_open(u32 filename, int flags, u32 mode)
+extern asmlinkage long sparc32_open(const char * filename, int flags, int mode);
+
+asmlinkage int solaris_open(u32 fname, int flags, u32 mode)
{
- int (*sys_open)(const char *,int,int) =
- (int (*)(const char *,int,int))SYS(open);
+ const char *filename = (const char *)(long)fname;
int fl = flags & 0xf;
-/* if (flags & 0x2000) - allow LFS */
+ /* Translate flags first. */
+ if (flags & 0x2000) fl |= O_LARGEFILE;
if (flags & 0x8050) fl |= O_SYNC;
if (flags & 0x80) fl |= O_NONBLOCK;
if (flags & 0x100) fl |= O_CREAT;
if (flags & 0x200) fl |= O_TRUNC;
if (flags & 0x400) fl |= O_EXCL;
if (flags & 0x800) fl |= O_NOCTTY;
- return sys_open((const char *)A(filename), fl, mode);
+ flags = fl;
+
+ return sparc32_open(filename, flags, mode);
}
#define SOL_F_SETLK 6
@@ -661,7 +668,16 @@ asmlinkage int solaris_fcntl(unsigned fd, unsigned cmd, u32 arg)
__put_user_ret (0, &((struct sol_flock *)A(arg))->l_sysid, -EFAULT);
return ret;
}
- }
+ case SOL_F_FREESP:
+ {
+ int length;
+ int (*sys_newftruncate)(unsigned int, unsigned long)=
+ (int (*)(unsigned int, unsigned long))SYS(ftruncate);
+
+ get_user_ret(length, &((struct sol_flock*)A(arg))->l_start, -EFAULT);
+ return sys_newftruncate(fd, length);
+ }
+ };
return -EINVAL;
}
diff --git a/arch/sparc64/solaris/ioctl.c b/arch/sparc64/solaris/ioctl.c
index ac3071b50..18d73e686 100644
--- a/arch/sparc64/solaris/ioctl.c
+++ b/arch/sparc64/solaris/ioctl.c
@@ -1,4 +1,4 @@
-/* $Id: ioctl.c,v 1.13 1999/08/20 00:27:15 davem Exp $
+/* $Id: ioctl.c,v 1.14 1999/09/22 09:28:50 davem Exp $
* ioctl.c: Solaris ioctl emulation.
*
* Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -7,6 +7,9 @@
* Streams & timod emulation based on code
* Copyright (C) 1995, 1996 Mike Jagdis (jaggy@purplet.demon.co.uk)
*
+ * 1999-08-19 Implemented solaris 'm' (mag tape) and
+ * 'O' (openprom) ioctls, by Jason Rappleye
+ * (rappleye@ccr.buffalo.edu)
*/
#include <linux/types.h>
@@ -18,9 +21,12 @@
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/netdevice.h>
+#include <linux/mtio.h>
+#include <linux/time.h>
#include <asm/uaccess.h>
#include <asm/termios.h>
+#include <asm/openpromio.h>
#include "conv.h"
#include "socksys.h"
@@ -678,6 +684,90 @@ static inline int solaris_i(unsigned int fd, unsigned int cmd, u32 arg)
return -ENOSYS;
}
+static int solaris_m(unsigned int fd, unsigned int cmd, u32 arg)
+{
+ int ret;
+
+ switch (cmd & 0xff) {
+ case 1: /* MTIOCTOP */
+ ret = sys_ioctl(fd, MTIOCTOP, (unsigned long)&arg);
+ break;
+ case 2: /* MTIOCGET */
+ ret = sys_ioctl(fd, MTIOCGET, (unsigned long)&arg);
+ break;
+ case 3: /* MTIOCGETDRIVETYPE */
+ case 4: /* MTIOCPERSISTENT */
+ case 5: /* MTIOCPERSISTENTSTATUS */
+ case 6: /* MTIOCLRERR */
+ case 7: /* MTIOCGUARANTEEDORDER */
+ case 8: /* MTIOCRESERVE */
+ case 9: /* MTIOCRELEASE */
+ case 10: /* MTIOCFORCERESERVE */
+ case 13: /* MTIOCSTATE */
+ case 14: /* MTIOCREADIGNOREILI */
+ case 15: /* MTIOCREADIGNOREEOFS */
+ case 16: /* MTIOCSHORTFMK */
+ default:
+ ret = -ENOSYS; /* linux doesn't support these */
+ break;
+ };
+
+ return ret;
+}
+
+static int solaris_O(unsigned int fd, unsigned int cmd, u32 arg)
+{
+ int ret = -EINVAL;
+
+ switch (cmd & 0xff) {
+ case 1: /* OPROMGETOPT */
+ ret = sys_ioctl(fd, OPROMGETOPT, arg);
+ break;
+ case 2: /* OPROMSETOPT */
+ ret = sys_ioctl(fd, OPROMSETOPT, arg);
+ break;
+ case 3: /* OPROMNXTOPT */
+ ret = sys_ioctl(fd, OPROMNXTOPT, arg);
+ break;
+ case 4: /* OPROMSETOPT2 */
+ ret = sys_ioctl(fd, OPROMSETOPT2, arg);
+ break;
+ case 5: /* OPROMNEXT */
+ ret = sys_ioctl(fd, OPROMNEXT, arg);
+ break;
+ case 6: /* OPROMCHILD */
+ ret = sys_ioctl(fd, OPROMCHILD, arg);
+ break;
+ case 7: /* OPROMGETPROP */
+ ret = sys_ioctl(fd, OPROMGETPROP, arg);
+ break;
+ case 8: /* OPROMNXTPROP */
+ ret = sys_ioctl(fd, OPROMNXTPROP, arg);
+ break;
+ case 9: /* OPROMU2P */
+ ret = sys_ioctl(fd, OPROMU2P, arg);
+ break;
+ case 10: /* OPROMGETCONS */
+ ret = sys_ioctl(fd, OPROMGETCONS, arg);
+ break;
+ case 11: /* OPROMGETFBNAME */
+ ret = sys_ioctl(fd, OPROMGETFBNAME, arg);
+ break;
+ case 12: /* OPROMGETBOOTARGS */
+ ret = sys_ioctl(fd, OPROMGETBOOTARGS, arg);
+ break;
+ case 13: /* OPROMGETVERSION */
+ case 14: /* OPROMPATH2DRV */
+ case 15: /* OPROMDEV2PROMNAME */
+ case 16: /* OPROMPROM2DEVNAME */
+ case 17: /* OPROMGETPROPLEN */
+ default:
+ ret = -EINVAL;
+ break;
+ };
+ return ret;
+}
+
/* }}} */
asmlinkage int solaris_ioctl(unsigned int fd, unsigned int cmd, u32 arg)
@@ -699,6 +789,8 @@ asmlinkage int solaris_ioctl(unsigned int fd, unsigned int cmd, u32 arg)
case 's': error = solaris_s(fd, cmd, arg); break;
case 't': error = solaris_t(fd, cmd, arg); break;
case 'f': error = sys_ioctl(fd, cmd, arg); break;
+ case 'm': error = solaris_m(fd, cmd, arg); break;
+ case 'O': error = solaris_O(fd, cmd, arg); break;
default:
error = -ENOSYS;
break;
diff --git a/arch/sparc64/solaris/ipc.c b/arch/sparc64/solaris/ipc.c
index 0c2116e73..3d312b5e1 100644
--- a/arch/sparc64/solaris/ipc.c
+++ b/arch/sparc64/solaris/ipc.c
@@ -1,4 +1,4 @@
-/* $Id: ipc.c,v 1.4 1999/05/13 07:11:37 jj Exp $
+/* $Id: ipc.c,v 1.5 1999/12/09 00:41:00 davem Exp $
* ipc.c: Solaris IPC emulation
*
* Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -8,6 +8,7 @@
#include <linux/types.h>
#include <linux/smp_lock.h>
#include <linux/wait.h>
+#include <linux/mm.h>
#include <linux/shm.h>
#include <linux/sem.h>
#include <linux/msg.h>
diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c
index c3176ac2c..a07fc7cc2 100644
--- a/arch/sparc64/solaris/misc.c
+++ b/arch/sparc64/solaris/misc.c
@@ -1,4 +1,4 @@
-/* $Id: misc.c,v 1.14 1999/06/25 11:00:53 davem Exp $
+/* $Id: misc.c,v 1.19 1999/12/15 17:51:25 jj Exp $
* misc.c: Miscelaneous syscall emulation for Solaris
*
* Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -476,8 +476,8 @@ asmlinkage int solaris_gettimeofday(u32 tim)
#define RLIMIT_SOL_VMEM 6
struct rlimit32 {
- s32 rlim_cur;
- s32 rlim_max;
+ u32 rlim_cur;
+ u32 rlim_max;
};
asmlinkage int solaris_getrlimit(unsigned int resource, struct rlimit32 *rlim)
@@ -747,11 +747,7 @@ struct exec_domain solaris_exec_domain = {
1, 1, /* PER_SVR4 personality */
solaris_to_linux_signals,
linux_to_solaris_signals,
-#ifdef MODULE
- &__this_module,
-#else
- NULL,
-#endif
+ THIS_MODULE,
NULL
};
diff --git a/arch/sparc64/solaris/socket.c b/arch/sparc64/solaris/socket.c
index 4b3f18fc1..b9db00918 100644
--- a/arch/sparc64/solaris/socket.c
+++ b/arch/sparc64/solaris/socket.c
@@ -1,7 +1,10 @@
-/* $Id: socket.c,v 1.1 1998/10/28 08:12:11 jj Exp $
+/* $Id: socket.c,v 1.2 1999/09/22 09:28:50 davem Exp $
* socket.c: Socket syscall emulation for Solaris 2.6+
*
* Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
+ *
+ * 1999-08-19 Fixed socketpair code
+ * Jason Rappleye (rappleye@ccr.buffalo.edu)
*/
#include <linux/types.h>
@@ -25,6 +28,18 @@
#define SOCK_SOL_RDM 5
#define SOCK_SOL_SEQPACKET 6
+#define SOL_SO_SNDLOWAT 0x1003
+#define SOL_SO_RCVLOWAT 0x1004
+#define SOL_SO_SNDTIMEO 0x1005
+#define SOL_SO_RCVTIMEO 0x1006
+#define SOL_SO_STATE 0x2000
+
+#define SOL_SS_NDELAY 0x040
+#define SOL_SS_NONBLOCK 0x080
+#define SOL_SS_ASYNC 0x100
+
+#define SO_STATE 0x000e
+
static int socket_check(int family, int type)
{
if (family != PF_UNIX && family != PF_INET)
@@ -40,6 +55,19 @@ static int socket_check(int family, int type)
return type;
}
+static int solaris_to_linux_sockopt(int optname)
+{
+ switch (optname) {
+ case SOL_SO_SNDLOWAT: optname = SO_SNDLOWAT; break;
+ case SOL_SO_RCVLOWAT: optname = SO_RCVLOWAT; break;
+ case SOL_SO_SNDTIMEO: optname = SO_SNDTIMEO; break;
+ case SOL_SO_RCVTIMEO: optname = SO_RCVTIMEO; break;
+ case SOL_SO_STATE: optname = SO_STATE; break;
+ };
+
+ return optname;
+}
+
asmlinkage int solaris_socket(int family, int type, int protocol)
{
int (*sys_socket)(int, int, int) =
@@ -50,14 +78,19 @@ asmlinkage int solaris_socket(int family, int type, int protocol)
return sys_socket(family, type, protocol);
}
-asmlinkage int solaris_socketpair(int family, int type, int protocol, int *usockvec)
+asmlinkage int solaris_socketpair(int *usockvec)
{
int (*sys_socketpair)(int, int, int, int *) =
(int (*)(int, int, int, int *))SYS(socketpair);
- type = socket_check (family, type);
- if (type < 0) return type;
- return sys_socketpair(family, type, protocol, usockvec);
+ /* solaris socketpair really only takes one arg at the syscall
+ * level, int * usockvec. The libs apparently take care of
+ * making sure that family==AF_UNIX and type==SOCK_STREAM. The
+ * pointer we really want ends up residing in the first (and
+ * supposedly only) argument.
+ */
+
+ return sys_socketpair(AF_UNIX, SOCK_STREAM, 0, (int *)usockvec);
}
asmlinkage int solaris_bind(int fd, struct sockaddr *addr, int addrlen)
@@ -73,6 +106,12 @@ asmlinkage int solaris_setsockopt(int fd, int level, int optname, u32 optval, in
int (*sunos_setsockopt)(int, int, int, u32, int) =
(int (*)(int, int, int, u32, int))SUNOS(105);
+ optname = solaris_to_linux_sockopt(optname);
+ if (optname < 0)
+ return optname;
+ if (optname == SO_STATE)
+ return 0;
+
return sunos_setsockopt(fd, level, optname, optval, optlen);
}
@@ -81,6 +120,13 @@ asmlinkage int solaris_getsockopt(int fd, int level, int optname, u32 optval, u3
int (*sunos_getsockopt)(int, int, int, u32, u32) =
(int (*)(int, int, int, u32, u32))SUNOS(118);
+ optname = solaris_to_linux_sockopt(optname);
+ if (optname < 0)
+ return optname;
+
+ if (optname == SO_STATE)
+ optname = SOL_SO_STATE;
+
return sunos_getsockopt(fd, level, optname, optval, optlen);
}
diff --git a/arch/sparc64/solaris/timod.c b/arch/sparc64/solaris/timod.c
index 050c6e0b3..062e00218 100644
--- a/arch/sparc64/solaris/timod.c
+++ b/arch/sparc64/solaris/timod.c
@@ -1,4 +1,4 @@
-/* $Id: timod.c,v 1.4 1999/09/01 08:07:47 davem Exp $
+/* $Id: timod.c,v 1.5 1999/11/23 08:55:24 davem Exp $
* timod.c: timod emulation.
*
* Copyright (C) 1998 Patrik Rak (prak3264@ss1000.ms.mff.cuni.cz)