summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_ipc.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-03-02 19:38:20 +0000
committerpeter <peter@FreeBSD.org>1996-03-02 19:38:20 +0000
commit8465726bdae0892d85c26b32cd01d2f6936303ef (patch)
tree83b4d342a731e2a76c19f214d574f24753abe420 /sys/compat/linux/linux_ipc.c
parent8283a18c8bf4ad6c988d73b3290e9d4b4a743ae3 (diff)
downloadFreeBSD-src-8465726bdae0892d85c26b32cd01d2f6936303ef.zip
FreeBSD-src-8465726bdae0892d85c26b32cd01d2f6936303ef.tar.gz
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now working, at least on my machine. (whew! :-) I'm uncomfortable with the size of this commit, but it's too inter-dependant to easily seperate out. The main changes: COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386 machine dependent section into the linux emulator itself. The int 0x80 syscall code was almost identical to the lcall 7,0 code and a minor tweak allows them to both be used with the same C code. All kernels can now just modload the lkm and it'll DTRT without having to rebuild the kernel first. Like IBCS2, you can statically compile it in with "options LINUX". A pile of new syscalls implemented, including getdents(), llseek(), readv(), writev(), msync(), personality(). The Linux-ELF libraries want to use some of these. linux_select() now obeys Linux semantics, ie: returns the time remaining of the timeout value rather than leaving it the original value. Quite a few bugs removed, including incorrect arguments being used in syscalls.. eg: mixups between passing the sigset as an int, vs passing it as a pointer and doing a copyin(), missing return values, unhandled cases, SIOC* ioctls, etc. The build for the code has changed. i386/conf/files now knows how to build linux_genassym and generate linux_assym.h on the fly. Supporting changes elsewhere in the kernel: The user-mode signal trampoline has moved from the U area to immediately below the top of the stack (below PS_STRINGS). This allows the different binary emulations to have their own signal trampoline code (which gets rid of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so that the emulator can provide the exact "struct sigcontext *" argument to the program's signal handlers. The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which have the same values as the re-used SA_DISABLE and SA_ONSTACK which are intended for sigaction only. This enables the support of a SA_RESETHAND flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal semantics where the signal handler is reset when it's triggered. makesyscalls.sh no longer appends the struct sysentvec on the end of the generated init_sysent.c code. It's a lot saner to have it in a seperate file rather than trying to update the structure inside the awk script. :-) At exec time, the dozen bytes or so of signal trampoline code are copied to the top of the user's stack, rather than obtaining the trampoline code the old way by getting a clone of the parent's user area. This allows Linux and native binaries to freely exec each other without getting trampolines mixed up.
Diffstat (limited to 'sys/compat/linux/linux_ipc.c')
-rw-r--r--sys/compat/linux/linux_ipc.c54
1 files changed, 30 insertions, 24 deletions
diff --git a/sys/compat/linux/linux_ipc.c b/sys/compat/linux/linux_ipc.c
index 2e5b924..854766b 100644
--- a/sys/compat/linux/linux_ipc.c
+++ b/sys/compat/linux/linux_ipc.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: linux_ipc.c,v 1.5 1996/01/05 19:52:49 wollman Exp $
+ * $Id: linux_ipc.c,v 1.6 1996/01/08 04:34:54 peter Exp $
*/
@@ -36,7 +36,20 @@
#include <sys/shm.h>
#include <i386/linux/linux.h>
-#include <i386/linux/sysproto.h>
+#include <i386/linux/linux_proto.h>
+#include <i386/linux/linux_util.h>
+
+static int linux_semop __P((struct proc *, struct linux_ipc_args *, int *));
+static int linux_semget __P((struct proc *, struct linux_ipc_args *, int *));
+static int linux_semctl __P((struct proc *, struct linux_ipc_args *, int *));
+static int linux_msgsnd __P((struct proc *, struct linux_ipc_args *, int *));
+static int linux_msgrcv __P((struct proc *, struct linux_ipc_args *, int *));
+static int linux_msgop __P((struct proc *, struct linux_ipc_args *, int *));
+static int linux_msgctl __P((struct proc *, struct linux_ipc_args *, int *));
+static int linux_shmat __P((struct proc *, struct linux_ipc_args *, int *));
+static int linux_shmdt __P((struct proc *, struct linux_ipc_args *, int *));
+static int linux_shmget __P((struct proc *, struct linux_ipc_args *, int *));
+static int linux_shmctl __P((struct proc *, struct linux_ipc_args *, int *));
struct linux_ipc_perm {
linux_key_t key;
@@ -115,33 +128,25 @@ bsd_to_linux_shmid_ds(struct shmid_ds *bsp, struct linux_shmid_ds *lsp)
lsp->private3 = bsp->shm_internal; /* this goes (yet) SOS */
}
-struct linux_ipc_args {
- int what;
- int arg1;
- int arg2;
- int arg3;
- caddr_t ptr;
-};
-
-int
+static int
linux_semop(struct proc *p, struct linux_ipc_args *args, int *retval)
{
return ENOSYS;
}
-int
+static int
linux_semget(struct proc *p, struct linux_ipc_args *args, int *retval)
{
return ENOSYS;
}
-int
+static int
linux_semctl(struct proc *p, struct linux_ipc_args *args, int *retval)
{
return ENOSYS;
}
-int
+static int
linux_msgsnd(struct proc *p, struct linux_ipc_args *args, int *retval)
{
struct msgsnd_args /* {
@@ -158,7 +163,7 @@ linux_msgsnd(struct proc *p, struct linux_ipc_args *args, int *retval)
return msgsnd(p, &bsd_args, retval);
}
-int
+static int
linux_msgrcv(struct proc *p, struct linux_ipc_args *args, int *retval)
{
struct msgrcv_args /* {
@@ -177,7 +182,7 @@ linux_msgrcv(struct proc *p, struct linux_ipc_args *args, int *retval)
return msgrcv(p, &bsd_args, retval);
}
-int
+static int
linux_msgget(struct proc *p, struct linux_ipc_args *args, int *retval)
{
struct msgget_args /* {
@@ -190,7 +195,7 @@ linux_msgget(struct proc *p, struct linux_ipc_args *args, int *retval)
return msgget(p, &bsd_args, retval);
}
-int
+static int
linux_msgctl(struct proc *p, struct linux_ipc_args *args, int *retval)
{
struct msgctl_args /* {
@@ -205,7 +210,7 @@ linux_msgctl(struct proc *p, struct linux_ipc_args *args, int *retval)
return msgctl(p, &bsd_args, retval);
}
-int
+static int
linux_shmat(struct proc *p, struct linux_ipc_args *args, int *retval)
{
struct shmat_args /* {
@@ -226,7 +231,7 @@ linux_shmat(struct proc *p, struct linux_ipc_args *args, int *retval)
return 0;
}
-int
+static int
linux_shmdt(struct proc *p, struct linux_ipc_args *args, int *retval)
{
struct shmdt_args /* {
@@ -237,7 +242,7 @@ linux_shmdt(struct proc *p, struct linux_ipc_args *args, int *retval)
return shmdt(p, &bsd_args, retval);
}
-int
+static int
linux_shmget(struct proc *p, struct linux_ipc_args *args, int *retval)
{
struct shmget_args /* {
@@ -252,7 +257,7 @@ linux_shmget(struct proc *p, struct linux_ipc_args *args, int *retval)
return shmget(p, &bsd_args, retval);
}
-int
+static int
linux_shmctl(struct proc *p, struct linux_ipc_args *args, int *retval)
{
struct shmid_ds bsd_shmid;
@@ -263,12 +268,13 @@ linux_shmctl(struct proc *p, struct linux_ipc_args *args, int *retval)
struct shmid_ds *buf;
} */ bsd_args;
int error;
+ caddr_t sg = stackgap_init();
switch (args->arg2) {
case LINUX_IPC_STAT:
bsd_args.shmid = args->arg1;
bsd_args.cmd = IPC_STAT;
- bsd_args.buf = (struct shmid_ds*)ua_alloc_init(sizeof(struct shmid_ds));
+ bsd_args.buf = (struct shmid_ds*)stackgap_alloc(&sg, sizeof(struct shmid_ds));
if ((error = shmctl(p, &bsd_args, retval)))
return error;
if ((error = copyin((caddr_t)&bsd_shmid, (caddr_t)bsd_args.buf,
@@ -282,7 +288,7 @@ linux_shmctl(struct proc *p, struct linux_ipc_args *args, int *retval)
sizeof(linux_shmid))))
return error;
linux_to_bsd_shmid_ds(&linux_shmid, &bsd_shmid);
- bsd_args.buf = (struct shmid_ds*)ua_alloc_init(sizeof(struct shmid_ds));
+ bsd_args.buf = (struct shmid_ds*)stackgap_alloc(&sg, sizeof(struct shmid_ds));
if ((error = copyout((caddr_t)&bsd_shmid, (caddr_t)bsd_args.buf,
sizeof(struct shmid_ds))))
return error;
@@ -297,7 +303,7 @@ linux_shmctl(struct proc *p, struct linux_ipc_args *args, int *retval)
sizeof(linux_shmid))))
return error;
linux_to_bsd_shmid_ds(&linux_shmid, &bsd_shmid);
- bsd_args.buf = (struct shmid_ds*)ua_alloc_init(sizeof(struct shmid_ds));
+ bsd_args.buf = (struct shmid_ds*)stackgap_alloc(&sg, sizeof(struct shmid_ds));
if ((error = copyout((caddr_t)&bsd_shmid, (caddr_t)bsd_args.buf,
sizeof(struct shmid_ds))))
return error;
OpenPOWER on IntegriCloud