make all other commands use ProcFS
This commit is contained in:
parent
33b131766f
commit
d299a6422b
10 changed files with 19 additions and 77 deletions
|
@ -932,9 +932,9 @@ SPDP dtime()
|
|||
return q;
|
||||
}
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/times.h>
|
||||
#include <minix/sysinfo.h>
|
||||
#include <time.h>
|
||||
|
||||
struct tms tms;
|
||||
|
@ -945,7 +945,7 @@ SPDP dtime(void)
|
|||
int secs, msecs;
|
||||
u32_t system_hz;
|
||||
times(&tms);
|
||||
getsysinfo_up(PM_PROC_NR, SIU_SYSTEMHZ, sizeof(system_hz), &system_hz);
|
||||
system_hz = (u32_t) sysconf(_SC_CLK_TCK);
|
||||
secs = tms.tms_utime / system_hz;
|
||||
q = secs;
|
||||
tms.tms_utime -= secs * system_hz;
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <minix/partition.h>
|
||||
#include <minix/u64.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/sysinfo.h>
|
||||
#include <machine/partition.h>
|
||||
#include <termios.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -1597,10 +1596,7 @@ void m_read(int ev, int *biosdrive)
|
|||
return;
|
||||
}
|
||||
|
||||
if(getsysinfo_up(PM_PROC_NR, SIU_SYSTEMHZ, sizeof(system_hz), &system_hz) < 0) {
|
||||
fprintf(stderr, "autopart: system hz not found\n");
|
||||
exit(1);
|
||||
}
|
||||
system_hz = (u32_t) sysconf(_SC_CLK_TCK);
|
||||
v = 2*system_hz;
|
||||
ioctl(device, DIOCTIMEOUT, &v);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
PROG= lspci
|
||||
SCRIPTS= lspci.sh
|
||||
MAN=
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Erik van der Kouwe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <minix/com.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct pciinfo_entry *entry;
|
||||
struct pciinfo pciinfo;
|
||||
|
||||
/* obtain a list of PCI devices from PM */
|
||||
if (getsysinfo(PM_PROC_NR, SI_PCI_INFO, &pciinfo) < 0)
|
||||
{
|
||||
perror("getsysinfo failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* print the list of devices */
|
||||
entry = pciinfo.pi_entries;
|
||||
while (pciinfo.pi_count-- > 0)
|
||||
{
|
||||
printf("%.4X:%.4X %s\n", entry->pie_vid, entry->pie_did, entry->pie_name);
|
||||
entry++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
8
commands/lspci/lspci.sh
Normal file
8
commands/lspci/lspci.sh
Normal file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ ! -f /proc/pci ]; then
|
||||
echo "PCI list not found (is /proc mounted?)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec cut -d' ' -f3- /proc/pci
|
|
@ -23,7 +23,6 @@
|
|||
#include <minix/ipc.h>
|
||||
#include <minix/rs.h>
|
||||
#include <minix/syslib.h>
|
||||
#include <minix/sysinfo.h>
|
||||
#include <minix/bitmap.h>
|
||||
#include <minix/paths.h>
|
||||
#include <minix/sef.h>
|
||||
|
@ -277,12 +276,7 @@ PRIVATE int parse_arguments(int argc, char **argv)
|
|||
}
|
||||
|
||||
/* Get HZ. */
|
||||
if(getsysinfo_up(PM_PROC_NR,
|
||||
SIU_SYSTEMHZ, sizeof(system_hz), &system_hz) < 0) {
|
||||
system_hz = DEFAULT_HZ;
|
||||
fprintf(stderr, "WARNING: reverting to default HZ %d\n",
|
||||
(int) system_hz);
|
||||
}
|
||||
system_hz = (u32_t) sysconf(_SC_CLK_TCK);
|
||||
|
||||
/* Check optional arguments that come in pairs like "-args arglist". */
|
||||
for (i=optind+MIN_ARG_COUNT+1; i<argc; i=i+2) {
|
||||
|
|
|
@ -25,7 +25,6 @@ Created: June 1995 by Philip Homburg <philip@f-mnx.phicoh.com>
|
|||
#include <net/gen/socket.h>
|
||||
#include <minix/queryparam.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/sysinfo.h>
|
||||
|
||||
#include <inet/generic/buf.h>
|
||||
#include <inet/generic/clock.h>
|
||||
|
@ -55,7 +54,7 @@ int main(int argc, char*argv[])
|
|||
int a_flag, n_flag, v_flag;
|
||||
struct tms tmsbuf;
|
||||
|
||||
getsysinfo_up(PM_PROC_NR, SIU_SYSTEMHZ, sizeof(system_hz), &system_hz);
|
||||
system_hz = (u32_t) sysconf(_SC_CLK_TCK);
|
||||
|
||||
(prog_name=strrchr(argv[0], '/')) ? prog_name++ : (prog_name=argv[0]);
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
#include <minix/minlib.h>
|
||||
#include <minix/sysinfo.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* -DNEW prints time to 0.01 sec. */
|
||||
|
@ -111,7 +110,7 @@ register clock_t t;
|
|||
int hours, minutes, seconds, hundredths, i;
|
||||
u32_t system_hz;
|
||||
|
||||
getsysinfo_up(PM_PROC_NR, SIU_SYSTEMHZ, sizeof(system_hz), &system_hz);
|
||||
system_hz = (u32_t) sysconf(_SC_CLK_TCK);
|
||||
|
||||
digit_seen = 0;
|
||||
for (i = 0; i < 8; i++) a[i] = ' ';
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <minix/config.h>
|
||||
#include <minix/sysinfo.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
|
@ -72,7 +71,7 @@ char **argv;
|
|||
{
|
||||
int i, m = 0xFFFF, n = 0xF;
|
||||
|
||||
getsysinfo_up(PM_PROC_NR, SIU_SYSTEMHZ, sizeof(system_hz), &system_hz);
|
||||
system_hz = sysconf(_SC_CLK_TCK);
|
||||
|
||||
if (strcmp(argv[0], "DO CHECK") == 0) {
|
||||
timer = atoi(argv[1]);
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <minix/com.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
|
@ -15,6 +14,7 @@ main(int argc, char *argv[])
|
|||
#define CHUNKS1 3
|
||||
#define CHUNKS2 2
|
||||
#define CHUNKS (CHUNKS1+CHUNKS2)
|
||||
#define LARGESIZE 262144
|
||||
int i, fd;
|
||||
char *v[CHUNKS];
|
||||
#define STARTV 0x90000000
|
||||
|
@ -86,11 +86,11 @@ main(int argc, char *argv[])
|
|||
exit(1);
|
||||
}
|
||||
} else {
|
||||
/* Child performs bogus getsysinfo */
|
||||
/* Child performs bogus read */
|
||||
int res;
|
||||
char *buf = v[CHUNKS-1];
|
||||
errno = 0;
|
||||
res = getsysinfo( PM_PROC_NR, SI_PROC_TAB, buf);
|
||||
res = read(fd, buf, LARGESIZE);
|
||||
if(res >= 0) {
|
||||
fprintf(stderr, "res %d\n", res);
|
||||
exit(1);
|
||||
|
|
Loading…
Reference in a new issue