diff options
Diffstat (limited to 'sys/i386/linux')
-rw-r--r-- | sys/i386/linux/imgact_linux.c | 6 | ||||
-rw-r--r-- | sys/i386/linux/linux.h | 20 | ||||
-rw-r--r-- | sys/i386/linux/linux_dummy.c | 9 | ||||
-rw-r--r-- | sys/i386/linux/linux_file.c | 6 | ||||
-rw-r--r-- | sys/i386/linux/linux_ioctl.c | 62 | ||||
-rw-r--r-- | sys/i386/linux/linux_misc.c | 271 | ||||
-rw-r--r-- | sys/i386/linux/linux_proto.h | 15 | ||||
-rw-r--r-- | sys/i386/linux/linux_signal.c | 4 | ||||
-rw-r--r-- | sys/i386/linux/linux_socket.c | 40 | ||||
-rw-r--r-- | sys/i386/linux/linux_syscall.h | 7 | ||||
-rw-r--r-- | sys/i386/linux/linux_sysent.c | 10 | ||||
-rw-r--r-- | sys/i386/linux/linux_sysvec.c | 27 | ||||
-rw-r--r-- | sys/i386/linux/linux_util.h | 4 | ||||
-rw-r--r-- | sys/i386/linux/syscalls.master | 13 |
14 files changed, 61 insertions, 433 deletions
diff --git a/sys/i386/linux/imgact_linux.c b/sys/i386/linux/imgact_linux.c index 59ee24737b737..72f846cb447c3 100644 --- a/sys/i386/linux/imgact_linux.c +++ b/sys/i386/linux/imgact_linux.c @@ -28,7 +28,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: imgact_linux.c,v 1.30 1998/10/16 03:55:00 peter Exp $ + * $Id: imgact_linux.c,v 1.29 1998/08/16 01:21:50 bde Exp $ */ #include <sys/param.h> @@ -234,8 +234,8 @@ exec_linux_imgact(imgp) /* * Tell kern_execve.c about it, with a little help from the linker. * Since `const' objects end up in the text segment, TEXT_SET is the - * correct directive to use. + * correct directive to use. Do not staticize; used by Linux LKM. */ -static const struct execsw linux_execsw = { exec_linux_imgact, "linux a.out" }; +const struct execsw linux_execsw = { exec_linux_imgact, "linux a.out" }; EXEC_SET(linuxaout, linux_execsw); diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index eaffa614c6b8c..db96f2e025d59 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -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.h,v 1.25 1998/12/19 02:55:32 julian Exp $ + * $Id: linux.h,v 1.22 1998/09/30 01:42:53 jfieber Exp $ */ #ifndef _I386_LINUX_LINUX_H_ @@ -418,7 +418,6 @@ struct trapframe; #define LINUX_MAP_PRIVATE 0x0002 #define LINUX_MAP_FIXED 0x0010 #define LINUX_MAP_ANON 0x0020 -#define LINUX_MAP_GROWSDOWN 0x0100 /* SystemV ipc defines */ #define LINUX_SEMOP 1 @@ -472,8 +471,6 @@ struct trapframe; #define LINUX_SHUTDOWN 13 #define LINUX_SETSOCKOPT 14 #define LINUX_GETSOCKOPT 15 -#define LINUX_SENDMSG 16 -#define LINUX_RECVMSG 17 #define LINUX_AF_UNSPEC 0 #define LINUX_AF_UNIX 1 @@ -515,21 +512,6 @@ struct trapframe; #define LINUX_IP_DROP_MEMBERSHIP 36 /* Sound system defines */ -#define LINUX_SNDCTL_SEQ_RESET 0x5100 -#define LINUX_SNDCTL_SEQ_SYNC 0x5101 -#define LINUX_SNDCTL_SYNTH_INFO 0x5102 -#define LINUX_SNDCTL_SEQ_CTRLRATE 0x5103 -#define LINUX_SNDCTL_SEQ_GETOUTCOUNT 0x5104 -#define LINUX_SNDCTL_SEQ_GETINCOUNT 0x5105 -#define LINUX_SNDCTL_SEQ_PERCMODE 0x5106 -#define LINUX_SNDCTL_FM_LOAD_INSTR 0x5107 -#define LINUX_SNDCTL_SEQ_TESTMIDI 0x5108 -#define LINUX_SNDCTL_SEQ_RESETSAMPLES 0x5109 -#define LINUX_SNDCTL_SEQ_NRSYNTHS 0x510A -#define LINUX_SNDCTL_SEQ_NRMIDIS 0x510B -#define LINUX_SNDCTL_MIDI_INFO 0x510C -#define LINUX_SNDCTL_SEQ_TRESHOLD 0x510D -#define LINUX_SNDCTL_SYNTH_MEMAVL 0x510E #define LINUX_SNDCTL_DSP_RESET 0x5000 #define LINUX_SNDCTL_DSP_SYNC 0x5001 #define LINUX_SNDCTL_DSP_SPEED 0x5002 diff --git a/sys/i386/linux/linux_dummy.c b/sys/i386/linux/linux_dummy.c index 6a7ce1e828023..30a0dba494493 100644 --- a/sys/i386/linux/linux_dummy.c +++ b/sys/i386/linux/linux_dummy.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_dummy.c,v 1.8 1997/11/06 19:28:52 phk Exp $ + * $Id: linux_dummy.c,v 1.7 1997/10/29 08:17:09 kato Exp $ */ #include <sys/param.h> @@ -212,6 +212,13 @@ linux_sysinfo(struct proc *p, struct linux_sysinfo_args *args) } int +linux_clone(struct proc *p, struct linux_clone_args *args) +{ + printf("Linux-emul(%d): clone() not supported\n", p->p_pid); + return ENOSYS; +} + +int linux_uname(struct proc *p, struct linux_uname_args *args) { printf("Linux-emul(%d): uname() not supported\n", p->p_pid); diff --git a/sys/i386/linux/linux_file.c b/sys/i386/linux/linux_file.c index 16f12ed4d7bea..6a80d4c5ec665 100644 --- a/sys/i386/linux/linux_file.c +++ b/sys/i386/linux/linux_file.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_file.c,v 1.22 1998/10/05 16:37:36 jfieber Exp $ + * $Id: linux_file.c,v 1.21 1998/07/29 16:43:00 bde Exp $ */ #include "opt_compat.h" @@ -812,7 +812,7 @@ linux_readlink(struct proc *p, struct linux_readlink_args *args) int linux_truncate(struct proc *p, struct linux_truncate_args *args) { - struct truncate_args bsd; + struct otruncate_args bsd; caddr_t sg; sg = stackgap_init(); @@ -825,6 +825,6 @@ linux_truncate(struct proc *p, struct linux_truncate_args *args) bsd.path = args->path; bsd.length = args->length; - return truncate(p, &bsd); + return otruncate(p, &bsd); } diff --git a/sys/i386/linux/linux_ioctl.c b/sys/i386/linux/linux_ioctl.c index 3010f74116bdf..26bb5ab710fc8 100644 --- a/sys/i386/linux/linux_ioctl.c +++ b/sys/i386/linux/linux_ioctl.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_ioctl.c,v 1.29 1998/09/30 01:42:53 jfieber Exp $ + * $Id: linux_ioctl.c,v 1.28 1998/08/31 10:53:33 jkh Exp $ */ #include <sys/param.h> @@ -683,66 +683,6 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args) return copyout(&linux_line, (caddr_t)args->arg, sizeof(int)); - case LINUX_SNDCTL_SEQ_RESET: - args->cmd = SNDCTL_SEQ_RESET; - return ioctl(p, (struct ioctl_args *)args); - - case LINUX_SNDCTL_SEQ_SYNC: - args->cmd = SNDCTL_SEQ_SYNC; - return ioctl(p, (struct ioctl_args *)args); - - case LINUX_SNDCTL_SYNTH_INFO: - args->cmd = SNDCTL_SYNTH_INFO; - return ioctl(p, (struct ioctl_args *)args); - - case LINUX_SNDCTL_SEQ_CTRLRATE: - args->cmd = SNDCTL_SEQ_CTRLRATE; - return ioctl(p, (struct ioctl_args *)args); - - case LINUX_SNDCTL_SEQ_GETOUTCOUNT: - args->cmd = SNDCTL_SEQ_GETOUTCOUNT; - return ioctl(p, (struct ioctl_args *)args); - - case LINUX_SNDCTL_SEQ_GETINCOUNT: - args->cmd = SNDCTL_SEQ_GETINCOUNT; - return ioctl(p, (struct ioctl_args *)args); - - case LINUX_SNDCTL_SEQ_PERCMODE: - args->cmd = SNDCTL_SEQ_PERCMODE; - return ioctl(p, (struct ioctl_args *)args); - - case LINUX_SNDCTL_FM_LOAD_INSTR: - args->cmd = SNDCTL_FM_LOAD_INSTR; - return ioctl(p, (struct ioctl_args *)args); - - case LINUX_SNDCTL_SEQ_TESTMIDI: - args->cmd = SNDCTL_SEQ_TESTMIDI; - return ioctl(p, (struct ioctl_args *)args); - - case LINUX_SNDCTL_SEQ_RESETSAMPLES: - args->cmd = SNDCTL_SEQ_RESETSAMPLES; - return ioctl(p, (struct ioctl_args *)args); - - case LINUX_SNDCTL_SEQ_NRSYNTHS: - args->cmd = SNDCTL_SEQ_NRSYNTHS; - return ioctl(p, (struct ioctl_args *)args); - - case LINUX_SNDCTL_SEQ_NRMIDIS: - args->cmd = SNDCTL_SEQ_NRMIDIS; - return ioctl(p, (struct ioctl_args *)args); - - case LINUX_SNDCTL_MIDI_INFO: - args->cmd = SNDCTL_MIDI_INFO; - return ioctl(p, (struct ioctl_args *)args); - - case LINUX_SNDCTL_SEQ_TRESHOLD: - args->cmd = SNDCTL_SEQ_TRESHOLD; - return ioctl(p, (struct ioctl_args *)args); - - case LINUX_SNDCTL_SYNTH_MEMAVL: - args->cmd = SNDCTL_SYNTH_MEMAVL; - return ioctl(p, (struct ioctl_args *)args); - case LINUX_SNDCTL_DSP_GETOPTR : args->cmd = SNDCTL_DSP_GETOPTR; return ioctl(p, (struct ioctl_args *)args); diff --git a/sys/i386/linux/linux_misc.c b/sys/i386/linux/linux_misc.c index 02f9785fa8a36..9fdd923276749 100644 --- a/sys/i386/linux/linux_misc.c +++ b/sys/i386/linux/linux_misc.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_misc.c,v 1.50 1998/12/30 21:01:33 sos Exp $ + * $Id: linux_misc.c,v 1.44 1998/09/24 13:25:43 jkh Exp $ */ #include <sys/param.h> @@ -41,9 +41,6 @@ #include <sys/resourcevar.h> #include <sys/stat.h> #include <sys/sysctl.h> -#ifdef COMPAT_LINUX_THREADS -#include <sys/unistd.h> -#endif /* COMPAT_LINUX_THREADS */ #include <sys/vnode.h> #include <sys/wait.h> #include <sys/time.h> @@ -563,79 +560,6 @@ linux_fork(struct proc *p, struct linux_fork_args *args) return 0; } -#ifndef COMPAT_LINUX_THREADS -int -linux_clone(struct proc *p, struct linux_clone_args *args) -{ - printf("linux_clone(%d): Not enabled\n", p->p_pid); - return (EOPNOTSUPP); -} - -#else -#define CLONE_VM 0x100 -#define CLONE_FS 0x200 -#define CLONE_FILES 0x400 -#define CLONE_SIGHAND 0x800 -#define CLONE_PID 0x1000 - -int -linux_clone(struct proc *p, struct linux_clone_args *args) -{ - int error, ff = RFPROC; - struct proc *p2; - int exit_signal; - vm_offset_t start; - struct rfork_args rf_args; - -#ifdef SMP - printf("linux_clone(%d): does not work with SMP yet\n", p->p_pid); - return (EOPNOTSUPP); -#endif -#ifdef DEBUG - if (args->flags & CLONE_PID) - printf("linux_clone(%d): CLONE_PID not yet supported\n", p->p_pid); - printf ("linux_clone(%d): invoked with flags %x and stack %x\n", p->p_pid, - (unsigned int)args->flags, (unsigned int)args->stack); -#endif - - if (!args->stack) - return (EINVAL); - exit_signal = args->flags & 0x000000ff; - if (exit_signal >= LINUX_NSIG) - return EINVAL; - exit_signal = linux_to_bsd_signal[exit_signal]; - - /* RFTHREAD probably not necessary here, but it shouldn't hurt either */ - ff |= RFTHREAD; - - if (args->flags & CLONE_VM) - ff |= RFMEM; - if (args->flags & CLONE_SIGHAND) - ff |= RFSIGSHARE; - if (!(args->flags & CLONE_FILES)) - ff |= RFFDG; - - error = 0; - start = 0; - - rf_args.flags = ff; - if (error = rfork(p, &rf_args)) - return error; - - p2 = pfind(p->p_retval[0]); - if (p2 == 0) - return ESRCH; - - p2->p_sigparent = exit_signal; - p2->p_md.md_regs->tf_esp = (unsigned int)args->stack; - -#ifdef DEBUG - printf ("linux_clone(%d): successful rfork to %d\n", p->p_pid, p2->p_pid); -#endif - return 0; -} - -#endif /* COMPAT_LINUX_THREADS */ /* XXX move */ struct linux_mmap_argv { linux_caddr_t addr; @@ -646,11 +570,6 @@ struct linux_mmap_argv { int pos; }; -#ifdef COMPAT_LINUX_THREADS -#define STACK_SIZE (2 * 1024 * 1024) -#define GUARD_SIZE (4 * PAGE_SIZE) - -#endif /* COMPAT_LINUX_THREADS */ int linux_mmap(struct proc *p, struct linux_mmap_args *args) { @@ -683,69 +602,8 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args) bsd_args.flags |= MAP_FIXED; if (linux_args.flags & LINUX_MAP_ANON) bsd_args.flags |= MAP_ANON; -#ifndef COMPAT_LINUX_THREADS bsd_args.addr = linux_args.addr; bsd_args.len = linux_args.len; -#else - -#ifndef VM_STACK - /* Linux Threads will map into the proc stack space, unless - * we prevent it. This causes problems if we're not using - * our VM_STACK options. - */ - if ((unsigned int)linux_args.addr + linux_args.len > (USRSTACK - MAXSSIZ)) - return (EINVAL); -#endif - - if (linux_args.flags & LINUX_MAP_GROWSDOWN) { - -#ifdef VM_STACK - bsd_args.flags |= MAP_STACK; -#endif - - /* The linux MAP_GROWSDOWN option does not limit auto - * growth of the region. Linux mmap with this option - * takes as addr the inital BOS, and as len, the initial - * region size. It can then grow down from addr without - * limit. However, linux threads has an implicit internal - * limit to stack size of STACK_SIZE. Its just not - * enforced explicitly in linux. But, here we impose - * a limit of (STACK_SIZE - GUARD_SIZE) on the stack - * region, since we can do this with our mmap. - * - * Our mmap with MAP_STACK takes addr as the maximum - * downsize limit on BOS, and as len the max size of - * the region. It them maps the top SGROWSIZ bytes, - * and autgrows the region down, up to the limit - * in addr. - * - * If we don't use the MAP_STACK option, the effect - * of this code is to allocate a stack region of a - * fixed size of (STACK_SIZE - GUARD_SIZE). - */ - - /* This gives us TOS */ - bsd_args.addr = linux_args.addr + linux_args.len; - - /* This gives us our maximum stack size */ - if (linux_args.len > STACK_SIZE - GUARD_SIZE) - bsd_args.len = linux_args.len; - else - bsd_args.len = STACK_SIZE - GUARD_SIZE; - - /* This gives us a new BOS. If we're using VM_STACK, then - * mmap will just map the top SGROWSIZ bytes, and let - * the stack grow down to the limit at BOS. If we're - * not using VM_STACK we map the full stack, since we - * don't have a way to autogrow it. - */ - bsd_args.addr -= bsd_args.len; - - } else { - bsd_args.addr = linux_args.addr; - bsd_args.len = linux_args.len; - } -#endif /* COMPAT_LINUX_THREADS */ bsd_args.prot = linux_args.prot | PROT_READ; /* always required */ bsd_args.fd = linux_args.fd; bsd_args.pos = linux_args.pos; @@ -801,23 +659,14 @@ int linux_pipe(struct proc *p, struct linux_pipe_args *args) { int error; - int reg_edx; #ifdef DEBUG printf("Linux-emul(%d): pipe(*)\n", p->p_pid); #endif - reg_edx = p->p_retval[1]; - if (error = pipe(p, 0)) { - p->p_retval[1] = reg_edx; + if (error = pipe(p, 0)) return error; - } - - if (error = copyout(p->p_retval, args->pipefds, 2*sizeof(int))) { - p->p_retval[1] = reg_edx; + if (error = copyout(p->p_retval, args->pipefds, 2*sizeof(int))) return error; - } - - p->p_retval[1] = reg_edx; p->p_retval[0] = 0; return 0; } @@ -897,18 +746,12 @@ linux_newuname(struct proc *p, struct linux_newuname_args *args) printf("Linux-emul(%d): newuname(*)\n", p->p_pid); #endif bzero(&linux_newuname, sizeof(struct linux_newuname_t)); - strncpy(linux_newuname.sysname, ostype, - sizeof(linux_newuname.sysname) - 1); - strncpy(linux_newuname.nodename, hostname, - sizeof(linux_newuname.nodename) - 1); - strncpy(linux_newuname.release, osrelease, - sizeof(linux_newuname.release) - 1); - strncpy(linux_newuname.version, version, - sizeof(linux_newuname.version) - 1); - strncpy(linux_newuname.machine, machine, - sizeof(linux_newuname.machine) - 1); - strncpy(linux_newuname.domainname, domainname, - sizeof(linux_newuname.domainname) - 1); + strncpy(linux_newuname.sysname, ostype, 64); + strncpy(linux_newuname.nodename, hostname, 64); + strncpy(linux_newuname.release, osrelease, 64); + strncpy(linux_newuname.version, version, 64); + strncpy(linux_newuname.machine, machine, 64); + strncpy(linux_newuname.domainname, domainname, 64); return (copyout((caddr_t)&linux_newuname, (caddr_t)args->buf, sizeof(struct linux_newuname_t))); } @@ -972,25 +815,11 @@ linux_waitpid(struct proc *p, struct linux_waitpid_args *args) #endif tmp.pid = args->pid; tmp.status = args->status; -#ifndef COMPAT_LINUX_THREADS tmp.options = args->options; -#else - /* This filters out the linux option _WCLONE. I don't - * think we need it, but I could be wrong. If we need - * it, we need to fix wait4, since it will give us an - * error return of EINVAL if we pass in _WCLONE, and - * of course, it won't do anything with it. - */ - tmp.options = (args->options & (WNOHANG | WUNTRACED)); -#endif /* COMPAT_LINUX_THREADS */ tmp.rusage = NULL; if (error = wait4(p, &tmp)) -#ifndef COMPAT_LINUX_THREADS - return error; -#else return error; -#endif /* COMPAT_LINUX_THREADS */ if (args->status) { if (error = copyin(args->status, &tmpstat, sizeof(int))) return error; @@ -1023,17 +852,7 @@ linux_wait4(struct proc *p, struct linux_wait4_args *args) #endif tmp.pid = args->pid; tmp.status = args->status; -#ifndef COMPAT_LINUX_THREADS tmp.options = args->options; -#else - /* This filters out the linux option _WCLONE. I don't - * think we need it, but I could be wrong. If we need - * it, we need to fix wait4, since it will give us an - * error return of EINVAL if we pass in _WCLONE, and - * of course, it won't do anything with it. - */ - tmp.options = (args->options & (WNOHANG | WUNTRACED)); -#endif /* COMPAT_LINUX_THREADS */ tmp.rusage = args->rusage; if (error = wait4(p, &tmp)) @@ -1170,75 +989,3 @@ linux_nice(struct proc *p, struct linux_nice_args *args) return setpriority(p, &bsd_args); } -int -linux_setgroups(p, uap) - struct proc *p; - struct linux_setgroups_args *uap; -{ - struct pcred *pc = p->p_cred; - linux_gid_t linux_gidset[NGROUPS]; - gid_t *bsd_gidset; - int ngrp, error; - - if ((error = suser(pc->pc_ucred, &p->p_acflag))) - return error; - - if (uap->gidsetsize > NGROUPS) - return EINVAL; - - ngrp = uap->gidsetsize; - pc->pc_ucred = crcopy(pc->pc_ucred); - if (ngrp >= 1) { - if ((error = copyin((caddr_t)uap->gidset, - (caddr_t)linux_gidset, - ngrp * sizeof(linux_gid_t)))) - return error; - - pc->pc_ucred->cr_ngroups = ngrp; - - bsd_gidset = pc->pc_ucred->cr_groups; - ngrp--; - while (ngrp >= 0) { - bsd_gidset[ngrp] = linux_gidset[ngrp]; - ngrp--; - } - } - else - pc->pc_ucred->cr_ngroups = 1; - - setsugid(p); - return 0; -} - -int -linux_getgroups(p, uap) - struct proc *p; - struct linux_getgroups_args *uap; -{ - struct pcred *pc = p->p_cred; - linux_gid_t linux_gidset[NGROUPS]; - gid_t *bsd_gidset; - int ngrp, error; - - if ((ngrp = uap->gidsetsize) == 0) { - p->p_retval[0] = pc->pc_ucred->cr_ngroups; - return 0; - } - - if (ngrp < pc->pc_ucred->cr_ngroups) - return EINVAL; - - ngrp = 0; - bsd_gidset = pc->pc_ucred->cr_groups; - while (ngrp < pc->pc_ucred->cr_ngroups) { - linux_gidset[ngrp] = bsd_gidset[ngrp]; - ngrp++; - } - - if ((error = copyout((caddr_t)linux_gidset, (caddr_t)uap->gidset, - ngrp * sizeof(linux_gid_t)))) - return error; - - p->p_retval[0] = ngrp; - return (0); -} diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h index cda56c279d8b4..eedb56606a4c3 100644 --- a/sys/i386/linux/linux_proto.h +++ b/sys/i386/linux/linux_proto.h @@ -2,7 +2,7 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * created from Id: syscalls.master,v 1.16 1998/12/30 20:58:28 sos Exp + * created from Id: syscalls.master,v 1.11 1998/06/09 03:28:14 bde Exp */ #ifndef _LINUX_SYSPROTO_H_ @@ -195,14 +195,6 @@ struct linux_sigsuspend_args { struct linux_sigpending_args { linux_sigset_t * mask; char mask_[PAD_(linux_sigset_t *)]; }; -struct linux_getgroups_args { - u_int gidsetsize; char gidsetsize_[PAD_(u_int)]; - linux_gid_t * gidset; char gidset_[PAD_(linux_gid_t *)]; -}; -struct linux_setgroups_args { - u_int gidsetsize; char gidsetsize_[PAD_(u_int)]; - linux_gid_t * gidset; char gidset_[PAD_(linux_gid_t *)]; -}; struct linux_select_args { struct linux_select_argv * ptr; char ptr_[PAD_(struct linux_select_argv *)]; }; @@ -309,8 +301,7 @@ struct linux_sigreturn_args { struct linux_sigcontext * scp; char scp_[PAD_(struct linux_sigcontext *)]; }; struct linux_clone_args { - int flags; char flags_[PAD_(int)]; - void * stack; char stack_[PAD_(void *)]; + register_t dummy; }; struct linux_newuname_args { struct linux_newuname_t * buf; char buf_[PAD_(struct linux_newuname_t *)]; @@ -437,8 +428,6 @@ int linux_siggetmask __P((struct proc *, struct linux_siggetmask_args *)); int linux_sigsetmask __P((struct proc *, struct linux_sigsetmask_args *)); int linux_sigsuspend __P((struct proc *, struct linux_sigsuspend_args *)); int linux_sigpending __P((struct proc *, struct linux_sigpending_args *)); -int linux_getgroups __P((struct proc *, struct linux_getgroups_args *)); -int linux_setgroups __P((struct proc *, struct linux_setgroups_args *)); int linux_select __P((struct proc *, struct linux_select_args *)); int linux_symlink __P((struct proc *, struct linux_symlink_args *)); int linux_readlink __P((struct proc *, struct linux_readlink_args *)); diff --git a/sys/i386/linux/linux_signal.c b/sys/i386/linux/linux_signal.c index 1f71bf53df09b..481ed7f177536 100644 --- a/sys/i386/linux/linux_signal.c +++ b/sys/i386/linux/linux_signal.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_signal.c,v 1.13 1998/10/11 04:54:16 jdp Exp $ + * $Id: linux_signal.c,v 1.12 1998/08/15 22:29:43 bde Exp $ */ #include <sys/param.h> @@ -310,7 +310,7 @@ linux_kill(struct proc *p, struct linux_kill_args *args) printf("Linux-emul(%d): kill(%d, %d)\n", p->p_pid, args->pid, args->signum); #endif - if (args->signum < 0 || args->signum >= LINUX_NSIG) + if (args->signum <= 0 || args->signum >= LINUX_NSIG) return EINVAL; tmp.pid = args->pid; tmp.signum = linux_to_bsd_signal[args->signum]; diff --git a/sys/i386/linux/linux_socket.c b/sys/i386/linux/linux_socket.c index e757fc13c7f81..b50cf5860e319 100644 --- a/sys/i386/linux/linux_socket.c +++ b/sys/i386/linux/linux_socket.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_socket.c,v 1.14 1998/12/30 21:20:00 sos Exp $ + * $Id: linux_socket.c,v 1.12 1998/02/07 02:13:27 msmith Exp $ */ /* XXX we use functions that might not exist. */ @@ -810,44 +810,6 @@ linux_socketcall(struct proc *p, struct linux_socketcall_args *args) return linux_setsockopt(p, args->args); case LINUX_GETSOCKOPT: return linux_getsockopt(p, args->args); - case LINUX_SENDMSG: - do { - int error; - int level; - caddr_t control; - struct { - int s; - const struct msghdr *msg; - int flags; - } *uap = args->args; - - error = copyin(&uap->msg->msg_control, - &control, sizeof(caddr_t)); - if (error) - return error; - if (control == NULL) - goto done; - error = copyin(&((struct cmsghdr *)control)->cmsg_level, - &level, sizeof(int)); - if (error) - return error; - if (level == 1) { - /* - * Linux thinks that SOL_SOCKET is 1; we know that it's really - * 0xffff, of course. - */ - level = SOL_SOCKET; - error = copyout(&level, &((struct cmsghdr *)control)-> - cmsg_level, sizeof(int)); - if (error) - return error; - } - done: - return sendmsg(p, args->args); - } while (0); - case LINUX_RECVMSG: - return recvmsg(p, args->args); - default: uprintf("LINUX: 'socket' typ=%d not implemented\n", args->what); return ENOSYS; diff --git a/sys/i386/linux/linux_syscall.h b/sys/i386/linux/linux_syscall.h index e30d836f2406e..c0b7147531562 100644 --- a/sys/i386/linux/linux_syscall.h +++ b/sys/i386/linux/linux_syscall.h @@ -2,7 +2,7 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from Id: syscalls.master,v 1.16 1998/12/30 20:58:28 sos Exp + * created from Id: syscalls.master,v 1.11 1998/06/09 03:28:14 bde Exp */ #define LINUX_SYS_linux_setup 0 @@ -85,8 +85,8 @@ #define LINUX_SYS_getrusage 77 #define LINUX_SYS_gettimeofday 78 #define LINUX_SYS_settimeofday 79 -#define LINUX_SYS_linux_getgroups 80 -#define LINUX_SYS_linux_setgroups 81 +#define LINUX_SYS_getgroups 80 +#define LINUX_SYS_setgroups 81 #define LINUX_SYS_linux_select 82 #define LINUX_SYS_linux_symlink 83 #define LINUX_SYS_ostat 84 @@ -162,6 +162,5 @@ #define LINUX_SYS_sched_rr_get_interval 161 #define LINUX_SYS_nanosleep 162 #define LINUX_SYS_linux_mremap 163 -#define LINUX_SYS_poll 168 #define LINUX_SYS_linux_chown 182 #define LINUX_SYS_MAXSYSCALL 183 diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c index a5e8bdbf7bc72..da9ac246a517b 100644 --- a/sys/i386/linux/linux_sysent.c +++ b/sys/i386/linux/linux_sysent.c @@ -2,7 +2,7 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * created from Id: syscalls.master,v 1.16 1998/12/30 20:58:28 sos Exp + * created from Id: syscalls.master,v 1.11 1998/06/09 03:28:14 bde Exp */ #include "opt_compat.h" @@ -94,8 +94,8 @@ struct sysent linux_sysent[] = { { 2, (sy_call_t *)getrusage }, /* 77 = getrusage */ { 2, (sy_call_t *)gettimeofday }, /* 78 = gettimeofday */ { 2, (sy_call_t *)settimeofday }, /* 79 = settimeofday */ - { 2, (sy_call_t *)linux_getgroups }, /* 80 = linux_getgroups */ - { 2, (sy_call_t *)linux_setgroups }, /* 81 = linux_setgroups */ + { 2, (sy_call_t *)getgroups }, /* 80 = getgroups */ + { 2, (sy_call_t *)setgroups }, /* 81 = setgroups */ { 1, (sy_call_t *)linux_select }, /* 82 = linux_select */ { 2, (sy_call_t *)linux_symlink }, /* 83 = linux_symlink */ { 2, (sy_call_t *)ostat }, /* 84 = ostat */ @@ -134,7 +134,7 @@ struct sysent linux_sysent[] = { { 5, (sy_call_t *)linux_ipc }, /* 117 = linux_ipc */ { 1, (sy_call_t *)fsync }, /* 118 = fsync */ { 1, (sy_call_t *)linux_sigreturn }, /* 119 = linux_sigreturn */ - { 2, (sy_call_t *)linux_clone }, /* 120 = linux_clone */ + { 0, (sy_call_t *)linux_clone }, /* 120 = linux_clone */ { 2, (sy_call_t *)setdomainname }, /* 121 = setdomainname */ { 1, (sy_call_t *)linux_newuname }, /* 122 = linux_newuname */ { 3, (sy_call_t *)linux_modify_ldt }, /* 123 = linux_modify_ldt */ @@ -182,7 +182,7 @@ struct sysent linux_sysent[] = { { 0, (sy_call_t *)nosys }, /* 165 = getresuid */ { 0, (sy_call_t *)nosys }, /* 166 = new_vm86 */ { 0, (sy_call_t *)nosys }, /* 167 = query_module */ - { 3, (sy_call_t *)poll }, /* 168 = poll */ + { 0, (sy_call_t *)nosys }, /* 168 = poll */ { 0, (sy_call_t *)nosys }, /* 169 = nfsservctl */ { 0, (sy_call_t *)nosys }, /* 170 = setresgid */ { 0, (sy_call_t *)nosys }, /* 171 = getresgid */ diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index fd80f1d438e86..cf8c021c53fe8 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.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_sysvec.c,v 1.43 1999/01/06 23:05:38 julian Exp $ + * $Id: linux_sysvec.c,v 1.36 1998/10/11 21:08:02 alex Exp $ */ /* XXX we use functions that might not exist. */ @@ -70,7 +70,7 @@ static void linux_sendsig __P((sig_t catcher, int sig, int mask, /* * Linux syscalls return negative errno's, we do positive and map them */ -static int bsd_to_linux_errno[ELAST + 1] = { +static int bsd_to_linux_errno[ELAST] = { -0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -35, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, @@ -79,7 +79,7 @@ static int bsd_to_linux_errno[ELAST + 1] = { -100,-101,-102,-103,-104,-105,-106,-107,-108,-109, -110,-111, -40, -36,-112,-113, -39, -11, -87,-122, -116, -66, -6, -6, -6, -6, -6, -37, -38, -9, - -6, -6, -43, -42, -75, -6, -84 + -6, -43, -42 }; int bsd_to_linux_signal[NSIG] = { @@ -217,11 +217,7 @@ linux_sendsig(sig_t catcher, int sig, int mask, u_long code) * and the stack can not be grown. useracc will return FALSE * if access is denied. */ -#ifdef VM_STACK - if ((grow_stack (p, (int)fp) == FALSE) || -#else if ((grow(p, (int)fp) == FALSE) || -#endif (useracc((caddr_t)fp, sizeof (struct linux_sigframe), B_WRITE) == FALSE)) { /* * Process has trashed its stack; give it an illegal @@ -285,7 +281,7 @@ linux_sendsig(sig_t catcher, int sig, int mask, u_long code) * Build context to run handler in. */ regs->tf_esp = (int)fp; - regs->tf_eip = PS_STRINGS - *(p->p_sysent->sv_szsigcode); + regs->tf_eip = (int)(((char *)PS_STRINGS) - *(p->p_sysent->sv_szsigcode)); regs->tf_eflags &= ~PSL_VM; regs->tf_cs = _ucodesel; regs->tf_ds = _udatasel; @@ -399,7 +395,7 @@ struct sysentvec linux_sysvec = { 0xff, NSIG, bsd_to_linux_signal, - ELAST + 1, + ELAST, bsd_to_linux_errno, translate_traps, linux_fixup, @@ -417,7 +413,7 @@ struct sysentvec elf_linux_sysvec = { 0xff, NSIG, bsd_to_linux_signal, - ELAST + 1, + ELAST, bsd_to_linux_errno, translate_traps, elf_linux_fixup, @@ -429,6 +425,9 @@ struct sysentvec elf_linux_sysvec = { elf_coredump }; +/* + * Installed either via SYSINIT() or via LKM stubs. + */ static Elf32_Brandinfo linux_brand = { "Linux", "/compat/linux", @@ -449,8 +448,14 @@ Elf32_Brandinfo *linux_brandlist[] = { NULL }; +/* + * XXX: this is WRONG, it needs to be SI_SUB_EXEC, but this is just at the + * "proof of concept" stage and will be fixed shortly + */ +static int linux_elf_modevent __P((module_t mod, modeventtype_t type, void *data)); + static int -linux_elf_modevent(module_t mod, int type, void *data) +linux_elf_modevent(module_t mod, modeventtype_t type, void *data) { Elf32_Brandinfo **brandinfo; int error; diff --git a/sys/i386/linux/linux_util.h b/sys/i386/linux/linux_util.h index 07a2d3ce686e8..58a477d67e9b9 100644 --- a/sys/i386/linux/linux_util.h +++ b/sys/i386/linux/linux_util.h @@ -28,7 +28,7 @@ * * from: svr4_util.h,v 1.5 1994/11/18 02:54:31 christos Exp * from: linux_util.h,v 1.2 1995/03/05 23:23:50 fvdl Exp - * $Id: linux_util.h,v 1.6 1998/06/30 08:40:33 jmg Exp $ + * $Id: linux_util.h,v 1.5 1997/02/22 09:38:30 peter Exp $ */ /* @@ -60,7 +60,7 @@ static __inline caddr_t stackgap_init() { #define szsigcode (*(curproc->p_sysent->sv_szsigcode)) - return (caddr_t)(PS_STRINGS - szsigcode - SPARE_USRSPACE); + return (caddr_t)(((caddr_t)PS_STRINGS) - szsigcode - SPARE_USRSPACE); } diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index c4cc425be69a0..912cb3244597e 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -1,4 +1,4 @@ - $Id: syscalls.master,v 1.15 1998/12/22 08:59:19 sos Exp $ + $Id: syscalls.master,v 1.11 1998/06/09 03:28:14 bde Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 ; System call name/number master file (or rather, slave, from LINUX). @@ -119,10 +119,8 @@ struct timezone *tzp); } 79 NOPROTO LINUX { int settimeofday(struct timeval *tp, \ struct timezone *tzp); } -80 STD LINUX { int linux_getgroups(u_int gidsetsize, \ - linux_gid_t *gidset); } -81 STD LINUX { int linux_setgroups(u_int gidsetsize, \ - linux_gid_t *gidset); } +80 NOPROTO LINUX { int getgroups(u_int gidsetsize, gid_t *gidset); } +81 NOPROTO LINUX { int setgroups(u_int gidsetsize, gid_t *gidset); } 82 STD LINUX { int linux_select(struct linux_select_argv *ptr); } 83 STD LINUX { int linux_symlink(char *path, char *to); } 84 NOPROTO LINUX { int ostat(char *path, struct ostat *up); } @@ -173,7 +171,7 @@ caddr_t ptr); } 118 NOPROTO LINUX { int fsync(int fd); } 119 STD LINUX { int linux_sigreturn(struct linux_sigcontext *scp); } -120 STD LINUX { int linux_clone(int flags, void *stack); } +120 STD LINUX { int linux_clone(void); } 121 NOPROTO LINUX { int setdomainname(char *name, \ int len); } 122 STD LINUX { int linux_newuname(struct linux_newuname_t *buf); } @@ -241,8 +239,7 @@ 165 UNIMPL LINUX getresuid 166 UNIMPL LINUX new_vm86 167 UNIMPL LINUX query_module -168 NOPROTO LINUX { int poll(struct pollfd*, unsigned int nfds, \ - long timeout); } +168 UNIMPL LINUX poll 169 UNIMPL LINUX nfsservctl 170 UNIMPL LINUX setresgid 171 UNIMPL LINUX getresgid |