linux_misc.c (12130) | linux_misc.c (12458) |
---|---|
1/*- 2 * Copyright (c) 1994-1995 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * | 1/*- 2 * Copyright (c) 1994-1995 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * |
28 * $Id: linux_misc.c,v 1.2 1995/10/04 07:08:04 julian Exp $ | 28 * $Id: linux_misc.c,v 1.3 1995/11/06 12:52:24 davidg Exp $ |
29 */ 30 | 29 */ 30 |
31#include <i386/linux/linux.h> | |
32#include <sys/param.h> 33#include <sys/systm.h> | 31#include <sys/param.h> 32#include <sys/systm.h> |
33#include <sys/sysproto.h> 34#include <sys/kernel.h> |
|
34#include <sys/exec.h> 35#include <sys/mman.h> 36#include <sys/proc.h> 37#include <sys/dirent.h> 38#include <sys/file.h> 39#include <sys/filedesc.h> 40#include <sys/ioctl.h> 41#include <sys/imgact_aout.h> 42#include <sys/mount.h> 43#include <sys/namei.h> 44#include <sys/resource.h> 45#include <sys/resourcevar.h> 46#include <sys/stat.h> | 35#include <sys/exec.h> 36#include <sys/mman.h> 37#include <sys/proc.h> 38#include <sys/dirent.h> 39#include <sys/file.h> 40#include <sys/filedesc.h> 41#include <sys/ioctl.h> 42#include <sys/imgact_aout.h> 43#include <sys/mount.h> 44#include <sys/namei.h> 45#include <sys/resource.h> 46#include <sys/resourcevar.h> 47#include <sys/stat.h> |
47#include <sys/time.h> | 48#include <sys/sysctl.h> |
48#include <sys/times.h> 49#include <sys/utsname.h> 50#include <sys/vnode.h> 51#include <sys/wait.h> 52 | 49#include <sys/times.h> 50#include <sys/utsname.h> 51#include <sys/vnode.h> 52#include <sys/wait.h> 53 |
54#include <vm/vm_kern.h> 55 |
|
53#include <machine/cpu.h> 54#include <machine/psl.h> | 56#include <machine/cpu.h> 57#include <machine/psl.h> |
55#include <machine/reg.h> | |
56 | 58 |
57#include <vm/vm.h> 58#include <vm/vm_kern.h> | 59#include <i386/linux/linux.h> 60#include <i386/linux/sysproto.h> |
59 | 61 |
60 | |
61struct linux_alarm_args { 62 unsigned int secs; 63}; 64 65int 66linux_alarm(struct proc *p, struct linux_alarm_args *args, int *retval) 67{ | 62struct linux_alarm_args { 63 unsigned int secs; 64}; 65 66int 67linux_alarm(struct proc *p, struct linux_alarm_args *args, int *retval) 68{ |
68 extern struct timeval time; | |
69 struct itimerval it, old_it; 70 int s; 71 72#ifdef DEBUG 73 printf("Linux-emul(%d): alarm(%d)\n", p->p_pid, args->secs); 74#endif 75 it.it_value.tv_sec = (long)args->secs; 76 it.it_value.tv_usec = 0; --- 29 unchanged lines hidden (view full) --- 106 107int 108linux_brk(struct proc *p, struct linux_brk_args *args, int *retval) 109{ 110#if 0 111 struct vmspace *vm = p->p_vmspace; 112 vm_offset_t new, old; 113 int error; | 69 struct itimerval it, old_it; 70 int s; 71 72#ifdef DEBUG 73 printf("Linux-emul(%d): alarm(%d)\n", p->p_pid, args->secs); 74#endif 75 it.it_value.tv_sec = (long)args->secs; 76 it.it_value.tv_usec = 0; --- 29 unchanged lines hidden (view full) --- 106 107int 108linux_brk(struct proc *p, struct linux_brk_args *args, int *retval) 109{ 110#if 0 111 struct vmspace *vm = p->p_vmspace; 112 vm_offset_t new, old; 113 int error; |
114 extern int swap_pager_full; | |
115 116 if ((vm_offset_t)args->dsend < (vm_offset_t)vm->vm_daddr) 117 return EINVAL; 118 if (((caddr_t)args->dsend - (caddr_t)vm->vm_daddr) 119 > p->p_rlimit[RLIMIT_DATA].rlim_cur) 120 return ENOMEM; 121 122 old = round_page((vm_offset_t)vm->vm_daddr) + ctob(vm->vm_dsize); --- 385 unchanged lines hidden (view full) --- 508 509struct linux_tms_args { 510 char *buf; 511}; 512 513int 514linux_times(struct proc *p, struct linux_tms_args *args, int *retval) 515{ | 114 115 if ((vm_offset_t)args->dsend < (vm_offset_t)vm->vm_daddr) 116 return EINVAL; 117 if (((caddr_t)args->dsend - (caddr_t)vm->vm_daddr) 118 > p->p_rlimit[RLIMIT_DATA].rlim_cur) 119 return ENOMEM; 120 121 old = round_page((vm_offset_t)vm->vm_daddr) + ctob(vm->vm_dsize); --- 385 unchanged lines hidden (view full) --- 507 508struct linux_tms_args { 509 char *buf; 510}; 511 512int 513linux_times(struct proc *p, struct linux_tms_args *args, int *retval) 514{ |
516 extern int hz; | |
517 struct timeval tv; 518 struct linux_tms tms; 519 520#ifdef DEBUG 521 printf("Linux-emul(%d): times(*)\n", p->p_pid); 522#endif 523 tms.tms_utime = p->p_uticks; 524 tms.tms_stime = p->p_sticks; --- 19 unchanged lines hidden (view full) --- 544struct linux_newuname_args { 545 char *buf; 546}; 547 548int 549linux_newuname(struct proc *p, struct linux_newuname_args *args, int *retval) 550{ 551 struct linux_newuname_t linux_newuname; | 515 struct timeval tv; 516 struct linux_tms tms; 517 518#ifdef DEBUG 519 printf("Linux-emul(%d): times(*)\n", p->p_pid); 520#endif 521 tms.tms_utime = p->p_uticks; 522 tms.tms_stime = p->p_sticks; --- 19 unchanged lines hidden (view full) --- 542struct linux_newuname_args { 543 char *buf; 544}; 545 546int 547linux_newuname(struct proc *p, struct linux_newuname_args *args, int *retval) 548{ 549 struct linux_newuname_t linux_newuname; |
552 extern char ostype[], osrelease[], machine[]; 553 extern char hostname[], domainname[]; | |
554 555#ifdef DEBUG 556 printf("Linux-emul(%d): newuname(*)\n", p->p_pid); 557#endif 558 bzero(&linux_newuname, sizeof(struct linux_newuname_args)); 559 strncpy(linux_newuname.sysname, ostype, 64); 560 strncpy(linux_newuname.nodename, hostname, 64); 561 strncpy(linux_newuname.release, osrelease, 64); --- 113 unchanged lines hidden --- | 550 551#ifdef DEBUG 552 printf("Linux-emul(%d): newuname(*)\n", p->p_pid); 553#endif 554 bzero(&linux_newuname, sizeof(struct linux_newuname_args)); 555 strncpy(linux_newuname.sysname, ostype, 64); 556 strncpy(linux_newuname.nodename, hostname, 64); 557 strncpy(linux_newuname.release, osrelease, 64); --- 113 unchanged lines hidden --- |