From owner-freebsd-bugs Tue May 29 18:10:13 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id CBA9037B42C for ; Tue, 29 May 2001 18:10:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f4U1A0Y45929; Tue, 29 May 2001 18:10:00 -0700 (PDT) (envelope-from gnats) Received: from mail.disney.com (mail.disney.com [204.128.192.15]) by hub.freebsd.org (Postfix) with ESMTP id 6E26F37B423 for ; Tue, 29 May 2001 18:02:44 -0700 (PDT) (envelope-from Jim.Pirzyk@disney.com) Received: from pain10.corp.disney.com (root@pain10.corp.disney.com [153.7.110.100]) by mail.disney.com (Switch-2.0.1/Switch-2.0.1) with SMTP id f4U126A08487 for ; Tue, 29 May 2001 18:02:06 -0700 (PDT) Received: from louie.fa.disney.com by pain.corp.disney.com with ESMTP for FreeBSD-gnats-submit@freebsd.org; Tue, 29 May 2001 18:03:33 -0700 Received: from plio.fan.fa.disney.com (plio.fan.fa.disney.com [153.7.118.2]) by louie.fa.disney.com (8.9.2/8.9.2) with ESMTP id SAA01770 for ; Tue, 29 May 2001 18:02:43 -0700 (PDT) (envelope-from Jim.Pirzyk@fa.disney.com) Received: from snoopy.fan.fa.disney.com (snoopy.fan.fa.disney.com [153.7.117.170]) by plio.fan.fa.disney.com (8.9.2/8.9.2) with ESMTP id SAA00971 for ; Tue, 29 May 2001 18:02:42 -0700 (PDT) (envelope-from Jim.Pirzyk@fa.disney.com) Received: (from Jim.Pirzyk@localhost) by snoopy.fan.fa.disney.com (8.11.3/8.9.3) id f4U12gc11399; Tue, 29 May 2001 18:02:42 -0700 (PDT) (envelope-from Jim.Pirzyk@fa.disney.com) Message-Id: <200105300102.f4U12gc11399@snoopy.fan.fa.disney.com> Date: Tue, 29 May 2001 18:02:42 -0700 (PDT) From: Jim.Pirzyk@disney.com Reply-To: Jim.Pirzyk@disney.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: kern/27759: linux module does not support sysinfo system call Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 27759 >Category: kern >Synopsis: linux sysinfo system call is needed for maya batch mode to work. >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue May 29 18:10:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: >Release: FreeBSD 4.3-RELEASE i386 >Organization: >Environment: System: FreeBSD snoopy 4.3-RELEASE FreeBSD 4.3-RELEASE #6: Tue May 29 10:01:46 PDT 2001 root@snoopy:/auto/roy/dist/pub/FreeBSD/4.3-RELEASE/sys/compile/UP_WORKSTATION i386 >Description: The maya batch mode renderer uses sysinfo from the linux kernel to get information about memory & etc from the system. The linux kernel module does not have this system call. >How-To-Repeat: Run a maya render and you get error messages of the following... linux: syscall %s is obsoleted or not implemented (pid=%ld) >Fix: This patch was sent to me by Charles Henrich *** ./sys/i386/linux/linux_dummy.c.orig Wed Jul 19 22:31:56 2000 --- ./sys/i386/linux/linux_dummy.c Fri Dec 1 08:51:52 2000 *************** *** 74,80 **** DUMMY(idle); DUMMY(vm86old); DUMMY(swapoff); - DUMMY(sysinfo); DUMMY(adjtimex); DUMMY(create_module); DUMMY(init_module); --- 74,79 ---- *************** *** 109,112 **** DUMMY(ftruncate64); DUMMY(stat64); DUMMY(lstat64); - DUMMY(fstat64); --- 108,110 ---- *** ./sys/i386/linux/linux_sysent.c.orig Tue Aug 8 16:28:16 2000 --- ./sys/i386/linux/linux_sysent.c Thu Nov 30 17:42:29 2000 *************** *** 133,139 **** { 0, (sy_call_t *)linux_vm86old }, /* 113 = linux_vm86old */ { AS(linux_wait4_args), (sy_call_t *)linux_wait4 }, /* 114 = linux_wait4 */ { 0, (sy_call_t *)linux_swapoff }, /* 115 = linux_swapoff */ ! { 0, (sy_call_t *)linux_sysinfo }, /* 116 = linux_sysinfo */ { AS(linux_ipc_args), (sy_call_t *)linux_ipc }, /* 117 = linux_ipc */ { AS(fsync_args), (sy_call_t *)fsync }, /* 118 = fsync */ { AS(linux_sigreturn_args), (sy_call_t *)linux_sigreturn }, /* 119 = linux_sigreturn */ --- 133,139 ---- { 0, (sy_call_t *)linux_vm86old }, /* 113 = linux_vm86old */ { AS(linux_wait4_args), (sy_call_t *)linux_wait4 }, /* 114 = linux_wait4 */ { 0, (sy_call_t *)linux_swapoff }, /* 115 = linux_swapoff */ ! { AS(linux_sysinfo_args), (sy_call_t *)linux_sysinfo }, /* 116 = linux_sysinfo */ { AS(linux_ipc_args), (sy_call_t *)linux_ipc }, /* 117 = linux_ipc */ { AS(fsync_args), (sy_call_t *)fsync }, /* 118 = fsync */ { AS(linux_sigreturn_args), (sy_call_t *)linux_sigreturn }, /* 119 = linux_sigreturn */ *** ./sys/i386/linux/linux_proto.h.orig Tue Aug 8 16:28:16 2000 --- ./sys/i386/linux/linux_proto.h Thu Nov 30 17:41:12 2000 *************** *** 312,318 **** register_t dummy; }; struct linux_sysinfo_args { ! register_t dummy; }; struct linux_ipc_args { int what; char what_[PAD_(int)]; --- 312,318 ---- register_t dummy; }; struct linux_sysinfo_args { ! struct linux_sysinfo * buf; char buf_[PAD_(struct linux_sysinfo *)]; }; struct linux_ipc_args { int what; char what_[PAD_(int)]; *** ./sys/compat/linux/linux_misc.c.orig Tue Mar 27 18:33:47 2001 --- ./sys/compat/linux/linux_misc.c Fri May 4 15:53:46 2001 *************** *** 40,45 **** --- 40,46 ---- #include #include #include + #include #include #include #include *************** *** 48,59 **** --- 49,64 ---- #include #include #include + #include + #include #include #include #include #include #include + #include + #include #include #include *************** *** 93,98 **** --- 98,176 ---- RLIMIT_MEMLOCK, -1 }; #endif /*!__alpha__*/ + + struct linux_sysinfo { + long uptime; /* Seconds since boot */ + unsigned long loads[3]; /* 1, 5, and 15 minute load averages */ + unsigned long totalram; /* Total usable main memory size */ + unsigned long freeram; /* Available memory size */ + unsigned long sharedram; /* Amount of shared memory */ + unsigned long bufferram; /* Memory used by buffers */ + unsigned long totalswap; /* Total swap space size */ + unsigned long freeswap; /* swap space still available */ + unsigned short procs; /* Number of current processes */ + char _f[22]; /* Pads structure to 64 bytes */ + }; + + int + linux_sysinfo(struct proc *p, struct linux_sysinfo_args *args) + { + struct linux_sysinfo sysinfo; + vm_object_t object; + int i; + struct timespec ts; + + /* Uptime is copied out of print_uptime() procedure in kern_shutdown.c */ + getnanouptime(&ts); + i = 0; + if (ts.tv_sec >= 86400) { + printf("%ldd", ts.tv_sec / 86400); + ts.tv_sec %= 86400; + i = 1; + } + if (i || ts.tv_sec >= 3600) { + printf("%ldh", ts.tv_sec / 3600); + ts.tv_sec %= 3600; + i = 1; + } + if (i || ts.tv_sec >= 60) { + printf("%ldm", ts.tv_sec / 60); + ts.tv_sec %= 60; + i = 1; + } + sysinfo.uptime=ts.tv_sec; + + /* Use the information from the mib to get our load averages */ + for (i = 0; i < 3; i++) + sysinfo.loads[i] = (double) averunnable.ldavg[i] / averunnable.fscale; + + sysinfo.totalram = physmem * PAGE_SIZE; + sysinfo.freeram = sysinfo.totalram - cnt.v_wire_count * PAGE_SIZE; + + sysinfo.sharedram = 0; + for (object = TAILQ_FIRST(&vm_object_list); object != NULL; + object = TAILQ_NEXT(object, object_list)) + if (object->shadow_count > 1) + sysinfo.sharedram += object->resident_page_count; + + sysinfo.sharedram *= PAGE_SIZE; + + sysinfo.bufferram = 0; + + if (swapblist == NULL) { + sysinfo.totalswap= 0; + sysinfo.freeswap = 0; + } else { + sysinfo.totalswap = swapblist->bl_blocks * 1024; + sysinfo.freeswap = swapblist->bl_root->u.bmu_avail * PAGE_SIZE; + } + + sysinfo.procs = 20; /* Hack */ + + return copyout((caddr_t)&sysinfo, (caddr_t)args->buf, + sizeof(struct linux_sysinfo)); + } + #ifndef __alpha__ int >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message