900 Commits

Author SHA1 Message Date
Ben Gras
2725087880 only check local benchmarks if /usr/local/benchmarks exists 2010-02-04 18:14:48 +00:00
Ben Gras
5795636593 also be able to run benchmarks from packages. 2010-02-04 17:52:52 +00:00
Ben Gras
7ff2ced50a benchmarks makefile. 2010-02-03 16:48:08 +00:00
Ben Gras
a6c6a2b4aa mimic old .sect .end behaviour 2010-02-03 15:30:26 +00:00
Ben Gras
6691830237 benchmarks. 2010-02-03 14:31:35 +00:00
Ben Gras
e0f2607bf0 remove benchmarks. 2010-02-03 14:30:36 +00:00
Ben Gras
0561f59b77 move benchmarks to their own dir. 2010-02-03 14:27:16 +00:00
Ben Gras
a008951e02 check for perl, don't assume Run is executable. 2010-02-03 14:18:25 +00:00
Ben Gras
77ca11d673 no big/small commands any more. 2010-02-03 13:55:48 +00:00
Ben Gras
e4201e90b0 asmconv in /usr/bin, other fixes 2010-02-03 13:32:33 +00:00
Ben Gras
64ab79e5e5 make run-bench executable too. 2010-02-02 15:35:51 +00:00
Ben Gras
ac33a29cf9 Nick's dec21140A fixes 2010-01-30 16:14:24 +00:00
Ben Gras
ca2d58a90c update qemu 2010-01-28 15:22:31 +00:00
Ben Gras
129c16543e updated package versions 2010-01-28 14:24:15 +00:00
Ben Gras
660364e68d include iperf, newer openssh 2010-01-28 14:14:23 +00:00
David van Moolenbroek
564e2a4368 HGFS tweaks 2010-01-27 22:59:03 +00:00
Erik van der Kouwe
6959226707 Increase process table size 2010-01-27 18:37:12 +00:00
Ben Gras
a36a3766b0 ignore .svn dirs when making binary packages 2010-01-27 16:20:28 +00:00
Ben Gras
75a3d4ebde bump version number to 3.1.6, copyright year to 2010. 2010-01-27 16:19:50 +00:00
Kees van Reeuwijk
2ba237cd4e Fixed a number of uses of uninitialized variables by adding assertions
or other sanity checks, code reshuffling, or fixing broken behavior.
2010-01-27 10:23:58 +00:00
Kees van Reeuwijk
c6eb51d66a Rewrite some functions to ANSI style. 2010-01-27 10:19:13 +00:00
Tomas Hruby
e0f7043e04 No need to use memcpy to copy a message of 36 bytes. The overhead just
to call memcpy is half of the inline copy (using gcc -O)
2010-01-27 09:34:47 +00:00
Thomas Veerman
9a7cd8e254 Pipe vnodes are always mapped. 2010-01-27 09:30:39 +00:00
Erik van der Kouwe
d8b8e10ba4 Add notrunc conversion for dd tool 2010-01-27 07:48:06 +00:00
Erik van der Kouwe
3e583f4c04 Add -p flag for install tool 2010-01-27 07:47:29 +00:00
Kees van Reeuwijk
c8a11b5453 Fixed some type inconsistencies in the kernel. 2010-01-26 12:26:06 +00:00
Kees van Reeuwijk
b67f788eea Removed a number of useless #includes 2010-01-26 10:59:01 +00:00
Ben Gras
76f8132545 dec21140A ethernet driver for virtualpc, contributed by nicolas tittley. 2010-01-26 10:20:18 +00:00
David van Moolenbroek
f23a37e10f IPC test set fixes:
- restore original UID before deleting test directory
- do not assume that SIGUSR1 signal is set to default action
2010-01-26 08:05:33 +00:00
David van Moolenbroek
e42952c93f typo 2010-01-25 23:48:14 +00:00
David van Moolenbroek
1ff4a7dbc6 update DS label retrieve calls 2010-01-25 23:23:43 +00:00
David van Moolenbroek
71fe2852f4 HGFS - VMware Shared Folders file system server 2010-01-25 23:18:02 +00:00
David van Moolenbroek
4c2cb6c04f typo 2010-01-25 21:06:07 +00:00
Erik van der Kouwe
ff416204c5 Add dirname function, forgot to commit header before 2010-01-25 18:17:57 +00:00
Erik van der Kouwe
eeaecf1d9c Explicitly mark i8_t as signed 2010-01-25 18:17:04 +00:00
Erik van der Kouwe
f8804c0240 Additions to inttypes.h format strings 2010-01-25 18:16:25 +00:00
Erik van der Kouwe
58024f9eb0 Add character classes for tr 2010-01-25 18:14:54 +00:00
Erik van der Kouwe
6b869823ae Have test40 use /dev/ptypf instead of /dev/ptyp0 2010-01-25 18:14:05 +00:00
Kees van Reeuwijk
a701e290f7 Removed unused symbols.
Made some functions PRIVATE, including ones that aren't used anywhere.
2010-01-25 18:13:48 +00:00
Erik van der Kouwe
0e564a1419 Add IPv6-related header definitions 2010-01-25 18:13:23 +00:00
Erik van der Kouwe
3ec29ae85e Add dirname function 2010-01-25 18:12:28 +00:00
Erik van der Kouwe
a89d141e90 Add getopt_long library function 2010-01-25 18:11:21 +00:00
Ben Gras
515d6ebc9a correct opcode of FNSTSW (hopefully fixes minix under virtualpc) 2010-01-25 16:25:20 +00:00
Tomas Hruby
ee4cff8d66 2 copies of taskcall.c removed
- taskcall.c is 3x in the trunk as part of libc, libsysutil and
  libsys.  It should be only part of libsys.

- only system process should be linked with libsys, therefore using
  raw _taskcall() in service.c is replaced by _syscall()

- the same for minix_rs.c

- lib/other/sys_eniop.c can go without replacement as it is part of
  syslib
2010-01-25 14:22:09 +00:00
David van Moolenbroek
769e5f373a man mount(1): dash escaping consistency 2010-01-22 23:24:02 +00:00
Kees van Reeuwijk
a7cee5bec4 Removed unused symbols.
Minor cleanups.
2010-01-22 22:01:08 +00:00
Tomas Hruby
0cfbe936ce Removed bunch of unused variables in kernel/proc.c 2010-01-22 16:14:57 +00:00
Erik van der Kouwe
af395bab13 Fix number of tests 2010-01-22 11:32:39 +00:00
Erik van der Kouwe
a39cb73e58 IPv6 address family and protocol familyconstants 2010-01-22 10:45:43 +00:00
Erik van der Kouwe
4dfe5f49ba Make int64 constants available under GCC 2010-01-22 10:45:05 +00:00
Kees van Reeuwijk
c43cdf06f8 Removed some uses of uninitialized variables in update.c, presumably remnands of old color support.
Fixed a few cases where free-ed memory blocks were subsequently read.
Removed some unused variables, #includes, other small cleanup.
2010-01-21 22:36:15 +00:00
Ben Gras
6292b96ac8 New 'benchmarks' dir in test/, with first benchmark - unixbench-5.1.2, ported
by Karol Sobczak.
2010-01-21 16:53:42 +00:00
Thomas Veerman
ee2e57b4dc Add return statement after failed dev_open (fixes open count in at_wini) 2010-01-21 15:02:29 +00:00
Kees van Reeuwijk
f30c82b430 Restored idt_reload() prototype. 2010-01-21 11:40:22 +00:00
Erik van der Kouwe
0bc2aad4af Fix parameter parsing in cut 2010-01-21 10:16:05 +00:00
Erik van der Kouwe
9baf8059fb Make function key for RTL8139 optional 2010-01-21 10:15:22 +00:00
Thomas Veerman
fadbbf7b2e Unmount defunct boot ramdisk at bootup 2010-01-21 09:58:07 +00:00
Thomas Veerman
ca9280e097 - Fix dangling symlink regression
- Make open(2) more POSIX compliant
- Add a test case for dangling symlinks and open() syscall with O_CREAT and
  O_EXCL on a symlink.
- Update open(2) man page to reflect change.
2010-01-21 09:32:15 +00:00
Erik van der Kouwe
a5a2073680 create the getaddrinfo and getnameinfo library functions and friends 2010-01-21 06:38:17 +00:00
Kees van Reeuwijk
24964aa706 Removed unused variable ip_port from icmp_router_advertisment(). 2010-01-20 22:02:25 +00:00
Kees van Reeuwijk
a2c8ae42e9 Remove iov_src variables, that were only declared and incremented,
but never used, all over the network drivers.
2010-01-20 21:31:59 +00:00
Kees van Reeuwijk
53f9f943a8 Rewrote a number of cases where variables were used before they initialized. 2010-01-20 17:59:48 +00:00
Kees van Reeuwijk
d6383bef47 Removed some unused tests. 2010-01-20 17:55:14 +00:00
Kees van Reeuwijk
9a755c3a1f Removed unused code in the ethernet driver that was left from an old implementation
Removed/rewritten the use of uninitialized variables in error messages.
2010-01-20 17:02:55 +00:00
Erik van der Kouwe
850f392c86 Fix typo in ENOPSUP definition 2010-01-20 16:36:48 +00:00
David van Moolenbroek
53a6e039de remove SYS_MAPDMA 2010-01-19 21:24:42 +00:00
David van Moolenbroek
f175410902 rename message.m5_c[12] to m5_s[12] 2010-01-19 21:19:59 +00:00
David van Moolenbroek
cff75286df setgroups fix 2010-01-19 21:15:43 +00:00
David van Moolenbroek
61bb82a44b VM information interface 2010-01-19 21:00:20 +00:00
Tomas Hruby
7d51b0cce1 Fixed warnings in watchdog.c 2010-01-19 14:47:25 +00:00
Kees van Reeuwijk
3a892d2312 Fixed some flawed defensive programming in audio drivers. 2010-01-18 21:37:24 +00:00
Erik van der Kouwe
32ad26e698 Use _POSIX_SOURCE rather than _MINIX to protect popen, pclose and snprintf 2010-01-18 18:06:43 +00:00
Ben Gras
daca9de450 Fix to make making a bootable cd possible again.
ow that the image has grown beyond the 1.44M that fits on a floppy.
(previously, the floppy emulation mode was used for cd's.)

the boot cd now uses 'no emulation mode,' where an image is provided on
the cd that is loaded and executed directly. this is the boot monitor.

in order to make this work (the entry point is the same as where the
image is loaded, and the boot monitor needs its a.out header too) and
keep compatability with the same code being used for regular booting, i
prepended 16 bytes that jumps over its header so execution can start
there.

to be able to read the CD (mostly in order to read the boot image),
boot has to use the already present 'extended read' call, but address
the CD using 2k sectors.
2010-01-18 14:10:04 +00:00
Tomas Hruby
5efa92f754 NMI watchdog is an awesome feature for debugging locked up kernels.
There is not that much use for it on a single CPU, however, deadlock
between kernel and system task can be delected. Or a runaway loop.

If a kernel gets locked up the timer interrupts don't occure (as all
interrupts are disabled in kernel mode). The only chance is to
interrupt the kernel by a non-maskable interrupt.

This patch generates NMIs using performance counters. It uses the most
widely available performace counters. As the performance counters are 
highly model-specific this patch is not guaranteed to work on every
machine.  Unfortunately this is also true for KVM :-/ On the other
hand adding this feature for other models is not extremely difficult
and the framework makes it hopefully easy enough.

Depending on the frequency of the CPU an NMI is generated at most
about every 0.5s If the cpu's speed is less then 2Ghz it is generated
at most every 1s. In general an NMI is generated much less often as
the performance counter counts down only if the cpu is not idle.
Therefore the overhead of this feature is fairly minimal even if the
load is high.

Uppon detecting that the kernel is locked up the kernel dumps the 
state of the kernel registers and panics.

Local APIC must be enabled for the watchdog to work.

The code is _always_ compiled in, however, it is only enabled if  
watchdog=<non-zero> is set in the boot monitor.

One corner case is serial console debugging. As dumping a lot of stuff
to the serial link may take a lot of time, the watchdog does not 
detect lockups during this time!!! as it would result in too many
false positives. 10 nmi have to be handled before the lockup is
detected. This means something between ~5s to 10s.

Another corner case is that the watchdog is enabled only after the
paging is enabled as it would be pure madness to try to get it right.
2010-01-16 20:53:55 +00:00
David van Moolenbroek
a8b52644c4 Give SETALARM privilege to atl2 driver 2010-01-16 14:31:35 +00:00
Kees van Reeuwijk
4faed703d9 Added a missing return statement in paired_grant().
Removed lots of unused variables.
2010-01-15 21:45:30 +00:00
Ben Gras
716df202de make C function setgroups() be _setgroups(), called by the asm stub.
initgroups() can then use _setgroups() instead of setgroups().
2010-01-15 17:16:15 +00:00
Tomas Hruby
80d671aea7 _cpuid() - full cpuid instruction wrapper
- the prototype changes to 

	_cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx)

- this makes possible to use all the features of the cpuid instruction as
  described in the Intel specs
2010-01-15 15:23:57 +00:00
Ben Gras
45eabea285 Fixed extern declaration from pointer to array 2010-01-15 12:08:57 +00:00
David van Moolenbroek
3537a7b59d Compile and install e1000 driver by default 2010-01-15 10:22:34 +00:00
Cristiano Giuffrida
c5b309ff07 Merge of Wu's GSOC 09 branch (src.20090525.r4372.wu)
Main changes:
- COW optimization for safecopy.
- safemap, a grant-based interface for sharing memory regions between processes.
- Integration with safemap and complete rework of DS, supporting new data types
  natively (labels, memory ranges, memory mapped ranges).
- For further information:
  http://wiki.minix3.org/en/SummerOfCode2009/MemoryGrants

Additional changes not included in the original Wu's branch:
- Fixed unhandled case in VM when using COW optimization for safecopy in case
  of a block that has already been shared as SMAP.
- Better interface and naming scheme for sys_saferevmap and ds_retrieve_map
  calls.
- Better input checking in syslib: check for page alignment when creating
  memory mapping grants.
- DS notifies subscribers when an entry is deleted.
- Documented the behavior of indirect grants in case of memory mapping.
- Test suite in /usr/src/test/safeperf|safecopy|safemap|ds/* reworked
  and extended.
- Minor fixes and general cleanup.
- TO-DO: Grant ids should be generated and managed the way endpoints are to make
sure grant slots are never misreused.
2010-01-14 15:24:16 +00:00
Kees van Reeuwijk
da3b64d8bc Fixed a bug in do_sdevio() that broke I/O size computations.
Removed redundant size computations.
Cleaned up code.
2010-01-14 14:51:23 +00:00
Kees van Reeuwijk
5459f3a607 Removed a whole herd of unused variables.
Some other cleanup.
2010-01-14 13:53:12 +00:00
Kees van Reeuwijk
9d247900c0 Remove obsolete m_ptr calculations in try_one() and mini_senda(). 2010-01-14 12:04:24 +00:00
Tomas Hruby
d96360e4d4 Uninitialized variable fix in VM to kernel protocol
- index must be initialized to 0 otherwise bad things happen like the mappings
  for local APIC are not correct after turning paging on.
2010-01-14 11:30:02 +00:00
Tomas Hruby
98563a4afa Killing Minix by typing Q on serial console
- if debugging on serial console is enabled typing Q kills the system. It is
  handy if the system gets locked up and the timer interrupts still work. Good
  for remote debugging.

- NOT_REACHABLE reintroduced and fixed. It should be used for marking code which
  is not reachable because the previous code _should_ not return. Such places
  are not always obvious
2010-01-14 09:46:16 +00:00
Tomas Hruby
8a2a4f97fc Fixed redundant typecast in lapic write/read macros 2010-01-13 18:23:58 +00:00
Tomas Hruby
42c13951a7 APIC disabled if CPU lacks TSC
- we cannot calibrate local APIC timer in such a case

- fixes possible uninitialized variable problem during calibration if no TSC
2010-01-13 18:22:41 +00:00
Thomas Veerman
cc86693102 - Make packman unmount the packages cd if it was mounted.
- Manpages for packman and packit.
2010-01-13 15:52:55 +00:00
Kees van Reeuwijk
ad4c0ff698 Fixed a bug in apic.c that broke lapic_stop_timer().
Fixed bugs in liveupdate.c that rendered load_state_info() meaningless.
More informative error message in do_config() in service.c.
2010-01-13 14:44:19 +00:00
David van Moolenbroek
6a5660a431 PCI: add 64-bit BAR support 2010-01-13 10:52:47 +00:00
David van Moolenbroek
b31119abf5 Mount updates:
- allow mounting with "none" block device
- allow unmounting by mountpoint
- make VFS aware of file system process labels
- allow m3_ca1 to use the full available message size
- use *printf in u/mount(1), as mount(2) uses it already
- fix reference leaks for some mount error cases in VFS
2010-01-12 23:08:50 +00:00
Erik van der Kouwe
483160f3d4 Add tests for sigsetjmp/siglongjmp 2010-01-12 09:53:39 +00:00
Tomas Hruby
a316221fbf Local apic is dissabled by default
to enable it set no_apic=0 in the boot monitor
2010-01-11 17:21:19 +00:00
Kees van Reeuwijk
f595416e7f Fixed some missing return statements. 2010-01-11 14:22:29 +00:00
Erik van der Kouwe
2baf34f801 Update years in man-pages (thanks to Antoine Leca for pointing this out) 2010-01-09 08:18:26 +00:00
Erik van der Kouwe
f025e5f06b Implementations of readv and writev 2010-01-08 13:40:34 +00:00
Erik van der Kouwe
aec561acc5 Add scalbn family of functions 2010-01-08 07:27:54 +00:00
Erik van der Kouwe
17b10f1bf3 Add fabsf function 2010-01-08 07:27:11 +00:00
Cristiano Giuffrida
d1fd04e72a Initialization protocol for system services.
SYSLIB CHANGES:
- SEF framework now supports a new SEF Init request type from RS. 3 different
callbacks are available (init_fresh, init_lu, init_restart) to specify
initialization code when a service starts fresh, starts after a live update,
or restarts.

SYSTEM SERVICE CHANGES:
- Initialization code for system services is now enclosed in a callback SEF will
automatically call at init time. The return code of the callback will
tell RS whether the initialization completed successfully.
- Each init callback can access information passed by RS to initialize. As of
now, each system service has access to the public entries of RS's system process
table to gather all the information required to initialize. This design
eliminates many existing or potential races at boot time and provides a uniform
initialization interface to system services. The same interface will be reused
for the upcoming publish/subscribe model to handle dynamic 
registration / deregistration of system services.

VM CHANGES:
- Uniform privilege management for all system services. Every service uses the
same call mask format. For boot services, VM copies the call mask from init
data. For dynamic services, VM still receives the call mask via rs_set_priv
call that will be soon replaced by the upcoming publish/subscribe model.

RS CHANGES:
- The system process table has been reorganized and split into private entries
and public entries. Only the latter ones are exposed to system services.
- VM call masks are now entirely configured in rs/table.c
- RS has now its own slot in the system process table. Only kernel tasks and
user processes not included in the boot image are now left out from the system
process table.
- RS implements the initialization protocol for system services.
- For services in the boot image, RS blocks till initialization is complete and
panics when failure is reported back. Services are initialized in their order of
appearance in the boot image priv table and RS blocks to implements synchronous
initialization for every system service having the flag SF_SYNCH_BOOT set.
- For services started dynamically, the initialization protocol is implemented
as though it were the first ping for the service. In this case, if the
system service fails to report back (or reports failure), RS brings the service
down rather than trying to restart it.
2010-01-08 01:20:42 +00:00
Erik van der Kouwe
acc3c30855 Prevent nanosleep from potentially overwriting sleep time
suggested by Rene Zatvo
2010-01-07 19:25:18 +00:00
Erik van der Kouwe
aac4b7923f Add ENOTSUP error code 2010-01-07 09:53:31 +00:00
Erik van der Kouwe
1a39ed880a Make get/setsockopt handle SOREUSEADDR 2010-01-07 09:53:08 +00:00
Erik van der Kouwe
413a8083b9 Allow test43 to deal with broken symlinks 2010-01-07 09:52:23 +00:00
Erik van der Kouwe
38ed5b2685 Fix brackets in kernel/arch/i386/include/archconst.h 2010-01-06 08:46:33 +00:00
Erik van der Kouwe
8d97f0253f Fix bracket with different color in netconf(8) man-page 2010-01-06 08:31:11 +00:00
Erik van der Kouwe
33afb396f8 Man-page for netconf(8), contributed by Leith Brandeland 2010-01-06 08:24:06 +00:00
Kees van Reeuwijk
d8f3af3672 Fixed a typing bug.
More explicit type conversion from virual to physical bytes.
Bracket negative #defines for extra paranoia.
Added a forgotten 'void' to a function.
2010-01-06 08:23:14 +00:00
Erik van der Kouwe
49ec221a92 Fix netconf alignment now that there is a number 10"
Note: should fix again when we reach 100 :)
2010-01-06 08:20:12 +00:00
Erik van der Kouwe
c554a39725 Move man-pages for zoneinfo, replace with links 2010-01-06 08:00:39 +00:00
Erik van der Kouwe
bbff2115d6 Oops, forgot to svn add this 2010-01-06 07:49:54 +00:00
Erik van der Kouwe
f9aac2c06b Move man-pages for bzip2, replace with links. 2010-01-06 07:45:45 +00:00
Erik van der Kouwe
a75c9fce4d Man-page for ping, contributed by Leith Brandeland 2010-01-06 07:36:12 +00:00
David van Moolenbroek
ac9ab099c8 General cleanup:
- clean up kernel section of minix/com.h somewhat
- remove ALLOCMEM and VM_ALLOCMEM calls
- remove non-safecopy and minix-vmd support from Inet
- remove SYS_VIRVCOPY and SYS_PHYSVCOPY calls
- remove obsolete segment encoding in SYS_SAFECOPY*
- remove DEVCTL call, svrctl(FSDEVUNMAP), map_driverX
- remove declarations of unimplemented svrctl requests
- remove everything related to swapping to disk
- remove floppysetup.sh
- remove traces of rescue device
- update DESCRIBE.sh with new devices
- some other small changes
2010-01-05 19:39:27 +00:00
David van Moolenbroek
be992434e7 VM: make munmap(2) round length up, not down (reported by Althaf K Backer) 2010-01-05 09:40:07 +00:00
David van Moolenbroek
0dcf5b7aa8 add ptrace(2) TO_NOEXEC flag 2010-01-05 09:30:28 +00:00
David van Moolenbroek
709ca777bd start a.out2com script with 'sh' (Bug#365.1, reported by Antoine Leca) 2010-01-05 09:21:55 +00:00
David van Moolenbroek
bac0e91705 typo (Bug#376, reported by Kees van Reeuwijk) 2010-01-04 12:29:51 +00:00
David van Moolenbroek
c473cfcdda more kernel header typos 2010-01-01 20:18:05 +00:00
Erik van der Kouwe
7bbe4aaaa6 Add man entry for new errno code 2009-12-31 12:09:31 +00:00
Erik van der Kouwe
c42de8045f Added EILSEQ, based on newsgroup post by Leith 2009-12-31 11:48:08 +00:00
David van Moolenbroek
1489f14b37 Driver for Attansic L2 FastEthernet (atl2) 2009-12-30 22:42:44 +00:00
Erik van der Kouwe
41f3075f99 Man-page name order fixes 2009-12-30 20:35:05 +00:00
Erik van der Kouwe
eeeadf65f5 Add timeout to test42 2009-12-30 20:22:21 +00:00
David van Moolenbroek
44e46860c7 Kernel: fix do_stime.c header comment (2) 2009-12-30 14:56:54 +00:00
David van Moolenbroek
010e23e504 Kernel: fix do_stime.c header comment 2009-12-30 14:56:35 +00:00
David van Moolenbroek
d3fc0eca1d mdb(1) fixes:
- allow core file offsets with high bit set
- repair and enable gcc-compiled binary support
- fix bug leading to random command execution
- remove obsolete ptrace.2 manpage
2009-12-29 21:38:26 +00:00
David van Moolenbroek
ac9a5829a2 suppress kernel/VM memory debugging information 2009-12-29 21:35:12 +00:00
David van Moolenbroek
0bafee3d78 unbreak, deprivilege dumpcore(1) 2009-12-29 21:34:06 +00:00
David van Moolenbroek
e423c86009 ptrace(2) modifications:
- add T_GETRANGE/T_SETRANGE to get/set ranges of values
- change EIO error code to EFAULT
- move common-I&D text-to-data translation to umap_local
2009-12-29 21:32:15 +00:00
David van Moolenbroek
8da928d2df unbreak "make dos" in boot (Bug#365, patch by Antoine Leca) 2009-12-24 23:49:23 +00:00
David van Moolenbroek
c8f8d69204 Fix MFS ftruncate crash (Bug#370, reported by Aki Goto) 2009-12-24 23:43:16 +00:00
Erik van der Kouwe
6dc5d42798 Floating point support functions 2009-12-24 20:22:41 +00:00
David van Moolenbroek
5e9a8f05ff unbreak building CDs 2009-12-23 23:59:32 +00:00
David van Moolenbroek
692dc020e1 Correct ping(1) usage string (Bug#372, reported by Leith Brandeland 2009-12-23 23:42:07 +00:00
Cristiano Giuffrida
f24f987b95 Move setuid() hack where it belongs. 2009-12-23 16:26:28 +00:00
Cristiano Giuffrida
6f912993ff Share exec images in RS.
RS CHANGES:
- RS retains information on both labels and process names now. Labels for boot
processes are configured in the boot image priv table. Process names are
inherited from the in-kernel boot image table.
- When RS_REUSE is specified in do_up, RS looks for an existing slot having the
same process name as the one we are about to start. If one is found with
an in-memory copy of its executable image, the image is then shared between
the two processes, rather than copying it again. This behavior can be specified
by using 'service -r' when starting a system service from the command line.
2009-12-23 14:05:20 +00:00
David van Moolenbroek
123683d4a5 Console function keys and color support:
- if "debug_fkeys" boot monitor variable is set to 0:
  - pass Fn, Shift+Fn, Ctrl+Fn, Shift+Ctrl+Fn to applications
  - don't start IS
- update termcap files with function key, color, end key support
2009-12-22 23:30:50 +00:00
David van Moolenbroek
d5471320d9 another warning regression fix 2009-12-22 00:05:09 +00:00
David van Moolenbroek
7a345b3528 no! no new warnings 2009-12-21 23:39:08 +00:00
David van Moolenbroek
92ae5c81ae Filter driver updates:
- optionally vectorize I/O requests to work around hardware bugs
- extend default buffer size to cover MFS's default maximum request size
- use mmap directly, rather than alloc_contig
- add 'nil' checksum type for comparison with layout
- minor style corrections
2009-12-21 23:30:01 +00:00
David van Moolenbroek
492d663444 TTY fixes:
- reenable code to restore screen/cursor at shutdown
- add proper signal checking logic
- lock to first console during shutdown
2009-12-21 23:19:01 +00:00
Cristiano Giuffrida
1f5841c8ed Basic System Event Framework (SEF) with ping and live update.
SYSLIB CHANGES:
- SEF must be used by every system process and is thereby part of the system
library.
- The framework provides a receive() interface (sef_receive) for system
processes to automatically catch known system even messages and process them.
- SEF provides a default behavior for each type of system event, but allows
system processes to register callbacks to override the default behavior.
- Custom (local to the process) or predefined (provided by SEF) callback
implementations can be registered to SEF.
- SEF currently includes support for 2 types of system events:
  1. SEF Ping. The event occurs every time RS sends a ping to figure out
  whether a system process is still alive. The default callback implementation
  provided by SEF is to notify RS back to let it know the process is alive
  and kicking.
  2. SEF Live update. The event occurs every time RS sends a prepare to update
  message to let a system process know an update is available and to prepare
  for it. The live update support is very basic for now. SEF only deals with
  verifying if the prepare state can be supported by the process, dumping the
  state for debugging purposes, and providing an event-driven programming
  model to the process to react to state changes check-in when ready to update.
- SEF should be extended in the future to integrate support for more types of
system events. Ideally, all the cross-cutting concerns should be integrated into
SEF to avoid duplicating code and ease extensibility. Examples include:
  * PM notify messages primarily used at shutdown.
  * SYSTEM notify messages primarily used for signals.
  * CLOCK notify messages used for system alarms.
  * Debug messages. IS could still be in charge of fkey handling but would
  forward the debug message to the target process (e.g. PM, if the user
  requested debug information about PM). SEF would then catch the message and
  do nothing unless the process has registered an appropriate callback to
  deal with the event. This simplifies the programming model to print debug
  information, avoids duplicating code, and reduces the effort to print
  debug information.

SYSTEM PROCESSES CHANGES:
- Every system process registers SEF callbacks it needs to override the default
system behavior and calls sef_startup() right after being started.
- sef_startup() does almost nothing now, but will be extended in the future to
support callbacks of its own to let RS control and synchronize with every
system process at initialization time.
- Every system process calls sef_receive() now rather than receive() directly,
to let SEF handle predefined system events.

RS CHANGES:
- RS supports a basic single-component live update protocol now, as follows:
  * When an update command is issued (via "service update *"), RS notifies the
  target system process to prepare for a specific update state.
  * If the process doesn't respond back in time, the update is aborted.
  * When the process responds back, RS kills it and marks it for refreshing.
  * The process is then automatically restarted as for a buggy process and can
  start running again.
  * Live update is currently prototyped as a controlled failure.
2009-12-21 14:12:21 +00:00
Thomas Veerman
48ef79f78d Fix typo 2009-12-21 13:59:04 +00:00
David van Moolenbroek
d5dee93bee Support for larger disks.
- MFS, df(1), fsck(1), badblocks(8), de(1x) now compute the
  superblock's s_firstdatazone value if the on-disk value is zero
- mkfs(1) sets s_firstdatazone in the superblock to zero if the
  on-disk field is too small to store the actual value
- more agressive mkfs(1) inode number heuristic, copied from r5261
2009-12-21 11:20:30 +00:00
Thomas Veerman
6aa43dc9e4 Fix typo and a bug causing vnode references to become too low. 2009-12-21 09:36:34 +00:00
Thomas Veerman
bcecad33d5 Fix compilation errors caused by more files not added in previous commit 2009-12-20 21:31:03 +00:00
Thomas Veerman
951c5f6b73 Add PFS (missing in previous commit) 2009-12-20 20:41:50 +00:00
Thomas Veerman
958b25be50 - Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
  the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
  functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
  the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
  - Several path lookup bugs in MFS.
  - A link can be too big for the path buffer.
  - A mountpoint can become inaccessible when the creation of a new inode
    fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
  suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
  unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
  named pipes. However, named pipes still reside on the (M)FS, as they are part
  of the file system on disk. To make this work VFS now has a concept of
  'mapped' inodes, which causes read, write, truncate and stat requests to be
  redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 20:27:14 +00:00
Erik van der Kouwe
ac900e59ba Remove some GCC library warnings 2009-12-17 08:43:31 +00:00
Cristiano Giuffrida
e090013056 Drivers and servers are simply known as services.
/etc CHANGES:
- /etc/drivers.conf has been renamed to /etc/system.conf. Every entry in 
the file is now marked as "service" rather than driver.
- user "service" has been added to password file /etc/passwd.
- docs/UPDATING updated accordingly, as well as every other mention to the old
drivers.conf in the system.

RS CHANGES:
- No more distinction between servers and drivers.
- RS_START has been renamed to RS_UP and the old legacy RS_UP and RS_UP_COPY
dropped.
- RS asks PCI to set / remove ACL entries only for services whose ACL properties
have been set. This change eliminates unnecessary warnings.
- Temporarily minimize the risk of potential races at boot time or when starting
a new service. Upcoming changes will eliminate races completely.
- General cleanup.
2009-12-17 01:53:26 +00:00
Cristiano Giuffrida
b4d6d9db26 Fix bug in IPC deadlock detection code.
The old deadlock code was misplaced and unable to deal with asynchronous
IPC primitives (notify and senda) effectively. As an example, the following
sequence of messages allowed the deadlock detection code to
trigger a false positive:
1. A.notify(B)
2. A.receive(B)
3. B.receive(A)
1. B.notify(A)
The solution is to run the deadlock detection routine only when a process is
about to block in mini_send() or mini_receive().
2009-12-16 23:32:08 +00:00
David van Moolenbroek
d31ad285a0 typo 2009-12-16 12:17:02 +00:00
David van Moolenbroek
d1918e2e9f fix remaining warnings in 'make world' 2009-12-14 20:25:52 +00:00
David van Moolenbroek
14367afaf7 awk: check presence of parameters 2009-12-14 20:24:33 +00:00
David van Moolenbroek
307ad7b3b0 test42: disable attach-to-PM test 2009-12-13 21:45:23 +00:00
Cristiano Giuffrida
f4574783dc Rewrite of boot process
KERNEL CHANGES:
- The kernel only knows about privileges of kernel tasks and the root system
process (now RS).
- Kernel tasks and the root system process are the only processes that are made
schedulable by the kernel at startup. All the other processes in the boot image
don't get their privileges set at startup and are inhibited from running by the
RTS_NO_PRIV flag.
- Removed the assumption on the ordering of processes in the boot image table.
System processes can now appear in any order in the boot image table.
- Privilege ids can now be assigned both statically or dynamically. The kernel
assigns static privilege ids to kernel tasks and the root system process. Each
id is directly derived from the process number.
- User processes now all share the static privilege id of the root user
process (now INIT).
- sys_privctl split: we have more calls now to let RS set privileges for system
processes. SYS_PRIV_ALLOW / SYS_PRIV_DISALLOW are only used to flip the
RTS_NO_PRIV flag and allow / disallow a process from running. SYS_PRIV_SET_SYS /
SYS_PRIV_SET_USER are used to set privileges for a system / user process.
- boot image table flags split: PROC_FULLVM is the only flag that has been
moved out of the privilege flags and is still maintained in the boot image
table. All the other privilege flags are out of the kernel now.

RS CHANGES:
- RS is the only user-space process who gets to run right after in-kernel
startup.
- RS uses the boot image table from the kernel and three additional boot image
info table (priv table, sys table, dev table) to complete the initialization
of the system.
- RS checks that the entries in the priv table match the entries in the boot
image table to make sure that every process in the boot image gets schedulable.
- RS only uses static privilege ids to set privileges for system services in
the boot image.
- RS includes basic memory management support to allocate the boot image buffer
dynamically during initialization. The buffer shall contain the executable
image of all the system services we would like to restart after a crash.
- First step towards decoupling between resource provisioning and resource
requirements in RS: RS must know what resources it needs to restart a process
and what resources it has currently available. This is useful to tradeoff
reliability and resource consumption. When required resources are missing, the
process cannot be restarted. In that case, in the future, a system flag will
tell RS what to do. For example, if CORE_PROC is set, RS should trigger a
system-wide panic because the system can no longer function correctly without
a core system process.

PM CHANGES:
- The process tree built at initialization time is changed to have INIT as root
with pid 0, RS child of INIT and all the system services children of RS. This
is required to make RS in control of all the system services.
- PM no longer registers labels for system services in the boot image. This is
now part of RS's initialization process.
2009-12-11 00:08:19 +00:00
Erik van der Kouwe
af80fd2789 Adjust number of tests 2009-12-09 19:30:39 +00:00
Erik van der Kouwe
6adadade32 Implementation of strto(u)ll, documentation and tests for strto(u)l(l) 2009-12-09 19:01:38 +00:00
Erik van der Kouwe
fcaaad3317 Add Ben's test 44 2009-12-09 13:42:33 +00:00
Erik van der Kouwe
54c05bc2bd Use subdirectory t43 for tests 2009-12-09 07:59:08 +00:00
Erik van der Kouwe
c8e211ddfa Removed non-existant test 44 from Makefile 2009-12-09 07:52:17 +00:00
Ben Gras
8d800b3df7 Make VM fix up memory for kernel that crosses region boundaries
too.

Add a test to make this happen (triggers a vm panic before this commit).
2009-12-08 13:35:52 +00:00
Erik van der Kouwe
bd0933a19b Implementation of getrlimit and getdtablesize 2009-12-07 19:56:40 +00:00
Ben Gras
26ba254a4a Intel Pro/1000 driver written by Niek Linnenbank. 2009-12-07 18:33:41 +00:00
Ben Gras
f0db9bb328 - map in as much memory as is necessary in 4MB chunks to
let boot processes run with segments
 - allow segment-only processes to fork() by copying them
   and giving them an identity page table
2009-12-07 12:10:44 +00:00
Tomas Hruby
51065a1b47 Cooments to warn not to use certains instructions
- gas2ack cannot handle all variants of some instructions. Until this issues is
  addressed, this patch places a big warning where appropriate. This code is not
  supposed to change frequently.
2009-12-07 12:01:05 +00:00
Erik van der Kouwe
45a52f7acc Give test 43 root privileges to prevent errors when run as non-root 2009-12-04 18:58:57 +00:00
Erik van der Kouwe
91d13ae054 Fixed tests to use the right path when run as root 2009-12-04 17:51:06 +00:00
Erik van der Kouwe
09939b454e Fix line which was too long 2009-12-04 17:49:20 +00:00
Erik van der Kouwe
5427ab41c8 Add realpath function 2009-12-04 07:52:22 +00:00
Erik van der Kouwe
150dfbe96d Cleanup getsockopt and add SO_TYPE 2009-12-04 07:26:56 +00:00
Tomas Hruby
ec1fec6c3f A debug print with no meaning removed from VM. 2009-12-03 10:53:56 +00:00
David van Moolenbroek
fe982ca684 FPU: fix field names, compiler warning, long lines 2009-12-02 23:12:46 +00:00
Ben Gras
38fecc5de1 Part of the FPU changes; forgot to add these files in FPU commit. 2009-12-02 16:35:05 +00:00
Ben Gras
207621b6fb rtl8169 driver contributed by Jaswinder Singh Rajput. 2009-12-02 15:59:42 +00:00
Ben Gras
b9825f55e0 previous commit premature and not part of FPU changes. 2009-12-02 15:53:20 +00:00
Erik van der Kouwe
9a10c6c620 Specify types for integer MAX constants 2009-12-02 15:35:09 +00:00
Ben Gras
39484601e7 any blocksize. 2009-12-02 15:33:14 +00:00
Ben Gras
bd42705433 FPU context switching support by Evgeniy Ivanov. 2009-12-02 13:01:48 +00:00
David van Moolenbroek
fce9fd4b4e Add 'getidle' CPU utilization measurement infrastructure 2009-12-02 11:52:26 +00:00
David van Moolenbroek
be2087ecf9 Filter driver by Wu Bingzheng et al 2009-12-02 10:08:58 +00:00
David van Moolenbroek
f197bcb435 Allow servers to run with fewer privileges:
- allow non-root processes to get their own endpoint
- make alloc_contig() call sys_umap() only when requested
2009-12-02 10:06:58 +00:00
David van Moolenbroek
30a7fe5fa9 libdriver changes:
- remove obsolete non-safecopy support
- merge libdriver and libdriver_asyn
- change standard reply model from sendnb to senda
2009-12-02 09:57:48 +00:00
David van Moolenbroek
4924d1a9b5 RS changes:
- add new "control" config directive, to let drivers restart drivers
  (by Jorrit Herder)
- fix bug causing system processes to be started twice sometimes
2009-12-02 09:54:50 +00:00
Ben Gras
7c0cdc61bc fix for race condition - IRQ can happen between clearing the endpoint
of the handling process and before removing the hook. The handler function
will panic then.
2009-12-01 16:46:27 +00:00
David van Moolenbroek
ad259e92af Alternative VirtualBox/Lance driver workaround 2009-11-28 13:28:55 +00:00
David van Moolenbroek
fe7b2f1652 RS fixes:
- fix resource leak (PCI ACLs) when child fails right after exec
- fix resource leak (memory) when child exec fails at all
- fix race condition setting VM call privileges for new child
- make dev_execve() return a proper result, and check this result
- remove RS_EXECFAILED, as it should behave exactly like RS_EXITING
- add more clarifying comments about starting servers
2009-11-28 13:23:45 +00:00
David van Moolenbroek
45123f83d3 PM: remove 'boottime' global variable 2009-11-28 13:22:01 +00:00
David van Moolenbroek
6da61b8f05 fix _NSIG usage 2009-11-28 13:20:50 +00:00
David van Moolenbroek
c6cce1823d Portability: POSIXize some of inet's error codes 2009-11-28 13:18:33 +00:00
David van Moolenbroek
709a739b52 Kernel: unbreak load averages 2009-11-28 13:16:03 +00:00
David van Moolenbroek
6c6e1db676 Kernel: fix faulty trap check 2009-11-28 13:15:07 +00:00
David van Moolenbroek
e06e85b511 Portability: include sys/select.h from sys/time.h 2009-11-22 20:11:06 +00:00
David van Moolenbroek
bdb85248d4 VM: don't send arbitrary status values to kernel 2009-11-22 13:06:18 +00:00
David van Moolenbroek
4d4cb8fa24 Support for read/write on connected UDP sockets 2009-11-19 23:45:46 +00:00
David van Moolenbroek
3926b70b22 Remove dead mini_ds_retrieve_u32 code 2009-11-17 14:10:09 +00:00
Erik van der Kouwe
c85bd7edb9 Patch by Jaswinder Singh Rajput to fix FTP progress display 2009-11-17 08:41:43 +00:00
Tomas Hruby
8a44a44cb9 Local APIC
- local APIC timer used as the source of time

- PIC is still used as the hw interrupt controller as we don't have
  enough info without ACPI or MPS to set up IO APICs

- remapping of APIC when switching paging on, uses the new mechanism
  to tell VM what phys areas to map in kernel's virtual space

- one more step to SMP

based on code by Arun C.
2009-11-16 21:41:44 +00:00
Tomas Hruby
6515c93ecf New instructions in gas2ack
pause
mfence
rdtsc
rdpmc
2009-11-16 21:32:48 +00:00
David van Moolenbroek
2dc9e354f7 ugly double blank line, my fault 2009-11-16 18:22:28 +00:00
Tomas Hruby
9e62bd5241 .align replaced by .balign in mpx386.S 2009-11-13 09:30:45 +00:00
Tomas Hruby
21a5917f3e gas2ack does not understand .align
- as .align is target dependent we for usage of .balign for byte alignment
2009-11-13 09:29:37 +00:00
Tomas Hruby
d653cb457f gas2ack support for rdmsr and wrmsr 2009-11-12 16:19:01 +00:00
Tomas Hruby
cb9faaebfd No need for a special idle queue
- as the idle task is never placed on any run queue, we don't need any special
  idle queue.

- one more queue available for user processes
2009-11-12 08:47:25 +00:00
Tomas Hruby
ad4dcaab71 Idle task never runs
- idle task becomes a pseudo task which is never scheduled. It is never put on
  any run queue and never enters userspace. An entry for this task still remains
  in the process table for time accounting

- Instead of panicing if there is not process to schedule, pick_proc() returns
  NULL which is a signal to put the cpu in an idle state and set everything in
  such a way that after receiving and interrupt it looks like idle task was
  preempted

- idle task is set non-preemptible to avoid handling in the timer interrupt code
  which make userspace scheduling simpler as idle task does not need to be
  handled as a special case.
2009-11-12 08:42:18 +00:00
Tomas Hruby
37a7e1b76b Use of isemptyp() macro instead of testing RTS_SLOT_FREE flag
- some code used to test if only this flag is set, some if also this flag is
  set. This change unifies the test
2009-11-12 08:35:26 +00:00
Tomas Hruby
f98bea8f67 The rest of the r5641 commit 2009-11-11 17:02:45 +00:00
Tomas Hruby
04db2d7184 enable printing of 64-bit ints with gcc. 2009-11-11 12:15:08 +00:00
Tomas Hruby
b3b0a18403 allow kernel to tell VM extra physical addresses it wants mapped in.
used in the future for mapping in local APIC memory.
2009-11-11 12:07:06 +00:00
Tomas Hruby
9ba3b53de8 kernel/proc.h can be included in kernel assembky files
- the gnu .S are compiled with __ASSEMBLY__ macro set which allows us to
  conditionaly remove C stuff from the proc.h file when included in assembly
  files
2009-11-10 09:14:50 +00:00
Tomas Hruby
a972f4bacc All macros defining rts flags are prefixed with RTS_
- macros used with RTS_SET group of macros to define struct proc p_rts_flags are
  now prefixed with RTS_ to make things clear
2009-11-10 09:11:13 +00:00
Tomas Hruby
daf7940c69 pick_proc() called only just before returning to userspace
- new proc_is_runnable() macro to test whether process is runnable. All tests
  whether p_rts_flags == 0 converted to use this macro

- pick_proc() calls removed from enqueue() and dequeue()

- removed the test for recursive calls from pick_proc() as it certainly cannot
  be called recursively now

- PREEMPTED flag to mark processes that were preempted by enqueueuing a higher
  priority process in enqueue()

- enqueue_head() to enqueue PREEMPTED processes again at the head of their
  current priority queue

- NO_QUANTUM flag to block and dequeue processes preempted by timer tick with
  exceeded quantum. They need to be enqueued again in schedcheck()

- next_ptr global variable removed
2009-11-09 17:48:31 +00:00
David van Moolenbroek
86cc12b9a3 pci: extend NR_DRIVERS to cover all system processes 2009-11-09 10:43:46 +00:00
Tomas Hruby
ae75f9d4e5 Removal of the executable flag from files that cannot be executed
- 755 -> 644
2009-11-09 10:26:00 +00:00
David van Moolenbroek
c539fea347 activate new ptrace test, too 2009-11-09 09:26:09 +00:00
David van Moolenbroek
a07f8d7646 Fix ptrace bug when reattaching to a detached process 2009-11-09 08:12:25 +00:00
Tomas Hruby
ebbce7507b Complete ovehaul of mode switching code
- after a trap to kernel, the code automatically switches to kernel
  stack, in the future local to the CPU

- k_reenter variable replaced by a test whether the CS is kernel cs or
  not. The information is passed further if needed. Removes a global
  variable which would need to be cpu local

- no need for global variables describing the exception or trap
  context. This information is kept on stack and a pointer to this
  structure is passed to the C code as a single structure

- removed loadedcr3 variable and its use replaced by reading the %cr3
  register

- no need to redisable interrupts in restart() as they are already
  disabled.

- unified handling of traps that push and don't push errorcode

- removed save() function as the process context is not saved directly
  to process table but saved as required by the trap code. Essentially
  it means that save() code is inlined everywhere not only in the
  exception handling routine

- returning from syscall is more arch independent - it sets the retger
  in C

- top of the x86 stack contains the current CPU id and pointer to the
  currently scheduled process (the one right interrupted) so the mode
  switch code can find where to save the context without need to use
  proc_ptr which will be cpu local in the future and therefore
  difficult to access in assembler and expensive to access in general

- some more clean up of level0 code. No need to read-back the argument
  passed in
  %eax from the proc structure. The mode switch code does not clobber
  %the general registers and hence we can just call what is in %eax

- many assebly macros in sconst.h as they will be reused by the apic
  assembly
2009-11-06 09:08:26 +00:00
Tomas Hruby
f2a1f21a39 Clock task split
- preemption handled in the clock timer interrupt handler, not in the clock task

- more achitecture independent clock timer handling code

- smp ready as each CPU can have its own timer
2009-11-06 09:04:15 +00:00
Tomas Hruby
6eebc03f88 Fix for broken parsing of memory environment string in pci driver
- unfixed parsing could run away from the the string and fail on a correct
  string in complete_bars()

- it reanables the body of complete_bars()
2009-11-06 08:58:05 +00:00
Tomas Hruby
d2c10fb85e inodes - using types with known size
- fixes a problem in inodes truct definitions. The original definitions use
  posix types. These types don't have well defined size. Therefore when
  compiling mkfs on a different system natively the inodes sizes do not match.
  This patch replaces the posix types with interger types of the same size and
  signedness as the original types in use.
2009-11-06 08:55:07 +00:00
Tomas Hruby
0b8e20c89e Changes to the include files in order to make cross-compilation possible.
- The primary reason is that mkfs and installboot need to run natively during
  the cross compilation (host and target versions are compiled). There is a
  collision of include files though. E.g. a.out.h is very minix-specific.
  Therefore some files we moved and replaced by stubs that include the original
  file if compiling on or for Minix :
  
  include/a.out.h -> include/minix/a.out.h
  include/sys/dir.h -> include/minix/dir.h
  include/dirent.h -> include/minix/dirent.h
  include/sys/types.h -> include/minix/types.h

- This does not break any native compilation on Minix. Other headers that were
  including the original files are changed according to include directly the
  new, minix specific location not to pick up the host system includes while
  cross-compiling.

- role of this patch is to make rebasing of the build branch simpler until the
  new build system is merged
2009-11-06 08:46:22 +00:00
Tomas Hruby
616d936638 vmassert reports also the source file in which it was triggered 2009-11-04 15:30:08 +00:00
Tomas Hruby
cf854041ce Hardware interrupts code path cleanup
- the PIC master and slave irq handlers don't pass the irq hook pointer but just
  the irq number. It gives a little bit more information to the C handler as the
  irq number is not lost

- the irq code path is more achitecture independent. i386 hw interrupts are
  called irq and whereever the code is arch independent enough hw_intr_
  functions are called to mask/unmask interrupts

- the legacy PIC is not the only possible interrupt controller in the x86 world,
  therefore the intr_(un)mask functions were renamed to signal their
  functionality explicitly. APIC will add their own.

- masking and unmasking PIC interrupt lines is removed from assembler and all
  the functionality is rewriten in C and moved to i8259.c

- interrupt handlers have to unmask the interrupt line if all irq handlers are
  done. Assembler does not do it anymore
2009-11-04 13:24:56 +00:00
Ben Gras
7e73260cf5 - enable remembering of device memory ranges set by PCI and
told to kernel
  - makes VM ask the kernel if a certain process is allowed
    to map in a range of physical memory (VM rounds it to page
    boundaries afterwards - but it's impossible to map anything
    smaller otherwise so I assume this is safe, i.e. there won't
    be anything else in that page; certainly no regular memory)
  - VM permission check cleanup (no more hardcoded calls, less
    hardcoded logic, more readable main loop), a loose end left
    by GQ
  - remove do_copy warning, as the ipc server triggers this but
    it's no more harmful than the special cases already excluded
    explicitly (VFS, PM, etc).
2009-11-03 11:12:23 +00:00
David van Moolenbroek
56d485c1d6 Various small IS, TTY, isofs fixes
IS:
- do not use p_getfrom_e for a process that is sending
- register with TTY only function keys that are used
- various header and formatting fixes
- proper shutdown code

TTY:
- restore proper Ctrl+F1 dump contents

isofs:
- don't even try to call sys_exit()
2009-11-02 23:04:52 +00:00
David van Moolenbroek
f814fe41be Kernel: add support for indirect grants 2009-11-02 22:30:37 +00:00
David van Moolenbroek
769bed22c8 ash: only execute regular files 2009-11-01 22:25:54 +00:00
David van Moolenbroek
f89388c241 Kernel, servers: remove unused proto.h definitions 2009-10-31 14:11:50 +00:00
David van Moolenbroek
4c263d6002 PM: clean up endpoint info API/ABI 2009-10-31 14:09:28 +00:00
Tomas Hruby
403764c538 Conversion of kernel assembly from ACK to GNU
- .s files removed and replaced by .S as the .S is a standard extension for assembly that needs preprocessing
2009-10-30 16:00:44 +00:00
Tomas Hruby
41d481b065 gas2ack
- an asmconv based tool for conversion from GNU ia32 assembly to ACK assembly
    
    - in contrast to asmconv it is a one way tool only
    
    - as the GNU assembly in Minix does not prefix global C symbols with _ gas2ack
      detects such symbols and prefixes them to be compliant with the ACK convention
    
    - gas2ack preserves comments and unexpanded macros
    
    - bunch of fixes to the asmconv GNU->ACK direction
    
    - support of more instructions that ACK does not know but are in use in Minix
    
    - it is meant as a temporary solution as long as ACK will be a supported
      compiler for the core system
2009-10-30 15:57:35 +00:00
David van Moolenbroek
6c4197f77e PM, VFS: remove unused param.h definitions 2009-10-29 13:29:04 +00:00
David van Moolenbroek
66998b594f PM: remove unused core_name variable 2009-10-29 12:07:53 +00:00
David van Moolenbroek
20ca68f5c9 DS: do not panic when sending reply fails 2009-10-27 17:06:45 +00:00
Erik van der Kouwe
379e087d6b Create man pages for bigsh and dev2name 2009-10-27 15:34:22 +00:00
David van Moolenbroek
bd30f2a988 Ground work for larger file systems, and miscellaneous fixes:
- MFS and mkfs(1) now perform extra sanity checks
- fsck(1) can now deal with inode tables extending beyond the file
  system's first 4GB
- badblocks(8) no longer writes out the superblock for no reason
- mkfs(1) no longer crashes when given no parameters
- more(1) no longer crashes when standard output is redirected
2009-10-26 13:35:39 +00:00
Ben Gras
5920582bde Don't check DMA_ST_ERROR before DMA_ST_INT is set (which is done too) 2009-10-22 14:31:29 +00:00
Erik van der Kouwe
204f9d496a Increase limits on PCI devices to have space for the new RTL8139 ACLSs 2009-10-21 09:14:58 +00:00
Ben Gras
97ae67e780 if from branch, include branch name in in-image tag and .iso filename. 2009-10-19 15:46:27 +00:00
Ben Gras
96b608c3f2 throw out unnecessary drive1 thing 2009-10-19 15:45:43 +00:00
Ben Gras
6b01026668 newer at_wini.c (really incl atapi dma this time) 2009-10-19 15:45:14 +00:00
Ben Gras
3017061093 include OSS on CD 2009-10-19 15:13:44 +00:00
Ben Gras
0333f21d8e - reverse order of transfer command and DMA initiation - fixes DMA problem
that some hardware had
 - clear DMA_ST_INT after DMA - fixes infinite number of interrupts 
   that some hardware had
 - initial ATAPI DMA implementation, doesn't actually increase performance
   on my test hardware so possibly not right yet, disabled by default
2009-10-19 14:23:04 +00:00
Ben Gras
53567bf741 no DEBUG_VMASSERT committed 2009-10-18 20:08:55 +00:00
Erik van der Kouwe
4c2f0eb22f Suppress spurious scancodes in VMWare 2009-10-18 07:12:42 +00:00
Erik van der Kouwe
44a4c8c0d2 Add more identifiers to drivers.conf for orinoco and rtl8137.
Increase RSS_NR_PCI_ID and remove dumplicate reference
to /etc/drivers.conf; each such reference uses _PATH_DRIVERS_CONF
from <minix/paths.h> now.
2009-10-14 07:20:13 +00:00
Ben Gras
abdf8e26fb moving OSS to a package. 2009-10-12 12:53:36 +00:00
David van Moolenbroek
0143cb2335 support for head -n (suggested by xorquewasp) 2009-10-10 22:36:46 +00:00
Erik van der Kouwe
fc2634d1ed Network card autodetection in netconf.sh 2009-10-10 15:54:05 +00:00
Erik van der Kouwe
cb6dbfca2c Add lspci command and SI_PCI_INFO getsysinfo call 2009-10-09 10:48:46 +00:00
David van Moolenbroek
045f1cdb10 inet: fix TCP connection corruption bug (causing test40 to fail sometimes) 2009-10-06 20:32:58 +00:00
Erik van der Kouwe
e9533909ff Report make issue in UPDATING (approved by Ben) 2009-10-06 14:17:13 +00:00
Erik van der Kouwe
d9a34f96e7 Add nohup tool (approved by Ben) 2009-10-06 14:16:35 +00:00
Ben Gras
dbbc0c23d5 fix compiler warning by including for prototype. 2009-10-05 16:45:03 +00:00
Ben Gras
c373473f24 add prototype for wait_for() to fix compiler warning. 2009-10-05 16:43:02 +00:00
Ben Gras
45ae52aec0 fix compiler warnings using dubious casts. 2009-10-05 16:41:28 +00:00
Ben Gras
2f4ea30d96 fix compiler warning 2009-10-05 16:40:21 +00:00
Ben Gras
1a85c6be78 fix compiler warning due to const char * -> char * 2009-10-05 16:38:12 +00:00
Ben Gras
24e1e83028 really revert endpoint_t -> int
debugging info on panic: decode segment selectors and descriptors, now moved
to arch-specific part, prototypes added; sanity checking in debug.h made
optional with vmassert().
2009-10-05 15:47:23 +00:00
Ben Gras
30804b9ed7 thanks to tomas: fix for level0() race condition - global variable can
be used concurrently.  pass the function in eax instead; this gets rid
of the global variable.  also execute the function directly if we're
already trapped into the kernel.

revert of u32_t endpoint_t to int (some code assumes endpoints are
negative for negative slot numbers).
2009-10-05 15:22:31 +00:00
Ben Gras
88a12c70d2 little more info in pagefault exception handler. 2009-10-03 12:23:02 +00:00
Ben Gras
6bd3002f06 - exact magic values for entered/nonentered states in recursive enter check
- read_*() functions to read segment selector values
 - decode loaded segments on panic
2009-10-03 12:17:46 +00:00
Ben Gras
fe35879325 - panic if there's no runnable process
- more basic sanity check before recursive enter check (data segment)
 - try to jump to boot monitor instantly on recursive panic
2009-10-03 11:30:35 +00:00
Ben Gras
e716fae585 packman -y: noninteractive mode to install all packages 2009-10-03 09:57:37 +00:00
Ben Gras
fb5b10a081 fixed grep usage in filter (again) 2009-10-02 13:29:36 +00:00
Ben Gras
85ad7b6b11 don't have ackpack in the list any more as it installs an
old /usr/bin/make.
2009-10-02 13:23:58 +00:00
Ben Gras
7f423d0fa2 Unique matching for package name when grepping for it in the master list. 2009-10-02 13:02:36 +00:00
David van Moolenbroek
e7dea9c609 Add id(1) -g, -n, -r options (Bug#302, reported by Aleksey Cheusov) 2009-10-02 12:23:00 +00:00
Tomas Hruby
982f4a0cbb isofs links with libsysutil which does not exist anymore 2009-10-02 12:07:46 +00:00
Ben Gras
b9e0af1c1e dirs for OSS 2009-10-02 10:35:05 +00:00
Ben Gras
57be617a8d revert to 16MB to fix reinstall for now. 2009-10-02 09:48:15 +00:00
David van Moolenbroek
e913d66749 INET: fix panic when network drivers are started late (Bug#309, reported by Niek Linnenbank) 2009-10-01 21:24:12 +00:00
David van Moolenbroek
8f9a90192f RS: disable harmless warning 2009-10-01 19:21:57 +00:00
Ben Gras
d3382c4a6c postgresql in packing list 2009-10-01 18:14:49 +00:00
Ben Gras
0d83eeb194 slightly larger /usr needed 2009-10-01 17:45:14 +00:00
Ben Gras
5a0c76e64a connect OSS to the build (clean and install only) 2009-10-01 17:23:54 +00:00
David van Moolenbroek
6168bcefa6 Fix bios_wini using wrong size for vector (Bug#280, reported by John Peace) 2009-10-01 16:59:04 +00:00
David van Moolenbroek
bc029d0bc6 Remove treecmp utility (Bug#310, reported by John Peace) 2009-10-01 16:58:13 +00:00
David van Moolenbroek
2ac8124914 Fix writeisofs lseek() usage (Bug#311, reported by John Peace 2009-10-01 16:56:46 +00:00
Ben Gras
b7ac32bfa4 dir for oss config files 2009-10-01 16:55:54 +00:00
David van Moolenbroek
0c1ae1965e Fix syslog buffer overflow (Bug#270, reported by Kevin Jordan) 2009-10-01 16:54:56 +00:00
Ben Gras
cb50e7e135 support for OSS. 2009-10-01 16:36:14 +00:00
Thomas Veerman
cb6f6a94f7 Fixes to ISOFS 2009-10-01 14:34:17 +00:00
Thomas Veerman
471ad9384f Initial import of ISOFS by Jacopo Urbani 2009-10-01 14:00:27 +00:00
Ben Gras
cee82da892 implement VAR += .. feature, contributed by Pieter Hijma 2009-10-01 11:29:08 +00:00
David van Moolenbroek
49808dcf77 PM delay call infrastructure improvements
- allow PM to tell sys_runctl() whether to use delay call feature
- only use this feature in PM for delivering signals - not for exits
- do better error checking in PM on sys_runctl() calls
- rename SIGKREADY to SIGNDELAY
2009-10-01 10:36:09 +00:00
David van Moolenbroek
f11f597777 Make message type ranges in com.h (eventually) unique 2009-10-01 10:33:01 +00:00
David van Moolenbroek
a8ebc69c6e Fix erroneous times() call in udpstat/tcpstat.
Reported by John Peace, bug #312.
Also fix times(2) man page.
2009-10-01 10:31:29 +00:00
Tomas Hruby
6539c356c6 idle_task() declared 3x in kernel/proto.h. 2 declarations removed 2009-10-01 07:59:15 +00:00
Arun Thomas
8f4ca2dc92 Increase root partition size to 64 MB. 2009-09-30 14:11:58 +00:00
Ben Gras
e326a01446 - retrieve binary packages and sources from webserver to make a release, incrementally using wget
(so wget required)
 - don't build List file again, but use webserver List file and filter it
2009-09-30 13:11:22 +00:00
Arun Thomas
782a05b919 Bump release to 3.1.5 in issue.install 2009-09-30 13:00:38 +00:00
David van Moolenbroek
b423d7b477 Merge of David's ptrace branch. Summary:
o Support for ptrace T_ATTACH/T_DETACH and T_SYSCALL
o PM signal handling logic should now work properly, even with debuggers
  being present
o Asynchronous PM/VFS protocol, full IPC support for senda(), and
  AMF_NOREPLY senda() flag

DETAILS

Process stop and delay call handling of PM:
o Added sys_runctl() kernel call with sys_stop() and sys_resume()
  aliases, for PM to stop and resume a process
o Added exception for sending/syscall-traced processes to sys_runctl(),
  and matching SIGKREADY pseudo-signal to PM
o Fixed PM signal logic to deal with requests from a process after
  stopping it (so-called "delay calls"), using the SIGKREADY facility
o Fixed various PM panics due to race conditions with delay calls versus
  VFS calls
o Removed special PRIO_STOP priority value
o Added SYS_LOCK RTS kernel flag, to stop an individual process from
  running while modifying its process structure

Signal and debugger handling in PM:
o Fixed debugger signals being dropped if a second signal arrives when
  the debugger has not retrieved the first one
o Fixed debugger signals being sent to the debugger more than once
o Fixed debugger signals unpausing process in VFS; removed PM_UNPAUSE_TR
  protocol message
o Detached debugger signals from general signal logic and from being
  blocked on VFS calls, meaning that even VFS can now be traced
o Fixed debugger being unable to receive more than one pending signal in
  one process stop
o Fixed signal delivery being delayed needlessly when multiple signals
  are pending
o Fixed wait test for tracer, which was returning for children that were
  not waited for
o Removed second parallel pending call from PM to VFS for any process
o Fixed process becoming runnable between exec() and debugger trap
o Added support for notifying the debugger before the parent when a
  debugged child exits
o Fixed debugger death causing child to remain stopped forever
o Fixed consistently incorrect use of _NSIG

Extensions to ptrace():
o Added T_ATTACH and T_DETACH ptrace request, to attach and detach a
  debugger to and from a process
o Added T_SYSCALL ptrace request, to trace system calls
o Added T_SETOPT ptrace request, to set trace options
o Added TO_TRACEFORK trace option, to attach automatically to children
  of a traced process
o Added TO_ALTEXEC trace option, to send SIGSTOP instead of SIGTRAP upon
  a successful exec() of the tracee
o Extended T_GETUSER ptrace support to allow retrieving a process's priv
  structure
o Removed T_STOP ptrace request again, as it does not help implementing
  debuggers properly
o Added MINIX3-specific ptrace test (test42)
o Added proper manual page for ptrace(2)

Asynchronous PM/VFS interface:
o Fixed asynchronous messages not being checked when receive() is called
  with an endpoint other than ANY
o Added AMF_NOREPLY senda() flag, preventing such messages from
  satisfying the receive part of a sendrec()
o Added asynsend3() that takes optional flags; asynsend() is now a
  #define passing in 0 as third parameter
o Made PM/VFS protocol asynchronous; reintroduced tell_fs()
o Made PM_BASE request/reply number range unique
o Hacked in a horrible temporary workaround into RS to deal with newly
  revealed RS-PM-VFS race condition triangle until VFS is asynchronous

System signal handling:
o Fixed shutdown logic of device drivers; removed old SIGKSTOP signal
o Removed is-superuser check from PM's do_procstat() (aka getsigset())
o Added sigset macros to allow system processes to deal with the full
  signal set, rather than just the POSIX subset

Miscellaneous PM fixes:
o Split do_getset into do_get and do_set, merging common code and making
  structure clearer
o Fixed setpriority() being able to put to sleep processes using an
  invalid parameter, or revive zombie processes
o Made find_proc() global; removed obsolete proc_from_pid()
o Cleanup here and there

Also included:
o Fixed false-positive boot order kernel warning
o Removed last traces of old NOTIFY_FROM code

THINGS OF POSSIBLE INTEREST

o It should now be possible to run PM at any priority, even lower than
  user processes
o No assumptions are made about communication speed between PM and VFS,
  although communication must be FIFO
o A debugger will now receive incoming debuggee signals at kill time
  only; the process may not yet be fully stopped
o A first step has been made towards making the SYSTEM task preemptible
2009-09-30 09:57:22 +00:00
Ben Gras
8d9aa1fe4f throw out exec debugging message. 2009-09-30 08:36:13 +00:00
Ben Gras
2c56b7eebc there is no elvis. 2009-09-30 08:21:21 +00:00
Ben Gras
5f8a77061b audio package obsolete 2009-09-30 07:41:03 +00:00
Ben Gras
bcd7d04203 throw out FIXME reminders for release 2009-09-30 07:40:34 +00:00
Tomas Hruby
40b1d58077 Mostly a revert of r5306. com.h defines MAX_NR_TASKS value which replaces
NR_TASKS in the endpoint macros. MAX_NR_TASKS defines the maximal number of
kernel tasks. It is unlikely that we will ever need this many tasks as the goal
is not to have such a difference in the future. For now it makes possible to
remove the limiting NR_TASKS from the endpoint code.
2009-09-29 20:13:41 +00:00
Tomas Hruby
4dad30937b Removed macros that depend on NOTIFY_FROM from servers and drivers. They
determine the information defined by these macros from the m_source field of the
notify message.
2009-09-29 18:47:56 +00:00
Ben Gras
0e1fd9ea33 add SDL-1.2.13 2009-09-29 14:32:49 +00:00
Ben Gras
07a5bd0fe3 sort; throw out old packages; qemu in 2009-09-29 14:31:26 +00:00
Thomas Veerman
4b02d58176 Removed debug string 2009-09-29 13:23:04 +00:00
Ben Gras
699e4345ea revert mkfs change; might run out of inodes, but large number of inodes
makes mkfs not want to mkfs large filesystems.

find optimal formula (e.g. dynamic capping of no. of inodes) later.
2009-09-29 12:14:35 +00:00
Ben Gras
0e43db1375 disable address space randomisation feature in normal mode. 2009-09-29 12:10:30 +00:00
Tomas Hruby
256610f1d5 Macros in endpoint.h need to know about endpoint_t 2009-09-28 16:25:47 +00:00
Ben Gras
da67a3af00 disable 'clever' optimisation (workaround for vmware(?) problem) 2009-09-28 15:47:01 +00:00
Ben Gras
856ec906bd assert overammbitious. 2009-09-28 01:23:11 +00:00
Ben Gras
7a45f80bd5 threw out sanity checks before pagetable rewrites, triggering false
page table inconsistencies.

fix handle_memory logic. again.
2009-09-27 12:44:36 +00:00
Ben Gras
67602ce85e field for sanity check feature. 2009-09-27 12:37:37 +00:00
Ben Gras
5715637aa2 new prototypes. 2009-09-27 12:37:16 +00:00
Ben Gras
5cf59f9225 verbose printing and sanity checking functions. 2009-09-27 12:36:48 +00:00
Ben Gras
a02d9aae0a re-enable munmap(). 2009-09-25 19:01:27 +00:00
Ben Gras
e114ae8195 unnecessarily verbose message. 2009-09-25 17:59:38 +00:00
Ben Gras
e900735ddd old reminder 2009-09-25 17:58:23 +00:00
Ben Gras
cd3e83f849 get_randomness restored. 2009-09-25 17:57:24 +00:00
Ben Gras
e64e75dbc5 also don't let user process change ss segment selector when returning from
signal.
2009-09-25 17:44:26 +00:00
Ben Gras
aa1c90fdd7 correct logic error in region.c. 2009-09-25 17:39:39 +00:00
Ben Gras
1d0854e6db pre-APPROVEd (thanks Arun) sanity check function. 2009-09-25 11:12:06 +00:00
Tomas Hruby
97fe6a4ba5 Broken pipes fix
- fix for the broken partial pipes r/w operations
2009-09-24 16:03:25 +00:00
Tomas Hruby
ab6fc64984 ps fix
It removes the no more existing marcos (XPIPE XPOPEN XDOPEN XLOCK XSELECT) and
replaces them with the new ones from servers/vfs/const.h No more dependency on
NR_TASKS macro.
2009-09-24 16:00:59 +00:00
Ben Gras
f236d1dd9c throw out the debugging stuff again. 2009-09-23 16:26:05 +00:00
Ben Gras
af77f4e964 debug output in SANITYCHECKS mode 2009-09-23 16:02:27 +00:00
Ben Gras
f87a91ce95 missing level-- in out-of-memory case. 2009-09-23 15:19:36 +00:00
Ben Gras
74616a057b temporarily disable munmap() to mask memory problem. 2009-09-23 13:34:04 +00:00
Ben Gras
4c11d7e6f5 - simplify findhole() for use for 1 page only
- do WMF_FREE
 - added WMF_VERIFY to check page table contents
 - randomize address space usage in vm self
2009-09-23 13:33:01 +00:00
Ben Gras
9e53925504 save a few lines of unnecessary output. 2009-09-23 13:27:21 +00:00
Arun Thomas
b2e3153263 Release script: Increase root ramdisk to 8KB 2009-09-23 11:07:55 +00:00
Ben Gras
0d7b967413 give sys_fork() a real endpoint_t * arg 2009-09-23 10:48:57 +00:00
Erik van der Kouwe
789c8a6ee4 Fixed compilation errors in ps.c and rs/manager.c. The former was fixed by disabling code using no-longer-existant flags and the latter by removing the spurious parameter i from sys_privctl 2009-09-23 08:46:17 +00:00
Tomas Hruby
dd0ea3aba0 NOT_REACHABLE() removed until ack will be taught to handle macros as a grownup
compiler
2009-09-23 07:25:04 +00:00
Tomas Hruby
7c10365f1b removed idt_reload()
- not part of klib386 yet
2009-09-23 07:20:57 +00:00
Tomas Hruby
f53377ed67 Removed the broken PROC_EVENT and SYN_ALARM from VFS 2009-09-22 22:11:20 +00:00
Tomas Hruby
8590ac260d Removed dependency of vfs on NR_TASKS macro
- all macros in consts.h that depend on NR_TASKS replaced by a FP_BLOCKED_ON_*

- fp_suspended removed and replaced by fp_blocked_on. Testing whether a process
  is supended is qeual to testing whether fp_blocked_on is FP_BLOCKED_ON_NONE or
  not

- fp_task is valid only if fp_blocked_on == FP_BLOCKED_ON_OTHER

- no need of special values that do not colide with valid and special endpoints
  since they are not used as endpoints anymore

- suspend only takes FP_BLOCKED_ON_* values not endpoints anymore

- suspend(task) replaced by wait_for(task) which sets fp_task so we remember who
  are we waiting for and suspend sets fp_blocked_on to FP_BLOCKED_ON_OTHER to
  signal that we are waiting for some other process

- some functions should take endpoint_t instead of int, fixed
2009-09-22 21:48:26 +00:00
Tomas Hruby
48602fcfae NOT_REACHABLE macro
- marks code path that should be unreachable (never executed)

- if hit, panics and reports the problem

- the end of main() marked as such. The SMP changes need some magic with stack
  switching before the AP can be started as they need to run on the boot stack
  before figuring out what is their own stack. As main() uses the boot stack to,
  we need to switch to to the stack of BSP before executing the last part of
  main() which needs to be in a separate function so we can jump to it.
  Therefore restart() won't be the last call in main() which may be confusing.
  The macro can/should be used in other such places too.
2009-09-22 21:46:47 +00:00
Tomas Hruby
c0a1fd1292 Removed NR_TASKS from macros manipulating endpoint_t
- the magic numbers ANY, NONE and SELF are kept for the compatibility with the
  current userspace. It is OK as long as NR_PROCS is greater so they don't
  colide with other endpoints

- the 32 bit endpoint_t value is split in half, lower 16 bits for process slot
  number and upper half for generation number

- transition to a structured endpoint_t in the future possible
2009-09-22 21:45:26 +00:00
Tomas Hruby
b900311656 endpoint_t in syslib
- headers use the endpoint_t in syslib.h and the implmentation was using int
  instead. Both uses endpoint_t now

- every variable named like proc, proc_nr or proc_nr_e of type endpoint_t has
  name proc_ep now

- endpoint_t defined as u32_t not int
2009-09-22 21:42:02 +00:00
Ben Gras
64df404150 umount before ramdisk spec to allow resizing 2009-09-22 14:01:17 +00:00
Ben Gras
6492bf0019 allow resizing of ramdisks. 2009-09-22 13:57:21 +00:00
Erik van der Kouwe
a97c9633ff Remove duplicate nanosleep stub 2009-09-22 12:05:22 +00:00
Ben Gras
0b713b0de5 unmap VR_DIRECT mappings too (fix for X) 2009-09-22 11:51:17 +00:00
Ben Gras
76a02db5e7 unused, thanks david 2009-09-21 21:00:36 +00:00
Ben Gras
c2324398f4 sha1 unused now. 2009-09-21 20:32:53 +00:00
Ben Gras
813021b56b forgot to svn add this. 2009-09-21 19:56:30 +00:00
Ben Gras
32fa22fc2d RS_LOOKUP feature for libc functions that want to access servers.
let ipc talk to all USER processes and vice versa.

pm sig wrapper notify has to be called from two files.

actually install include files.
2009-09-21 15:25:15 +00:00
Ben Gras
a5599efd9c fp might be NULL. 2009-09-21 15:23:08 +00:00
Ben Gras
a4d1b17453 ipc tests by GQ 2009-09-21 14:53:53 +00:00
Ben Gras
75d3db4911 new ipc server that implements shared memory and semaphores.
this server, tests, vm support, library stubs and other contributions
are the work of Guanqun Lu, a 2009 GSOC student.
2009-09-21 14:53:13 +00:00
Ben Gras
32fbbd370c - pages that points to page directory values of all processes,
shared with the kernel, mapped into kernel address space; 
   kernel is notified of its location. kernel segment size is
   increased to make it fit.
 - map in kernel and other processes that don't have their
   own page table using single 4MB (global) mapping.
 - new sanity check facility: objects that are allocated with
   the slab allocator are, when running with sanity checking on,
   marked readonly until they are explicitly unlocked using the USE()
   macro.
 - another sanity check facility: collect all uses of memory and
   see if they don't overlap with (a) eachother and (b) free memory
 - own munmap() and munmap_text() functions.
 - exec() recovers from out-of-memory conditions properly now; this
   solves some weird exec() behaviour
 - chew off memory from the same side of the chunk as where we
   start scanning, solving some memory fragmentation issues
 - use avl trees for freelist and phys_ranges in regions
 - implement most useful part of munmap()
 - remap() stuff is GQ's for shared memory
2009-09-21 14:49:49 +00:00
Ben Gras
f5459e38db - some exec debugging prints when errors happen
- lookup mounted_on check to avoid NULL dereference
 - some errors in exec() shouldn't be fatal
2009-09-21 14:49:26 +00:00
Ben Gras
e402927576 support for vm priv system.
fix NULL envp ptr.
2009-09-21 14:49:04 +00:00
Ben Gras
5f497bcf22 - Introduce some macros for field names, so that endpt, pendpt,
addr and taddr don't have to be defined any more, so that <sys/mman.h>
    can be included for proper prototypes of munmap() and friends.
  - rename our GETPID to MINIX_GETPID to avoid a name conflict with
    other sources
  - PM needs its own munmap() and munmap_text() to avoid sending messages
    to VM at the startup phase. It *does* want to do that, but only
    after initialising. So they're called again with unmap_ok set to 1
    later.
  - getnuid(), getngid() implementation
2009-09-21 14:48:19 +00:00
Ben Gras
a0d8cc0765 - No maximum block size any more.
- If allocation of a new buffer fails, use an already-allocated
   unused buffer if available (low memory conditions)
 - Allocate buffers dynamically, so memory isn't wasted on wrong-sized
   buffers.
 - No more _MAX_BLOCK_SIZE.
2009-09-21 14:47:51 +00:00
Ben Gras
08d291da53 no more scheduling queue dumps (kernel will print this over serial);
initial vm stats retrieve support
2009-09-21 14:47:24 +00:00
Ben Gras
90be3a051f clever hack to avoid starting from 0 disabled because
when own 0-pages are mapped out, this doesn't work and
isn't necessary.
2009-09-21 14:46:42 +00:00
Ben Gras
d6819ff659 various syscall entry points 2009-09-21 14:46:10 +00:00
Ben Gras
40411ea908 rename GETPID to MINIX_GETPID (for now); macro for field name 2009-09-21 14:45:46 +00:00
Ben Gras
76ba69151d more vm stubs 2009-09-21 14:45:09 +00:00
Ben Gras
e8b3ac74a6 ftime() 2009-09-21 14:44:35 +00:00
Ben Gras
b2adf0c1ae more pid queries; PM field macros; vm stubs 2009-09-21 14:44:00 +00:00
Ben Gras
348978e64a vm stubs; no more sys_vm_setbuf 2009-09-21 14:42:58 +00:00
Ben Gras
c9fee544b6 sysvipc dir 2009-09-21 14:42:13 +00:00
Ben Gras
da8360c0a3 change startup code to call munmap()/munmap_text() to map out
own 0-pages.
2009-09-21 14:41:47 +00:00
Ben Gras
1c217d038c new sysv ipc call stubs 2009-09-21 14:41:03 +00:00
Ben Gras
8c2bece89f - remove unused kmalloc
- initial implementation of _read_host_time_ns, a function to retrieve
   real-time in ns in vmware virtual machines
2009-09-21 14:39:15 +00:00
Ben Gras
cd8b915ed9 Primary goal for these changes is:
- no longer have kernel have its own page table that is loaded
    on every kernel entry (trap, interrupt, exception). the primary
    purpose is to reduce the number of required reloads.
Result:
  - kernel can only access memory of process that was running when
    kernel was entered
  - kernel must be mapped into every process page table, so traps to
    kernel keep working
Problem:
  - kernel must often access memory of arbitrary processes (e.g. send
    arbitrary processes messages); this can't happen directly any more;
    usually because that process' page table isn't loaded at all, sometimes
    because that memory isn't mapped in at all, sometimes because it isn't
    mapped in read-write.
So:
  - kernel must be able to map in memory of any process, in its own
    address space.
Implementation:
  - VM and kernel share a range of memory in which addresses of
    all page tables of all processes are available. This has two purposes:
      . Kernel has to know what data to copy in order to map in a range
      . Kernel has to know where to write the data in order to map it in
    That last point is because kernel has to write in the currently loaded
    page table.
  - Processes and kernel are separated through segments; kernel segments
    haven't changed.
  - The kernel keeps the process whose page table is currently loaded
    in 'ptproc.'
  - If it wants to map in a range of memory, it writes the value of the
    page directory entry for that range into the page directory entry
    in the currently loaded map. There is a slot reserved for such
    purposes. The kernel can then access this memory directly.
  - In order to do this, its segment has been increased (and the
    segments of processes start where it ends).
  - In the pagefault handler, detect if the kernel is doing
    'trappable' memory access (i.e. a pagefault isn't a fatal
     error) and if so,
       - set the saved instruction pointer to phys_copy_fault,
	 breaking out of phys_copy
       - set the saved eax register to the address of the page
	 fault, both for sanity checking and for checking in
	 which of the two ranges that phys_copy was called
	 with the fault occured
  - Some boot-time processes do not have their own page table,
    and are mapped in with the kernel, and separated with
    segments. The kernel detects this using HASPT. If such a
    process has to be scheduled, any page table will work and
    no page table switch is done.

Major changes in kernel are
  - When accessing user processes memory, kernel no longer
    explicitly checks before it does so if that memory is OK.
    It simply makes the mapping (if necessary), tries to do the
    operation, and traps the pagefault if that memory isn't present;
    if that happens, the copy function returns EFAULT.
    So all of the CHECKRANGE_OR_SUSPEND macros are gone.
  - Kernel no longer has to copy/read and parse page tables.
  - A message copying optimisation: when messages are copied, and
    the recipient isn't mapped in, they are copied into a buffer
    in the kernel. This is done in QueueMess. The next time
    the recipient is scheduled, this message is copied into
    its memory. This happens in schedcheck().
    This eliminates the mapping/copying step for messages, and makes
    it easier to deliver messages. This eliminates soft_notify.
  - Kernel no longer creates a page table at all, so the vm_setbuf
    and pagetable writing in memory.c is gone.

Minor changes in kernel are
  - ipc_stats thrown out, wasn't used
  - misc flags all renamed to MF_*
  - NOREC_* macros to enter and leave functions that should not
    be called recursively; just sanity checks really
  - code to fully decode segment selectors and descriptors
    to print on exceptions
  - lots of vmassert()s added, only executed if DEBUG_VMASSERT is 1
2009-09-21 14:31:52 +00:00
Ben Gras
f5b04e1881 minor change to panic code 2009-09-21 14:28:16 +00:00
Ben Gras
ad4fc01b7b - new entry for bios_wini and ipc
- start ipc server on botting
2009-09-21 14:26:20 +00:00
Ben Gras
89bf7bae27 - tty: only report unrecognized scancodes once; forget about
remembering the origin and cursor position as that feature didn't
   really work properly anyway
 - tty: map in video and font memory using a vm call, access it from C,
   thereby eliminating pesky weird segment calls and assembly to access it,
   and unbreaks loadfont (Roman Ignatov)
 - bios_wini: fix bios_wini by allocating a <1MB buffers for it
 - memory: preallocate ramdisk, makes it a bit faster (and doesn't
   fail halfway if you allocate a huge one)
 - floppy: use <1MB buffer
 - ramdisk proto: because of the 2x1 page reservations, binaries
   got a little fatter and didn't fit on the ramdisk any more.
   increase it.
2009-09-21 14:25:54 +00:00
Ben Gras
36e935fe0f - added 'datasizes' script that shows you the size allocated
for each symbol, usually answering those "why is does my binary have
   such a lot of BSS" questions.
 - stop binpackage looking in /var/spool for package files.
 - let makewhatis recognize .Sh as heading name
 - setup, fsck, df: allow >4kB block sizes painlessly
 - mkfs: new #-of-inodes heuristic that depends on kb, not
   on blocks; i've run out of inodes on my /usr
 - asmconv: don't silently truncate .aligns to 16 bytes
 - ipc* commands for shared memory support
2009-09-21 14:24:29 +00:00
Ben Gras
ba91b3b7d2 - remove unused bootdelay feauture
- only print a line for every boot process if 'verbose' variable set to
   nonzero; reason: with serial output, the long output
   significantly slows down frequent reboots, and causes 'scroll damage'
   that in some cases is pretty bad. also the verbose output doesn't tell
   you the one thing you might want to know about a process: how much memory
   is it using? or how much memory is everything using?
 - short format does print out total memory allocated for processes
2009-09-21 14:23:47 +00:00
Ben Gras
8a54d267f0 - VM_KERN_NOPAGEZERO feature is gone
- sys_getbiosbuffer feature is gone (from kernel; available from vm)
- bump version number because munmap() calls that newly compiled binaries
  will do trigger an ugly (but harmless) error message in older VM's
- some new VM calls and flags, the new IPC calls
- some new CR0 register bits
- added files for shared memory
2009-09-21 14:23:10 +00:00
David van Moolenbroek
0a27cf279e test31 fix 2009-09-20 18:15:24 +00:00
David van Moolenbroek
1fe1b219c9 test32 fix 2009-09-20 16:47:57 +00:00
David van Moolenbroek
f2def7d360 Kernel: correct a few SYSTEM source documentation comments 2009-09-17 20:51:34 +00:00
Tomas Hruby
db56801ddc Some clean up of the segment selectors macros
- [ABCD]_INDEX are not used anywhere

- value of *_SELECTOR is now calculated using the *_INDEX value so changing the
  index does not break the selector

- TSS is now the last of the global selectors. There will be TSS per CPU on SMP
  and the number will vary depending on the maximal supported number of CPUs
  configured
2009-09-15 10:01:06 +00:00
Tomas Hruby
71077d1228 iskernelp() and isuserp() test pointers
- we may test even not fully initialized entries, e.g. during boot
  crash

- is we know the process number we should use iskerneln
  and isusern
2009-09-15 09:58:46 +00:00
Tomas Hruby
78793f4f38 pproc_addr unused and removed 2009-09-15 09:57:54 +00:00
Tomas Hruby
4fd433694f proc_addr() returns address based on location in proc array
- pproc_addr is not neccessary to get the address of a process if we know its
  number

- local proc variables in system calls implementation (sys_task) conflicts with
  the global proc array of all process, therefore the variable were renamed to
  proc_nr as they hold the process number
2009-09-15 09:57:22 +00:00
Erik van der Kouwe
3615d93383 Handle SIGSTOP more consistently and according to POSIX rules; it can no longer be ignored 2009-09-13 12:24:23 +00:00
David van Moolenbroek
ba83b7663d PM: some tiny fixes 2009-09-12 18:36:07 +00:00
David van Moolenbroek
c72487dc9f remove unused NEW_KSIG definition 2009-09-07 22:12:50 +00:00
David van Moolenbroek
e538509508 Kernel: remove unused CHECK_DEADLOCK definition 2009-09-07 20:23:31 +00:00
David van Moolenbroek
18ae423990 it's/its 2009-09-06 17:13:08 +00:00
David van Moolenbroek
9c19233879 Kernel: do_[sv]devio.c header corrections 2009-09-06 15:54:15 +00:00
David van Moolenbroek
8ef6c9b063 cleanup: sys_irqrmpolicy does not need IRQ vector 2009-09-06 14:24:44 +00:00
David van Moolenbroek
9b417d616f remove unused IRQ_ENDPT definition 2009-09-06 14:14:03 +00:00
David van Moolenbroek
979bcfc195 - sys_privctl: don't mix message types
- sys_privctl: remove CTL_MM_PRIV (third parameter)
- remove obsolete sys_svrctl.c library file
2009-09-06 12:37:13 +00:00
David van Moolenbroek
32b2758ba8 syslib: make sys_nice use field aliases 2009-09-05 12:51:00 +00:00
Erik van der Kouwe
f92e0dafb5 Disabled check in test 28 which hard links a directory; this is nott required by POSIX and not supported (currently) by MINIX. Also corrected total number of tests. 2009-09-04 20:23:25 +00:00
Erik van der Kouwe
141e5531ad Now all tests except for 28 succeed in root mode 2009-09-04 14:14:49 +00:00
Erik van der Kouwe
9dda815067 Remove redundant line from previous patch 2009-09-04 13:36:43 +00:00
Erik van der Kouwe
e1e4d6649f Allow setuid tests 11 and 33 to run. The former still fails (but now with a meaningful error) while the latter succeeds. Only 2 tests are left borken on default MINIX, namely 11 and 28. 2009-09-04 13:18:49 +00:00
Erik van der Kouwe
ec4b567894 Avoid alarm to prevent the setitimer interval from being reset 2009-09-03 20:35:22 +00:00
Thomas Veerman
360dc9104c - Added netconf script which makes it a lot easier to change network settings.
- Modified the setup script to use the netconf script for the network
   configuration:
    - Moved step 2 to step 8 and renamed the steps in between.
    - Autopart adapted to print step 3 instead of step 4.
2009-09-03 09:38:27 +00:00
David van Moolenbroek
8aeb17c75e typo 2009-09-02 21:55:26 +00:00
Ben Gras
3d3e12f50f postgresql services entry. 2009-09-02 13:23:22 +00:00
David van Moolenbroek
7e9e0ce9bc FXP: support for 8086/1064 (reported and tested by Jose Luis Sanchez) 2009-08-30 16:13:46 +00:00
David van Moolenbroek
a57fbb11cd Fix time(1) for custom system HZ values (reported by Jose Luis Sanchez 2009-08-30 16:06:59 +00:00
Tomas Hruby
2e293ce7c0 system_init() renamed to arch_init()
- a better name for architecture specific init function

- some of x86 init code must execute in protected mode

- prot_init() removed from this function and still called in cstart() Imho this
  should be called from the architecture specific assembly not cstart. cstart
  perform Minix monitor specific tasks and will be touched once another
  bootloader is in use, e.g. booting via tftp, therefore we keep it as is for
  now.

- this is a backport from the SMP code which requires this. Merging will be simpler
2009-08-30 14:55:30 +00:00
Tomas Hruby
b1aaee6dcc Printing the trap info even if kernel crashes is handy. 2009-08-29 19:38:11 +00:00
Tomas Hruby
50473107c2 saved_proc in exception() may be NULL
If an exception happens in kernel while the kernel is booting and no processes
are running yet, saved_proc == NULL and priting any process related information
results in dumping rubish.

This check is mostly useful when debugging kernel stuff. Should _never_ happen
on a production kernel.
2009-08-29 19:26:46 +00:00
David van Moolenbroek
42f0bf7dda VFS: fetch_name() buffer underflow (reported by John Peace, bug #305) 2009-08-29 08:22:50 +00:00
Tomas Hruby
4903a734b8 IDT is initialized in idt_init() not in prot_init()
This is a backport form the SMP branch. Not required here, it only makes life
for SMP easier. And future merging too.

- filling the IDT is removed from prot_init()

- struct gate_table_s is a public type

- gate_table_pic is a global array as it is used by APIC code too

- idt_copy_vectors() is also global and used by idt_init() as well as
  apic_idt_init()

- idt_init() is called right after prot_init() in system_init()
2009-08-28 15:55:30 +00:00
Erik van der Kouwe
1162806940 Re-disable complete_bars, it was not needed for PRO/100 despite the error message 2009-08-27 07:10:03 +00:00
Erik van der Kouwe
ada4859302 Extend Intel PRO/100 support 2009-08-26 21:01:46 +00:00
David van Moolenbroek
d84472dfc8 urlget: broken ftpget call, reported by Charles Littlefield 2009-08-23 13:53:03 +00:00
David van Moolenbroek
47e6506d7b support for TCP sockets in send/sendto/recv/recvfrom 2009-08-21 09:59:09 +00:00
Erik van der Kouwe
5cdd995dc5 Use su to allow tests 3, 6, 17, 18, 19, 21 and 25 to work as root, making testing easier 2009-08-18 19:58:34 +00:00
Erik van der Kouwe
192c0be4a8 Fix HUGE_VAL warnings 2009-08-18 19:10:48 +00:00
Erik van der Kouwe
d81563a9b1 Fix HUGE_VAL warnings 2009-08-18 19:10:20 +00:00
Tomas Hruby
f3e0c5c381 VFS quits gracefully if mount fails and mounted_on remains uninitialized 2009-08-18 13:30:05 +00:00
Thomas Veerman
b47483433c Added a hack to start binaries from the boot image only. In particular, setting
bin_img=1 in the boot monitor will make sure that during the boot procedure the
mfs binary that is part of the boot image is the only binary that is used to
mount partitions. This is useful when for some reason the mfs binary on disk 
malfunctions, rendering Minix unable to boot. By setting bin_img=1, the binary
on disk is ignored and the binary in the boot image is used instead.

- 'service' now accepts an additional flag -r. -r implies -c. -r instructs RS
  to first look in memory if the binary has already been copied to memory and
  execute that version, instead of loading the binary from disk. For example,
  the first time a MFS is being started it is copied (-c) to memory and
  executed from there. The second time MFS is being started this way, RS will
  look in memory for a previously copied MFS binary and reuse it if it exists.
- The mount and newroot commands now accept an additional flag -i, which
  instructs them to set the MS_REUSE flag in the mount flags.
- The mount system call now supports the MS_REUSE flag and invokes 'service'
  with the -r flag when MS_REUSE is set.
- /etc/rc and the rc script that's included in the boot image check for the
  existence of the bin_img flag in the boot monitor, and invoke mount and 
  newroot with the -i flag accordingly.
2009-08-18 11:36:01 +00:00
David van Moolenbroek
47a2bfeddd small errno.h corrections 2009-08-18 09:26:51 +00:00
Erik van der Kouwe
5490ef1083 Fixed some warnings 2009-08-17 18:49:15 +00:00
Erik van der Kouwe
fdf47c1046 Fixed some warnings 2009-08-17 18:49:07 +00:00
Erik van der Kouwe
b3ab0cb03a Fixed some warnings 2009-08-17 18:48:57 +00:00
Erik van der Kouwe
fcbb7ac780 Fixed some warnings 2009-08-17 18:48:27 +00:00
Erik van der Kouwe
2d7dfd1a46 Fix warning in panic 2009-08-17 17:56:34 +00:00
Tomas Hruby
bd2dd15cc6 Missing defines preventing recursive includesion in some include/sys/*.h files 2009-08-17 14:34:14 +00:00
Erik van der Kouwe
d1b4c5be5b Removed obsolete declarations in include/ipc.h 2009-08-16 15:12:07 +00:00
Erik van der Kouwe
f5421e64f8 Nanosleep was implemented twice, removed from _sleep.c 2009-08-16 12:55:59 +00:00
Erik van der Kouwe
3573bc1abe Function nanosleep now checks arguments 2009-08-16 12:13:33 +00:00
Erik van der Kouwe
83b84cbe64 Man page for new function nanosleep(3), updated man page for sleep(3) 2009-08-16 12:12:40 +00:00
David van Moolenbroek
247e1e8fa8 man page fix: sigaction.2 signals list 2009-08-15 23:27:32 +00:00
David van Moolenbroek
769a0cdb35 PM: make SIGBUS, but not SIGUSR1 or SIGUSR2, cause a core dump 2009-08-15 23:23:24 +00:00
David van Moolenbroek
ff6318d559 run test 41, too (oops) 2009-08-15 22:31:38 +00:00
David van Moolenbroek
5a13b2eda8 nanosleep(3), and sleep(3) rewrite, by Erik van der Kouwe 2009-08-15 22:14:48 +00:00
David van Moolenbroek
323f0abdd6 Support for setitimer(ITIMER_VIRTUAL/ITIMER_PROF). New test (41) for setitimer. 2009-08-15 21:37:26 +00:00
David van Moolenbroek
d82e260a90 Support for setitimer(ITIMER_REAL). 2009-08-15 16:09:32 +00:00
David van Moolenbroek
062bb2c1e8 fix test14's "clever" (broken) filename generation 2009-08-15 15:13:57 +00:00
David van Moolenbroek
4db12454e9 awk: support for whitespace between array name and bracket 2009-08-15 12:05:41 +00:00
David van Moolenbroek
708929bc32 awk: support for ENVIRON 2009-08-15 11:34:41 +00:00
Tomas Hruby
88f7b63019 u64_t for human beings - the high and low parts are named hi and lo, lib/sysutil/profile.c updated accordingly 2009-08-13 15:47:49 +00:00
David van Moolenbroek
aae63b5410 move _mount.c from lib/posix to lib/other 2009-08-13 09:55:50 +00:00
Thomas Veerman
f50d94b793 Fixed compilation issue. 2009-08-13 09:02:43 +00:00
Thomas Veerman
c2ffe723d1 - Moved (u)mount prototypes from unistd.h to sys/mount.h.
- Prepared mount system call to accept multiple mount flags
   instead of just read_only (however, it remains backwards
   compatible).
 - Updated the man mount(2) to reflect new header file usage. 
 - Updated badblocks, newroot, mount, and umount commands to use the
   new header file.
2009-08-12 19:57:37 +00:00
David van Moolenbroek
1defc4fc3a compile and install mdb(1) by default again 2009-08-11 09:08:33 +00:00
Tomas Hruby
09a47e6a40 vm_assert macros fix up 2009-08-11 07:53:32 +00:00
Arun Thomas
b8eedfee6b Lance cleanup 2009-07-22 12:36:19 +00:00
Thomas Veerman
df41717f44 Fixed case error 2009-07-22 08:59:57 +00:00
David van Moolenbroek
5a370afc8e MFS put_inode issues (reported by Maurizio Lombardi) 2009-07-22 08:54:28 +00:00
Arun Thomas
0be5720af1 Fix VirtualBox Lance bug; ec_reinit should be called only once. 2009-07-21 13:13:45 +00:00
Thomas Veerman
70d25344a2 Added select test 2009-07-14 09:43:33 +00:00
Thomas Veerman
ce916bcb91 Fixed a minor select bug:
- When one does a select on a file descriptor that is meaningless for that particular file type, select shall indicate that the file descriptor is ready for that particular operation and that the file descriptor has no exceptional condition pending.
2009-07-14 09:39:05 +00:00
David van Moolenbroek
b21beea985 IS: fix up PM flags field somewhat 2009-07-12 15:30:59 +00:00
David van Moolenbroek
1d0e43c8f1 make remove(3) remove directories as well 2009-07-12 14:44:37 +00:00
David van Moolenbroek
f80aaae86a MFS: remove some redundant code (reported by Maurizio Lombardi) 2009-07-12 13:57:34 +00:00
David van Moolenbroek
013241a006 RS: the plural of 'child' is 'children' 2009-07-11 17:59:05 +00:00
David van Moolenbroek
cf89d27218 make unstack work on gcc-compiled binaries 2009-07-11 17:55:24 +00:00
David van Moolenbroek
9e075d8623 PM cleanup: remove unused fields from mproc structure 2009-07-11 17:15:33 +00:00
David van Moolenbroek
1a9e07b0e5 PM: fix ptrace(T_EXIT) 'exit_proc: not idle' race condition. 2009-07-11 13:22:56 +00:00
David van Moolenbroek
14f3a0e018 PM: add clarifying comment about exiting system processes early (thanks Philip) 2009-07-11 11:19:39 +00:00
David van Moolenbroek
9808816c14 MFS fixes:
- Don't dereference NULL dir inode in advance_* (reported by Maurizio Lombardi)
- Fix potential inode reference leak in fs_slink_*
2009-07-11 10:36:57 +00:00
David van Moolenbroek
73c5bbf1a3 PM: add EXITING process flag as stopgap between starting coredump and setting ZOMBIE flag 2009-07-09 22:33:56 +00:00
David van Moolenbroek
1450a8ac6d let IS call getuptime() 2009-07-09 20:54:35 +00:00
David van Moolenbroek
f15d1fb13d Fix race condition in test 25 2009-07-09 11:44:35 +00:00
David van Moolenbroek
693a6652ca PM cleanup: remove obsolete HAS_DMA flag 2009-07-08 20:08:46 +00:00
David van Moolenbroek
67d986f882 PM cleanup: merge exit and coredump paths 2009-07-08 17:16:53 +00:00
David van Moolenbroek
5e173f55f5 Remove leftover PowerPC cruft. Reported by Evgeniy Ivanov. 2009-07-07 18:55:11 +00:00
David van Moolenbroek
12451e6b06 Miscellaneous PM fixes:
o Don't call vm_willexit() more than once upon normal process exit
o Correct two cases of indenting of the no-discussion-possible kind
o Perform slightly stricter ptrace(2) checks:
  - process calling ptrace must be target process's parent
  - process must call wait/waitpid before using ptrace on stopped child
  - no ptrace on zombies
o Allow user processes to use ptrace(T_STOP) to stop an active child
2009-07-05 22:48:18 +00:00
David van Moolenbroek
b8b8f537bd IPC privileges fixes
Kernel:
o Remove s_ipc_sendrec, instead using s_ipc_to for all send primitives
o Centralize s_ipc_to bit manipulation,
  - disallowing assignment of bits pointing to unused priv structs;
  - preventing send-to-self by not setting bit for own priv struct;
  - preserving send mask matrix symmetry in all cases
o Add IPC send mask checks to SENDA, which were missing entirely somehow
o Slightly improve IPC stats accounting for SENDA
o Remove SYSTEM from user processes' send mask
o Half-fix the dependency between boot image order and process numbers,
  - correcting the table order of the boot processes;
  - documenting the order requirement needed for proper send masks;
  - warning at boot time if the order is violated

RS:
o Add support in /etc/drivers.conf for servers that talk to user processes,
  - disallowing IPC to user processes if no "ipc" field is present
  - adding a special "USER" label to explicitly allow IPC to user processes
o Always apply IPC masks when specified; remove -i flag from service(8)
o Use kernel send mask symmetry to delay adding IPC permissions for labels
  that do not exist yet, adding them to that label's process upon creation
o Add VM to ipc permissions list for rtl8139 and fxp in drivers.conf

Left to future fixes:
o Removal of the table order vs process numbers dependency altogether,
  possibly using per-process send list structures as used for SYSTEM calls
o Proper assignment of send masks to boot processes;
  some of the assigned (~0) masks are much wider than necessary
o Proper assignment of IPC send masks for many more servers in drivers.conf
o Removal of the debugging warning about the now legitimate case where RS's
  add_forward_ipc cannot find the IPC destination's label yet
2009-07-02 16:25:31 +00:00
David van Moolenbroek
aa84986819 more small man page fixes 2009-06-25 10:41:55 +00:00
David van Moolenbroek
be9606a4e0 random man page update: cut.1 2009-06-24 21:13:28 +00:00
David van Moolenbroek
3018cd023a random man page fix: cawf.1 2009-06-24 11:42:05 +00:00
David van Moolenbroek
951581a29c fix installation of home directories in setup.sh 2009-06-23 13:40:32 +00:00
Arun Thomas
dacc0644c8 Restore last(1) and uptime(1) building/installing. 2009-06-23 12:22:35 +00:00
David van Moolenbroek
d8b9bf642b make mdb(1) compile again 2009-06-17 14:59:22 +00:00
David van Moolenbroek
66d1f1260c remove last traces of FSDEVMAP svrctl 2009-06-13 13:09:14 +00:00
David van Moolenbroek
87beb9c469 better solution for poweroff(8) 2009-06-12 13:17:33 +00:00
David van Moolenbroek
12a01e8f01 poweroff(8) aesthetics 2009-06-12 13:13:29 +00:00
David van Moolenbroek
24bb7fbb4c added poweroff(8) 2009-06-12 13:02:51 +00:00
Arun Thomas
86d89ed3f1 ls(1) manpage corrections
-Add missing '-n' option to synopsis.
-MINIX 3 does support symbolic links now.

Thanks to River Tarnell for the patch.
2009-05-30 11:01:17 +00:00
Arun Thomas
a415b68523 Release.sh now uses packages.install and package_sources.install to
determine which packages and package sources to include on the
installation media, as opposed to including everything in the
PACKAGEDIR AND PACKAGESOURCEDIR directories.
2009-05-30 09:31:19 +00:00
Arun Thomas
dac531addf Support for VMWare Workstation 6.x
VMWare Workstation 6.x would previously die when running MINIX 3 with an
IOSPACE assertion and several error messages about multiply registered
I/O ports. The assertion is triggered when we probe for BAR sizes in
record_bar(). The solution: The PCI driver now disables I/O and mem
access before probing for BAR sizes.

Bumped up NR_PCIDEV and NR_PCIBUS, since Workstation 6.x virtualizes
more PCI buses and devices.
2009-05-27 23:35:34 +00:00
Arun Thomas
745f99bb1d Update issue.install for 3.1.4 2009-05-27 12:42:32 +00:00
David van Moolenbroek
83885ebc39 make lseek64 return correct new position 2009-05-23 13:47:17 +00:00
David van Moolenbroek
00a2463d71 update readlink(2) manpage accordingly 2009-05-20 11:49:10 +00:00
David van Moolenbroek
9797d17d54 move symlink type check for readlink() into VFS, and return the right POSIX error 2009-05-20 09:46:06 +00:00
David van Moolenbroek
50b77e3529 VFS consistency: use I_PIPE/NO_PIPE when checking v_pipe 2009-05-19 14:34:44 +00:00
Ben Gras
8ee3d26722 don't include /usr/src changes in packages. 2009-05-19 10:55:15 +00:00
Ben Gras
fe39483dc9 4MB mask 2009-05-18 15:56:13 +00:00
Ben Gras
f86da99e67 map in kernel in 4MB, global-bit-set 'pages' if hardware
supports it. helps performance.

broken use of region data structure for kernel mapping to be fixed.
2009-05-18 15:34:42 +00:00
David van Moolenbroek
f76d75a5ec Various VFS and MFS fixes to improve correctness, consistency and
POSIX compliance.

VFS changes:
* truncate() on a file system mounted read-only no longer panics MFS.
* ftruncate() and fcntl(F_FREESP) now check for write permission on
  the file descriptor instead of the file, write().
* utime(), chown() and fchown() now check for file system read-only
  status.

MFS changes:
* link() and rename() no longer return the internal EENTERMOUNT and
  ELEAVEMOUNT errors to the application as part of a check on the
  source path.
* rename() now treats EENTERMOUNT from the destination path check as
  an error, preventing file system corruption from renaming a normal
  directory to an existing mountpoint directory.
* mountpoints (mounted-on dirs) are hidden better during lookups:
  - if a lookup starts from a mountpoint, the first component has to
    be ".." (anything else being a VFS-FS protocol violation).
  - in that case, the permissions of the mountpoint are not checked.
  - in all other cases, visiting a mountpoint always results in
    EENTERMOUNT.
* a lookup on ".." from a mount root or chroot(2) root no longer
  succeeds if the caller does not have search permission on that
  directory.
* POSIX: getdents() now updates directory access times.
* POSIX: readlink() now returns partial results instead of ERANGE.

Miscellaneous changes:
* semaphore file handling bug (leading to hangs) fixed in test 32.

The VFS changes should now put the burden of checking for read-only
status of file systems entirely on VFS, and limit the access
permission checks that file systems have to perform, to checking
search permission on directories during lookups. From this point on,
any deviation from that spceification should be considered a bug.
Note that for legacy reasons, the root partition is assumed to be
mounted read-write.
2009-05-18 11:27:12 +00:00
Ben Gras
bdab3c4cfb Library call for cpu features; make kernel and vm use this to query cpu
features (specifically: 4MB pages and TLB global bit).  Only enable
these features in CR4 if available. 4MB pages to be used in the near
future.
2009-05-15 17:07:36 +00:00
Ben Gras
d0b6e76bfb correct the revision variable used in /etc/version 2009-05-15 13:02:23 +00:00
Arun Thomas
d749b3b965 -Remove qemu_pci boot variable. Useres no longer need to set qemu_pci when
booting MINIX under QEMU/KVM.
-Kept the diagnostic message, however.
2009-05-14 19:07:37 +00:00
Ben Gras
143422fa0a C CPUID interface. 2009-05-14 15:55:28 +00:00
Arun Thomas
db4faccbf9 -Installation info is on the wiki now, so remove setup guides and update
README.
-Remove obsolete FAT partitioning utility.
-Update startup banner.
2009-05-14 15:54:02 +00:00
David van Moolenbroek
c2aef85eda Clear trace bit for child on fork.
Without this, a forking single-stepped process will have its child
die from a TRAP signal right away.
2009-05-13 21:58:10 +00:00
David van Moolenbroek
fe8c612aa4 support in 'mount' for specifying file system type and options 2009-05-13 15:39:44 +00:00
David van Moolenbroek
3affa4c796 'service' null pointer dereference fix 2009-05-12 16:52:00 +00:00
Ben Gras
dd56aa321f to let tty run with its own page table (instead of with the kernel identity
map table), make it map in video memory.

sadly, this breaks tty in non-paged mode.

happily, this simplifies the code by throwing out the messing
around with segments, and throws out vidcopy.s.
2009-05-12 12:43:18 +00:00
Ben Gras
909c1bb8a7 don't bother with unmapping physical memory in non-sanitycheck mode. 2009-05-12 11:51:53 +00:00
Ben Gras
581e68433a basic sparepage optimisation
some simplification of linear/virtual address translation
(less hardcoding and more use of arch_*2* functions)
2009-05-12 11:38:29 +00:00
Ben Gras
f9e81cb57b remove bogus arch_map2vir calls 2009-05-12 11:36:15 +00:00
Ben Gras
6fad23f500 don't call this function with a bogus addr (done by region.c print code) 2009-05-12 11:35:49 +00:00
Ben Gras
e3ca89c0be more sanity checking. sanity checking disabled by default.
give every process a full pagetable by default now.

first step to disabling kernel page table code (processes
might not have page tables -> no address translation).
2009-05-12 11:35:01 +00:00
Ben Gras
ebe050dbe2 large page size constant. 2009-05-12 09:23:27 +00:00
Ben Gras
d2caeb6146 start all processes, including VM, in VM_PROCSTART in linear address space,
to make space for kernel to be able to map in things below there.
2009-05-11 19:11:37 +00:00
Ben Gras
ade4c03b73 Don't build arch objs more than once. 2009-05-11 19:05:45 +00:00
Ben Gras
7c88767f75 remove debug msg 2009-05-11 11:57:20 +00:00
David van Moolenbroek
9a01c828c8 VFS-FS error codes: better safe than sorry 2009-05-11 11:30:04 +00:00
David van Moolenbroek
0ac1aaccca Limited support for nested FS->VFS requests during VFS->FS call.
- Changed VFS-FS protocol to only store OK or negative error code in
  m_type field of reply messages.
- Changed VFS to treat nonzero positive replies from FS as requests.
- Added backwards compatibility to VFS and MFS.
No protection of global data structures is provided in VFS, so many
VFS calls cannot be made safely by FS servers during many FS calls.
Use with caution (or, preferably, not at all).
2009-05-11 10:02:28 +00:00
David van Moolenbroek
dcfaf50f79 wrong field index in at_wini env_parse call 2009-05-10 16:58:23 +00:00
David van Moolenbroek
a2485b346c potential buffer overruns in env_* routines 2009-05-10 16:54:37 +00:00
David van Moolenbroek
e08b38a5c4 regression fix: vfs lookup passes incorrect chroot information after crossing mountpoints 2009-05-09 17:53:22 +00:00
David van Moolenbroek
021808b12a fix for commands that try to include mfs constants from vfs 2009-05-08 20:37:06 +00:00
David van Moolenbroek
293be6b80b quick cleanup of old mfs cruft from vfs 2009-05-08 14:12:41 +00:00
Ben Gras
dc1238b7b9 make unpause() decrease susp_count, as it shouldn't be decreased
if the process was REVIVING. (susp_count doesn't count those
 processes.) this together with dev_io SELECT suspend side effect
 for asynch. character devices solves the hanging pipe bug. or
 at last vastly improves it.

 added sanity checks, turned off by default.

 made the {NOT_,}{SUSPENDING,REVIVING} constants weirder to
 help sanity checking.
2009-05-08 13:56:41 +00:00
David van Moolenbroek
113b1ec5f3 remove unused global variable from vfs 2009-05-08 13:54:01 +00:00
Ben Gras
ece26e2731 don't suspend the process as a side-effect if
device returns SUSPEND if it's select; select already
does this.
2009-05-08 13:50:29 +00:00
David van Moolenbroek
2a48c4ad48 Reenable RS table dump from IS (Shift+F6) 2009-05-08 12:38:14 +00:00
David van Moolenbroek
e9e347f5b6 Fix for large transfer operations not advancing buffer address
offset when DMA transfer unit is smaller than given buffer size.
Bug tracker item #82.
2009-05-08 12:29:57 +00:00
David van Moolenbroek
4af032bbfe Kernel interrupt hook management fixes:
- properly assign unique hook IDs
- after hook removal, remove hook-specific interrupt disable flag
2009-05-07 14:52:07 +00:00
Ben Gras
a38287067a disable scary looking debug messages. 2009-05-07 09:58:16 +00:00
Ben Gras
746e138036 turn off scary looking debug messages. 2009-05-07 09:57:43 +00:00
Ben Gras
8b72765e39 ignore errors of pipe read (can happen with shutdown now,
now that all fd's are closed neatly in vfs), change messaging
in unexpected restarts
2009-05-06 15:38:32 +00:00
Ben Gras
fd7ef243e4 cleanup of vfs shutdown logic; makes clean unmounts easier (but
needs checking if fp_wd or fp_rd is NULL before use)
2009-04-29 16:59:18 +00:00
Ben Gras
b7e23b70e8 - delete unused .h files
- slight code cleanup
 - neater exit procedure: exit when unmount
   message received and kill signal (from RS 'down' or
   reboot/shutdown) received (speed up unmount, but don't
   confuse VFS by exiting before/during unmount msg)
2009-04-27 16:13:51 +00:00
Ben Gras
bb23344283 spurious debug 2009-04-27 16:11:38 +00:00
Ben Gras
02f047d008 lose -s flag for umount. 2009-04-27 14:23:57 +00:00
Ben Gras
a12113e476 process restarts are pretty rare/serious. 2009-04-27 14:07:47 +00:00
Ben Gras
4593eaec24 minor fixes to install script - allow 8kB blocksize (necessary for
large filesystems)
2009-04-27 12:59:49 +00:00
Ben Gras
60e7602aad When we receive a PROC_EVENT message from PM, exit nicely; avoids
annoying graceful RS timeout on unmount.
2009-04-27 12:02:31 +00:00
Ben Gras
e5209d51f1 bad dma fallback to pio mode 2009-04-27 11:53:11 +00:00
Ben Gras
3b3e3b36c2 some more vm bits. 2009-04-23 15:21:03 +00:00
Ben Gras
ef8a741301 set global flag for kernel pages, so tlb entries for kernel aren't thrown
away on cr3 reload. minor optimization.
2009-04-23 15:11:16 +00:00
Arun Thomas
e9e1ae1cfc Move queue.h to include/sys so that it can be used elsewhere. Pull in
FreeBSD's r179210 queue.h.
2009-04-22 20:02:39 +00:00
Arun Thomas
f149733e16 Disable IOMMU warnings. 2009-04-22 16:53:46 +00:00
Arun Thomas
3b37103fa3 Make the rtl8139 and orinoco drivers handle the system shutdown case
like other drivers. Also, some minor cleanups.
2009-04-22 12:42:37 +00:00
Ben Gras
2dd02cc560 mark pages whose refcount were >1 and drop to 1 and are
read/write writable in the pagetable right away instead of waiting for
a pagefault. minor optimization.

some a sanity check of SLAB-allocated pointers.

vm gets its own _exit and __exit like PM, so the stock (library) panic works.
2009-04-22 12:39:29 +00:00
Ben Gras
e0f3a5acf1 - enable ipc warnings by default
- ipc checking code in kernel didn't properly catch the
   sendrec() to self case; added special case check
 - triggered by PM using stock panic() - needs its own _exit()

reported by Joren l'Ami.
2009-04-17 13:46:37 +00:00
Ben Gras
e5717f7aef clarify not found error message a bit. 2009-04-14 14:16:24 +00:00
Ben Gras
4cd6875d05 don't flush output for SIGWINCH. found by Joren l'Ami. 2009-04-06 09:39:42 +00:00
Ben Gras
65a9f0253b unnecessary debugging message 2009-04-02 16:43:35 +00:00
Ben Gras
9647fbc94e moved type and constants for random data to include file;
added consistency check in random; added source of randomness
internal to random using timing; only retrieve random bins that are full.
2009-04-02 15:24:44 +00:00
Ben Gras
51596bc608 print who the message is from. 2009-04-02 11:56:50 +00:00
Ben Gras
73ee8b8b99 don't make susp_count negative. 2009-04-02 11:44:26 +00:00
Ben Gras
b560a36b20 trace fix contributed by Joren l'Ami 2009-04-02 11:38:23 +00:00
Ben Gras
dc9a1bc30c increment nph when printing physical regions; suggested by Guanqun Lu 2009-03-31 14:26:24 +00:00
Ben Gras
45d54cf1b0 change DmaMode checks from DEV_WRITE to DEV_WRITE_S 2009-03-31 14:23:33 +00:00
Arun Thomas
9e7837f63c Tweak 64-bit integer type declarations; Fixes GCC sysutil build
breakage.
2009-03-30 17:07:39 +00:00
Ben Gras
3bb80322d9 suppress more mostly-harmless messages. 2009-03-26 16:11:27 +00:00
Ben Gras
2d1c884e35 suppress these noisy, alarming messages. 2009-03-26 15:56:08 +00:00
Ben Gras
cd2d85c13d no 'small minix' option 2009-03-26 15:54:09 +00:00
Ben Gras
f56316a168 don't need to explicitly enable lance any more. 2009-03-26 15:23:07 +00:00
Ben Gras
cf8c4cc851 ignore linmem.
don't disable the driver by default.
2009-03-26 15:22:08 +00:00
Ben Gras
4e2291fff2 SizeMB isn't used any more. 2009-03-26 13:19:14 +00:00
Ben Gras
ec50fa00c7 don't execute hlt in real mode.
workaround for getting minix under qemu kvm.
Ameya, ape800 at few.vu.nl.
2009-03-24 16:08:10 +00:00
Ben Gras
fc11209417 more inodes than default for /usr on cd. 2009-03-24 15:41:51 +00:00
Ben Gras
46d28c6ffb workaround for qemu writing the configuration byte on the AUX port pre-0.10. 2009-03-24 15:41:18 +00:00
Ben Gras
d8d63f0e07 make USRMB settable 2009-03-19 14:14:57 +00:00
Ben Gras
e5079dfc02 multiple ram disks; also make release process use this
so temporary partitions aren't needed any more.
2009-03-19 13:48:19 +00:00
Arun Thomas
347fa61675 Increase ARG_MAX 2009-03-17 07:38:35 +00:00
Arun Thomas
5eb353ebbc Update setup's NIC selection dialog 2009-03-06 17:45:22 +00:00
Arun Thomas
7ce582c783 Define 64 bit integer types when compiling with GCC 2009-03-06 16:56:46 +00:00
Ben Gras
8af5f877bc 2009-03-04 17:44:34 +00:00
Ben Gras
3f6e061948 fix error check 2009-03-04 17:38:27 +00:00
Ben Gras
a742aed5ad only assign value if request went ok. 2009-02-19 17:14:36 +00:00
Ben Gras
cd37a0299c Check for firstdatazone overflow. 2009-02-17 13:01:25 +00:00
Ben Gras
733d6c1ef6 help debugging cause of these sometimes odd calls. 2009-02-17 12:09:59 +00:00
Ben Gras
570b9cd753 Checking wrong inode pointer for refcount in mount (!) 2009-02-17 09:50:02 +00:00
Ben Gras
379be7f0fb A serial ata pci card we have. 2009-02-16 13:20:10 +00:00
Ben Gras
1f3dd53283 We don't install the bzip2 manual, much less four copies of it, and
it's quite big.
2009-02-16 10:01:22 +00:00
Ben Gras
01f1132eac let at_wini see ata raid controllers 2009-02-12 12:28:28 +00:00
Ben Gras
59e972f074 let drivers allocate memory at 64k physical boundary. 2009-02-12 12:26:08 +00:00
Ben Gras
6ac0338584 Don't declare the cprof buf if CPROFILE isn't on. 2009-02-06 16:31:28 +00:00
Ben Gras
b696823379 stingy stack. 2009-02-06 16:29:00 +00:00
Ben Gras
95ff97d4fb readclock easily runs out of stack with so little of it. 2009-02-06 16:28:35 +00:00
Ben Gras
eafd4730ea check for devices that would need more blocks than 32
bits allow..
2009-02-05 16:30:20 +00:00
Ben Gras
6e86e6706d fix compiler warning; missing memory range check 2009-02-05 13:00:03 +00:00
Ben Gras
bb18be5d06 simplified the code a little, corrected some hasty statements. 2009-02-04 17:30:01 +00:00
Ben Gras
6a0e8e3b80 Added a separate keymap for escaped scancodes. This makes the code
a little cleaner (escaped scancodes are less of a special case) and
lets us be completely flexible when assigning meaning to them.

Future: a tool and ioctl to load the escaped keymap.
2009-02-04 17:04:16 +00:00
Ben Gras
ba4687e519 the escaped keymap is usually the same as the original. 2009-02-04 16:55:30 +00:00
Ben Gras
113932905f disable interrupts if necessary in kernel debug code to dump all process
stacks.
2009-01-29 15:13:54 +00:00
Ben Gras
80f5eea8b8 If serial debugging in the boot monitor / kernel is enabled, don't touch
the serial line in use for it (mostly so that input isn't eaten by tty).
2009-01-29 15:06:40 +00:00
Ben Gras
d0a2e6b2f4 use library panic, doesn't need its own any more. 2009-01-29 14:41:44 +00:00
Ben Gras
c628f24bc2 moved stacktrace to sysctl, as vmctl is very privileged so can't
be used outside VM. IS code cleanup. added stacktrace feature to IS.
2009-01-27 12:54:33 +00:00
Ben Gras
3cc092ff06 . new kernel call sysctl for generic unprivileged system operations;
now used for printing diagnostic messages through the kernel message
   buffer. this lets processes print diagnostics without sending messages
   to tty and log directly, simplifying the message protocol a lot and
   reducing difficulties with deadlocks and other situations in which
   diagnostics are blackholed (e.g. grants don't work). this makes
   DIAGNOSTICS(_S), ASYN_DIAGNOSTICS and DIAG_REPL obsolete, although tty
   and log still accept the codes for 'old' binaries. This also simplifies
   diagnostics in several servers and drivers - only tty needs its own
   kputc() now.
 . simplifications in vfs, and some effort to get the vnode references
   right (consistent) even during shutdown. m_mounted_on is now NULL
   for root filesystems (!) (the original and new root), a less awkward
   special case than 'm_mounted_on == m_root_node'. root now has exactly
   one reference, to root, if no files are open, just like all other
   filesystems. m_driver_e is unused.
2009-01-26 17:43:59 +00:00
Ben Gras
4984a86f32 don't hang on disappearing filesystem. 2009-01-26 13:02:41 +00:00
Ben Gras
b784e88026 prototype 2009-01-22 17:09:45 +00:00
Ben Gras
539192f4c3 must be unsigned for base+limit check to to work 2009-01-22 13:05:20 +00:00
Ben Gras
36c12c1251 package list sanity check 2009-01-20 15:49:42 +00:00
Ben Gras
0f41416100 minor cleanup, extra check 2009-01-20 15:47:00 +00:00
Ben Gras
723a756c14 reduce kernel buffer size. 2009-01-20 13:57:24 +00:00
Ben Gras
86e7e4828e sanity check function 2009-01-20 13:43:18 +00:00
Ben Gras
45ec30f6af mostly harmless sanity checks. 2009-01-20 13:43:00 +00:00
Ben Gras
6a267baeb8 simplification suggested by Mark Farnsworth 2009-01-15 14:42:40 +00:00
Ben Gras
36909196cf make bootinfo valid immediately 2009-01-14 08:56:20 +00:00
Ben Gras
4f08002c2c RS needs a bit more memory 2009-01-14 08:55:48 +00:00
Ben Gras
ef2867de41 don't print if we're already printing to serial. 2009-01-14 08:54:17 +00:00
Ben Gras
b4934f0e12 debug twiddle. 2009-01-14 08:52:50 +00:00
Ben Gras
b450c33377 sometime this will be a new release. 2009-01-14 08:38:37 +00:00
Ben Gras
5cbcc11ed3 compile fix for new lock timings 2009-01-12 22:14:43 +00:00
Ben Gras
3ca00a926c don't produce kernel output if serial debug is on. 2009-01-11 23:47:03 +00:00
Ben Gras
d5f978411e use #include name for servarname 2009-01-11 23:45:29 +00:00
Ben Gras
037f39767c debug msg 2009-01-09 21:47:04 +00:00
Ben Gras
cd54beeb30 cprofile not conditional 2009-01-09 21:45:27 +00:00
Ben Gras
c27008fbcc cprofile not conditional 2009-01-09 21:44:52 +00:00
Ben Gras
e190ff9f84 cprofile always on 2009-01-09 21:42:36 +00:00
Ben Gras
b82588848d cprofile always on; data type and definitions to include file 2009-01-09 21:40:29 +00:00
Ben Gras
628ed99101 CPROFILE wants this 2009-01-09 21:11:23 +00:00
Ben Gras
22d9444773 don't always time that 2009-01-09 20:58:35 +00:00
Ben Gras
7d48584659 profbuf syscall 2009-01-09 17:47:38 +00:00
Ben Gras
ad87da99d3 bigger ramdisk for bigger binaries 2009-01-09 17:47:18 +00:00
Ben Gras
7606dc5f1f profiling reminder 2009-01-09 16:44:47 +00:00
Ben Gras
ad03a650e6 timing library from kernel into library 2009-01-09 16:39:31 +00:00
Ben Gras
7740d0379c no longer in kernel 2009-01-09 16:35:25 +00:00
Ben Gras
128a0508c0 timing measurement code out of kernel and into library
(so other components can use it too)
2009-01-09 16:15:15 +00:00
Ben Gras
54b3f50b05 actually build and install zoneinfo. 2008-12-21 04:33:50 +00:00
Ben Gras
1943df25dd forget about bad block testing. 2008-12-21 04:26:41 +00:00
Ben Gras
523fdf2729 stopgap measure against elvis going nuts when files that are too large
are opened.
2008-12-21 04:01:01 +00:00
Ben Gras
0579810535 don't ignore the fact that scancodes are escaped.
if not understood explicitly, print diagnostic and 
ignore scancode.
2008-12-21 03:53:25 +00:00
Ben Gras
23a158b361 don't check senda() buffer if size is 0. 2008-12-21 03:46:42 +00:00
Ben Gras
203eb54a4c make space for first code and data pages if so configured. 2008-12-19 15:46:29 +00:00
Ben Gras
d2757d4b73 debug buffer slightly usabler. 2008-12-19 15:19:42 +00:00
Ben Gras
866a4a667e phys addr arg of 0 must be possible for pt_writemap too (instead of meaning
unmap).
2008-12-19 13:29:12 +00:00
Ben Gras
b740ff055f if serial output is enabled in the boot monitor, on the first serial line,
enable serial debug output in the kernel too.
2008-12-19 13:21:42 +00:00
Ben Gras
7fdc181d5f /boot/boot install helper script. 2008-12-19 12:52:45 +00:00
Ben Gras
8072ef5509 oops, shouldn't be on in svn. 2008-12-18 17:42:29 +00:00
Ben Gras
3121eec6bd . map text (kernel's and processes') in readonly
. map kernel in non-user
 . don't map in first pages of kernel code and data
   if possible

these first pages could actually be freed but as the
kernel isn't allowed to touch them either we can't reuse
them until VM has totally taken over page table management
and kernel doesn't rely on identity mapping any more.
2008-12-18 15:35:22 +00:00
Ben Gras
f0000078c3 make kernel leave a page-sized gap in its code and data to not be
mapped in if so configured.
2008-12-18 14:30:55 +00:00
Ben Gras
834d9d34e8 Initialize deferred field. This seems to fix a hanging select() bug. 2008-12-17 14:20:08 +00:00
Ben Gras
2528a06954 bugfix for lance. works in vmware now. 2008-12-17 01:20:15 +00:00
Ben Gras
34d5401ed4 put put_vnode() back where it belongs! 2008-12-16 16:11:24 +00:00
Ben Gras
46ecfa2b5c syslib function for VMCTL_STACKTRACE 2008-12-16 14:42:32 +00:00
Ben Gras
710f44c4b8 added code for debugging pagefaults 2008-12-16 14:33:53 +00:00
Ben Gras
4be5b6f437 2008-12-16 14:32:56 +00:00
Ben Gras
a306c63e0b 2008-12-15 15:16:26 +00:00
Ben Gras
8beff61807 get fproc table. don't print size as that doesn't say much in VM mode.
this restores ps.
2008-12-15 13:05:52 +00:00
Ben Gras
e4e3995fb0 don't force vm to print to serial; don't kill processes when they
have 'bad' memory ranges (as it's the requestor's fault)
2008-12-11 17:36:33 +00:00
Ben Gras
ef812af5a6 use VM functions to allocate ramdisk on demand. some unification in code. 2008-12-11 17:33:13 +00:00
Ben Gras
73e3431dfd DEV_BOOT is obsolete. 2008-12-11 16:50:11 +00:00
Ben Gras
0cd26cd1c0 DEV_BOOT is obsolete. 2008-12-11 16:50:01 +00:00
Ben Gras
6009642110 for compatability with older images. 2008-12-11 15:50:33 +00:00
Ben Gras
5db1a042c2 stacktrace feature. 2008-12-11 15:33:43 +00:00
Ben Gras
6300c26921 prototype fix 2008-12-11 15:02:44 +00:00
Ben Gras
fe3e0181d4 straggler. 2008-12-11 14:55:06 +00:00
Ben Gras
70f1f28439 dynamic HZ, library stacktrace 2008-12-11 14:54:42 +00:00
Ben Gras
b6b361a474 rc script needs to open its own stdin, stdout and stderr 2008-12-11 14:50:56 +00:00
Ben Gras
011de3ac49 everyone needs GETINFO for HZ 2008-12-11 14:50:28 +00:00
Ben Gras
2024bf0bcf . no more HZ
. let user processes query HZ
 . no more custom panic()
2008-12-11 14:49:17 +00:00
Ben Gras
ccf70aa989 system_hz replaces HZ 2008-12-11 14:48:05 +00:00
Ben Gras
7d674f4b8e no more HZ; less debugging statements 2008-12-11 14:47:48 +00:00
Ben Gras
b9a0d46ea9 debug out 2008-12-11 14:46:46 +00:00
Ben Gras
3287b7f7d8 don't hang old binaries 2008-12-11 14:45:49 +00:00
Ben Gras
5e1bb6eb63 added some code to debug why filesystems won't unmount 2008-12-11 14:45:31 +00:00
Ben Gras
e96f86ed8c throw out debugging code. 2008-12-11 14:44:10 +00:00
Ben Gras
eeba8ef01f No more HZ. 2008-12-11 14:43:53 +00:00
Ben Gras
e9f0c576a3 Open stdin, stdout and stderr only after /etc/rc has executed. (/etc/rc
executes it itself.) This avoids keeping /dev nodes on the temporary
root filesystem (initial mfs) in use unnecessarily.
2008-12-11 14:43:25 +00:00
Ben Gras
1d8aed840c . no more HZ, but use sys_hz() to get that value
. memory maps in physical memory (for /dev/mem) with new vm interface
 . pci complete_bars() seems to be buggy behaviour sometimes
 . startup script opens its own stdout, stderr and stdin so init doesn't
   have to do it
2008-12-11 14:42:23 +00:00
Ben Gras
6cfe4bdd2d slight args change 2008-12-11 14:37:42 +00:00
Ben Gras
991000dd70 dynamic HZ 2008-12-11 14:37:18 +00:00
Ben Gras
eae27c899a move senda to sep. file 2008-12-11 14:37:02 +00:00
Ben Gras
3e29947e28 No more HZ; move stacktrace() to library 2008-12-11 14:36:37 +00:00
Ben Gras
825dfb0282 introduce Hz variable that is what used to be the HZ constant.
default 60Hz of course.
2008-12-11 14:33:33 +00:00
Ben Gras
4c1ac39678 Changes so the HZ constant isn't needed any more. 2008-12-11 14:27:18 +00:00
Ben Gras
37a9ce7275 I want to see /dev/imgrd so I can unmount it when it's free. 2008-12-11 14:26:50 +00:00
Ben Gras
5aea2817bc syslogd needs a bit more stack. 2008-12-11 14:26:27 +00:00
Ben Gras
9d096e014b . print kernel stacktrace unconditionally on panic
. provide a panic() in the kernel for if a library function wants to panic
2008-12-11 14:23:58 +00:00
Ben Gras
b61687fb1b . VM needs a higher priority than VFS, PM etc
. introduce FULLVM flag: MEMORY and the initial MFS
   get their own full address spaces, making their stacks
   and heaps not preallocated (well, freed after VM has
   initialized it) and letting them allocate more dynamically.
   MEMORY in particular needs this to map in physical memory
   using its own page table, without having to allocate.
2008-12-11 14:21:47 +00:00
Ben Gras
034b5c6042 PM_PROC_NR shouldn't be hardcoded as the caller. 2008-12-11 14:18:51 +00:00
Ben Gras
66b161238d function to increase process stack (pointer). used by VM to set up large,
sparse, non-preallocated heap and stack.
2008-12-11 14:17:45 +00:00
Ben Gras
e911d44a5c system image processes with full address space are allowed to have pagefaults. 2008-12-11 14:16:40 +00:00
Ben Gras
c4fb567bd5 . replace HZ by runtime system_hz (sysenv variable 'hz')
. new flag PROC_FULLVM in table indicating process wants full address
   space (this is then created and managed by VM)
2008-12-11 14:15:23 +00:00
Ben Gras
afef5e0711 . some flags to <minix/const.h>
. add system_hz for runtime HZ value
2008-12-11 14:12:52 +00:00
Ben Gras
dd9e9c74cd vm map request - ioctl to /dev/video 2008-12-11 14:11:59 +00:00
Ben Gras
3f30c3a0ee add va_copy() 2008-12-11 14:10:56 +00:00
Ben Gras
9bbee4f1ce 2008-12-11 14:10:37 +00:00
Ben Gras
e75e231abc VMCTL_INCSP to increase process stack pointer.
(Used to change the virtual address of the stack before a process has
started executing.)
2008-12-11 14:10:17 +00:00
Ben Gras
682b9a872e . ser_putc() goes to library
. another cmd for getinfo - obtaining current HZ value
2008-12-11 14:09:38 +00:00
Ben Gras
ef5b6f8cdf . HZ no longer constant, but settable at boot time; default is DEFAULT_HZ (60)
. some kernel flags to <minix/const.h>
2008-12-11 14:08:53 +00:00
Ben Gras
a74132ec69 fix race condition that can trigger 'enqueue already ready process' panic. 2008-12-11 13:42:37 +00:00
Ben Gras
567f2f0ba0 umap fix 2008-12-08 17:06:38 +00:00
Ben Gras
68d0c4defe - code shared with exec() letting boot-time processes have
their own fully fledged virtual address space and freeing
   their pre-allocated heap+stack area (necessary to let memory
   driver map in arbitrary areas of memory for /dev/mem without
   sys_vm_map)
 - small optimization preallocating memory on exec
 - finished VR_DIRECT physical mapping code
2008-12-08 16:43:20 +00:00
Ben Gras
f4d0d635fd - hz dynamic
- new map /dev/video implementation
 - ser_putc into library
2008-12-08 16:40:29 +00:00
Ben Gras
fe56202038 floppy must be able to allocate a bit more for nonpaged mode. 2008-11-19 17:31:42 +00:00
Ben Gras
9b33056d2b make allocmem accept and return values in bytes, ramdisk expects this. 2008-11-19 15:40:17 +00:00
Ben Gras
51fdce1d36 minor fixes 2008-11-19 14:10:33 +00:00
Ben Gras
6c92081a5a paged mode is default. 2008-11-19 13:19:37 +00:00
Ben Gras
16e14559e6 include libraries. 2008-11-19 13:15:35 +00:00
Ben Gras
7b3d952a77 lingering file 2008-11-19 12:38:31 +00:00
Ben Gras
b686e8b6d7 lingering file. 2008-11-19 12:35:46 +00:00
Ben Gras
c078ec0331 Basic VM and other minor improvements.
Not complete, probably not fully debugged or optimized.
2008-11-19 12:26:10 +00:00
Philip Homburg
c888305e21 Reverted accidental change to stat.c. 2008-10-02 14:11:12 +00:00
Philip Homburg
005bc7a649 Some changes that were missing from the previous commit 2008-10-02 13:48:05 +00:00
Philip Homburg
5b5b54c76c Minix 3 version 2008-10-02 13:45:46 +00:00
Philip Homburg
659ab96c1f Unmodified source of the software fault injection utility 2008-10-02 13:43:32 +00:00
Ben Gras
58f428a704 throw out two time consuming tests 2008-10-01 15:09:33 +00:00
David van Moolenbroek
e8b863702a Added lance entry to drivers.conf. 2008-07-22 15:11:01 +00:00
David van Moolenbroek
f73b541952 Backport of fix from asynchvfs branch for PM-LOG-VFS-PM deadlock that resulted in VFS panics. 2008-06-24 13:53:03 +00:00
Ben Gras
39aa2e6489 A glob() implementation. 2008-04-08 13:14:33 +00:00
Ben Gras
d939a9c54b Use $PAGER if set. Suggested by gigabo at gmail.com. 2008-04-08 12:34:35 +00:00
Philip Homburg
4696d74480 Select support for eth by Erik van der Kouwe. 2008-03-12 14:10:21 +00:00
Philip Homburg
60c1131b94 SYS_MAPDMAx -> SYS_MAPDMA, added IOMMU_MAP 2008-02-25 14:39:19 +00:00
Philip Homburg
9d41dbc55e Build libdriver_asyn for target image 2008-02-25 14:38:09 +00:00
Philip Homburg
9d62f56ea1 SYS_MAPDMAx -> SYS_MAPDMA. 2008-02-25 14:36:28 +00:00
Philip Homburg
f82a1c4df7 Fixed include files. 2008-02-25 14:35:54 +00:00
Philip Homburg
a508e0a03c _function, function -> call_nr 2008-02-25 14:35:11 +00:00
Philip Homburg
822fcd368d Added O_REOPEN, better error handling. 2008-02-25 12:13:30 +00:00
Philip Homburg
41efa40ad2 Added XDOPEN. 2008-02-25 12:12:07 +00:00
Philip Homburg
9d176133ee Added libdriver_asyn and amddev 2008-02-25 12:07:48 +00:00
Philip Homburg
4474166403 Driver for AMD's DEV. 2008-02-25 12:07:19 +00:00
Philip Homburg
a51dbad054 Asynchrnous character device interface. 2008-02-25 11:54:04 +00:00
Philip Homburg
65df875abb Need separate 'prev_next' pointers for kernel and TTY. 2008-02-25 11:53:37 +00:00
Philip Homburg
830b79f0d5 Link random number genertor with libdriver_asyn 2008-02-25 10:25:43 +00:00
Philip Homburg
bc125e3e1c Copy of libdriver for asynch interface to character drivers. Has to be cleaned
up.
2008-02-25 10:24:46 +00:00
Philip Homburg
404325b193 Support for I/O MMU. 2008-02-25 10:19:29 +00:00
Philip Homburg
668515afe2 More heap for fxp, support for I/O MMU. 2008-02-25 10:12:09 +00:00
Philip Homburg
54f714e59e Respond to RS ping request, asynch interface, register with I/O MMU. 2008-02-25 10:02:24 +00:00
Philip Homburg
00ef93d6a2 Use nonblocking sends to reply, fixed reply message for DIAGNOSTICS(_S) 2008-02-22 16:03:00 +00:00
Philip Homburg
e3d4c74393 Functions that check arguments and return a status code and functions that
don't.
2008-02-22 15:59:12 +00:00
Philip Homburg
fecd153c2c Declare and call functions that check arguments and return a status code. 2008-02-22 15:56:12 +00:00
Philip Homburg
8a07b7687a Use nonblocking send to reply. 2008-02-22 15:52:13 +00:00
Philip Homburg
bc7e3c02a3 Asynchronous select implementation. 2008-02-22 15:46:59 +00:00
Philip Homburg
ff7eae2ad8 Private copy of kputc to support asynch communication with log device. 2008-02-22 15:43:33 +00:00
Philip Homburg
2ec762c60c Asynchronous communication with character specials. 2008-02-22 15:41:07 +00:00
Philip Homburg
d9a9b727e2 Added dmap_async_driver and dmap_sel_filp fields. Support for asynch character
drivers (needs cleaning up).
2008-02-22 15:01:00 +00:00
Philip Homburg
9df94c5ee8 Use dev_t instead of Dev_t in structures. 2008-02-22 14:54:00 +00:00
Philip Homburg
097d8fee66 Use nonblocking send for reply. Support for asynchronous message passing
(needs cleaning up).
2008-02-22 14:53:02 +00:00
Philip Homburg
66c930ef8b Higher NCALLS requires bigger table. New calls are in PM. 2008-02-22 14:51:38 +00:00
Philip Homburg
93ff4c327f Added XDOPEN. 2008-02-22 14:50:41 +00:00
Philip Homburg
9388a27070 Support for O_REOPEN flag and pass the filp numbet to dev_open. 2008-02-22 14:49:02 +00:00
Philip Homburg
7387449b23 Support for suspending on character device open and on drivers that need to
be restarted.
2008-02-22 14:47:40 +00:00
Philip Homburg
ca91b3b5be New fp_flags. Currently used to signal that is process should be suspended
a driver is restarted.
2008-02-22 14:32:23 +00:00
Philip Homburg
6ef71b8198 Pass suspend_reopen flag to dev_io. 2008-02-22 14:26:41 +00:00
Philip Homburg
047cc090e4 Added filp_state for driver recovery and filp_select_flags to store select
state for character specials that use asynch I/O.
2008-02-22 14:19:23 +00:00
Philip Homburg
1d7d5aa629 dev_close needs the filp number for asynch I/O, dev_io gets suspend_reopen
flag to suspend a process until the filedescriptor is re-opened. Added 
dev_reopen, asyn_io, suspended_ep, reopen_reply, asynsend, diag_repl, 
close_filp, close_reply, unpause, select_reply1, select_reply2.
2008-02-22 14:03:14 +00:00
Philip Homburg
e5df351245 Support for blocking open on char specials (due to asynch message passing),
asynch. close, added close_filp function.
2008-02-22 13:57:11 +00:00
Philip Homburg
73ea967b6c Keep track of error statistics, rate limit debug output, added SYS_MAPDMA. 2008-02-22 12:38:22 +00:00
Philip Homburg
992edfd558 Keep track of various statistics related to IPC and SYSTEM. 2008-02-22 12:36:46 +00:00
Philip Homburg
5996d1de58 Added do_mapdma. 2008-02-22 12:25:59 +00:00
Philip Homburg
f6872f8323 Added ipc_stats_target. 2008-02-22 12:25:44 +00:00
Philip Homburg
4a86b1fea5 Changes to debug output, mostly rate limiting. 2008-02-22 11:00:06 +00:00
Philip Homburg
3c2e122d6d Disabled code to set ipc_stats_target. 2008-02-22 10:58:27 +00:00
Philip Homburg
2679321ba0 Added do_mapdma. 2008-02-22 10:51:37 +00:00
Philip Homburg
594035f13c More verbose (optional) debug output for exceptions. 2008-02-22 10:43:18 +00:00
Philip Homburg
f5389ecf19 Code to dump IPC statistics over a serial line. (Disabled) code to disable the
FPU.
2008-02-22 10:40:38 +00:00
Philip Homburg
1cffa69d2c Support for I/O MMU: do not re-use a memory segment until the I/O MMU has
removed it from its map.
2008-02-21 16:33:34 +00:00
Philip Homburg
75520b7403 ipc restrictions for some drivers and I/O MMU (amddev) 2008-02-21 16:24:35 +00:00
Philip Homburg
3f23bca404 Removed defines not needed by mfs (XPIPE, XLOCK, XPOPEN, XSELECT, DUP_MASK). 2008-02-21 16:22:36 +00:00
Philip Homburg
ca8291c815 Support for restricting limiting IPC to a set of endpoints. Not enabled by
default, pass -i to service. Do not reply to bogus request types. Reply using
sendnb.
2008-02-21 16:20:22 +00:00
Philip Homburg
19db2b646e Removed superfluous argument. 2008-02-21 16:09:58 +00:00
Philip Homburg
d9858cfabf Removed some debug output. 2008-02-21 16:08:08 +00:00
Philip Homburg
4951a741b0 adddma/deldma/getdma/sys_mapdma 2008-02-21 16:02:22 +00:00
Philip Homburg
959ed5a191 Added ERESTART 2008-02-21 16:00:39 +00:00
Philip Homburg
07c258a9c7 Added adddma/deldma/getdma. 2008-02-21 15:58:55 +00:00
Philip Homburg
e674f1a54f Added ERESTART. 2008-02-21 15:58:26 +00:00
Philip Homburg
3b3fc8a9c4 Added O_REOPEN. 2008-02-21 15:58:06 +00:00
Philip Homburg
82cb46af0a Changes for asynchronous interface to character specials.
Removed DEV_SEL_WATCH. Added SYS_MAPDMAx. New message type (DIAG_REPL) for
replies to DIAGNOSTICS(_S).
2008-02-21 15:57:35 +00:00
Philip Homburg
698df384c3 Extra calls to PM for I/O MMUs. 2008-02-21 15:51:27 +00:00
Philip Homburg
cb2b7ada63 Nonblocking send. 2008-02-21 15:50:09 +00:00
Philip Homburg
fc4593fb42 List of service/driver names that are allowed as IPC endpoints for a new
driver/service.
2008-02-21 15:49:44 +00:00
Philip Homburg
124a128736 Defines for AMD I/O MMU 2008-02-21 15:47:11 +00:00
Ben Gras
2c45324c47 keymap contributed by Roman Ignatov. 2008-02-06 15:16:50 +00:00
Ben Gras
2876d5c4ba Optimization in searching for new zones to allocate contributed
by Jens de Smit.
2008-02-06 15:05:57 +00:00
Ben Gras
cd89066f9a Trust $PATH. 2007-12-19 10:51:21 +00:00
Ben Gras
b250847120 Makefile for audio drivers. 2007-12-19 10:37:29 +00:00
Ben Gras
8e727c97ce always re-enable irq, so devices sharing this irq don't go deaf
as IRQ_REENABLE isn't specified.
2007-12-14 12:44:20 +00:00
Ben Gras
50fa859819 A rint() implementation. 2007-12-14 11:59:54 +00:00
Ben Gras
bd489b6c0b Original imported versions of s_rint.c and math_private.h. 2007-12-11 12:32:26 +00:00
Ben Gras
3f2230eee5 add M_SQRT1_2 (1/sqrt(2)) 2007-12-11 10:59:02 +00:00
Ben Gras
e39af6d1ff yearly fsck increase. 2007-12-11 10:51:35 +00:00
Ben Gras
45744bff41 Connect new audio drivers to build. 2007-11-23 11:53:33 +00:00
Ben Gras
b79b305ba1 More es1371 bij Pieter Hijma. 2007-11-23 11:52:34 +00:00
Ben Gras
c67a56708e es1370 driver and updated es1371 and framework by Pieter Hijma. 2007-11-23 11:40:33 +00:00
Ben Gras
0d2d8c6db2 audio drivers. (not updated for trunk.)
sb16: port of isa sb16 driver to user-space. Port by Peter Boonstoppel.
es1371: By Laurens Bronwasser.
2007-11-23 11:30:50 +00:00
Ben Gras
1327804478 MFS doesn't need sys_exit(). 2007-10-23 14:24:41 +00:00
Ben Gras
67d1b67805 exit prototype 2007-10-23 14:19:16 +00:00
Ben Gras
e8aec69c7b tweak to panic functions of mfs and vfs.
. print newline
  . when recursive panic detected, don't simply return, confusing
    the caller, but print a diagnostic and exit
  . don't call sys_exit as this may confuse PM; it should be OK
    to call PM exit() nowadays.
2007-10-23 14:17:51 +00:00
Ben Gras
515e8216e1 Basic entry for dpeth suggested by Jens de Smit. 2007-10-17 11:02:33 +00:00
Ben Gras
0ae1ff99b8 Fix for DL_STAT_REPLY/DL_TASK_REPLY
Bug found and fixed by Jens de Smit <jfdsmit at few.vu.nl>.
2007-10-17 10:53:47 +00:00
Ben Gras
23f6e478df Fixed a glitch introduced in safe i/o conversion. 2007-10-17 10:50:18 +00:00
Ben Gras
21ae963cf1 Fixes two wrong grant return checks and one 'grant leak'. 2007-10-17 10:46:20 +00:00
Ben Gras
af591d2151 Internally, floppy driver still used vircopies ('unsafe' copies), but
this isn't allowed in its drivers.conf entry. Changed these to memcpy()
calls.  Bug reported by Maurizio Lombardi in comp.os.minix.
2007-10-16 14:31:35 +00:00
Ben Gras
b6e07e1835 close device if mount fails after device opened. 2007-09-26 15:06:41 +00:00
Philip Homburg
b74b3315a3 Added PF_UNIX and PF_INET to make porting easier. 2007-09-17 11:35:44 +00:00
Philip Homburg
af678531aa Disabled some debug output in recvfrom. 2007-09-17 11:22:06 +00:00
Ben Gras
38604e4e3a Don't truncate read requests based on v_size; v_size can be stale in the
case of directories extended by subfilesystem. Rely on subfilesystem to
do read size truncating and return actual i/o size. This fixes bug 81 in
gforge, and unbreaks test 23.
2007-09-11 15:52:22 +00:00
Ben Gras
007bb33c7d Make test 17 use dir 17 2007-09-11 14:56:48 +00:00
Ben Gras
ff9f4dd59c fix for i/o data/addr pair set macro's. 2007-09-11 11:22:29 +00:00
Philip Homburg
ab3062c8c0 REQ_FSTATFS now operates on the root inode (the inode parameter has been
removed)
2007-08-17 11:20:59 +00:00
Philip Homburg
9c3f85d14f Better interface for sys_times. 2007-08-16 13:16:26 +00:00
Philip Homburg
341270673b mfs no longer needs access to VIRCOPY, Added rs.inet. Start inet with
rs.inet as the restart script.
2007-08-15 12:56:35 +00:00
Philip Homburg
4b1cd8c0ec Return EIO if a filedescriptor cannot be re-opened after a driver restart.
Select now returns such a filedescriptor as ready (instead of EBADF). 
Reply before dev_up in FSSIGNON to avoid the problem that a DEV_OPEN
request is received by a driver that expects a reply from the FSSIGNON.
2007-08-15 12:53:52 +00:00
Philip Homburg
c26de9f435 Close UDP socket after error. 2007-08-15 12:50:24 +00:00
Philip Homburg
90fde6e97d cleanup 2007-08-10 13:02:39 +00:00
Philip Homburg
06e1f0da61 Better recovery when req_readsuper fails. 2007-08-10 13:01:38 +00:00
Philip Homburg
57c6f099f2 Removed old debug code. 2007-08-08 15:27:07 +00:00
Philip Homburg
e2f06e7c89 Directory check before access check. 2007-08-08 15:26:47 +00:00
Philip Homburg
a116b3aa55 To return the right error, check first is an object is a directory (for
mkdir, rmdir/unlink, mknod), simply pipe code by using v_pipe_rd_pos and
v_pipe_wr_pos directly. Some cleanup work in open.c
2007-08-08 14:01:36 +00:00
Philip Homburg
c2bf536a55 Disable POSIX-required behavior wrt trailing slashes. 2007-08-08 11:40:47 +00:00
Philip Homburg
d232b2ef42 Removed invalid consistency check. 2007-08-07 14:27:19 +00:00
Philip Homburg
9c51f0b92a O_EXCL check went missing. 2007-08-07 14:26:56 +00:00
Philip Homburg
d01d630727 include "../vfs/dmap.h". 2007-08-07 13:26:25 +00:00
Philip Homburg
1b883a3613 Removed references to stacktrace. 2007-08-07 13:21:55 +00:00
Philip Homburg
a318cd291f Somehow request.c got garbled. 2007-08-07 13:12:27 +00:00
Philip Homburg
f46319037b New VFS interface 2007-08-07 12:52:47 +00:00
Philip Homburg
2ca2b86a3a Added new interface to VFS. 2007-08-07 12:38:35 +00:00
Philip Homburg
a81e82b3da Tell the kernel about the new boottime and don't tell VFS.
Tell DS about all processes in the boot image. PM_STIME is removed.
Diagnostic for calls to do_getprocnr (DS should be used to get endpoints).
2007-08-07 12:28:42 +00:00
Philip Homburg
fd151245e9 Removed sigaction call. PM tries to talk to DS. DS should not talk to PM. 2007-08-07 12:25:21 +00:00
Philip Homburg
1f04287b3f Removed dmap table. Publish endpoint in DS before calling mapdriver5. 2007-08-07 12:24:06 +00:00
Philip Homburg
6ef2e9b866 Added global variable boottime, prototype for do_stime, and table entry for
SYS_STIME.
2007-08-07 12:21:40 +00:00
Philip Homburg
fab77fd01f Added do_stime.c, return boot time in do_times.c 2007-08-07 12:20:31 +00:00
Philip Homburg
4f787035ea Removed check for grants that wrap. 2007-08-07 12:19:45 +00:00
Philip Homburg
2519a7cb61 Added getuptime2.c 2007-08-07 12:14:04 +00:00
Philip Homburg
5aa84fb0e6 Added mapdriver5.s. 2007-08-07 12:05:36 +00:00
Philip Homburg
21e7edb683 Added sys_stime.c, T_CHILD_UTIME and T_CHILD_STIME are gone, should
change interface of sys_times.
2007-08-07 12:04:29 +00:00
Philip Homburg
1f02168ce7 Added _mapdriver5.c. 2007-08-07 12:02:38 +00:00
Philip Homburg
4d2f56daf6 Added prototype for mapdriver5 (from RS to VFS, report the name of a driver
instead of its endpoint).
2007-08-07 11:59:02 +00:00
Philip Homburg
6b0db0d181 Many changes to the VFS/FS interface. 2007-08-07 11:58:03 +00:00
Philip Homburg
d9166df3f7 Added FS_READY (from vfsif.h), and MAPDRIVER (from RS to VFS) 2007-08-07 11:57:33 +00:00
Philip Homburg
23fd914307 New message type 9: 5 longs, 3 shorts, and 2 chars. 2007-08-07 11:56:28 +00:00
Philip Homburg
498728bdbe New call SYS_STIME, restructured fields for SYS_TIMES, removed PM_STIME,
added VFS_BASE.
2007-08-07 11:55:28 +00:00
Philip Homburg
fc0d7995e9 Some parts of dmap can be private (to vfs) 2007-08-07 11:53:41 +00:00
Philip Homburg
bf6620d285 Added prototypes for sys_stime and getuptime2 (tell the kernel about the
boot time and return the boot time together with the uptime)
2007-08-07 11:52:15 +00:00
Philip Homburg
2a58d1dc58 Constants for symlink loops 2007-08-07 11:43:49 +00:00
Philip Homburg
1d4afb3599 Compile-time option to duplicate console output to the first serial line 2007-08-07 11:27:03 +00:00
Philip Homburg
acfaea0fa2 More space on ramdisk 2007-08-07 11:22:35 +00:00
Philip Homburg
f352a3fb15 Print the value of a capability as well. 2007-08-07 11:21:57 +00:00
Ben Gras
a80365f407 . add checks to printer driver kernel calls
. correct some i/o locations for printer in drivers.conf
2007-08-06 11:17:08 +00:00
Ben Gras
03446f5554 micro_delay in sysutil, used in ti1225, dp8390, fxp and
orinoco now. Uses a combination of tickdelay (where possible) and
calibrated busywait (where necessary).
2007-07-31 15:01:49 +00:00
Ben Gras
2dc2db4ba1 'fix' crlf style 2007-07-24 14:49:39 +00:00
Ben Gras
816f5dd550 a driver for wireless pci cards with the Prism chipset from Intersil
Original version, by Stevens Le Blond and Michael Valkering.
2007-07-24 14:49:09 +00:00
Ben Gras
e2932a1180 . remove small image (doesn't fit)
. edparams line a bit more readable
 . use image built in build tree, not regular source tree
2007-07-17 14:36:42 +00:00
Ben Gras
cd4756933a Typo reported by Johnathan Gurley. 2007-07-17 11:40:02 +00:00
Ben Gras
30ba1ec187 also allow vm_map. 2007-07-11 13:45:06 +00:00
Ben Gras
eb4609c108 Don't exit when rebooting. 2007-07-11 13:44:45 +00:00
Ben Gras
d524b0b351 Don't quit (some processes want to talk to pci at reboot time) 2007-07-11 13:44:00 +00:00
Ben Gras
ee3e40516b . clarify panic messages in syslib about pci
. use ds_retrieve_u32 instead of _pm_findproc
2007-07-11 13:38:13 +00:00
Ben Gras
c829928cf1 Give arp and install the default amount of memory - otherwise they run
out of memory in extreme cases.
2007-07-11 13:36:31 +00:00
Ben Gras
2746a5a2a9 Reported by Erik van der Kouwe <vdkouwe at cs.vu.nl>:
-  fprintf(stderr, "%s: reboot(): %s\n", strerror(errno));
+  fprintf(stderr, "%s: reboot(): %s\n", prog, strerror(errno));
  
Other minor fixes inspired by other warnings produced by gcc.
2007-07-02 11:16:27 +00:00
Ben Gras
ad93329236 Assume bios parameters are wrong/missing if any of the parameters are 0. 2007-05-30 16:13:52 +00:00
Ben Gras
ed920a691d include 'printer' driver 2007-05-30 15:40:12 +00:00
Ben Gras
b918f61820 Boot monitor flag that enables 'sticky right-alt', permanent change
to col selected from the keymap untill right-alt is pressed again.

Sticky alt code and russian keymap contributed by Roman Ignatov
and Yaroslav Schekin.
2007-05-16 13:14:37 +00:00
Ben Gras
b6cd5d0351 Include fonts blobs in src repository. 2007-05-16 13:00:43 +00:00
Ben Gras
b00f287449 Restore user-owned bits from PSW after a signal handler, instead of
copying complete PSW after signal handler.

This fixes a psw corruption bug reported by Jens de Smit <jst260@few.vu.nl>.
2007-05-08 15:43:00 +00:00
Philip Homburg
56a68dc32b Hack in service to use RS_START instead of RS_UP. RS reports the use of RS_UP. 2007-05-02 15:20:28 +00:00
Philip Homburg
2db15eaa80 Added fxp. rtl8139 doesn't need to be root anymore. 2007-05-02 11:40:15 +00:00
Philip Homburg
2d49b4ecb5 Use ds_retrieve_u32 to get the endpoint of inet. 2007-05-02 11:39:10 +00:00
Philip Homburg
a124958e59 Use ds_retrieve_u32 to get the endpoint of inet. 2007-05-02 11:32:22 +00:00
Philip Homburg
33d31720a5 Use ds_retrieve_u32 to get the endpoint of inet and of the ethernet drivers. 2007-05-02 11:30:16 +00:00
Philip Homburg
9852471c08 Use ds_retrieve_u32 to find the endpoint of pci. 2007-05-02 11:24:51 +00:00
Ben Gras
47c18edb26 date not built from here 2007-05-01 14:18:55 +00:00
Ben Gras
b49ba611bd shell at least as big in 'big' as in normal 2007-05-01 14:11:10 +00:00
Philip Homburg
02a229f14d Publish endpoints in ds. 2007-04-27 13:03:33 +00:00
Philip Homburg
93f9bb4a57 Restrict access to rs to root's processes. 2007-04-27 12:27:40 +00:00
Philip Homburg
69ca935251 getpeuid implementation. Get the uid of a process (by endpoint) 2007-04-27 12:21:06 +00:00
Ben Gras
8eb09f6ddc . readall: use lseek64() to read more than 4GB of a device
. vfs: 64-bit offset support for character device i/o
   (also remove unused dev_bio function)
 . memory: /dev/null and /dev/zero are infinitely large, don't stop
   reading/writing at 4GB
2007-04-24 13:27:33 +00:00
Ben Gras
cc7c561d41 obsolete manpages (these have become packages) 2007-04-24 13:25:57 +00:00
Philip Homburg
0dc0d3fe5b Fixed releasing PCI resources after a driver terminates. 2007-04-24 12:55:37 +00:00
Ben Gras
ac64c1b3dc Take out obsolete message about 4GB. 2007-04-24 12:40:25 +00:00
Ben Gras
72e6862e4e dp8390 doesn't cope with the different semantics of the pci
functions.

Bug and workaround reported by "E.Agafonov" <e.a.agafonov@gmail.com>.
2007-04-24 12:29:51 +00:00
Philip Homburg
cab8f526de Fixed some lose ends in the serial line debug dump code. 2007-04-23 15:59:16 +00:00
Philip Homburg
29f7031340 Remove KILL and VIRCOPY from drivers that don't need them. Added rtl8139. 2007-04-23 15:39:46 +00:00
Philip Homburg
50f81c4939 Ethernet driver changes for asynchronous inet. 2007-04-23 15:38:00 +00:00
Philip Homburg
bb659b1ad6 Disabled ser_putc for reporting debug internal to tty over the serial line.
Disabled return statement for serial debug input in the kernel.
2007-04-23 14:59:32 +00:00
Philip Homburg
a3c8619923 Added do_del_acl. More detailed debug output for the secure device capability. 2007-04-23 14:54:51 +00:00
Philip Homburg
0bd4c5ee7d Initial convertion to asynchronous sends for communicating with ethernet
drivers.
2007-04-23 14:49:20 +00:00
Philip Homburg
b613f5cb4b Report and detect exec failures using a pipe.
XXX Hardcoded values for s_ipc_to and s_ipc_sendrec.
2007-04-23 14:47:04 +00:00
Philip Homburg
727ce18aa8 Initialize exec_pipe. 2007-04-23 14:43:25 +00:00
Philip Homburg
849285f66d Diagnostics from service go to standard error. 2007-04-23 14:42:58 +00:00
Philip Homburg
e68a2b4d6a Extra flags RS_SIGNALED and RS_EXECFAILED. Pipe for detecting exec failures. 2007-04-23 14:42:08 +00:00
Philip Homburg
b4a88a3705 Removed ECHO from dump, added SENDA. Also dump s_ipc_sendrec. 2007-04-23 14:40:13 +00:00
Philip Homburg
77f5b40141 Round memory size up for VM. 2007-04-23 14:38:55 +00:00
Philip Homburg
b5e6319ae7 Removed some indentation. 2007-04-23 14:33:42 +00:00
Philip Homburg
13da935060 Debug dumps over the serial line. Direct output to video memory. 2007-04-23 14:25:17 +00:00
Philip Homburg
c59b23859e Clean and support for asynchronous sends. 2007-04-23 14:24:30 +00:00
Philip Homburg
47233bdf30 Fixed bad boundary condition, support for asynchronous I/O. 2007-04-23 14:23:37 +00:00
Philip Homburg
c7a7c0cb17 Removed some white space. 2007-04-23 13:58:37 +00:00
Philip Homburg
94bc849574 Poll serial line for debug output requests when do_serial_debug is true. 2007-04-23 13:56:27 +00:00
Philip Homburg
8937b6a8de Initialize s_ipc_sendrec. 2007-04-23 13:46:54 +00:00
Philip Homburg
da4bb9144d Removed ECHO. 2007-04-23 13:46:26 +00:00
Philip Homburg
f41429d815 Cleanup. 2007-04-23 13:44:56 +00:00
Philip Homburg
cb3e271b24 Fields for asynchronous sends (s_asyntab and s_asynsize) and for allowed
sendrecs (s_ipc_sendrec).
2007-04-23 13:37:30 +00:00
Philip Homburg
6554f3d3dc Added MF_ASYNMSG. 2007-04-23 13:36:38 +00:00
Ben Gras
1d7cea10ed str[] is too small - reported by Erik van der Kouwe <vdkouwe@cs.vu.nl>. 2007-04-23 13:36:13 +00:00
Philip Homburg
8eb27a714e More debug output. Dump kernel process on serial line. Directly put
text in video memory.
2007-04-23 13:36:11 +00:00
Philip Homburg
c082f607df Disallow unaligned access to I/O ports. 2007-04-23 13:31:45 +00:00
Philip Homburg
d2cec7db49 Disallow unaligned access to I/O ports. 2007-04-23 13:31:16 +00:00
Philip Homburg
7541e0753b Separate permissions for sendrec. Actually initialize send/sendrec permissions
for data supplied by rs.
2007-04-23 13:30:04 +00:00
Philip Homburg
d80e25068c GET_PRIVID: return the ID of a process' privilege structure. 2007-04-23 13:28:14 +00:00
Philip Homburg
2b2d3d5131 Fail unsafe sdevio. Disallow unaligned I/O ports. 2007-04-23 13:22:26 +00:00
Philip Homburg
bc17115a34 Prototypes for exception and stacktrace. Declare additional arguments
for exception to be able to print nexted exceptions.
2007-04-23 13:19:25 +00:00
Philip Homburg
b4f6994278 Use sprintf to avoid buffer overflows. 2007-04-23 13:04:31 +00:00
Philip Homburg
82e77742b5 Added pci_del_acl. Fixed return value of pci_set_acl. 2007-04-23 12:14:44 +00:00
Philip Homburg
4ce2267dd3 Type _exit and abort before generating a trap. 2007-04-23 12:13:51 +00:00
Philip Homburg
4ce9ca03cf Added cpf_reload to reload the safecopy table pointer (for example after a
fork).
2007-04-23 12:12:32 +00:00
Philip Homburg
e9899f3c86 Added sendnb and senda, removed echo and _ipcnew.s. 2007-04-23 12:11:03 +00:00
Philip Homburg
35c3f52d99 Renamed BUSC_PCI_ACL to BUSC_PCI_SET_ACL, added BUSC_PCI_DEL_ACL.
Added DL_STAT_REPLY and GET_PRIVID.
2007-04-23 12:01:47 +00:00
Philip Homburg
555bc29a0c sys_getprivid macro to get the ID of a process' privilege structure.
Prototype for pci_del_acl.
2007-04-23 12:00:46 +00:00
Philip Homburg
36c764be1c Asynchronous send. 2007-04-23 11:59:19 +00:00
Philip Homburg
a17ff08fb9 Prototype for cpf_reload. 2007-04-23 11:58:41 +00:00
Ben Gras
ac41dcd35f bc and mtools out of the base system (gpl) 2007-04-20 12:06:14 +00:00
Ben Gras
0a0f800805 Make mkfs message a bit clearer. 2007-04-19 14:13:27 +00:00
Ben Gras
3b614085c6 Don't limit partitions to 4GB. 2007-04-19 14:08:41 +00:00
Ben Gras
365e867a88 Some features for the automatic image build. 2007-04-18 11:42:48 +00:00
Ben Gras
673c7ced15 Print svn rev and date info in /etc/version. 2007-04-18 11:39:18 +00:00
Ben Gras
8aa0d26891 update binary_sizes to not make binaries smaller than the build does. 2007-04-17 13:50:58 +00:00
3086 changed files with 149732 additions and 136240 deletions

10
LICENSE Executable file → Normal file
View File

@@ -50,3 +50,13 @@ observe the conditions of the GPL with respect to this software. As
clearly stated in Article 2 of the GPL, when GPL and nonGPL software are
distributed together on the same medium, this aggregation does not cause
the license of either part to apply to the other part.
Acknowledgements
This product includes software developed by the University of
California, Berkeley and its contributors.
This product includes software developed by Softweyr LLC, the
University of California, Berkeley, and its contributors.

0
Makefile Executable file → Normal file
View File

7
benchmarks/Makefile Normal file
View File

@@ -0,0 +1,7 @@
# Makefile for the benchmarks.
all::
chmod 755 run
all clean::
for b in *bench*; do cd $$b && $(MAKE) $@; done

51
benchmarks/run Normal file
View File

@@ -0,0 +1,51 @@
#!/bin/sh
set -e
make
BENCHDIR=/usr/local/benchmarks
basebenchmarks=`echo *bench*`
if [ -d $BENCHDIR ]
then packagebenchmarks=`(cd $BENCHDIR && echo *bench*)`
fi
runbench() {
bench=$1
out="Results/$bench.`date +%Y%m%d.%H%M%S`"
if [ -d $bench ]
then dir=$bench
fi
if [ -d $BENCHDIR/$bench ]
then dir=$BENCHDIR/$bench
fi
clear
echo "Running $dir."
echo "Saving output to $out."
echo ""
( cd $dir && sh run.sh 2>&1 ) | tee $out
}
clear
n=1
for b in $basebenchmarks $packagebenchmarks
do echo "$n. $b"
eval "n$n=$b"
n=`expr $n + 1`
done
echo
echo -n "Run which benchmark or 'all'? "
read bench
eval var=\$n$bench
if [ "$bench" = all ]
then for b in $basebenchmarks $packagebenchmarks
do runbench $b
done
else if [ -d "$var" -o -d "$BENCHDIR/$var" ]
then runbench $var
else echo "Unknown benchmark $var."
exit 1
fi
fi

View File

@@ -0,0 +1,246 @@
##############################################################################
# UnixBench v5.1.1
# Based on The BYTE UNIX Benchmarks - Release 3
# Module: Makefile SID: 3.9 5/15/91 19:30:15
#
##############################################################################
# Bug reports, patches, comments, suggestions should be sent to:
# David C Niemi <niemi@tux.org>
#
# Original Contacts at Byte Magazine:
# Ben Smith or Tom Yager at BYTE Magazine
# bensmith@bytepb.byte.com tyager@bytepb.byte.com
#
##############################################################################
# Modification Log: 7/28/89 cleaned out workload files
# 4/17/90 added routines for installing from shar mess
# 7/23/90 added compile for dhrystone version 2.1
# (this is not part of Run file. still use old)
# removed HZ from everything but dhry.
# HZ is read from the environment, if not
# there, you must define it in this file
# 10/30/90 moved new dhrystone into standard set
# new pgms (dhry included) run for a specified
# time rather than specified number of loops
# 4/5/91 cleaned out files not needed for
# release 3 -- added release 3 files -ben
# 10/22/97 added compiler options for strict ANSI C
# checking for gcc and DEC's cc on
# Digital Unix 4.x (kahn@zk3.dec.com)
# 09/26/07 changes for UnixBench 5.0
# 09/30/07 adding ubgears, GRAPHIC_TESTS switch
# 10/14/07 adding large.txt
##############################################################################
##############################################################################
# CONFIGURATION
##############################################################################
SHELL = /bin/sh
# GRAPHICS TESTS: Uncomment the definition of "GRAPHIC_TESTS" to enable
# the building of the graphics benchmarks. This will require the
# X11 libraries on your system.
#
# Comment the line out to disable these tests.
# GRAPHIC_TESTS = defined
# Set "GL_LIBS" to the libraries needed to link a GL program.
GL_LIBS = -lGL -lXext -lX11
# OPTIMISATION SETTINGS:
## Very generic
OPTON = -O
## For Linux 486/Pentium, GCC 2.7.x and 2.8.x
#OPTON = -O2 -fomit-frame-pointer -fforce-addr -fforce-mem -ffast-math \
# -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2
## For Linux, GCC previous to 2.7.0
#OPTON = -O2 -fomit-frame-pointer -fforce-addr -fforce-mem -ffast-math -m486
#OPTON = -O2 -fomit-frame-pointer -fforce-addr -fforce-mem -ffast-math \
# -m386 -malign-loops=1 -malign-jumps=1 -malign-functions=1
## For Solaris 2, or general-purpose GCC 2.7.x
#OPTON = -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall
## For Digital Unix v4.x, with DEC cc v5.x
#OPTON = -O4
#CFLAGS = -DTIME -std1 -verbose -w0
## generic gcc CFLAGS. -DTIME must be included.
CFLAGS += $(CPPFLAGS) -DTIME -DMINIX=1 -D_MINIX=1 -D_POSIX_SOURCE=1
##############################################################################
# END CONFIGURATION
##############################################################################
# local directories
PROGDIR = ./pgms
SRCDIR = ./src
TESTDIR = ./testdir
RESULTDIR = ./results
TMPDIR = ./tmp
# other directories
INCLDIR = /usr/include
LIBDIR = /lib
SCRIPTS = unixbench.logo multi.sh tst.sh index.base
SOURCES = arith.c big.c context1.c \
dummy.c execl.c \
fstime.c hanoi.c \
pipe.c spawn.c \
syscall.c looper.c timeit.c time-polling.c \
dhry_1.c dhry_2.c dhry.h whets.c ubgears.c
TESTS = sort.src cctest.c dc.dat large.txt
# ifdef GRAPHIC_TESTS
# GRAPHIC_BINS = $(PROGDIR)/ubgears
# else
GRAPHIC_BINS =
# endif
# Program binaries.
BINS = $(PROGDIR)/arithoh $(PROGDIR)/register $(PROGDIR)/short \
$(PROGDIR)/int $(PROGDIR)/long $(PROGDIR)/float $(PROGDIR)/double \
$(PROGDIR)/hanoi $(PROGDIR)/syscall $(PROGDIR)/context1 \
$(PROGDIR)/pipe $(PROGDIR)/spawn $(PROGDIR)/execl \
$(PROGDIR)/dhry2 $(PROGDIR)/dhry2reg $(PROGDIR)/looper \
$(PROGDIR)/fstime $(PROGDIR)/whetstone-double $(GRAPHIC_BINS)
## These compile only on some platforms...
# $(PROGDIR)/poll $(PROGDIR)/poll2 $(PROGDIR)/select
# Required non-binary files.
REQD = $(BINS) $(PROGDIR)/unixbench.logo \
$(PROGDIR)/multi.sh $(PROGDIR)/tst.sh $(PROGDIR)/index.base \
$(PROGDIR)/gfx-x11 \
$(TESTDIR)/sort.src $(TESTDIR)/cctest.c $(TESTDIR)/dc.dat \
$(TESTDIR)/large.txt
# ######################### the big ALL ############################
all: distr programs
## Ick!!! What is this about??? How about let's not chmod everything bogusly.
# @chmod 744 * $(SRCDIR)/* $(PROGDIR)/* $(TESTDIR)/* $(DOCDIR)/*
# ####################### a check for Run ######################
check: $(REQD)
make all
# ##############################################################
# distribute the files out to subdirectories if they are in this one
distr:
@echo "Checking distribution of files"
# scripts
@if test ! -d $(PROGDIR) \
; then \
mkdir $(PROGDIR) \
; mv $(SCRIPTS) $(PROGDIR) \
; else \
echo "$(PROGDIR) exists" \
; fi
# C sources
@if test ! -d $(SRCDIR) \
; then \
mkdir $(SRCDIR) \
; mv $(SOURCES) $(SRCDIR) \
; else \
echo "$(SRCDIR) exists" \
; fi
# test data
@if test ! -d $(TESTDIR) \
; then \
mkdir $(TESTDIR) \
; mv $(TESTS) $(TESTDIR) \
; else \
echo "$(TESTDIR) exists" \
; fi
# temporary work directory
@if test ! -d $(TMPDIR) \
; then \
mkdir $(TMPDIR) \
; else \
echo "$(TMPDIR) exists" \
; fi
# directory for results
@if test ! -d $(RESULTDIR) \
; then \
mkdir $(RESULTDIR) \
; else \
echo "$(RESULTDIR) exists" \
; fi
programs: $(BINS)
# Individual programs
$(PROGDIR)/arithoh: $(SRCDIR)/arith.c
$(CC) -o $(PROGDIR)/arithoh ${CFLAGS} ${OPTON} -Darithoh $(SRCDIR)/arith.c
$(PROGDIR)/register: $(SRCDIR)/arith.c
$(CC) -o $(PROGDIR)/register ${CFLAGS} ${OPTON} -Ddatum='register int' $(SRCDIR)/arith.c
$(PROGDIR)/short: $(SRCDIR)/arith.c
$(CC) -o $(PROGDIR)/short ${CFLAGS} ${OPTON} -Ddatum=short $(SRCDIR)/arith.c
$(PROGDIR)/int: $(SRCDIR)/arith.c
$(CC) -o $(PROGDIR)/int ${CFLAGS} ${OPTON} -Ddatum=int $(SRCDIR)/arith.c
$(PROGDIR)/long: $(SRCDIR)/arith.c
$(CC) -o $(PROGDIR)/long ${CFLAGS} ${OPTON} -Ddatum=long $(SRCDIR)/arith.c
$(PROGDIR)/float: $(SRCDIR)/arith.c
$(CC) -o $(PROGDIR)/float ${CFLAGS} ${OPTON} -Ddatum=float $(SRCDIR)/arith.c
$(PROGDIR)/double: $(SRCDIR)/arith.c
$(CC) -o $(PROGDIR)/double ${CFLAGS} ${OPTON} -Ddatum=double $(SRCDIR)/arith.c
$(PROGDIR)/whetstone-double: $(SRCDIR)/whets.c
$(CC) -o $(PROGDIR)/whetstone-double ${CFLAGS} ${OPTON} -DDP -DUNIX -DUNIXBENCH $(SRCDIR)/whets.c -lm
$(PROGDIR)/hanoi: $(SRCDIR)/hanoi.c
$(CC) -o $(PROGDIR)/hanoi ${CFLAGS} ${OPTON} $(SRCDIR)/hanoi.c
$(PROGDIR)/poll: $(SRCDIR)/time-polling.c
$(CC) -DHAS_POLL -DUNIXBENCH -o $(PROGDIR)/poll ${CFLAGS} ${OPTON} $(SRCDIR)/time-polling.c
$(PROGDIR)/poll2: $(SRCDIR)/time-polling.c
$(CC) -DHAS_POLL2 -DUNIXBENCH -o $(PROGDIR)/poll2 ${CFLAGS} ${OPTON} $(SRCDIR)/time-polling.c
$(PROGDIR)/select: $(SRCDIR)/time-polling.c
$(CC) -DHAS_SELECT -DUNIXBENCH -o $(PROGDIR)/select ${CFLAGS} ${OPTON} $(SRCDIR)/time-polling.c
$(PROGDIR)/fstime: $(SRCDIR)/fstime.c
$(CC) -o $(PROGDIR)/fstime ${CFLAGS} ${OPTON} $(SRCDIR)/fstime.c
$(PROGDIR)/syscall: $(SRCDIR)/syscall.c
$(CC) -o $(PROGDIR)/syscall ${CFLAGS} ${OPTON} $(SRCDIR)/syscall.c
$(PROGDIR)/context1: $(SRCDIR)/context1.c
$(CC) -o $(PROGDIR)/context1 ${CFLAGS} ${OPTON} $(SRCDIR)/context1.c
$(PROGDIR)/pipe: $(SRCDIR)/pipe.c
$(CC) -o $(PROGDIR)/pipe ${CFLAGS} ${OPTON} $(SRCDIR)/pipe.c
$(PROGDIR)/spawn: $(SRCDIR)/spawn.c
$(CC) -o $(PROGDIR)/spawn ${CFLAGS} ${OPTON} $(SRCDIR)/spawn.c
$(PROGDIR)/execl: $(SRCDIR)/execl.c $(SRCDIR)/big.c
$(CC) -o $(PROGDIR)/execl ${CFLAGS} ${OPTON} $(SRCDIR)/execl.c
$(PROGDIR)/dhry2: $(SRCDIR)/dhry_1.c $(SRCDIR)/dhry_2.c $(SRCDIR)/dhry.h
cd $(SRCDIR); $(CC) -c ${CFLAGS} -DHZ=${HZ} ${OPTON} dhry_1.c
cd $(SRCDIR); $(CC) -c ${CFLAGS} -DHZ=${HZ} ${OPTON} dhry_2.c
$(CC) -o $(PROGDIR)/dhry2 ${CFLAGS} ${OPTON} $(SRCDIR)/dhry_1.o $(SRCDIR)/dhry_2.o
cd $(SRCDIR); rm -f dhry_1.o dhry_2.o
$(PROGDIR)/dhry2reg: $(SRCDIR)/dhry_1.c $(SRCDIR)/dhry_2.c $(SRCDIR)/dhry.h
cd $(SRCDIR); $(CC) -c ${CFLAGS} -DREG=register -DHZ=${HZ} ${OPTON} dhry_1.c
cd $(SRCDIR); $(CC) -c ${CFLAGS} -DREG=register -DHZ=${HZ} ${OPTON} dhry_2.c
$(CC) -o $(PROGDIR)/dhry2reg ${CFLAGS} ${OPTON} $(SRCDIR)/dhry_1.o $(SRCDIR)/dhry_2.o
cd $(SRCDIR); rm -f dhry_1.o dhry_2.o
$(PROGDIR)/looper: $(SRCDIR)/looper.c
$(CC) -o $(PROGDIR)/looper ${CFLAGS} ${OPTON} $(SRCDIR)/looper.c
$(PROGDIR)/ubgears: $(SRCDIR)/ubgears.c
$(CC) -o $(PROGDIR)/ubgears ${CFLAGS} ${OPTON} $(SRCDIR)/ubgears.c $(GL_LIBS)
# Run the benchmarks and create the reports
run:
sh ./Run
clean:
rm -f $(BINS) core *~ */*~
spotless: clean
rm -f $(RESULTDIR)/* $(TMPDIR)/*
## END ##

View File

@@ -0,0 +1,406 @@
Version 5.1.2 -- 2007-12-26
================================================================
To use Unixbench:
1. UnixBench from version 5.1 on has both system and graphics tests.
If you want to use the graphic tests, edit the Makefile and make sure
that the line "GRAPHIC_TESTS = defined" is not commented out; then check
that the "GL_LIBS" definition is OK for your system. Also make sure
that the "x11perf" command is on your search path.
If you don't want the graphics tests, then comment out the
"GRAPHIC_TESTS = defined" line. Note: comment it out, don't
set it to anything.
2. Do "make".
3. Do "Run" to run the system test; "Run graphics" to run the graphics
tests; "Run gindex" to run both.
You will need perl, as Run is written in perl.
For more information on using the tests, read "USAGE".
For information on adding tests into the benchmark, see "WRITING_TESTS".
===================== RELEASE NOTES =====================================
======================== Dec 07 ==========================
v5.1.2
One big fix: if unixbench is installed in a directory whose pathname contains
a space, it should now run (previously it failed).
To avoid possible clashes, the environment variables unixbench uses are now
prefixed with "UB_". These are all optional, and for most people will be
completely unnecessary, but if you want you can set these:
UB_BINDIR Directory where the test programs live.
UB_TMPDIR Temp directory, for temp files.
UB_RESULTDIR Directory to put results in.
UB_TESTDIR Directory where the tests are executed.
And a couple of tiny fixes:
* In pgms/tst.sh, changed "sort -n +1" to "sort -n -k 1"
* In Makefile, made it clearer that GRAPHIC_TESTS should be commented
out (not set to 0) to disable graphics
Thanks to nordi for pointing these out.
Ian Smith, December 26, 2007
johantheghost at yahoo period com
======================== Oct 07 ==========================
v5.1.1
It turns out that the setting of LANG is crucial to the results. This
explains why people in different regions were seeing odd results, and also
why runlevel 1 produced odd results -- runlevel 1 doesn't set LANG, and
hence reverts to ASCII, whereas most people use a UTF-8 encoding, which is
much slower in some tests (eg. shell tests).
So now we manually set LANG to "en_US.utf8", which is configured with the
variable "$language". Don't change this if you want to share your results.
We also report the language settings in use.
See "The Language Setting" in USAGE for more info. Thanks to nordi for
pointing out the LANG issue.
I also added the "grep" and "sysexec" tests. These are non-index tests,
and "grep" uses the system's grep, so it's not much use for comparing
different systems. But some folks on the OpenSuSE list have been finding
these useful. They aren't in any of the main test groups; do "Run grep
sysexec" to run them.
Index Changes
-------------
The setting of LANG will affect consistency with systems where this is
not the default value. However, it should produce more consistent results
in future.
Ian Smith, October 15, 2007
johantheghost at yahoo period com
======================== Oct 07 ==========================
v5.1
The major new feature in this version is the addition of graphical
benchmarks. Since these may not compile on all systems, you can enable/
disable them with the GRAPHIC_TESTS variable in the Makefile.
As before, each test is run for 3 or 10 iterations. However, we now discard
the worst 1/3 of the scores before averaging the remainder. The logic is
that a glitch in the system (background process waking up, for example) may
make one or two runs go slow, so let's discard those. Hopefully this will
produce more consistent and repeatable results. Check the log file
for a test run to see the discarded scores.
Made the tests compile and run on x86-64/Linux (fixed an execl bug passing
int instead of pointer).
Also fixed some general bugs.
Thanks to Stefan Esser for help and testing / bug reporting.
Index Changes
-------------
The tests are now divided into categories, and each category generates
its own index. This keeps the graphics test results separate from
the system tests.
The "graphics" test and corresponding index are new.
The "discard the worst scores" strategy should produce slightly higher
test scores, but at least they should (hopefully!) be more consistent.
The scores should not be higher than the best scores you would have got
with 5.0, so this should not be a huge consistency issue.
Ian Smith, October 11, 2007
johantheghost at yahoo period com
======================== Sep 07 ==========================
v5.0
All the work I've done on this release is Linux-based, because that's
the only Unix I have access to. I've tried to make it more OS-agnostic
if anything; for example, it no longer has to figure out the format reported
by /usr/bin/time. However, it's possible that portability has been damaged.
If anyone wants to fix this, please feel free to mail me patches.
In particular, the analysis of the system's CPUs is done via /proc/cpuinfo.
For systems which don't have this, please make appropriate changes in
getCpuInfo() and getSystemInfo().
The big change has been to make the tests multi-CPU aware. See the
"Multiple CPUs" section in "USAGE" for details. Other changes:
* Completely rewrote Run in Perl; drastically simplified the way data is
processed. The confusing system of interlocking shell and awk scripts is
now just one script. Various intermediate files used to store and process
results are now replaced by Perl data structures internal to the script.
* Removed from the index runs file system read and write tests which were
ignored for the index and wasted about 10 minutes per run (see fstime.c).
The read and write tests can now be selected individually. Made fstime.c
take parameters, so we no longer need to build 3 versions of it.
* Made the output file names unique; they are built from
hostname-date-sequence.
* Worked on result reporting, error handling, and logging. See TESTS.
We now generate both text and HTML reports.
* Removed some obsolete files.
Index Changes
-------------
The index is still based on David Niemi's SPARCstation 20-61 (rated at 10.0),
and the intention in the changes I've made has been to keep the tests
unchanged, in order to maintain consistency with old result sets.
However, the following changes have been made to the index:
* The Pipe-based Context Switching test (context1) was being dropped
from the index report in v4.1.0 due to a bug; I've put it back in.
* I've added shell1 to the index, to get a measure of how the shell tests
scale with multiple CPUs (shell8 already exercises all the CPUs, even
in single-copy mode). I made up the baseline score for this by
extrapolation.
Both of these test can be dropped, if you wish, by editing the "TEST
SPECIFICATIONS" section of Run.
Ian Smith, September 20, 2007
johantheghost at yahoo period com
======================== Aug 97 ==========================
v4.1.0
Double precision Whetstone put in place instead of the old "double" benchmark.
Removal of some obsolete files.
"system" suite adds shell8.
perlbench and poll added as "exhibition" (non-index) benchmarks.
Incorporates several suggestions by Andre Derrick Balsa <andrewbalsa@usa.net>
Code cleanups to reduce compiler warnings by David C Niemi <niemi@tux.org>
and Andy Kahn <kahn@zk3.dec.com>; Digital Unix options by Andy Kahn.
======================== Jun 97 ==========================
v4.0.1
Minor change to fstime.c to fix overflow problems on fast machines. Counting
is now done in units of 256 (smallest BUFSIZE) and unsigned longs are used,
giving another 23 dB or so of headroom ;^) Results should be virtually
identical aside from very small rounding errors.
======================== Dec 95 ==========================
v4.0
Byte no longer seems to have anything to do with this benchmark, and I was
unable to reach any of the original authors; so I have taken it upon myself
to clean it up.
This is version 4. Major assumptions made in these benchmarks have changed
since they were written, but they are nonetheless popular (particularly for
measuring hardware for Linux). Some changes made:
- The biggest change is to put a lot more operating system-oriented
tests into the index. I experimented for a while with a decibel-like
logarithmic scale, but finally settled on using a geometric mean for
the final index (the individual scores are a normalized, and their
logs are averaged; the resulting value is exponentiated).
"George", certain SPARCstation 20-61 with 128 MB RAM, a SPARC Storage
Array, and Solaris 2.3 is my new baseline; it is rated at 10.0 in each
of the index scores for a final score of 10.0.
Overall I find the geometric averaging is a big improvement for
avoiding the skew that was once possible (e.g. a Pentium-75 which got
40 on the buggy version of fstime, such that fstime accounted for over
half of its total score and hence wildly skewed its average).
I also expect that the new numbers look different enough from the old
ones that no one is too likely to casually mistake them for each other.
I am finding new SPARCs running Solaris 2.4 getting about 15-20, and
my 486 DX2-66 Compaq running Linux 1.3.45 got a 9.1. It got
understandably poor scores on CPU and FPU benchmarks (a horrible
1.8 on "double" and 1.3 on "fsdisk"); but made up for it by averaging
over 20 on the OS-oriented benchmarks. The Pentium-75 running
Linux gets about 20 (and it *still* runs Windows 3.1 slowly. Oh well).
- It is difficult to get a modern compiler to even consider making
dhry2 without registers, short of turning off *all* optimizations.
This is also not a terribly meaningful test, even if it were possible,
as noone compiles without registers nowadays. Replaced this benchmark
with dhry2reg in the index, and dropped it out of usage in general as
it is so hard to make a legitimate one.
- fstime: this had some bugs when compiled on modern systems which return
the number of bytes read/written for read(2)/write(2) calls. The code
assumed that a negative return code was given for EOF, but most modern
systems return 0 (certainly on SunOS 4, Solaris2, and Linux, which is
what counts for me). The old code yielded wildly inflated read scores,
would eat up tens of MB of disk space on fast systems, and yielded
roughly 50% lower than normal copy scores than it should have.
Also, it counted partial blocks *fully*; made it count the proportional
part of the block which was actually finished.
Made bigger and smaller variants of fstime which are designed to beat
up the disk I/O and the buffer cache, respectively. Adjusted the
sleeps so that they are short for short benchmarks.
- Instead of 1,2,4, and 8-shell benchmarks, went to 1, 8, and 16 to
give a broader range of information (and to run 1 fewer test).
The only real problem with this is that not many iterations get
done with 16 at a time on slow systems, so there are some significant
rounding errors; 8 therefore still used for the benchmark. There is
also the problem that the last (uncompleted) loop is counted as a full
loop, so it is impossible to score below 1.0 lpm (which gave my laptop
a break). Probably redesigning Shell to do each loop a bit more
quickly (but with less intensity) would be a good idea.
This benchmark appears to be very heavily influenced by the speed
of the loader, by which shell is being used as /bin/sh, and by how
well-compiled some of the common shell utilities like grep, sed, and
sort are. With a consistent tool set it is also a good indicator of
the bandwidth between main memory and the CPU (e.g. Pentia score about
twice as high as 486es due to their 64-bit bus). Small, sometimes
broken shells like "ash-linux" do particularly well here, while big,
robust shells like bash do not.
- "dc" is a somewhat iffy benchmark, because there are two versions of
it floating around, one being small, very fast, and buggy, and one
being more correct but slow. It was never in the index anyway.
- Execl is a somewhat troubling benchmark in that it yields much higher
scores if compiled statically. I frown on this practice because it
distorts the scores away from reflecting how programs are really used
(i.e. dynamically linked).
- Arithoh is really more an indicator of the compiler quality than of
the computer itself. For example, GCC 2.7.x with -O2 and a few extra
options optimizes much of it away, resulting in about a 1200% boost
to the score. Clearly not a good one for the index.
I am still a bit unhappy with the variance in some of the benchmarks, most
notably the fstime suite; and with how long it takes to run. But I think
it gets significantly more reliable results than the older version in less
time.
If anyone has ideas on how to make these benchmarks faster, lower-variance,
or more meaningful; or has nice, new, portable benchmarks to add, don't
hesitate to e-mail me.
David C Niemi <niemi@tux.org> 7 Dec 1995
======================== May 91 ==========================
This is version 3. This set of programs should be able to determine if
your system is BSD or SysV. (It uses the output format of time (1)
to see. If you have any problems, contact me (by email,
preferably): ben@bytepb.byte.com
---
The document doc/bench.doc describes the basic flow of the
benchmark system. The document doc/bench3.doc describes the major
changes in design of this version. As a user of the benchmarks,
you should understand some of the methods that have been
implemented to generate loop counts:
Tests that are compiled C code:
The function wake_me(second, func) is included (from the file
timeit.c). This function uses signal and alarm to set a countdown
for the time request by the benchmark administration script
(Run). As soon as the clock is started, the test is run with a
counter keeping track of the number of loops that the test makes.
When alarm sends its signal, the loop counter value is sent to stderr
and the program terminates. Since the time resolution, signal
trapping and other factors don't insure that the test is for the
precise time that was requested, the test program is also run
from the time (1) command. The real time value returned from time
(1) is what is used in calculating the number of loops per second
(or minute, depending on the test). As is obvious, there is some
overhead time that is not taken into account, therefore the
number of loops per second is not absolute. The overhead of the
test starting and stopping and the signal and alarm calls is
common to the overhead of real applications. If a program loads
quickly, the number of loops per second increases; a phenomenon
that favors systems that can load programs quickly. (Setting the
sticky bit of the test programs is not considered fair play.)
Test that use existing UNIX programs or shell scripts:
The concept is the same as that of compiled tests, except the
alarm and signal are contained in separate compiled program,
looper (source is looper.c). Looper uses an execvp to invoke the
test with its arguments. Here, the overhead includes the
invocation and execution of looper.
--
The index numbers are generated from a baseline file that is in
pgms/index.base. You can put tests that you wish in this file.
All you need to do is take the results/log file from your
baseline machine, edit out the comment and blank lines, and sort
the result (vi/ex command: 1,$!sort). The sort in necessary
because the process of generating the index report uses join (1).
You can regenerate the reports by running "make report."
--
========================= Jan 90 =============================
Tom Yager has joined the effort here at BYTE; he is responsible
for many refinements in the UNIX benchmarks.
The memory access tests have been deleted from the benchmarks.
The file access tests have been reversed so that the test is run
for a fixed time. The amount of data transfered (written, read,
and copied) is the variable. !WARNING! This test can eat up a
large hunk of disk space.
The initial line of all shell scripts has been changed from the
SCO and XENIX form (:) to the more standard form "#! /bin/sh".
But different systems handle shell switching differently. Check
the documentation on your system and find out how you are
supposed to do it. Or, simpler yet, just run the benchmarks from
the Bourne shell. (You may need to set SHELL=/bin/sh as well.)
The options to Run have not been checked in a while. They may no
longer function. Next time, I'll get back on them. There needs to
be another option added (next time) that halts testing between
each test. !WARNING! Some systems have caches that are not getting flushed
before the next test or iteration is run. This can cause
erroneous values.
========================= Sept 89 =============================
The database (db) programs now have a tuneable message queue space.
queue space. The default set in the Run script is 1024 bytes.
Other major changes are in the format of the times. We now show
Arithmetic and Geometric mean and standard deviation for User
Time, System Time, and Real Time. Generally, in reporting, we
plan on using the Real Time values with the benchs run with one
active user (the bench user). Comments and arguments are requested.
contact: BIX bensmith or rick_g

1868
benchmarks/unixbench-5.1.2/Run Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,394 @@
Running the Tests
=================
All the tests are executed using the "Run" script in the top-level directory.
The simplest way to generate results is with the commmand:
./Run
This will run a standard "index" test (see "The BYTE Index" below), and
save the report in the "results" directory, with a filename like
hostname-2007-09-23-01
An HTML version is also saved.
If you want to generate both the basic system index and the graphics index,
then do:
./Run gindex
If your system has more than one CPU, the tests will be run twice -- once
with a single copy of each test running at once, and once with N copies,
where N is the number of CPUs. Some categories of tests, however (currently
the graphics tests) will only run with a single copy.
Since the tests are based on constant time (variable work), a "system"
run usually takes about 29 minutes; the "graphics" part about 18 minutes.
A "gindex" run on a dual-core machine will do 2 "system" passes (single-
and dual-processing) and one "graphics" run, for a total around one and
a quarter hours.
============================================================================
Detailed Usage
==============
The Run script takes a number of options which you can use to customise a
test, and you can specify the names of the tests to run. The full usage
is:
Run [ -q | -v ] [-i <n> ] [-c <n> [-c <n> ...]] [test ...]
The option flags are:
-q Run in quiet mode.
-v Run in verbose mode.
-i <count> Run <count> iterations for each test -- slower tests
use <count> / 3, but at least 1. Defaults to 10 (3 for
slow tests).
-c <n> Run <n> copies of each test in parallel.
The -c option can be given multiple times; for example:
./Run -c 1 -c 4
will run a single-streamed pass, then a 4-streamed pass. Note that some
tests (currently the graphics tests) will only run in a single-streamed pass.
The remaining non-flag arguments are taken to be the names of tests to run.
The default is to run "index". See "Tests" below.
When running the tests, I do *not* recommend switching to single-user mode
("init 1"). This seems to change the results in ways I don't understand,
and it's not realistic (unless your system will actually be running in this
mode, of course). However, if using a windowing system, you may want to
switch to a minimal window setup (for example, log in to a "twm" session),
so that randomly-churning background processes don't randomise the results
too much. This is particularly true for the graphics tests.
============================================================================
Tests
=====
The available tests are organised into categories; when generating index
scores (see "The BYTE Index" below) the results for each category are
produced separately. The categories are:
system The original Unix system tests (not all are actually
in the index)
2d 2D graphics tests (not all are actually in the index)
3d 3D graphics tests
misc Various non-indexed tests
The following individual tests are available:
system:
dhry2reg Dhrystone 2 using register variables
whetstone-double Double-Precision Whetstone
syscall System Call Overhead
pipe Pipe Throughput
context1 Pipe-based Context Switching
spawn Process Creation
execl Execl Throughput
fstime-w File Write 1024 bufsize 2000 maxblocks
fstime-r File Read 1024 bufsize 2000 maxblocks
fstime File Copy 1024 bufsize 2000 maxblocks
fsbuffer-w File Write 256 bufsize 500 maxblocks
fsbuffer-r File Read 256 bufsize 500 maxblocks
fsbuffer File Copy 256 bufsize 500 maxblocks
fsdisk-w File Write 4096 bufsize 8000 maxblocks
fsdisk-r File Read 4096 bufsize 8000 maxblocks
fsdisk File Copy 4096 bufsize 8000 maxblocks
shell1 Shell Scripts (1 concurrent) (runs "looper 60 multi.sh 1")
shell8 Shell Scripts (8 concurrent) (runs "looper 60 multi.sh 8")
shell16 Shell Scripts (8 concurrent) (runs "looper 60 multi.sh 16")
2d:
2d-rects 2D graphics: rectangles
2d-lines 2D graphics: lines
2d-circle 2D graphics: circles
2d-ellipse 2D graphics: ellipses
2d-shapes 2D graphics: polygons
2d-aashapes 2D graphics: aa polygons
2d-polys 2D graphics: complex polygons
2d-text 2D graphics: text
2d-blit 2D graphics: images and blits
2d-window 2D graphics: windows
3d:
ubgears 3D graphics: gears
misc:
C C Compiler Throughput ("looper 60 $cCompiler cctest.c")
arithoh Arithoh (huh?)
short Arithmetic Test (short) (this is arith.c configured for
"short" variables; ditto for the ones below)
int Arithmetic Test (int)
long Arithmetic Test (long)
float Arithmetic Test (float)
double Arithmetic Test (double)
dc Dc: sqrt(2) to 99 decimal places (runs
"looper 30 dc < dc.dat", using your system's copy of "dc")
hanoi Recursion Test -- Tower of Hanoi
grep Grep for a string in a large file, using your system's
copy of "grep"
sysexec Exercise fork() and exec().
The following pseudo-test names are aliases for combinations of other
tests:
arithmetic Runs arithoh, short, int, long, float, double,
and whetstone-double
dhry Alias for dhry2reg
dhrystone Alias for dhry2reg
whets Alias for whetstone-double
whetstone Alias for whetstone-double
load Runs shell1, shell8, and shell16
misc Runs C, dc, and hanoi
speed Runs the arithmetic and system groups
oldsystem Runs execl, fstime, fsbuffer, fsdisk, pipe, context1,
spawn, and syscall
system Runs oldsystem plus shell1, shell8, and shell16
fs Runs fstime-w, fstime-r, fstime, fsbuffer-w,
fsbuffer-r, fsbuffer, fsdisk-w, fsdisk-r, and fsdisk
shell Runs shell1, shell8, and shell16
index Runs the tests which constitute the official index:
the oldsystem group, plus dhry2reg, whetstone-double,
shell1, and shell8
See "The BYTE Index" below for more information.
graphics Runs the tests which constitute the graphics index:
2d-rects, 2d-ellipse, 2d-aashapes, 2d-text, 2d-blit,
2d-window, and ubgears
gindex Runs the index and graphics groups, to generate both
sets of index results
all Runs all tests
============================================================================
The BYTE Index
==============
The purpose of this test is to provide a basic indicator of the performance
of a Unix-like system; hence, multiple tests are used to test various
aspects of the system's performance. These test results are then compared
to the scores from a baseline system to produce an index value, which is
generally easier to handle than the raw sores. The entire set of index
values is then combined to make an overall index for the system.
Since 1995, the baseline system has been "George", a SPARCstation 20-61
with 128 MB RAM, a SPARC Storage Array, and Solaris 2.3, whose ratings
were set at 10.0. (So a system which scores 520 is 52 times faster than
this machine.) Since the numbers are really only useful in a relative
sense, there's no particular reason to update the base system, so for the
sake of consistency it's probably best to leave it alone. George's scores
are in the file "pgms/index.base"; this file is used to calculate the
index scores for any particular run.
Over the years, various changes have been made to the set of tests in the
index. Although there is a desire for a consistent baseline, various tests
have been determined to be misleading, and have been removed; and a few
alternatives have been added. These changes are detailed in the README,
and should be born in mind when looking at old scores.
A number of tests are included in the benchmark suite which are not part of
the index, for various reasons; these tests can of course be run manually.
See "Tests" above.
============================================================================
Graphics Tests
==============
As of version 5.1, UnixBench now contains some graphics benchmarks. These
are intended to give a rough idea of the general graphics performance of
a system.
The graphics tests are in categories "2d" and "3d", so the index scores
for these tests are separate from the basic system index. This seems
like a sensible division, since the graphics performance of a system
depends largely on the graphics adaptor.
The tests currently consist of some 2D "x11perf" tests and "ubgears".
* The 2D tests are a selection of the x11perf tests, using the host
system's x11perf command (which must be installed and in the search
path). Only a few of the x11perf tests are used, in the interests
of completing a test run in a reasonable time; if you want to do
detailed diagnosis of an X server or graphics chip, then use x11perf
directly.
* The 3D test is "ubgears", a modified version of the familiar "glxgears".
This version runs for 5 seconds to "warm up", then performs a timed
run and displays the average frames-per-second.
On multi-CPU systems, the graphics tests will only run in single-processing
mode. This is because the meaning of running two copies of a test at once
is dubious; and the test windows tend to overlay each other, meaning that
the window behind isn't actually doing any work.
============================================================================
Multiple CPUs
=============
If your system has multiple CPUs, the default behaviour is to run the selected
tests twice -- once with one copy of each test program running at a time,
and once with N copies, where N is the number of CPUs. (You can override
this with the "-c" option; see "Detailed Usage" above.) This is designed to
allow you to assess:
- the performance of your system when running a single task
- the performance of your system when running multiple tasks
- the gain from your system's implementation of parallel processing
The results, however, need to be handled with care. Here are the results
of two runs on a dual-processor system, one in single-processing mode, one
dual-processing:
Test Single Dual Gain
-------------------- ------ ------ ----
Dhrystone 2 562.5 1110.3 97%
Double Whetstone 320.0 640.4 100%
Execl Throughput 450.4 880.3 95%
File Copy 1024 759.4 595.9 -22%
File Copy 256 535.8 438.8 -18%
File Copy 4096 1261.8 1043.4 -17%
Pipe Throughput 481.0 979.3 104%
Pipe-based Switching 326.8 1229.0 276%
Process Creation 917.2 1714.1 87%
Shell Scripts (1) 1064.9 1566.3 47%
Shell Scripts (8) 1567.7 1709.9 9%
System Call Overhead 944.2 1445.5 53%
-------------------- ------ ------ ----
Index Score: 678.2 1026.2 51%
As expected, the heavily CPU-dependent tasks -- dhrystone, whetstone,
execl, pipe throughput, process creation -- show close to 100% gain when
running 2 copies in parallel.
The Pipe-based Context Switching test measures context switching overhead
by sending messages back and forth between 2 processes. I don't know why
it shows such a huge gain with 2 copies (ie. 4 processes total) running,
but it seems to be consistent on my system. I think this may be an issue
with the SMP implementation.
The System Call Overhead shows a lesser gain, presumably because it uses a
lot of CPU time in single-threaded kernel code. The shell scripts test with
8 concurrent processes shows no gain -- because the test itself runs 8
scripts in parallel, it's already using both CPUs, even when the benchmark
is run in single-stream mode. The same test with one process per copy
shows a real gain.
The filesystem throughput tests show a loss, instead of a gain, when
multi-processing. That there's no gain is to be expected, since the tests
are presumably constrained by the throughput of the I/O subsystem and the
disk drive itself; the drop in performance is presumably down to the
increased contention for resources, and perhaps greater disk head movement.
So what tests should you use, how many copies should you run, and how should
you interpret the results? Well, that's up to you, since it depends on
what it is you're trying to measure.
Implementation
--------------
The multi-processing mode is implemented at the level of test iterations.
During each iteration of a test, N slave processes are started using fork().
Each of these slaves executes the test program using fork() and exec(),
reads and stores the entire output, times the run, and prints all the
results to a pipe. The Run script reads the pipes for each of the slaves
in turn to get the results and times. The scores are added, and the times
averaged.
The result is that each test program has N copies running at once. They
should all finish at around the same time, since they run for constant time.
If a test program itself starts off K multiple processes (as with the shell8
test), then the effect will be that there are N * K processes running at
once. This is probably not very useful for testing multi-CPU performance.
============================================================================
The Language Setting
====================
The $LANG environment variable determines how programs abnd library
routines interpret text. This can have a big impact on the test results.
If $LANG is set to POSIX, or is left unset, text is treated as ASCII; if
it is set to en_US.UTF-8, foir example, then text is treated as being
encoded in UTF-8, which is more complex and therefore slower. Setting
it to other languages can have varying results.
To ensure consistency between test runs, the Run script now (as of version
5.1.1) sets $LANG to "en_US.utf8".
This setting which is configured with the variable "$language". You
should not change this if you want to share your results to allow
comparisons between systems; however, you may want to change it to see
how different language settings affect performance.
Each test report now includes the language settings in use. The reported
language is what is set in $LANG, and is not necessarily supported by the
system; but we also report the character mapping and collation order which
are actually in use (as reported by "locale").
============================================================================
Interpreting the Results
========================
Interpreting the results of these tests is tricky, and totally depends on
what you're trying to measure.
For example, are you trying to measure how fast your CPU is? Or how good
your compiler is? Because these tests are all recompiled using your host
system's compiler, the performance of the compiler will inevitably impact
the performance of the tests. Is this a problem? If you're choosing a
system, you probably care about its overall speed, which may well depend
on how good its compiler is; so including that in the test results may be
the right answer. But you may want to ensure that the right compiler is
used to build the tests.
On the other hand, with the vast majority of Unix systems being x86 / PC
compatibles, running Linux and the GNU C compiler, the results will tend
to be more dependent on the hardware; but the versions of the compiler and
OS can make a big difference. (I measured a 50% gain between SUSE 10.1
and OpenSUSE 10.2 on the same machine.) So you may want to make sure that
all your test systems are running the same version of the OS; or at least
publish the OS and compuiler versions with your results. Then again, it may
be compiler performance that you're interested in.
The C test is very dubious -- it tests the speed of compilation. If you're
running the exact same compiler on each system, OK; but otherwise, the
results should probably be discarded. A slower compilation doesn't say
anything about the speed of your system, since the compiler may simply be
spending more time to super-optimise the code, which would actually make it
faster.
This will be particularly true on architectures like IA-64 (Itanium etc.)
where the compiler spends huge amounts of effort scheduling instructions
to run in parallel, with a resultant significant gain in execution speed.
Some tests are even more dubious in terms of host-dependency -- for example,
the "dc" test uses the host's version of dc (a calculator program). The
version of this which is available can make a huge difference to the score,
which is why it's not in the index group. Read through the release notes
for more on these kinds of issues.
Another age-old issue is that of the benchmarks being too trivial to be
meaningful. With compilers getting ever smarter, and performing more
wide-ranging flow path analyses, the danger of parts of the benchmarks
simply being optimised out of existance is always present.
All in all, the "index" and "gindex" tests (see above) are designed to
give a reasonable measure of overall system performance; but the results
of any test run should always be used with care.

View File

@@ -0,0 +1,133 @@
Writing a Test
==============
Writing a test program is pretty easy. Basically, a test is configured via
a monster array in the Run script, which specifics (among other things) the
program to execute and the parameters to pass it.
The test itself is simply a program which is given the optional parameters
on the command line, and produces logging data on stdout and its results on
stderr.
============================================================================
Test Configuration
==================
In Run, all tests are named in the "$testList" array. This names the
individual tests, and also sets up aliases for groups of tests, eg. "index".
The test specifications are in the "$testParams" array. This contains the
details of each individual test as a hash. The fields in the hash are:
* "logmsg": the full name to display for this test.
* "cat": the category this test belongs to; must be configured
in $testCats.
* "prog": the name of the program to execute; defaults to the name of
the benchmark.
* "repeat": number of passes to run; either 'short' (the default),
'long', or 'single'. For 'short' and 'long', the actual numbers of
passes are given by $shortIterCount and $longIterCount, which are
configured at the top of the script or by the "-i" flag. 'single'
means just run one pass; this should be used for test which do their
own multi-pass handling internally.
* "stdout": non-0 to add the test's stdout to the log file; defaults to 1.
Set to 0 for tests that are too wordy.
* "stdin": name of a file to send to the program's stdin; default null.
* "options": options to be put on the program's command line; default null.
============================================================================
Output Format
=============
The results on stderr take the form of a line header and fields, separated
by "|" characters. A result line can be one of:
COUNT|score|timebase|label
TIME|seconds
ERROR|message
Any other text on stderr is treated as if it were:
ERROR|text
Any output to stdout is placed in a log file, and can be used for debugging.
COUNT
-----
The COUNT line is the line used to report a test score.
* "score" is the result, typically the number of loops performed during
the run
* "timebase" is the time base used for the final report to the user. A
value of 1 reports the score as is; a value of 60, for example, divides
the time taken by 60 to get loops per minute. Atimebase of zero indicates
that the score is already a rate, ie. a count of things per second.
* "label" is the label to use for the score; like "lps" (loops per
second), etc.
TIME
----
The TIME line is optionally used to report the time taken. The Run script
normally measures this, but if your test has signifant overhead outside the
actual test loop, you should use TIME to report the time taken for the actual
test. The argument is the time in seconds in floating-point.
ERROR
-----
The argument is an error message; this will abort the benchmarking run and
display the message.
Any output to stderr which is not a formatted line will be treated as an
error message, so use of ERROR is optional.
============================================================================
Test Examples
=============
Iteration Count
---------------
The simplest thing is to count the number of loops executed in a given time;
see eg. arith.c. The utlilty functions in timeit.c can be used to implement
the fixed time interval, which is generally passed in on the command line.
The result is reported simply as the number of iterations completed:
fprintf(stderr,"COUNT|%lu|1|lps\n", iterations);
The bnenchmark framework will measure the time taken itself. If the test
code has significant overhead (eg. a "pump-priming" pass), then you should
explicitly report the time taken for the test by adding a line like this:
fprintf(stderr, "TIME|%.1f\n", seconds);
If you want results reported as loops per minute, then set timebase to 60:
fprintf(stderr,"COUNT|%lu|60|lpm\n", iterations);
Note that this only affects the final report; all times passed to or
from the test are still in seconds.
Rate
----
The other technique is to calculate the rate (things per second) in the test,
and report that directly. To do this, just set timebase to 0:
fprintf(stderr, "COUNT|%ld|0|KBps\n", kbytes_per_sec);
Again, you can use TIME to explicitly report the time taken:
fprintf(stderr, "TIME|%.1f\n", end - start);
but this isn't so important since you've already calculated the rate.

View File

@@ -0,0 +1,476 @@
#!/usr/bin/perl -w
use strict;
############################################################################
# gfx-x11: a front-end for x11perf. Runs a selected x11perf test, and
# produces output in the format needed by UnixBench.
############################################################################
# Modification Log:
# 2007.09.26 Ian Smith Created
############################################################################
# This program runs sets of x11perf tests, indexes the results against
# a common base reference system (see $testData below), and reports the
# final score.
#
# Usage:
# gfx-x11 <group> <reps> <time>
# where:
# <group> is one of the test groups defined in $testGroups below
# <reps> is the number of repeats to do per test (the -repeat
# argument to x11perf)
# <time> is the number of seconds to run each repeat for (the
# -time argument to x11perf)
# Note that x11perf runs a calibration pass before the requested number
# of test passes. The score we compute for a test is the average of the
# test passes, divided by the base value in $testData, times 1000.0.
# The final score we report is the average of the test scores.
############################################################################
# TEST DATA
############################################################################
# This array lists all of the x11perf tests, together with their scores
# on an HP Compaq nc8430, with an ATI Mobility Radeon X1600 (256MB)
# graphics adapter. There isn't anything special about this reference
# system, but scaling all the scores back to a single reference system
# allows us to average them in a roughly meaningful way, which in turn
# allows us to produce sensible scores for the test groups defined below.
#
# The results we report are indexed to these values, at a base of 1000.0.
my $testData = {
'dot' => [ 31700000.0, "Dot" ],
'rect1' => [ 18400000.0, "1x1 rectangle" ],
'rect10' => [ 7180000.0, "10x10 rectangle" ],
'rect100' => [ 110000.0, "100x100 rectangle" ],
'rect500' => [ 4110.0, "500x500 rectangle" ],
'srect1' => [ 15800000.0, "1x1 stippled rectangle (8x8 stipple)" ],
'srect10' => [ 7400000.0, "10x10 stippled rectangle (8x8 stipple)" ],
'srect100' => [ 110000.0, "100x100 stippled rectangle (8x8 stipple)" ],
'srect500' => [ 4110.0, "500x500 stippled rectangle (8x8 stipple)" ],
'osrect1' => [ 15900000.0, "1x1 opaque stippled rectangle (8x8 stipple)" ],
'osrect10' => [ 7170000.0, "10x10 opaque stippled rectangle (8x8 stipple)" ],
'osrect100' => [ 110000.0, "100x100 opaque stippled rectangle (8x8 stipple)" ],
'osrect500' => [ 4110.0, "500x500 opaque stippled rectangle (8x8 stipple)" ],
'tilerect1' => [ 15800000.0, "1x1 tiled rectangle (4x4 tile)" ],
'tilerect10' => [ 7170000.0, "10x10 tiled rectangle (4x4 tile)" ],
'tilerect100' => [ 110000.0, "100x100 tiled rectangle (4x4 tile)" ],
'tilerect500' => [ 4110.0, "500x500 tiled rectangle (4x4 tile)" ],
'oddsrect1' => [ 2990000.0, "1x1 stippled rectangle (17x15 stipple)" ],
'oddsrect10' => [ 1490000.0, "10x10 stippled rectangle (17x15 stipple)" ],
'oddsrect100' => [ 55600.0, "100x100 stippled rectangle (17x15 stipple)" ],
'oddsrect500' => [ 2360.0, "500x500 stippled rectangle (17x15 stipple)" ],
'oddosrect1' => [ 2990000.0, "1x1 opaque stippled rectangle (17x15 stipple)" ],
'oddosrect10' => [ 1430000.0, "10x10 opaque stippled rectangle (17x15 stipple)" ],
'oddosrect100' => [ 54500.0, "100x100 opaque stippled rectangle (17x15 stipple)" ],
'oddosrect500' => [ 2320.0, "500x500 opaque stippled rectangle (17x15 stipple)" ],
'oddtilerect1' => [ 2990000.0, "1x1 tiled rectangle (17x15 tile)" ],
'oddtilerect10' => [ 1430000.0, "10x10 tiled rectangle (17x15 tile)" ],
'oddtilerect100' => [ 54500.0, "100x100 tiled rectangle (17x15 tile)" ],
'oddtilerect500' => [ 2320.0, "500x500 tiled rectangle (17x15 tile)" ],
'bigsrect1' => [ 4300000.0, "1x1 stippled rectangle (161x145 stipple)" ],
'bigsrect10' => [ 705000.0, "10x10 stippled rectangle (161x145 stipple)" ],
'bigsrect100' => [ 12300.0, "100x100 stippled rectangle (161x145 stipple)" ],
'bigsrect500' => [ 524.0, "500x500 stippled rectangle (161x145 stipple)" ],
'bigosrect1' => [ 3980000.0, "1x1 opaque stippled rectangle (161x145 stipple)" ],
'bigosrect10' => [ 644000.0, "10x10 opaque stippled rectangle (161x145 stipple)" ],
'bigosrect100' => [ 12800.0, "100x100 opaque stippled rectangle (161x145 stipple)" ],
'bigosrect500' => [ 584.0, "500x500 opaque stippled rectangle (161x145 stipple)" ],
'bigtilerect1' => [ 5970000.0, "1x1 tiled rectangle (161x145 tile)" ],
'bigtilerect10' => [ 684000.0, "10x10 tiled rectangle (161x145 tile)" ],
'bigtilerect100' => [ 16200.0, "100x100 tiled rectangle (161x145 tile)" ],
'bigtilerect500' => [ 872.0, "500x500 tiled rectangle (161x145 tile)" ],
'eschertilerect1' => [ 5940000.0, "1x1 tiled rectangle (216x208 tile)" ],
'eschertilerect10' => [ 639000.0, "10x10 tiled rectangle (216x208 tile)" ],
'eschertilerect100' => [ 18000.0, "100x100 tiled rectangle (216x208 tile)" ],
'eschertilerect500' => [ 922.0, "500x500 tiled rectangle (216x208 tile)" ],
'seg1' => [ 28800000.0, "1-pixel line segment" ],
'seg10' => [ 4460000.0, "10-pixel line segment" ],
'seg100' => [ 470000.0, "100-pixel line segment" ],
'seg500' => [ 94600.0, "500-pixel line segment" ],
'seg100c1' => [ 449000.0, "100-pixel line segment (1 kid)" ],
'seg100c2' => [ 432000.0, "100-pixel line segment (2 kids)" ],
'seg100c3' => [ 421000.0, "100-pixel line segment (3 kids)" ],
'dseg10' => [ 3720000.0, "10-pixel dashed segment" ],
'dseg100' => [ 687000.0, "100-pixel dashed segment" ],
'ddseg100' => [ 454000.0, "100-pixel double-dashed segment" ],
'hseg10' => [ 7020000.0, "10-pixel horizontal line segment" ],
'hseg100' => [ 2170000.0, "100-pixel horizontal line segment" ],
'hseg500' => [ 456000.0, "500-pixel horizontal line segment" ],
'vseg10' => [ 3990000.0, "10-pixel vertical line segment" ],
'vseg100' => [ 411000.0, "100-pixel vertical line segment" ],
'vseg500' => [ 82400.0, "500-pixel vertical line segment" ],
'whseg10' => [ 2880000.0, "10x1 wide horizontal line segment" ],
'whseg100' => [ 616000.0, "100x10 wide horizontal line segment" ],
'whseg500' => [ 33300.0, "500x50 wide horizontal line segment" ],
'wvseg10' => [ 2890000.0, "10x1 wide vertical line segment" ],
'wvseg100' => [ 584000.0, "100x10 wide vertical line segment" ],
'wvseg500' => [ 31700.0, "500x50 wide vertical line segment" ],
'line1' => [ 28300000.0, "1-pixel line" ],
'line10' => [ 4470000.0, "10-pixel line" ],
'line100' => [ 472000.0, "100-pixel line" ],
'line500' => [ 94200.0, "500-pixel line" ],
'dline10' => [ 3640000.0, "10-pixel dashed line" ],
'dline100' => [ 673000.0, "100-pixel dashed line" ],
'ddline100' => [ 453000.0, "100-pixel double-dashed line" ],
'wline10' => [ 908000.0, "10x1 wide line" ],
'wline100' => [ 146000.0, "100x10 wide line" ],
'wline500' => [ 30600.0, "500x50 wide line" ],
'wdline100' => [ 69900.0, "100x10 wide dashed line" ],
'wddline100' => [ 60600.0, "100x10 wide double-dashed line" ],
'orect10' => [ 5100000.0, "10x10 rectangle outline" ],
'orect100' => [ 709000.0, "100x100 rectangle outline" ],
'orect500' => [ 146000.0, "500x500 rectangle outline" ],
'worect10' => [ 4530000.0, "10x10 wide rectangle outline" ],
'worect100' => [ 204000.0, "100x100 wide rectangle outline" ],
'worect500' => [ 9790.0, "500x500 wide rectangle outline" ],
'circle1' => [ 5160000.0, "1-pixel circle" ],
'circle10' => [ 1160000.0, "10-pixel circle" ],
'circle100' => [ 141000.0, "100-pixel circle" ],
'circle500' => [ 28900.0, "500-pixel circle" ],
'dcircle100' => [ 98400.0, "100-pixel dashed circle" ],
'ddcircle100' => [ 75000.0, "100-pixel double-dashed circle" ],
'wcircle10' => [ 780000.0, "10-pixel wide circle" ],
'wcircle100' => [ 90900.0, "100-pixel wide circle" ],
'wcircle500' => [ 11300.0, "500-pixel wide circle" ],
'wdcircle100' => [ 8100.0, "100-pixel wide dashed circle" ],
'wddcircle100' => [ 8300.0, "100-pixel wide double-dashed circle" ],
'pcircle10' => [ 1270000.0, "10-pixel partial circle" ],
'pcircle100' => [ 212000.0, "100-pixel partial circle" ],
'wpcircle10' => [ 104000.0, "10-pixel wide partial circle" ],
'wpcircle100' => [ 39000.0, "100-pixel wide partial circle" ],
'fcircle1' => [ 61300000.0, "1-pixel solid circle" ],
'fcircle10' => [ 1720000.0, "10-pixel solid circle" ],
'fcircle100' => [ 120000.0, "100-pixel solid circle" ],
'fcircle500' => [ 5170.0, "500-pixel solid circle" ],
'fcpcircle10' => [ 981000.0, "10-pixel fill chord partial circle" ],
'fcpcircle100' => [ 205000.0, "100-pixel fill chord partial circle" ],
'fspcircle10' => [ 876000.0, "10-pixel fill slice partial circle" ],
'fspcircle100' => [ 187000.0, "100-pixel fill slice partial circle" ],
'ellipse10' => [ 1410000.0, "10-pixel ellipse" ],
'ellipse100' => [ 172000.0, "100-pixel ellipse" ],
'ellipse500' => [ 35100.0, "500-pixel ellipse" ],
'dellipse100' => [ 114000.0, "100-pixel dashed ellipse" ],
'ddellipse100' => [ 88900.0, "100-pixel double-dashed ellipse" ],
'wellipse10' => [ 889000.0, "10-pixel wide ellipse" ],
'wellipse100' => [ 124000.0, "100-pixel wide ellipse" ],
'wellipse500' => [ 15600.0, "500-pixel wide ellipse" ],
'wdellipse100' => [ 7730.0, "100-pixel wide dashed ellipse" ],
'wddellipse100' => [ 6680.0, "100-pixel wide double-dashed ellipse" ],
'pellipse10' => [ 1350000.0, "10-pixel partial ellipse" ],
'pellipse100' => [ 260000.0, "100-pixel partial ellipse" ],
'wpellipse10' => [ 97900.0, "10-pixel wide partial ellipse" ],
'wpellipse100' => [ 16800.0, "100-pixel wide partial ellipse" ],
'fellipse10' => [ 2110000.0, "10-pixel filled ellipse" ],
'fellipse100' => [ 212000.0, "100-pixel filled ellipse" ],
'fellipse500' => [ 11000.0, "500-pixel filled ellipse" ],
'fcpellipse10' => [ 1060000.0, "10-pixel fill chord partial ellipse" ],
'fcpellipse100' => [ 296000.0, "100-pixel fill chord partial ellipse" ],
'fspellipse10' => [ 945000.0, "10-pixel fill slice partial ellipse" ],
'fspellipse100' => [ 269000.0, "100-pixel fill slice partial ellipse" ],
'triangle1' => [ 2460000.0, "Fill 1x1 equivalent triangle" ],
'triangle10' => [ 969000.0, "Fill 10x10 equivalent triangle" ],
'triangle100' => [ 97000.0, "Fill 100x100 equivalent triangle" ],
'trap1' => [ 2630000.0, "Fill 1x1 trapezoid" ],
'trap10' => [ 1260000.0, "Fill 10x10 trapezoid" ],
'trap100' => [ 106000.0, "Fill 100x100 trapezoid" ],
'trap300' => [ 11600.0, "Fill 300x300 trapezoid" ],
'strap1' => [ 2010000.0, "Fill 1x1 stippled trapezoid (8x8 stipple)" ],
'strap10' => [ 910000.0, "Fill 10x10 stippled trapezoid (8x8 stipple)" ],
'strap100' => [ 104000.0, "Fill 100x100 stippled trapezoid (8x8 stipple)" ],
'strap300' => [ 11700.0, "Fill 300x300 stippled trapezoid (8x8 stipple)" ],
'ostrap1' => [ 2000000.0, "Fill 1x1 opaque stippled trapezoid (8x8 stipple)" ],
'ostrap10' => [ 907000.0, "Fill 10x10 opaque stippled trapezoid (8x8 stipple)" ],
'ostrap100' => [ 104000.0, "Fill 100x100 opaque stippled trapezoid (8x8 stipple)" ],
'ostrap300' => [ 11600.0, "Fill 300x300 opaque stippled trapezoid (8x8 stipple)" ],
'tiletrap1' => [ 1430000.0, "Fill 1x1 tiled trapezoid (4x4 tile)" ],
'tiletrap10' => [ 778000.0, "Fill 10x10 tiled trapezoid (4x4 tile)" ],
'tiletrap100' => [ 104000.0, "Fill 100x100 tiled trapezoid (4x4 tile)" ],
'tiletrap300' => [ 11600.0, "Fill 300x300 tiled trapezoid (4x4 tile)" ],
'oddstrap1' => [ 1700000.0, "Fill 1x1 stippled trapezoid (17x15 stipple)" ],
'oddstrap10' => [ 296000.0, "Fill 10x10 stippled trapezoid (17x15 stipple)" ],
'oddstrap100' => [ 18600.0, "Fill 100x100 stippled trapezoid (17x15 stipple)" ],
'oddstrap300' => [ 2090.0, "Fill 300x300 stippled trapezoid (17x15 stipple)" ],
'oddostrap1' => [ 1830000.0, "Fill 1x1 opaque stippled trapezoid (17x15 stipple)" ],
'oddostrap10' => [ 296000.0, "Fill 10x10 opaque stippled trapezoid (17x15 stipple)" ],
'oddostrap100' => [ 18400.0, "Fill 100x100 opaque stippled trapezoid (17x15 stipple)" ],
'oddostrap300' => [ 2080.0, "Fill 300x300 opaque stippled trapezoid (17x15 stipple)" ],
'oddtiletrap1' => [ 1710000.0, "Fill 1x1 tiled trapezoid (17x15 tile)" ],
'oddtiletrap10' => [ 296000.0, "Fill 10x10 tiled trapezoid (17x15 tile)" ],
'oddtiletrap100' => [ 18400.0, "Fill 100x100 tiled trapezoid (17x15 tile)" ],
'oddtiletrap300' => [ 2080.0, "Fill 300x300 tiled trapezoid (17x15 tile)" ],
'bigstrap1' => [ 1510000.0, "Fill 1x1 stippled trapezoid (161x145 stipple)" ],
'bigstrap10' => [ 235000.0, "Fill 10x10 stippled trapezoid (161x145 stipple)" ],
'bigstrap100' => [ 9110.0, "Fill 100x100 stippled trapezoid (161x145 stipple)" ],
'bigstrap300' => [ 1260.0, "Fill 300x300 stippled trapezoid (161x145 stipple)" ],
'bigostrap1' => [ 1480000.0, "Fill 1x1 opaque stippled trapezoid (161x145 stipple)" ],
'bigostrap10' => [ 213000.0, "Fill 10x10 opaque stippled trapezoid (161x145 stipple)" ],
'bigostrap100' => [ 8830.0, "Fill 100x100 opaque stippled trapezoid (161x145 stipple)" ],
'bigostrap300' => [ 1420.0, "Fill 300x300 opaque stippled trapezoid (161x145 stipple)" ],
'bigtiletrap1' => [ 1630000.0, "Fill 1x1 tiled trapezoid (161x145 tile)" ],
'bigtiletrap10' => [ 272000.0, "Fill 10x10 tiled trapezoid (161x145 tile)" ],
'bigtiletrap100' => [ 12900.0, "Fill 100x100 tiled trapezoid (161x145 tile)" ],
'bigtiletrap300' => [ 2350.0, "Fill 300x300 tiled trapezoid (161x145 tile)" ],
'eschertiletrap1' => [ 1650000.0, "Fill 1x1 tiled trapezoid (216x208 tile)" ],
'eschertiletrap10' => [ 273000.0, "Fill 10x10 tiled trapezoid (216x208 tile)" ],
'eschertiletrap100' => [ 13400.0, "Fill 100x100 tiled trapezoid (216x208 tile)" ],
'eschertiletrap300' => [ 2450.0, "Fill 300x300 tiled trapezoid (216x208 tile)" ],
'aatrap1' => [ 260000.0, "Fill 1x1 aa trap" ],
'aatrap10' => [ 23500.0, "Fill 10x10 aa trap" ],
'aatrap100' => [ 13300.0, "Fill 100x100 aa trap" ],
'aatrap300' => [ 4450.0, "Fill 300x300 aa trap" ],
'aa4trap1' => [ 2150.0, "Fill 1x1 aa trap with 4 bit alpha" ],
'aa4trap10' => [ 2130.0, "Fill 10x10 aa trap with 4 bit alpha" ],
'aa4trap100' => [ 1890.0, "Fill 100x100 aa trap with 4 bit alpha" ],
'aa4trap300' => [ 1460.0, "Fill 300x300 aa trap with 4 bit alpha" ],
'aa1trap1' => [ 2200000.0, "Fill 1x1 aa trap with 1 bit alpha" ],
'aa1trap10' => [ 357000.0, "Fill 10x10 aa trap with 1 bit alpha" ],
'aa1trap100' => [ 167000.0, "Fill 100x100 aa trap with 1 bit alpha" ],
'aa1trap300' => [ 67000.0, "Fill 300x300 aa trap with 1 bit alpha" ],
'aatrap2x1' => [ 368000.0, "Fill 2x1 aa trap" ],
'aatrap2x10' => [ 25700.0, "Fill 2x10 aa trap" ],
'aatrap2x100' => [ 12400.0, "Fill 2x100 aa trap" ],
'aatrap2x300' => [ 5710.0, "Fill 2x300 aa trap" ],
'aatrapezoid1' => [ 372000.0, "Fill 1x1 aa trapezoid" ],
'aatrapezoid10' => [ 137000.0, "Fill 10x10 aa trapezoid" ],
'aatrapezoid100' => [ 9590.0, "Fill 100x100 aa trapezoid" ],
'aatrapezoid300' => [ 1420.0, "Fill 300x300 aa trapezoid" ],
'addaatrapezoid1' => [ 433000.0, "Fill 1x1 aa pre-added trapezoid" ],
'addaatrapezoid10' => [ 24100.0, "Fill 10x10 aa pre-added trapezoid" ],
'addaatrapezoid100' => [ 13300.0, "Fill 100x100 aa pre-added trapezoid" ],
'addaatrapezoid300' => [ 4460.0, "Fill 300x300 aa pre-added trapezoid" ],
'complex10' => [ 655000.0, "Fill 10x10 equivalent complex polygon" ],
'complex100' => [ 87000.0, "Fill 100x100 equivalent complex polygons" ],
'64poly10convex' => [ 481000.0, "Fill 10x10 64-gon (Convex)" ],
'64poly100convex' => [ 105000.0, "Fill 100x100 64-gon (Convex)" ],
'64poly10complex' => [ 353000.0, "Fill 10x10 64-gon (Complex)" ],
'64poly100complex' => [ 105000.0, "Fill 100x100 64-gon (Complex)" ],
'ftext' => [ 2200000.0, "Char in 80-char line (6x13)" ],
'f8text' => [ 1970000.0, "Char in 70-char line (8x13)" ],
'f9text' => [ 1690000.0, "Char in 60-char line (9x15)" ],
'f14text16' => [ 679000.0, "Char16 in 40-char line (k14)" ],
'f24text16' => [ 272000.0, "Char16 in 23-char line (k24)" ],
'tr10text' => [ 2520000.0, "Char in 80-char line (TR 10)" ],
'tr24text' => [ 940000.0, "Char in 30-char line (TR 24)" ],
'polytext' => [ 2230000.0, "Char in 20/40/20 line (6x13, TR 10)" ],
'polytext16' => [ 369000.0, "Char16 in 7/14/7 line (k14, k24)" ],
'fitext' => [ 1350000.0, "Char in 80-char image line (6x13)" ],
'f8itext' => [ 1130000.0, "Char in 70-char image line (8x13)" ],
'f9itext' => [ 902000.0, "Char in 60-char image line (9x15)" ],
'f14itext16' => [ 449000.0, "Char16 in 40-char image line (k14)" ],
'f24itext16' => [ 169000.0, "Char16 in 23-char image line (k24)" ],
'tr10itext' => [ 1590000.0, "Char in 80-char image line (TR 10)" ],
'tr24itext' => [ 435000.0, "Char in 30-char image line (TR 24)" ],
'aa10text' => [ 53200.0, "Char in 80-char aa line (Charter 10)" ],
'aa24text' => [ 13300.0, "Char in 30-char aa line (Charter 24)" ],
'aaftext' => [ 45200.0, "Char in 80-char aa line (Courier 12)" ],
'a10text' => [ 53100.0, "Char in 80-char a line (Charter 10)" ],
'a24text' => [ 13300.0, "Char in 30-char a line (Charter 24)" ],
'aftext' => [ 45200.0, "Char in 80-char a line (Courier 12)" ],
'rgb10text' => [ 49400.0, "Char in 80-char rgb line (Charter 10)" ],
'rgb24text' => [ 10200.0, "Char in 30-char rgb line (Charter 24)" ],
'rgbftext' => [ 42200.0, "Char in 80-char rgb line (Courier 12)" ],
'caa10text' => [ 15300.0, "Char in 80-char aa core line (Charter 10)" ],
'caa24text' => [ 2540.0, "Char in 30-char aa core line (Charter 24)" ],
'caaftext' => [ 10900.0, "Char in 80-char aa core line (Courier 12)" ],
'ca10text' => [ 15300.0, "Char in 80-char a core line (Charter 10)" ],
'ca24text' => [ 2540.0, "Char in 30-char a core line (Charter 24)" ],
'caftext' => [ 10900.0, "Char in 80-char a core line (Courier 12)" ],
'rgb10text' => [ 15000.0, "Char in 80-char rgb core line (Charter 10)" ],
'rgb24text' => [ 2510.0, "Char in 30-char rgb core line (Charter 24)" ],
'rgbftext' => [ 10700.0, "Char in 80-char rgb core line (Courier 12)" ],
'scroll10' => [ 1310000.0, "Scroll 10x10 pixels" ],
'scroll100' => [ 52000.0, "Scroll 100x100 pixels" ],
'scroll500' => [ 2190.0, "Scroll 500x500 pixels" ],
'copywinwin10' => [ 1030000.0, "Copy 10x10 from window to window" ],
'copywinwin100' => [ 52200.0, "Copy 100x100 from window to window" ],
'copywinwin500' => [ 2080.0, "Copy 500x500 from window to window" ],
'copypixwin10' => [ 502000.0, "Copy 10x10 from pixmap to window" ],
'copypixwin100' => [ 20300.0, "Copy 100x100 from pixmap to window" ],
'copypixwin500' => [ 1020.0, "Copy 500x500 from pixmap to window" ],
'copywinpix10' => [ 7730.0, "Copy 10x10 from window to pixmap" ],
'copywinpix100' => [ 127.0, "Copy 100x100 from window to pixmap" ],
'copywinpix500' => [ 5.0, "Copy 500x500 from window to pixmap" ],
'copypixpix10' => [ 1260000.0, "Copy 10x10 from pixmap to pixmap" ],
'copypixpix100' => [ 56300.0, "Copy 100x100 from pixmap to pixmap" ],
'copypixpix500' => [ 2470.0, "Copy 500x500 from pixmap to pixmap" ],
'copyplane10' => [ 466000.0, "Copy 10x10 1-bit deep plane" ],
'copyplane100' => [ 13700.0, "Copy 100x100 1-bit deep plane" ],
'copyplane500' => [ 671.0, "Copy 500x500 1-bit deep plane" ],
'deepcopyplane10' => [ 151000.0, "Copy 10x10 n-bit deep plane" ],
'deepcopyplane100' => [ 6090.0, "Copy 100x100 n-bit deep plane" ],
'deepcopyplane500' => [ 278.0, "Copy 500x500 n-bit deep plane" ],
'putimage10' => [ 434000.0, "PutImage 10x10 square" ],
'putimage100' => [ 13600.0, "PutImage 100x100 square" ],
'putimage500' => [ 713.0, "PutImage 500x500 square" ],
'putimagexy10' => [ 321.0, "PutImage XY 10x10 square" ],
'putimagexy100' => [ 3.2, "PutImage XY 100x100 square" ],
'putimagexy500' => [ 0.1, "PutImage XY 500x500 square" ],
'shmput10' => [ 465000.0, "ShmPutImage 10x10 square" ],
'shmput100' => [ 20200.0, "ShmPutImage 100x100 square" ],
'shmput500' => [ 1020.0, "ShmPutImage 500x500 square" ],
'shmputxy10' => [ 31400.0, "ShmPutImage XY 10x10 square" ],
'shmputxy100' => [ 458.0, "ShmPutImage XY 100x100 square" ],
'shmputxy500' => [ 19.0, "ShmPutImage XY 500x500 square" ],
'getimage10' => [ 6650.0, "GetImage 10x10 square" ],
'getimage100' => [ 77.0, "GetImage 100x100 square" ],
'getimage500' => [ 3.1, "GetImage 500x500 square" ],
'getimagexy10' => [ 320.0, "GetImage XY 10x10 square" ],
'getimagexy100' => [ 3.2, "GetImage XY 100x100 square" ],
'getimagexy500' => [ 0.1, "GetImage XY 500x500 square" ],
'noop' => [ 8760000.0, "X protocol NoOperation" ],
'pointer' => [ 54800.0, "QueryPointer" ],
'prop' => [ 50900.0, "GetProperty" ],
'gc' => [ 1190000.0, "Change graphics context" ],
'create' => [ 597000.0, "Create and map subwindows (25 kids)" ],
'ucreate' => [ 1100000.0, "Create unmapped window (25 kids)" ],
'map' => [ 1350000.0, "Map window via parent (25 kids)" ],
'unmap' => [ 3360000.0, "Unmap window via parent (25 kids)" ],
'destroy' => [ 1190000.0, "Destroy window via parent (25 kids)" ],
'popup' => [ 660000.0, "Hide/expose window via popup (25 kids)" ],
'move' => [ 120000.0, "Move window (25 kids)" ],
'umove' => [ 1990000.0, "Moved unmapped window (25 kids)" ],
'movetree' => [ 877000.0, "Move window via parent (25 kids)" ],
'resize' => [ 136000.0, "Resize window (25 kids)" ],
'uresize' => [ 1870000.0, "Resize unmapped window (25 kids)" ],
'circulate' => [ 56300.0, "Circulate window (25 kids)" ],
'ucirculate' => [ 3630000.0, "Circulate Unmapped window (25 kids)" ],
};
# This array defines named groups of tests. This is designed to allow
# for simpler runs of related tests.
#
# Note that this array does *not* include all the x11perf tests. The idea
# here is to run a representative sampling of the available tests, to get
# a general idea of a system's performance, without taking forever to
# do it. If you want to do detailed analysis of an X server or graphics
# chip, then use x11perf directly.
my $testGroups = {
'rects' => [ "rect10", "rect100", "oddtilerect10", "eschertilerect100" ],
'lines' => [ "seg100c3", "wvseg100", "ddline100", "worect500" ],
'circle' => [ "circle500", "wddcircle100", "wpcircle100", "fspcircle100" ],
'ellipse' => [ "ddellipse100", "wddellipse100", "pellipse10", "fspellipse100" ],
'shapes' => [ "triangle10", "trap300", "oddostrap300", "eschertiletrap300" ],
'aashapes' => [ "aa4trap300", "aa1trap10", "aatrap2x300", "addaatrapezoid300" ],
'polys' => [ "complex10", "64poly100convex", "64poly10complex", "64poly100complex" ],
'text' => [ "polytext16", "rgb24text", "caa10text", "ca24text" ],
'blit' => [ "scroll100", "copypixwin10", "deepcopyplane10", "putimagexy500" ],
'window' => [ "popup", "move", "movetree", "resize" ],
};
############################################################################
# CODE
############################################################################
# Exec the given command, and catch its standard output.
# We return an array containing the PID and the filehandle on the
# process' standard output. It's up to the caller to wait for the command
# to terminate.
sub command {
my ( $cmd ) = @_;
my $pid = open(my $childFd, "-|");
if (!defined($pid)) {
die("Run: fork() failed (undef)\n");
} elsif ($pid == 0) {
exec($cmd);
die("Run: exec() failed (returned)\n");
}
return ( $pid, $childFd );
}
# Get data from running a system command. Used for things like getting
# the host OS from `uname -o` etc.
#
# Ignores initial blank lines from the command and returns the first
# non-blank line, with white space trimmed off.
sub runTest {
my ( $test, $reps, $time ) = @_;
my $tdata = $testData->{$test};
if (!defined($tdata)) {
printf STDERR "gfx-x11: No such test: %s\n", $test;
exit(9);
}
my $cmd = sprintf "x11perf -repeat %d -subs 25 -time %d -%s",
$reps, $time, $test;
my ( $pid, $fd ) = command($cmd);
my $average = 0;
while (<$fd>) {
chomp;
# Display the output for logging.
printf "%s\n", $_;
# Save the score.
my ( $reps, $per, $rate ) =
( m:([0-9]+)\s+trep\s+@\s+([0-9.]+)\s+msec\s+\(\s*([0-9.]+)/sec\): );
$average = $rate if (defined($rate));
}
# Close the command and wait for it to die. Bomb out if it failed.
# close($fd);
my $p = waitpid($pid, 0);
my $status = $?;
exit($status) if ($status != 0);
# Calculate and return the weighted result.
my $score = $average / $tdata->[0] * 1000.0;
printf "Test %s: %d --> %.1f\n", $test, $average, $score;
return $score;
}
sub runGroup {
my ( $group, $reps, $time ) = @_;
my $gdata = $testGroups->{$group};
if (!defined($gdata)) {
printf STDERR "gfx-x11: No such test group: %s\n", $group;
exit(9);
}
my $count = 0;
my $total = 0;
foreach my $test (@$gdata) {
$total += runTest($test, $reps, $time);
++$count;
}
$total /= $count;
$total;
}
############################################################################
# MAIN
############################################################################
sub main {
my @args = @_;
if (scalar(@args) < 3) {
printf STDERR "Usage: gfx-x11 group reps time\n";
exit(9);
}
my $reps = $args[1];
my $time = $args[2];
my $score = runGroup($args[0], $reps, $time);
printf STDERR "COUNT|%.1f|0|score\n", $score;
return 0;
}
exit(main(@ARGV));

View File

@@ -0,0 +1,46 @@
# Baseline benchmark scores, used for calculating index results.
# Scores from "George", a SPARCstation 20-61.
dhry2reg|10|lps|116700|116700|2
whetstone-double|10|MWIPS|55.0|55.0|2
execl|20|lps|43.0|43.0|1
fstime|20|KBps|3960|3960|1
fsbuffer|20|KBps|1655|1655|1
fsdisk|20|KBps|5800|5800|1
pipe|10|lps|12440|12440|2
context1|10|lps|4000|4000|2
spawn|20|lps|126|126|1
shell8|60|lpm|6|6|1
syscall|10|lps|15000|15000|2
# The shell1 test was added to the index in 5.0, and this baseline score
# was extrapolated to roughly match George's performance.
shell1|60|lpm|42.4|42.4|1
# The 2D baseline scores were derived from a test run on an HP Compaq nc8430
# with an ATI Mobility Radeon X1600 Video (256MB) — this is a fairly
# common modern adaptor with 3D. The baseline scores here are then
# 1/66.6 of the values from that run, to bring them roughly in line with
# George. (The HP has an index score of 666.6 single-process.)
2d-rects|3|score|15|15|1
#2d-lines|3|score|15|15|1
#2d-circle|3|score|15|15|1
2d-ellipse|3|score|15|15|1
#2d-shapes|3|score|15|15|1
2d-aashapes|3|score|15|15|1
#2d-polys|3|score|15|15|1
2d-text|3|score|15|15|1
2d-blit|3|score|15|15|1
2d-window|3|score|15|15|1
# The gears test score is derived from a test run on an HP Compaq nc8430
# with an ATI Mobility Radeon X1600 Video (256MB) — this is a fairly
# common modern adaptor with 3D. The baseline scores here are then
# 1/66.6 of the values from that run, to bring them roughly in line with
# George.
ubgears|20|fps|33.4|33.4|3
# The grep and sysexec tests were added in 5.1.1; they are not index tests,
# but these baseline scores were added for convenience.
grep|30|lpm|1|1|3
sysexec|10|lps|25|25|10

View File

@@ -0,0 +1,23 @@
#! /bin/sh
###############################################################################
# The BYTE UNIX Benchmarks - Release 3
# Module: multi.sh SID: 3.4 5/15/91 19:30:24
#
###############################################################################
# Bug reports, patches, comments, suggestions should be sent to:
#
# Ben Smith or Rick Grehan at BYTE Magazine
# ben@bytepb.UUCP rick_g@bytepb.UUCP
#
###############################################################################
# Modification Log:
#
###############################################################################
ID="@(#)multi.sh:3.4 -- 5/15/91 19:30:24";
instance=1
while [ $instance -le $1 ]; do
/bin/sh "$UB_BINDIR/tst.sh" &
instance=`expr $instance + 1`
done
wait

View File

@@ -0,0 +1,19 @@
#! /bin/sh
###############################################################################
# The BYTE UNIX Benchmarks - Release 3
# Module: tst.sh SID: 3.4 5/15/91 19:30:24
#
###############################################################################
# Bug reports, patches, comments, suggestions should be sent to:
#
# Ben Smith or Rick Grehan at BYTE Magazine
# ben@bytepb.UUCP rick_g@bytepb.UUCP
#
###############################################################################
# Modification Log:
#
###############################################################################
ID="@(#)tst.sh:3.4 -- 5/15/91 19:30:24";
sort >sort.$$ <sort.src
grep the sort.$$ | tee grep.$$ | wc > wc.$$
rm sort.$$ grep.$$ wc.$$

View File

@@ -0,0 +1,14 @@
# # # # # # # ##### ###### # # #### # #
# # ## # # # # # # # ## # # # # #
# # # # # # ## ##### ##### # # # # ######
# # # # # # ## # # # # # # # # #
# # # ## # # # # # # # ## # # # #
#### # # # # # ##### ###### # # #### # #
Version 5.1.2 Based on the Byte Magazine Unix Benchmark
Multi-CPU version Version 5 revisions by Ian Smith,
Sunnyvale, CA, USA
December 22, 2007 johantheghost at yahoo period com

View File

@@ -0,0 +1,8 @@
#!/bin/sh
export CC=cc
export MINIX=1
if perl -e 'exit 0'
then perl -w Run
else echo "perl not installed. please install perl to run unixbench." >&2
exit 1
fi

View File

@@ -0,0 +1,108 @@
/*******************************************************************************
* The BYTE UNIX Benchmarks - Release 3
* Module: arith.c SID: 3.3 5/15/91 19:30:19
*
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith, Rick Grehan or Tom Yager
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
*
*******************************************************************************
* Modification Log:
* May 12, 1989 - modified empty loops to avoid nullifying by optimizing
* compilers
* August 28, 1990 - changed timing relationship--now returns total number
* of iterations (ty)
* November 9, 1990 - made changes suggested by Keith Cantrell
* (digi!kcantrel) to defeat optimization
* to non-existence
* October 22, 1997 - code cleanup to remove ANSI C compiler warnings
* Andy Kahn <kahn@zk3.dec.com>
*
******************************************************************************/
char SCCSid[] = "@(#) @(#)arith.c:3.3 -- 5/15/91 19:30:19";
/*
* arithmetic test
*
*/
#include <stdio.h>
#include <stdlib.h>
#include "timeit.c"
int dumb_stuff(int);
unsigned long iter;
/* this function is called when the alarm expires */
void report(int sig)
{
fprintf(stderr,"COUNT|%ld|1|lps\n", iter);
exit(0);
}
int main(int argc, char *argv[])
{
int duration;
int result = 0;
if (argc != 2) {
printf("Usage: %s duration\n", argv[0]);
exit(1);
}
duration = atoi(argv[1]);
/* set up alarm call */
iter = 0; /* init iteration count */
wake_me(duration, report);
/* this loop will be interrupted by the alarm call */
while (1)
{
/* in switching to time-based (instead of iteration-based),
the following statement was added. It should not skew
the timings too much--there was an increment and test
in the "while" expression above. The only difference is
that now we're incrementing a long instead of an int. (ty) */
++iter;
/* the loop calls a function to insure that something is done
the results of the function are fed back in (just so they
they won't be thrown away. A loop with
unused assignments may get optimized out of existence */
result = dumb_stuff(result);
}
}
/************************** dumb_stuff *******************/
int dumb_stuff(i)
int i;
{
#ifndef arithoh
datum x, y, z;
z = 0;
#endif
/*
* 101
* sum i*i/(i*i-1)
* i=2
*/
/* notice that the i value is always reset by the loop */
for (i=2; i<=101; i++)
{
#ifndef arithoh
x = i;
y = x*x;
z += y/(y-1);
}
return(x+y+z);
#else
}
return(0);
#endif
}

View File

@@ -0,0 +1,595 @@
/*******************************************************************************
* The BYTE UNIX Benchmarks - Release 3
* Module: big.c SID: 3.3 5/15/91 19:30:18
*
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith, Rick Grehan or Tom Yager
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
*
*******************************************************************************
* Modification Log:
* 10/22/97 - code cleanup to remove ANSI C compiler warnings
* Andy Kahn <kahn@zk3.dec.com>
*
******************************************************************************/
/*
* dummy code for execl test [ old version of makework.c ]
*
* makework [ -r rate ] [ -c copyfile ] nusers
*
* job streams are specified on standard input with lines of the form
* full_path_name_for_command [ options ] [ <standard_input_file ]
*
* "standard input" is send to all nuser instances of the commands in the
* job streams at a rate not in excess of "rate" characters per second
* per command
*
*/
/* this code is included in other files and therefore has no SCCSid */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
#include <fcntl.h>
#include <time.h>
#include <string.h>
#include <sys/wait.h>
#define DEF_RATE 5.0
#define GRANULE 5
#define CHUNK 60
#define MAXCHILD 12
#define MAXWORK 10
/* Can't seem to get this declared in the headers... */
extern int kill(pid_t pid, int sig);
void wrapup(char *);
void onalarm(int);
void pipeerr(int sig);
void grunt(int sig);
void getwork(void);
#if debug
void dumpwork(void);
#endif
void fatal(char *s);
float thres;
float est_rate = DEF_RATE;
int nusers; /* number of concurrent users to be simulated by
* this process */
int firstuser; /* ordinal identification of first user for this
* process */
int nwork = 0; /* number of job streams */
int exit_status = 0; /* returned to parent */
int sigpipe; /* pipe write error flag */
struct st_work {
char *cmd; /* name of command to run */
char **av; /* arguments to command */
char *input; /* standard input buffer */
int inpsize; /* size of standard input buffer */
char *outf; /* standard output (filename) */
} work[MAXWORK];
struct {
int xmit; /* # characters sent */
char *bp; /* std input buffer pointer */
int blen; /* std input buffer length */
int fd; /* stdin to command */
int pid; /* child PID */
char *line; /* start of input line */
int firstjob; /* inital piece of work */
int thisjob; /* current piece of work */
} child[MAXCHILD], *cp;
int main(int argc, char *argv[])
{
int i;
int l;
int fcopy = 0; /* fd for copy output */
int master = 1; /* the REAL master, == 0 for clones */
int nchild; /* no. of children for a clone to run */
int done; /* count of children finished */
int output; /* aggregate output char count for all
children */
int c;
int thiswork = 0; /* next job stream to allocate */
int nch; /* # characters to write */
int written; /* # characters actully written */
char logname[15]; /* name of the log file(s) */
int pvec[2]; /* for pipes */
char *p;
char *prog; /* my name */
#if ! debug
freopen("masterlog.00", "a", stderr);
#endif
prog = argv[0];
while (argc > 1 && argv[1][0] == '-') {
p = &argv[1][1];
argc--;
argv++;
while (*p) {
switch (*p) {
case 'r':
est_rate = atoi(argv[1]);
sscanf(argv[1], "%f", &est_rate);
if (est_rate <= 0) {
fprintf(stderr, "%s: bad rate, reset to %.2f chars/sec\n", prog, DEF_RATE);
est_rate = DEF_RATE;
}
argc--;
argv++;
break;
case 'c':
fcopy = open(argv[1], 1);
if (fcopy < 0)
fcopy = creat(argv[1], 0600);
if (fcopy < 0) {
fprintf(stderr, "%s: cannot open copy file '%s'\n",
prog, argv[1]);
exit(2);
}
lseek(fcopy, 0L, 2); /* append at end of file */
argc--;
argv++;
break;
default:
fprintf(stderr, "%s: bad flag '%c'\n", prog, *p);
exit(4);
}
p++;
}
}
if (argc < 2) {
fprintf(stderr, "%s: missing nusers\n", prog);
exit(4);
}
nusers = atoi(argv[1]);
if (nusers < 1) {
fprintf(stderr, "%s: impossible nusers (%d<-%s)\n", prog, nusers, argv[1]);
exit(4);
}
fprintf(stderr, "%d Users\n", nusers);
argc--;
argv++;
/* build job streams */
getwork();
#if debug
dumpwork();
#endif
/* clone copies of myself to run up to MAXCHILD jobs each */
firstuser = MAXCHILD;
fprintf(stderr, "master pid %d\n", getpid());
fflush(stderr);
while (nusers > MAXCHILD) {
fflush(stderr);
if (nusers >= 2*MAXCHILD)
/* the next clone must run MAXCHILD jobs */
nchild = MAXCHILD;
else
/* the next clone must run the leftover jobs */
nchild = nusers - MAXCHILD;
if ((l = fork()) == -1) {
/* fork failed */
fatal("** clone fork failed **\n");
goto bepatient;
} else if (l > 0) {
fprintf(stderr, "master clone pid %d\n", l);
/* I am the master with nchild fewer jobs to run */
nusers -= nchild;
firstuser += MAXCHILD;
continue;
} else {
/* I am a clone, run MAXCHILD jobs */
#if ! debug
sprintf(logname, "masterlog.%02d", firstuser/MAXCHILD);
freopen(logname, "w", stderr);
#endif
master = 0;
nusers = nchild;
break;
}
}
if (master)
firstuser = 0;
close(0);
for (i = 0; i < nusers; i++ ) {
fprintf(stderr, "user %d job %d ", firstuser+i, thiswork);
if (pipe(pvec) == -1) {
/* this is fatal */
fatal("** pipe failed **\n");
goto bepatient;
}
fflush(stderr);
if ((child[i].pid = fork()) == 0) {
int fd;
/* the command */
if (pvec[0] != 0) {
close(0);
dup(pvec[0]);
}
#if ! debug
sprintf(logname, "userlog.%02d", firstuser+i);
freopen(logname, "w", stderr);
#endif
for (fd = 3; fd < 24; fd++)
close(fd);
if (work[thiswork].outf[0] != '\0') {
/* redirect std output */
char *q;
for (q = work[thiswork].outf; *q != '\n'; q++) ;
*q = '\0';
if (freopen(work[thiswork].outf, "w", stdout) == NULL) {
fprintf(stderr, "makework: cannot open %s for std output\n",
work[thiswork].outf);
fflush(stderr);
}
*q = '\n';
}
execv(work[thiswork].cmd, work[thiswork].av);
/* don't expect to get here! */
fatal("** exec failed **\n");
goto bepatient;
}
else if (child[i].pid == -1) {
fatal("** fork failed **\n");
goto bepatient;
}
else {
close(pvec[0]);
child[i].fd = pvec[1];
child[i].line = child[i].bp = work[thiswork].input;
child[i].blen = work[thiswork].inpsize;
child[i].thisjob = thiswork;
child[i].firstjob = thiswork;
fprintf(stderr, "pid %d pipe fd %d", child[i].pid, child[i].fd);
if (work[thiswork].outf[0] != '\0') {
char *q;
fprintf(stderr, " > ");
for (q=work[thiswork].outf; *q != '\n'; q++)
fputc(*q, stderr);
}
fputc('\n', stderr);
thiswork++;
if (thiswork >= nwork)
thiswork = 0;
}
}
fflush(stderr);
srand(time(0));
thres = 0;
done = output = 0;
for (i = 0; i < nusers; i++) {
if (child[i].blen == 0)
done++;
else
thres += est_rate * GRANULE;
}
est_rate = thres;
signal(SIGALRM, onalarm);
signal(SIGPIPE, pipeerr);
alarm(GRANULE);
while (done < nusers) {
for (i = 0; i < nusers; i++) {
cp = &child[i];
if (cp->xmit >= cp->blen) continue;
l = rand() % CHUNK + 1; /* 1-CHUNK chars */
if (l == 0) continue;
if (cp->xmit + l > cp->blen)
l = cp->blen - cp->xmit;
p = cp->bp;
cp->bp += l;
cp->xmit += l;
#if debug
fprintf(stderr, "child %d, %d processed, %d to go\n", i, cp->xmit, cp->blen - cp->xmit);
#endif
while (p < cp->bp) {
if (*p == '\n' || (p == &cp->bp[-1] && cp->xmit >= cp->blen)) {
/* write it out */
nch = p - cp->line + 1;
if ((written = write(cp->fd, cp->line, nch)) != nch) {
/* argh! */
cp->line[nch] = '\0';
fprintf(stderr, "user %d job %d cmd %s ",
firstuser+i, cp->thisjob, cp->line);
fprintf(stderr, "write(,,%d) returns %d\n", nch, written);
if (sigpipe)
fatal("** SIGPIPE error **\n");
else
fatal("** write error **\n");
goto bepatient;
}
if (fcopy)
write(fcopy, cp->line, p - cp->line + 1);
#if debug
fprintf(stderr, "child %d gets \"", i);
{
char *q = cp->line;
while (q <= p) {
if (*q >= ' ' && *q <= '~')
fputc(*q, stderr);
else
fprintf(stderr, "\\%03o", *q);
q++;
}
}
fputc('"', stderr);
#endif
cp->line = &p[1];
}
p++;
}
if (cp->xmit >= cp->blen) {
done++;
close(cp->fd);
#if debug
fprintf(stderr, "child %d, close std input\n", i);
#endif
}
output += l;
}
while (output > thres) {
pause();
#if debug
fprintf(stderr, "after pause: output, thres, done %d %.2f %d\n", output, thres, done);
#endif
}
}
bepatient:
alarm(0);
/****
* If everything is going OK, we should simply be able to keep
* looping unitil 'wait' fails, however some descendent process may
* be in a state from which it can never exit, and so a timeout
* is used.
* 5 minutes should be ample, since the time to run all jobs is of
* the order of 5-10 minutes, however some machines are painfully slow,
* so the timeout has been set at 20 minutes (1200 seconds).
****/
signal(SIGALRM, grunt);
alarm(1200);
while ((c = wait(&l)) != -1) {
for (i = 0; i < nusers; i++) {
if (c == child[i].pid) {
fprintf(stderr, "user %d job %d pid %d done", firstuser+i, child[i].thisjob, c);
if (l != 0) {
if (l & 0x7f)
fprintf(stderr, " status %d", l & 0x7f);
if (l & 0xff00)
fprintf(stderr, " exit code %d", (l>>8) & 0xff);
exit_status = 4;
}
fputc('\n', stderr);
c = child[i].pid = -1;
break;
}
}
if (c != -1) {
fprintf(stderr, "master clone done, pid %d ", c);
if (l != 0) {
if (l & 0x7f)
fprintf(stderr, " status %d", l & 0x7f);
if (l & 0xff00)
fprintf(stderr, " exit code %d", (l>>8) & 0xff);
exit_status = 4;
}
fputc('\n', stderr);
}
}
alarm(0);
wrapup("Finished waiting ...");
exit(0);
}
void onalarm(int foo)
{
thres += est_rate;
signal(SIGALRM, onalarm);
alarm(GRANULE);
}
void grunt(int sig)
{
/* timeout after label "bepatient" in main */
exit_status = 4;
wrapup("Timed out waiting for jobs to finish ...");
}
void pipeerr(int sig)
{
sigpipe++;
}
void wrapup(char *reason)
{
int i;
int killed = 0;
fflush(stderr);
for (i = 0; i < nusers; i++) {
if (child[i].pid > 0 && kill(child[i].pid, SIGKILL) != -1) {
if (!killed) {
killed++;
fprintf(stderr, "%s\n", reason);
fflush(stderr);
}
fprintf(stderr, "user %d job %d pid %d killed off\n", firstuser+i, child[i].thisjob, child[i].pid);
fflush(stderr);
}
}
exit(exit_status);
}
#define MAXLINE 512
void getwork(void)
{
int i;
int f;
int ac=0;
char *lp = (void *)0;
char *q = (void *)0;
struct st_work *w = (void *)0;
char line[MAXLINE];
char c;
while (fgets(line, MAXLINE, stdin) != NULL) {
if (nwork >= MAXWORK) {
fprintf(stderr, "Too many jobs specified, .. increase MAXWORK\n");
exit(4);
}
w = &work[nwork];
lp = line;
i = 1;
while (*lp && *lp != ' ') {
i++;
lp++;
}
w->cmd = (char *)malloc(i);
strncpy(w->cmd, line, i-1);
w->cmd[i-1] = '\0';
w->inpsize = 0;
w->input = "";
/* start to build arg list */
ac = 2;
w->av = (char **)malloc(2*sizeof(char *));
q = w->cmd;
while (*q) q++;
q--;
while (q >= w->cmd) {
if (*q == '/') {
q++;
break;
}
q--;
}
w->av[0] = q;
while (*lp) {
if (*lp == ' ') {
/* space */
lp++;
continue;
}
else if (*lp == '<') {
/* standard input for this job */
q = ++lp;
while (*lp && *lp != ' ') lp++;
c = *lp;
*lp = '\0';
if ((f = open(q, 0)) == -1) {
fprintf(stderr, "cannot open input file (%s) for job %d\n",
q, nwork);
exit(4);
}
/* gobble input */
w->input = (char *)malloc(512);
while ((i = read(f, &w->input[w->inpsize], 512)) > 0) {
w->inpsize += i;
w->input = (char *)realloc(w->input, w->inpsize+512);
}
w->input = (char *)realloc(w->input, w->inpsize);
close(f);
/* extract stdout file name from line beginning "C=" */
w->outf = "";
for (q = w->input; q < &w->input[w->inpsize-10]; q++) {
if (*q == '\n' && strncmp(&q[1], "C=", 2) == 0) {
w->outf = &q[3];
break;
}
}
#if debug
if (*w->outf) {
fprintf(stderr, "stdout->");
for (q=w->outf; *q != '\n'; q++)
fputc(*q, stderr);
fputc('\n', stderr);
}
#endif
}
else {
/* a command option */
ac++;
w->av = (char **)realloc(w->av, ac*sizeof(char *));
q = lp;
i = 1;
while (*lp && *lp != ' ') {
lp++;
i++;
}
w->av[ac-2] = (char *)malloc(i);
strncpy(w->av[ac-2], q, i-1);
w->av[ac-2][i-1] = '\0';
}
}
w->av[ac-1] = (char *)0;
nwork++;
}
}
#if debug
void dumpwork(void)
{
int i;
int j;
for (i = 0; i < nwork; i++) {
fprintf(stderr, "job %d: cmd: %s\n", i, work[i].cmd);
j = 0;
while (work[i].av[j]) {
fprintf(stderr, "argv[%d]: %s\n", j, work[i].av[j]);
j++;
}
fprintf(stderr, "input: %d chars text: ", work[i].inpsize);
if (work[i].input == (char *)0)
fprintf(stderr, "<NULL>\n");
else {
register char *pend;
char *p;
char c;
p = work[i].input;
while (*p) {
pend = p;
while (*pend && *pend != '\n')
pend++;
c = *pend;
*pend = '\0';
fprintf(stderr, "%s\n", p);
*pend = c;
p = &pend[1];
}
}
}
}
#endif
void fatal(char *s)
{
int i;
fprintf(stderr, s);
fflush(stderr);
perror("Reason?");
fflush(stderr);
for (i = 0; i < nusers; i++) {
if (child[i].pid > 0 && kill(child[i].pid, SIGKILL) != -1) {
fprintf(stderr, "pid %d killed off\n", child[i].pid);
fflush(stderr);
}
}
exit_status = 4;
}

View File

@@ -0,0 +1,125 @@
/*******************************************************************************
* The BYTE UNIX Benchmarks - Release 3
* Module: context1.c SID: 3.3 5/15/91 19:30:18
*
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith, Rick Grehan or Tom Yager
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
*
*******************************************************************************
* Modification Log:
* $Header: context1.c,v 3.4 87/06/22 14:22:59 kjmcdonell Beta $
* August 28, 1990 - changed timing routines--now returns total number of
* iterations in specified time period
* October 22, 1997 - code cleanup to remove ANSI C compiler warnings
* Andy Kahn <kahn@zk3.dec.com>
*
******************************************************************************/
char SCCSid[] = "@(#) @(#)context1.c:3.3 -- 5/15/91 19:30:18";
/*
* Context switching via synchronized unbuffered pipe i/o
*
*/
#ifdef MINIX
#include <signal.h>
#endif
#ifdef LINUX
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "timeit.c"
unsigned long iter;
#ifdef MINIX
pid_t child;
#endif
void report(int sig)
{
fprintf(stderr, "COUNT|%lu|1|lps\n", iter);
#ifdef MINIX
kill(child, SIGKILL);
#endif
exit(0);
}
int main(int argc, char *argv[])
{
int duration;
unsigned long check;
int p1[2], p2[2];
if (argc != 2) {
fprintf(stderr, "Usage: context duration\n");
exit(1);
}
duration = atoi(argv[1]);
/* set up alarm call */
iter = 0;
wake_me(duration, report);
if (pipe(p1) || pipe(p2)) {
perror("pipe create failed");
exit(1);
}
#ifndef MINIX
if (fork()) { /* parent process */
#else
if ((child = fork())) {
#endif
/* master, write p1 & read p2 */
close(p1[0]); close(p2[1]);
while (1) {
if (write(p1[1], (char *)&iter, sizeof(iter)) != sizeof(iter)) {
if ((errno != 0) && (errno != EINTR))
perror("master write failed");
exit(1);
}
if (read(p2[0], (char *)&check, sizeof(check)) != sizeof(check)) {
if ((errno != 0) && (errno != EINTR))
perror("master read failed");
exit(1);
}
if (check != iter) {
fprintf(stderr, "Master sync error: expect %lu, got %lu\n",
iter, check);
exit(2);
}
iter++;
}
}
else { /* child process */
unsigned long iter1;
iter1 = 0;
/* slave, read p1 & write p2 */
close(p1[1]); close(p2[0]);
while (1) {
if (read(p1[0], (char *)&check, sizeof(check)) != sizeof(check)) {
if ((errno != 0) && (errno != EINTR))
perror("slave read failed");
exit(1);
}
if (check != iter1) {
fprintf(stderr, "Slave sync error: expect %lu, got %lu\n",
iter, check);
exit(2);
}
if (write(p2[1], (char *)&iter1, sizeof(iter1)) != sizeof(check)) {
if ((errno != 0) && (errno != EINTR))
perror("slave write failed");
exit(1);
}
iter1++;
}
}
}

View File

@@ -0,0 +1,435 @@
/*****************************************************************************
* The BYTE UNIX Benchmarks - Release 3
* Module: dhry.h SID: 3.4 5/15/91 19:30:21
*
*****************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith, Rick Grehan or Tom Yager
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
*
*****************************************************************************
* Modification Log:
* addapted from:
*
*
* "DHRYSTONE" Benchmark Program
* -----------------------------
*
* Version: C, Version 2.1
*
* File: dhry.h (part 1 of 3)
*
* Date: May 25, 1988
*
* Author: Reinhold P. Weicker
* Siemens AG, AUT E 51
* Postfach 3220
* 8520 Erlangen
* Germany (West)
* Phone: [+49]-9131-7-20330
* (8-17 Central European Time)
* Usenet: ..!mcvax!unido!estevax!weicker
*
* Original Version (in Ada) published in
* "Communications of the ACM" vol. 27., no. 10 (Oct. 1984),
* pp. 1013 - 1030, together with the statistics
* on which the distribution of statements etc. is based.
*
* In this C version, the following C library functions are used:
* - strcpy, strcmp (inside the measurement loop)
* - printf, scanf (outside the measurement loop)
* In addition, Berkeley UNIX system calls "times ()" or "time ()"
* are used for execution time measurement. For measurements
* on other systems, these calls have to be changed.
*
* Collection of Results:
* Reinhold Weicker (address see above) and
*
* Rick Richardson
* PC Research. Inc.
* 94 Apple Orchard Drive
* Tinton Falls, NJ 07724
* Phone: (201) 834-1378 (9-17 EST)
* Usenet: ...!seismo!uunet!pcrat!rick
*
* Please send results to Rick Richardson and/or Reinhold Weicker.
* Complete information should be given on hardware and software used.
* Hardware information includes: Machine type, CPU, type and size
* of caches; for microprocessors: clock frequency, memory speed
* (number of wait states).
* Software information includes: Compiler (and runtime library)
* manufacturer and version, compilation switches, OS version.
* The Operating System version may give an indication about the
* compiler; Dhrystone itself performs no OS calls in the measurement loop.
*
* The complete output generated by the program should be mailed
* such that at least some checks for correctness can be made.
*
***************************************************************************
*
* History: This version C/2.1 has been made for two reasons:
*
* 1) There is an obvious need for a common C version of
* Dhrystone, since C is at present the most popular system
* programming language for the class of processors
* (microcomputers, minicomputers) where Dhrystone is used most.
* There should be, as far as possible, only one C version of
* Dhrystone such that results can be compared without
* restrictions. In the past, the C versions distributed
* by Rick Richardson (Version 1.1) and by Reinhold Weicker
* had small (though not significant) differences.
*
* 2) As far as it is possible without changes to the Dhrystone
* statistics, optimizing compilers should be prevented from
* removing significant statements.
*
* This C version has been developed in cooperation with
* Rick Richardson (Tinton Falls, NJ), it incorporates many
* ideas from the "Version 1.1" distributed previously by
* him over the UNIX network Usenet.
* I also thank Chaim Benedelac (National Semiconductor),
* David Ditzel (SUN), Earl Killian and John Mashey (MIPS),
* Alan Smith and Rafael Saavedra-Barrera (UC at Berkeley)
* for their help with comments on earlier versions of the
* benchmark.
*
* Changes: In the initialization part, this version follows mostly
* Rick Richardson's version distributed via Usenet, not the
* version distributed earlier via floppy disk by Reinhold Weicker.
* As a concession to older compilers, names have been made
* unique within the first 8 characters.
* Inside the measurement loop, this version follows the
* version previously distributed by Reinhold Weicker.
*
* At several places in the benchmark, code has been added,
* but within the measurement loop only in branches that
* are not executed. The intention is that optimizing compilers
* should be prevented from moving code out of the measurement
* loop, or from removing code altogether. Since the statements
* that are executed within the measurement loop have NOT been
* changed, the numbers defining the "Dhrystone distribution"
* (distribution of statements, operand types and locality)
* still hold. Except for sophisticated optimizing compilers,
* execution times for this version should be the same as
* for previous versions.
*
* Since it has proven difficult to subtract the time for the
* measurement loop overhead in a correct way, the loop check
* has been made a part of the benchmark. This does have
* an impact - though a very minor one - on the distribution
* statistics which have been updated for this version.
*
* All changes within the measurement loop are described
* and discussed in the companion paper "Rationale for
* Dhrystone version 2".
*
* Because of the self-imposed limitation that the order and
* distribution of the executed statements should not be
* changed, there are still cases where optimizing compilers
* may not generate code for some statements. To a certain
* degree, this is unavoidable for small synthetic benchmarks.
* Users of the benchmark are advised to check code listings
* whether code is generated for all statements of Dhrystone.
*
* Version 2.1 is identical to version 2.0 distributed via
* the UNIX network Usenet in March 1988 except that it corrects
* some minor deficiencies that were found by users of version 2.0.
* The only change within the measurement loop is that a
* non-executed "else" part was added to the "if" statement in
* Func_3, and a non-executed "else" part removed from Proc_3.
*
***************************************************************************
*
* Defines: The following "Defines" are possible:
* -DREG=register (default: Not defined)
* As an approximation to what an average C programmer
* might do, the "register" storage class is applied
* (if enabled by -DREG=register)
* - for local variables, if they are used (dynamically)
* five or more times
* - for parameters if they are used (dynamically)
* six or more times
* Note that an optimal "register" strategy is
* compiler-dependent, and that "register" declarations
* do not necessarily lead to faster execution.
* -DNOSTRUCTASSIGN (default: Not defined)
* Define if the C compiler does not support
* assignment of structures.
* -DNOENUMS (default: Not defined)
* Define if the C compiler does not support
* enumeration types.
* -DTIMES (default)
* -DTIME
* The "times" function of UNIX (returning process times)
* or the "time" function (returning wallclock time)
* is used for measurement.
* For single user machines, "time ()" is adequate. For
* multi-user machines where you cannot get single-user
* access, use the "times ()" function. If you have
* neither, use a stopwatch in the dead of night.
* "printf"s are provided marking the points "Start Timer"
* and "Stop Timer". DO NOT use the UNIX "time(1)"
* command, as this will measure the total time to
* run this program, which will (erroneously) include
* the time to allocate storage (malloc) and to perform
* the initialization.
* -DHZ=nnn
* In Berkeley UNIX, the function "times" returns process
* time in 1/HZ seconds, with HZ = 60 for most systems.
* CHECK YOUR SYSTEM DESCRIPTION BEFORE YOU JUST APPLY
* A VALUE.
*
***************************************************************************
*
* Compilation model and measurement (IMPORTANT):
*
* This C version of Dhrystone consists of three files:
* - dhry.h (this file, containing global definitions and comments)
* - dhry_1.c (containing the code corresponding to Ada package Pack_1)
* - dhry_2.c (containing the code corresponding to Ada package Pack_2)
*
* The following "ground rules" apply for measurements:
* - Separate compilation
* - No procedure merging
* - Otherwise, compiler optimizations are allowed but should be indicated
* - Default results are those without register declarations
* See the companion paper "Rationale for Dhrystone Version 2" for a more
* detailed discussion of these ground rules.
*
* For 16-Bit processors (e.g. 80186, 80286), times for all compilation
* models ("small", "medium", "large" etc.) should be given if possible,
* together with a definition of these models for the compiler system used.
*
**************************************************************************
*
* Dhrystone (C version) statistics:
*
* [Comment from the first distribution, updated for version 2.
* Note that because of language differences, the numbers are slightly
* different from the Ada version.]
*
* The following program contains statements of a high level programming
* language (here: C) in a distribution considered representative:
*
* assignments 52 (51.0 %)
* control statements 33 (32.4 %)
* procedure, function calls 17 (16.7 %)
*
* 103 statements are dynamically executed. The program is balanced with
* respect to the three aspects:
*
* - statement type
* - operand type
* - operand locality
* operand global, local, parameter, or constant.
*
* The combination of these three aspects is balanced only approximately.
*
* 1. Statement Type:
* ----------------- number
*
* V1 = V2 9
* (incl. V1 = F(..)
* V = Constant 12
* Assignment, 7
* with array element
* Assignment, 6
* with record component
* --
* 34 34
*
* X = Y +|-|"&&"|"|" Z 5
* X = Y +|-|"==" Constant 6
* X = X +|- 1 3
* X = Y *|/ Z 2
* X = Expression, 1
* two operators
* X = Expression, 1
* three operators
* --
* 18 18
*
* if .... 14
* with "else" 7
* without "else" 7
* executed 3
* not executed 4
* for ... 7 | counted every time
* while ... 4 | the loop condition
* do ... while 1 | is evaluated
* switch ... 1
* break 1
* declaration with 1
* initialization
* --
* 34 34
*
* P (...) procedure call 11
* user procedure 10
* library procedure 1
* X = F (...)
* function call 6
* user function 5
* library function 1
* --
* 17 17
* ---
* 103
*
* The average number of parameters in procedure or function calls
* is 1.82 (not counting the function values as implicit parameters).
*
*
* 2. Operators
* ------------
* number approximate
* percentage
*
* Arithmetic 32 50.8
*
* + 21 33.3
* - 7 11.1
* * 3 4.8
* / (int div) 1 1.6
*
* Comparison 27 42.8
*
* == 9 14.3
* /= 4 6.3
* > 1 1.6
* < 3 4.8
* >= 1 1.6
* <= 9 14.3
*
* Logic 4 6.3
*
* && (AND-THEN) 1 1.6
* | (OR) 1 1.6
* ! (NOT) 2 3.2
*
* -- -----
* 63 100.1
*
*
* 3. Operand Type (counted once per operand reference):
* ---------------
* number approximate
* percentage
*
* Integer 175 72.3 %
* Character 45 18.6 %
* Pointer 12 5.0 %
* String30 6 2.5 %
* Array 2 0.8 %
* Record 2 0.8 %
* --- -------
* 242 100.0 %
*
* When there is an access path leading to the final operand (e.g. a record
* component), only the final data type on the access path is counted.
*
*
* 4. Operand Locality:
* -------------------
* number approximate
* percentage
*
* local variable 114 47.1 %
* global variable 22 9.1 %
* parameter 45 18.6 %
* value 23 9.5 %
* reference 22 9.1 %
* function result 6 2.5 %
* constant 55 22.7 %
* --- -------
* 242 100.0 %
*
*
* The program does not compute anything meaningful, but it is syntactically
* and semantically correct. All variables have a value assigned to them
* before they are used as a source operand.
*
* There has been no explicit effort to account for the effects of a
* cache, or to balance the use of long or short displacements for code or
* data.
*
***************************************************************************
*/
/* Compiler and system dependent definitions: */
#ifndef TIME
#define TIMES
#endif
/* Use times(2) time function unless */
/* explicitly defined otherwise */
#ifdef TIMES
#include <sys/types.h>
#include <sys/times.h>
/* for "times" */
#endif
#define Mic_secs_Per_Second 1000000.0
/* Berkeley UNIX C returns process times in seconds/HZ */
#ifdef NOSTRUCTASSIGN
#define structassign(d, s) memcpy(&(d), &(s), sizeof(d))
#else
#define structassign(d, s) d = s
#endif
#ifdef NOENUM
#define Ident_1 0
#define Ident_2 1
#define Ident_3 2
#define Ident_4 3
#define Ident_5 4
typedef int Enumeration;
#else
typedef enum {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5}
Enumeration;
#endif
/* for boolean and enumeration types in Ada, Pascal */
/* General definitions: */
#include <stdio.h>
/* for strcpy, strcmp */
#define Null 0
/* Value of a Null pointer */
#define true 1
#define false 0
typedef int One_Thirty;
typedef int One_Fifty;
typedef char Capital_Letter;
typedef int Boolean;
typedef char Str_30 [31];
typedef int Arr_1_Dim [50];
typedef int Arr_2_Dim [50] [50];
typedef struct record
{
struct record *Ptr_Comp;
Enumeration Discr;
union {
struct {
Enumeration Enum_Comp;
int Int_Comp;
char Str_Comp [31];
} var_1;
struct {
Enumeration E_Comp_2;
char Str_2_Comp [31];
} var_2;
struct {
char Ch_1_Comp;
char Ch_2_Comp;
} var_3;
} variant;
} Rec_Type, *Rec_Pointer;

View File

@@ -0,0 +1,427 @@
/*****************************************************************************
* The BYTE UNIX Benchmarks - Release 3
* Module: dhry_1.c SID: 3.4 5/15/91 19:30:21
*
*****************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith, Rick Grehan or Tom Yager
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
*
*****************************************************************************
*
* *** WARNING **** With BYTE's modifications applied, results obtained with
* ******* this version of the Dhrystone program may not be applicable
* to other versions.
*
* Modification Log:
* 10/22/97 - code cleanup to remove ANSI C compiler warnings
* Andy Kahn <kahn@zk3.dec.com>
*
* Adapted from:
*
* "DHRYSTONE" Benchmark Program
* -----------------------------
*
* Version: C, Version 2.1
*
* File: dhry_1.c (part 2 of 3)
*
* Date: May 25, 1988
*
* Author: Reinhold P. Weicker
*
***************************************************************************/
char SCCSid[] = "@(#) @(#)dhry_1.c:3.4 -- 5/15/91 19:30:21";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dhry.h"
#include "timeit.c"
unsigned long Run_Index;
Enumeration Func_1(Capital_Letter, Capital_Letter);
void report(int sig)
{
fprintf(stderr,"COUNT|%ld|1|lps\n", Run_Index);
exit(0);
}
/* Global Variables: */
Rec_Pointer Ptr_Glob,
Next_Ptr_Glob;
int Int_Glob;
Boolean Bool_Glob;
char Ch_1_Glob,
Ch_2_Glob;
int Arr_1_Glob [50];
int Arr_2_Glob [50] [50];
#ifndef REG
Boolean Reg = false;
#define REG
/* REG becomes defined as empty */
/* i.e. no register variables */
#else
Boolean Reg = true;
#endif
/* variables for time measurement: */
#ifdef TIMES
struct tms time_info;
extern int times ();
/* see library function "times" */
#define Too_Small_Time 120
/* Measurements should last at least about 2 seconds */
#endif
#ifdef TIME
#define Too_Small_Time 2
/* Measurements should last at least 2 seconds */
#endif
long Begin_Time,
End_Time,
User_Time;
float Microseconds,
Dhrystones_Per_Second;
/* end of variables for time measurement */
void Proc_1 (REG Rec_Pointer Ptr_Val_Par);
void Proc_2 (One_Fifty *Int_Par_Ref);
void Proc_3 (Rec_Pointer *Ptr_Ref_Par);
void Proc_4 (void);
void Proc_5 (void);
extern Boolean Func_2(Str_30, Str_30);
extern void Proc_6(Enumeration, Enumeration *);
extern void Proc_7(One_Fifty, One_Fifty, One_Fifty *);
extern void Proc_8(Arr_1_Dim, Arr_2_Dim, int, int);
int main (int argc, char *argv[])
/* main program, corresponds to procedures */
/* Main and Proc_0 in the Ada version */
{
int duration;
One_Fifty Int_1_Loc;
REG One_Fifty Int_2_Loc;
One_Fifty Int_3_Loc;
REG char Ch_Index;
Enumeration Enum_Loc;
Str_30 Str_1_Loc;
Str_30 Str_2_Loc;
/* Initializations */
Next_Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
Ptr_Glob->Ptr_Comp = Next_Ptr_Glob;
Ptr_Glob->Discr = Ident_1;
Ptr_Glob->variant.var_1.Enum_Comp = Ident_3;
Ptr_Glob->variant.var_1.Int_Comp = 40;
strcpy (Ptr_Glob->variant.var_1.Str_Comp,
"DHRYSTONE PROGRAM, SOME STRING");
strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");
Arr_2_Glob [8][7] = 10;
/* Was missing in published program. Without this statement, */
/* Arr_2_Glob [8][7] would have an undefined value. */
/* Warning: With 16-Bit processors and Number_Of_Runs > 32000, */
/* overflow may occur for this array element. */
#ifdef PRATTLE
printf ("\n");
printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
printf ("\n");
if (Reg)
{
printf ("Program compiled with 'register' attribute\n");
printf ("\n");
}
else
{
printf ("Program compiled without 'register' attribute\n");
printf ("\n");
}
printf ("Please give the number of runs through the benchmark: ");
{
int n;
scanf ("%d", &n);
Number_Of_Runs = n;
}
printf ("\n");
printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);
#endif /* PRATTLE */
if (argc != 2) {
fprintf(stderr, "Usage: %s duration\n", argv[0]);
exit(1);
}
duration = atoi(argv[1]);
Run_Index = 0;
wake_me(duration, report);
/***************/
/* Start timer */
/***************/
#ifdef SELF_TIMED
#ifdef TIMES
times (&time_info);
Begin_Time = (long) time_info.tms_utime;
#endif
#ifdef TIME
Begin_Time = time ( (long *) 0);
#endif
#endif /* SELF_TIMED */
for (Run_Index = 1; ; ++Run_Index)
{
Proc_5();
Proc_4();
/* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */
Int_1_Loc = 2;
Int_2_Loc = 3;
strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
Enum_Loc = Ident_2;
Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc);
/* Bool_Glob == 1 */
while (Int_1_Loc < Int_2_Loc) /* loop body executed once */
{
Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc;
/* Int_3_Loc == 7 */
Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
/* Int_3_Loc == 7 */
Int_1_Loc += 1;
} /* while */
/* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc);
/* Int_Glob == 5 */
Proc_1 (Ptr_Glob);
for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index)
/* loop body executed twice */
{
if (Enum_Loc == Func_1 (Ch_Index, 'C'))
/* then, not executed */
{
Proc_6 (Ident_1, &Enum_Loc);
strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING");
Int_2_Loc = Run_Index;
Int_Glob = Run_Index;
}
}
/* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
Int_2_Loc = Int_2_Loc * Int_1_Loc;
Int_1_Loc = Int_2_Loc / Int_3_Loc;
Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc;
/* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */
Proc_2 (&Int_1_Loc);
/* Int_1_Loc == 5 */
} /* loop "for Run_Index" */
/**************/
/* Stop timer */
/**************/
#ifdef SELF_TIMED
#ifdef TIMES
times (&time_info);
End_Time = (long) time_info.tms_utime;
#endif
#ifdef TIME
End_Time = time ( (long *) 0);
#endif
#endif /* SELF_TIMED */
/* BYTE version never executes this stuff */
#ifdef SELF_TIMED
printf ("Execution ends\n");
printf ("\n");
printf ("Final values of the variables used in the benchmark:\n");
printf ("\n");
printf ("Int_Glob: %d\n", Int_Glob);
printf (" should be: %d\n", 5);
printf ("Bool_Glob: %d\n", Bool_Glob);
printf (" should be: %d\n", 1);
printf ("Ch_1_Glob: %c\n", Ch_1_Glob);
printf (" should be: %c\n", 'A');
printf ("Ch_2_Glob: %c\n", Ch_2_Glob);
printf (" should be: %c\n", 'B');
printf ("Arr_1_Glob[8]: %d\n", Arr_1_Glob[8]);
printf (" should be: %d\n", 7);
printf ("Arr_2_Glob[8][7]: %d\n", Arr_2_Glob[8][7]);
printf (" should be: Number_Of_Runs + 10\n");
printf ("Ptr_Glob->\n");
printf (" Ptr_Comp: %d\n", (int) Ptr_Glob->Ptr_Comp);
printf (" should be: (implementation-dependent)\n");
printf (" Discr: %d\n", Ptr_Glob->Discr);
printf (" should be: %d\n", 0);
printf (" Enum_Comp: %d\n", Ptr_Glob->variant.var_1.Enum_Comp);
printf (" should be: %d\n", 2);
printf (" Int_Comp: %d\n", Ptr_Glob->variant.var_1.Int_Comp);
printf (" should be: %d\n", 17);
printf (" Str_Comp: %s\n", Ptr_Glob->variant.var_1.Str_Comp);
printf (" should be: DHRYSTONE PROGRAM, SOME STRING\n");
printf ("Next_Ptr_Glob->\n");
printf (" Ptr_Comp: %d\n", (int) Next_Ptr_Glob->Ptr_Comp);
printf (" should be: (implementation-dependent), same as above\n");
printf (" Discr: %d\n", Next_Ptr_Glob->Discr);
printf (" should be: %d\n", 0);
printf (" Enum_Comp: %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp);
printf (" should be: %d\n", 1);
printf (" Int_Comp: %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp);
printf (" should be: %d\n", 18);
printf (" Str_Comp: %s\n",
Next_Ptr_Glob->variant.var_1.Str_Comp);
printf (" should be: DHRYSTONE PROGRAM, SOME STRING\n");
printf ("Int_1_Loc: %d\n", Int_1_Loc);
printf (" should be: %d\n", 5);
printf ("Int_2_Loc: %d\n", Int_2_Loc);
printf (" should be: %d\n", 13);
printf ("Int_3_Loc: %d\n", Int_3_Loc);
printf (" should be: %d\n", 7);
printf ("Enum_Loc: %d\n", Enum_Loc);
printf (" should be: %d\n", 1);
printf ("Str_1_Loc: %s\n", Str_1_Loc);
printf (" should be: DHRYSTONE PROGRAM, 1'ST STRING\n");
printf ("Str_2_Loc: %s\n", Str_2_Loc);
printf (" should be: DHRYSTONE PROGRAM, 2'ND STRING\n");
printf ("\n");
User_Time = End_Time - Begin_Time;
if (User_Time < Too_Small_Time)
{
printf ("Measured time too small to obtain meaningful results\n");
printf ("Please increase number of runs\n");
printf ("\n");
}
else
{
#ifdef TIME
Microseconds = (float) User_Time * Mic_secs_Per_Second
/ (float) Number_Of_Runs;
Dhrystones_Per_Second = (float) Number_Of_Runs / (float) User_Time;
#else
Microseconds = (float) User_Time * Mic_secs_Per_Second
/ ((float) HZ * ((float) Number_Of_Runs));
Dhrystones_Per_Second = ((float) HZ * (float) Number_Of_Runs)
/ (float) User_Time;
#endif
printf ("Microseconds for one run through Dhrystone: ");
printf ("%6.1f \n", Microseconds);
printf ("Dhrystones per Second: ");
printf ("%6.1f \n", Dhrystones_Per_Second);
printf ("\n");
}
#endif /* SELF_TIMED */
}
void Proc_1 (REG Rec_Pointer Ptr_Val_Par)
/* executed once */
{
REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp;
/* == Ptr_Glob_Next */
/* Local variable, initialized with Ptr_Val_Par->Ptr_Comp, */
/* corresponds to "rename" in Ada, "with" in Pascal */
structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob);
Ptr_Val_Par->variant.var_1.Int_Comp = 5;
Next_Record->variant.var_1.Int_Comp
= Ptr_Val_Par->variant.var_1.Int_Comp;
Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp;
Proc_3 (&Next_Record->Ptr_Comp);
/* Ptr_Val_Par->Ptr_Comp->Ptr_Comp
== Ptr_Glob->Ptr_Comp */
if (Next_Record->Discr == Ident_1)
/* then, executed */
{
Next_Record->variant.var_1.Int_Comp = 6;
Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp,
&Next_Record->variant.var_1.Enum_Comp);
Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp;
Proc_7 (Next_Record->variant.var_1.Int_Comp, 10,
&Next_Record->variant.var_1.Int_Comp);
}
else /* not executed */
structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp);
} /* Proc_1 */
void Proc_2 (One_Fifty *Int_Par_Ref)
/* executed once */
/* *Int_Par_Ref == 1, becomes 4 */
{
One_Fifty Int_Loc;
Enumeration Enum_Loc;
Enum_Loc = 0;
Int_Loc = *Int_Par_Ref + 10;
do /* executed once */
if (Ch_1_Glob == 'A')
/* then, executed */
{
Int_Loc -= 1;
*Int_Par_Ref = Int_Loc - Int_Glob;
Enum_Loc = Ident_1;
} /* if */
while (Enum_Loc != Ident_1); /* true */
} /* Proc_2 */
void Proc_3 (Rec_Pointer *Ptr_Ref_Par)
/* executed once */
/* Ptr_Ref_Par becomes Ptr_Glob */
{
if (Ptr_Glob != Null)
/* then, executed */
*Ptr_Ref_Par = Ptr_Glob->Ptr_Comp;
Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp);
} /* Proc_3 */
void Proc_4 (void) /* without parameters */
/* executed once */
{
Boolean Bool_Loc;
Bool_Loc = Ch_1_Glob == 'A';
Bool_Glob = Bool_Loc | Bool_Glob;
Ch_2_Glob = 'B';
} /* Proc_4 */
void Proc_5 (void) /* without parameters */
/*******/
/* executed once */
{
Ch_1_Glob = 'A';
Bool_Glob = false;
} /* Proc_5 */
/* Procedure for the assignment of structures, */
/* if the C compiler doesn't support this feature */
#ifdef NOSTRUCTASSIGN
memcpy (d, s, l)
register char *d;
register char *s;
register int l;
{
while (l--) *d++ = *s++;
}
#endif

View File

@@ -0,0 +1,209 @@
/*****************************************************************************
* The BYTE UNIX Benchmarks - Release 3
* Module: dhry_2.c SID: 3.4 5/15/91 19:30:22
*
*****************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith, Rick Grehan or Tom Yager
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
*
*****************************************************************************
* Modification Log:
* 10/22/97 - code cleanup to remove ANSI C compiler warnings
* Andy Kahn <kahn@zk3.dec.com>
*
* Adapted from:
*
* "DHRYSTONE" Benchmark Program
* -----------------------------
*
* **** WARNING **** See warning in n.dhry_1.c
*
* Version: C, Version 2.1
*
* File: dhry_2.c (part 3 of 3)
*
* Date: May 25, 1988
*
* Author: Reinhold P. Weicker
*
****************************************************************************/
/* SCCSid is defined in dhry_1.c */
#include <string.h>
#include "dhry.h"
#ifndef REG
#define REG
/* REG becomes defined as empty */
/* i.e. no register variables */
#endif
extern int Int_Glob;
extern char Ch_1_Glob;
void Proc_6(Enumeration, Enumeration *);
void Proc_7(One_Fifty, One_Fifty, One_Fifty *);
void Proc_8(Arr_1_Dim, Arr_2_Dim, int, int);
Enumeration Func_1(Capital_Letter, Capital_Letter);
Boolean Func_2(Str_30, Str_30);
Boolean Func_3(Enumeration);
void Proc_6 (Enumeration Enum_Val_Par, Enumeration *Enum_Ref_Par)
/* executed once */
/* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
{
*Enum_Ref_Par = Enum_Val_Par;
if (! Func_3 (Enum_Val_Par))
/* then, not executed */
*Enum_Ref_Par = Ident_4;
switch (Enum_Val_Par)
{
case Ident_1:
*Enum_Ref_Par = Ident_1;
break;
case Ident_2:
if (Int_Glob > 100)
/* then */
*Enum_Ref_Par = Ident_1;
else *Enum_Ref_Par = Ident_4;
break;
case Ident_3: /* executed */
*Enum_Ref_Par = Ident_2;
break;
case Ident_4: break;
case Ident_5:
*Enum_Ref_Par = Ident_3;
break;
} /* switch */
} /* Proc_6 */
void Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
One_Fifty Int_1_Par_Val;
One_Fifty Int_2_Par_Val;
One_Fifty *Int_Par_Ref;
/**********************************************/
/* executed three times */
/* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */
/* Int_Par_Ref becomes 7 */
/* second call: Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
/* Int_Par_Ref becomes 17 */
/* third call: Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
/* Int_Par_Ref becomes 18 */
{
One_Fifty Int_Loc;
Int_Loc = Int_1_Par_Val + 2;
*Int_Par_Ref = Int_2_Par_Val + Int_Loc;
} /* Proc_7 */
void Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
/*********************************************************************/
/* executed once */
/* Int_Par_Val_1 == 3 */
/* Int_Par_Val_2 == 7 */
Arr_1_Dim Arr_1_Par_Ref;
Arr_2_Dim Arr_2_Par_Ref;
int Int_1_Par_Val;
int Int_2_Par_Val;
{
REG One_Fifty Int_Index;
REG One_Fifty Int_Loc;
Int_Loc = Int_1_Par_Val + 5;
Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val;
Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc];
Arr_1_Par_Ref [Int_Loc+30] = Int_Loc;
for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index)
Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc;
Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1;
Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc];
Int_Glob = 5;
} /* Proc_8 */
Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val)
/*************************************************/
/* executed three times */
/* first call: Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R' */
/* second call: Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C' */
/* third call: Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C' */
{
Capital_Letter Ch_1_Loc;
Capital_Letter Ch_2_Loc;
Ch_1_Loc = Ch_1_Par_Val;
Ch_2_Loc = Ch_1_Loc;
if (Ch_2_Loc != Ch_2_Par_Val)
/* then, executed */
return (Ident_1);
else /* not executed */
{
Ch_1_Glob = Ch_1_Loc;
return (Ident_2);
}
} /* Func_1 */
Boolean Func_2 (Str_1_Par_Ref, Str_2_Par_Ref)
/*************************************************/
/* executed once */
/* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
/* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
Str_30 Str_1_Par_Ref;
Str_30 Str_2_Par_Ref;
{
REG One_Thirty Int_Loc;
Capital_Letter Ch_Loc;
Ch_Loc = 'A';
Int_Loc = 2;
while (Int_Loc <= 2) /* loop body executed once */
if (Func_1 (Str_1_Par_Ref[Int_Loc],
Str_2_Par_Ref[Int_Loc+1]) == Ident_1)
/* then, executed */
{
Ch_Loc = 'A';
Int_Loc += 1;
} /* if, while */
if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
/* then, not executed */
Int_Loc = 7;
if (Ch_Loc == 'R')
/* then, not executed */
return (true);
else /* executed */
{
if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
/* then, not executed */
{
Int_Loc += 7;
Int_Glob = Int_Loc;
return (true);
}
else /* executed */
return (false);
} /* if Ch_Loc */
} /* Func_2 */
Boolean Func_3 (Enum_Par_Val)
/***************************/
/* executed once */
/* Enum_Par_Val == Ident_3 */
Enumeration Enum_Par_Val;
{
Enumeration Enum_Loc;
Enum_Loc = Enum_Par_Val;
if (Enum_Loc == Ident_3)
/* then, executed */
return (true);
else /* not executed */
return (false);
} /* Func_3 */

View File

@@ -0,0 +1,319 @@
/*******************************************************************************
* The BYTE UNIX Benchmarks - Release 3
* Module: dummy.c SID: 3.3 5/15/91 19:30:19
*
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith, Rick Grehan or Tom Yager
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
*
*******************************************************************************
* Modification Log:
* 10/22/97 - code cleanup to remove ANSI C compiler warnings
* Andy Kahn <kahn@zk3.dec.com>
*
******************************************************************************/
/*
* Hacked up C program for use in the standard shell.? scripts of
* the multiuser test. This is based upon makework.c, and is typically
* edited using edscript.2 before compilation.
*
* $Header: dummy.c,v 3.4 87/06/23 15:54:53 kjmcdonell Beta $
*/
char SCCSid[] = "@(#) @(#)dummy.c:3.3 -- 5/15/91 19:30:19";
#include <stdio.h>
#include <signal.h>
#define DEF_RATE 5.0
#define GRANULE 5
#define CHUNK 60
#define MAXCHILD 12
#define MAXWORK 10
float thres;
float est_rate = DEF_RATE;
int nusers; /* number of concurrent users to be simulated by
* this process */
int firstuser; /* ordinal identification of first user for this
* process */
int nwork = 0; /* number of job streams */
int exit_status = 0; /* returned to parent */
int sigpipe; /* pipe write error flag */
struct st_work {
char *cmd; /* name of command to run */
char **av; /* arguments to command */
char *input; /* standard input buffer */
int inpsize; /* size of standard input buffer */
} work[MAXWORK];
struct {
int xmit; /* # characters sent */
char *bp; /* std input buffer pointer */
int blen; /* std input buffer length */
int fd; /* stdin to command */
int pid; /* child PID */
char *line; /* start of input line */
int firstjob; /* inital piece of work */
int thisjob; /* current piece of work */
} child[MAXCHILD], *cp;
main(argc, argv)
int argc;
char *argv[];
{
int i;
int l;
int fcopy = 0; /* fd for copy output */
int master = 1; /* the REAL master, == 0 for clones */
int nchild; /* no. of children for a clone to run */
int done; /* count of children finished */
int output; /* aggregate output char count for all
children */
int c;
int thiswork = 0; /* next job stream to allocate */
int nch; /* # characters to write */
int written; /* # characters actully written */
char logname[15]; /* name of the log file(s) */
void onalarm(void);
void pipeerr(void);
void wrapup(void);
void grunt(void);
char *malloc();
int pvec[2]; /* for pipes */
char *p;
char *prog; /* my name */
#if ! debug
freopen("masterlog.00", "a", stderr);
#endif
fprintf(stderr, "*** New Run *** ");
prog = argv[0];
while (argc > 1 && argv[1][0] == '-') {
p = &argv[1][1];
argc--;
argv++;
while (*p) {
switch (*p) {
case 'r':
/* code DELETED here */
argc--;
argv++;
break;
case 'c':
/* code DELETED here */
lseek(fcopy, 0L, 2); /* append at end of file */
break;
default:
fprintf(stderr, "%s: bad flag '%c'\n", prog, *p);
exit(4);
}
p++;
}
}
if (argc < 2) {
fprintf(stderr, "%s: missing nusers\n", prog);
exit(4);
}
nusers = atoi(argv[1]);
if (nusers < 1) {
fprintf(stderr, "%s: impossible nusers (%d<-%s)\n", prog, nusers, argv[1]);
exit(4);
}
fprintf(stderr, "%d Users\n", nusers);
argc--;
argv++;
/* build job streams */
getwork();
#if debug
dumpwork();
#endif
/* clone copies of myself to run up to MAXCHILD jobs each */
firstuser = MAXCHILD;
fprintf(stderr, "master pid %d\n", getpid());
fflush(stderr);
while (nusers > MAXCHILD) {
fflush(stderr);
if (nusers >= 2*MAXCHILD)
/* the next clone must run MAXCHILD jobs */
nchild = MAXCHILD;
else
/* the next clone must run the leftover jobs */
nchild = nusers - MAXCHILD;
if ((l = fork()) == -1) {
/* fork failed */
fatal("** clone fork failed **\n");
goto bepatient;
} else if (l > 0) {
fprintf(stderr, "master clone pid %d\n", l);
/* I am the master with nchild fewer jobs to run */
nusers -= nchild;
firstuser += MAXCHILD;
continue;
} else {
/* I am a clone, run MAXCHILD jobs */
#if ! debug
sprintf(logname, "masterlog.%02d", firstuser/MAXCHILD);
freopen(logname, "w", stderr);
#endif
master = 0;
nusers = nchild;
break;
}
}
if (master)
firstuser = 0;
close(0);
/* code DELETED here */
fflush(stderr);
srand(time(0));
thres = 0;
done = output = 0;
for (i = 0; i < nusers; i++) {
if (child[i].blen == 0)
done++;
else
thres += est_rate * GRANULE;
}
est_rate = thres;
signal(SIGALRM, onalarm);
signal(SIGPIPE, pipeerr);
alarm(GRANULE);
while (done < nusers) {
for (i = 0; i < nusers; i++) {
cp = &child[i];
if (cp->xmit >= cp->blen) continue;
l = rand() % CHUNK + 1; /* 1-CHUNK chars */
if (l == 0) continue;
if (cp->xmit + l > cp->blen)
l = cp->blen - cp->xmit;
p = cp->bp;
cp->bp += l;
cp->xmit += l;
#if debug
fprintf(stderr, "child %d, %d processed, %d to go\n", i, cp->xmit, cp->blen - cp->xmit);
#endif
while (p < cp->bp) {
if (*p == '\n' || (p == &cp->bp[-1] && cp->xmit >= cp->blen)) {
/* write it out */
nch = p - cp->line + 1;
if ((written = write(cp->fd, cp->line, nch)) != nch) {
/* code DELETED here */
}
if (fcopy)
write(fcopy, cp->line, p - cp->line + 1);
#if debug
fprintf(stderr, "child %d gets \"", i);
{
char *q = cp->line;
while (q <= p) {
if (*q >= ' ' && *q <= '~')
fputc(*q, stderr);
else
fprintf(stderr, "\\%03o", *q);
q++;
}
}
fputc('"', stderr);
#endif
cp->line = &p[1];
}
p++;
}
if (cp->xmit >= cp->blen) {
done++;
close(cp->fd);
#if debug
fprintf(stderr, "child %d, close std input\n", i);
#endif
}
output += l;
}
while (output > thres) {
pause();
#if debug
fprintf(stderr, "after pause: output, thres, done %d %.2f %d\n", output, thres, done);
#endif
}
}
bepatient:
alarm(0);
/****
* If everything is going OK, we should simply be able to keep
* looping unitil 'wait' fails, however some descendent process may
* be in a state from which it can never exit, and so a timeout
* is used.
* 5 minutes should be ample, since the time to run all jobs is of
* the order of 5-10 minutes, however some machines are painfully slow,
* so the timeout has been set at 20 minutes (1200 seconds).
****/
/* code DELETED here */
}
onalarm()
{
thres += est_rate;
signal(SIGALRM, onalarm);
alarm(GRANULE);
}
grunt()
{
/* timeout after label "bepatient" in main */
exit_status = 4;
wrapup();
}
pipeerr()
{
sigpipe++;
}
wrapup()
{
/* DUMMY, real code dropped */
}
getwork()
{
/* DUMMY, real code dropped */
gets();
strncpy();
malloc(); realloc();
open(); close();
}
fatal(s)
char *s;
{
int i;
fprintf(stderr, s);
fflush(stderr);
perror("Reason?");
for (i = 0; i < nusers; i++) {
if (child[i].pid > 0 && kill(child[i].pid, SIGKILL) != -1)
fprintf(stderr, "pid %d killed off\n", child[i].pid);
}
fflush(stderr);
exit_status = 4;
return;
}

View File

@@ -0,0 +1,91 @@
/*******************************************************************************
* The BYTE UNIX Benchmarks - Release 3
* Module: execl.c SID: 3.3 5/15/91 19:30:19
*
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith, Rick Grehan or Tom Yager
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
*
*******************************************************************************
* Modification Log:
* $Header: execl.c,v 3.5 87/06/22 15:37:08 kjmcdonell Beta $
* August 28, 1990 - Modified timing routines
* October 22, 1997 - code cleanup to remove ANSI C compiler warnings
* Andy Kahn <kahn@zk3.dec.com>
*
******************************************************************************/
/*
* Execing
*
*/
char SCCSid[] = "@(#) @(#)execl.c:3.3 -- 5/15/91 19:30:19";
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
char bss[8*1024]; /* something worthwhile */
#define main dummy
#include "big.c" /* some real code */
#undef main
int main(int argc, char *argv[]) /* the real program */
{
unsigned long iter = 0;
char *ptr;
char *fullpath;
int duration;
char count_str[12], start_str[24], path_str[256], *dur_str;
time_t start_time, this_time;
#ifdef DEBUG
int count;
for(count = 0; count < argc; ++ count)
printf("%s ",argv[count]);
printf("\n");
#endif
if (argc < 2)
{
fprintf(stderr, "Usage: %s duration\n", argv[0]);
exit(1);
}
duration = atoi(argv[1]);
if (duration > 0)
/* the first invocation */
{
dur_str = argv[1];
if((ptr = getenv("UB_BINDIR")) != NULL)
sprintf(path_str,"%s/execl",ptr);
fullpath=path_str;
time(&start_time);
}
else /* one of those execl'd invocations */
{
/* real duration follow the phoney null duration */
duration = atoi(argv[2]);
dur_str = argv[2];
iter = (unsigned long)atoi(argv[3]); /* where are we now ? */
sscanf(argv[4], "%lu", (unsigned long *) &start_time);
fullpath = argv[0];
}
sprintf(count_str, "%lu", ++iter); /* increment the execl counter */
sprintf(start_str, "%lu", (unsigned long) start_time);
time(&this_time);
if (this_time - start_time >= duration) { /* time has run out */
fprintf(stderr, "COUNT|%lu|1|lps\n", iter);
exit(0);
}
execl(fullpath, fullpath, "0", dur_str, count_str, start_str, (void *) 0);
fprintf(stderr, "Exec failed at iteration %lu\n", iter);
perror("Reason");
exit(1);
}

View File

@@ -0,0 +1,471 @@
/*******************************************************************************
* The BYTE UNIX Benchmarks - Release 3
* Module: fstime.c SID: 3.5 5/15/91 19:30:19
*
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith, Rick Grehan or Tom Yager
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
*
*******************************************************************************
* Modification Log:
* $Header: fstime.c,v 3.4 87/06/22 14:23:05 kjmcdonell Beta $
* 10/19/89 - rewrote timing calcs and added clock check (Ben Smith)
* 10/26/90 - simplify timing, change defaults (Tom Yager)
* 11/16/90 - added better error handling and changed output format (Ben Smith)
* 11/17/90 - changed the whole thing around (Ben Smith)
* 2/22/91 - change a few style elements and improved error handling (Ben Smith)
* 4/17/91 - incorporated suggestions from Seckin Unlu (seckin@sumac.intel.com)
* 4/17/91 - limited size of file, will rewind when reaches end of file
* 7/95 - fixed mishandling of read() and write() return codes
* Carl Emilio Prelz <fluido@telepac.pt>
* 12/95 - Massive changes. Made sleep time proportional increase with run
* time; added fsbuffer and fsdisk variants; added partial counting
* of partial reads/writes (was *full* credit); added dual syncs.
* David C Niemi <niemi@tux.org>
* 10/22/97 - code cleanup to remove ANSI C compiler warnings
* Andy Kahn <kahn@zk3.dec.com>
* 9/24/07 - Separate out the read and write tests;
* output the actual time used in the results.
* Ian Smith <johantheghost at yahoo period com>
******************************************************************************/
char SCCSid[] = "@(#) @(#)fstime.c:3.5 -- 5/15/91 19:30:19";
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/time.h>
#define SECONDS 10
#define MAX_BUFSIZE 8192
/* This must be set to the smallest BUFSIZE or 1024, whichever is smaller */
#define COUNTSIZE 256
#define HALFCOUNT (COUNTSIZE/2) /* Half of COUNTSIZE */
#define FNAME0 "dummy0"
#define FNAME1 "dummy1"
#ifndef MINIX
extern void sync(void);
#else
extern int sync(void);
#endif
int w_test(int timeSecs);
int r_test(int timeSecs);
int c_test(int timeSecs);
long read_score = 1, write_score = 1, copy_score = 1;
/****************** GLOBALS ***************************/
/* The buffer size for the tests. */
int bufsize = 1024;
/*
* The max number of 1024-byte blocks in the file.
* Don't limit it much, so that memory buffering
* can be overcome.
*/
int max_blocks = 2000;
/* The max number of BUFSIZE blocks in the file. */
int max_buffs = 2000;
/* Countable units per 1024 bytes */
int count_per_k;
/* Countable units per bufsize */
int count_per_buf;
/* The actual buffer. */
/* char *buf = 0; */
/* Let's carry on using a static buffer for this, like older versions
* of the code did. It turns out that if you use a malloc buffer,
* it goes 50% slower on reads, when using a 4k buffer -- at least on
* my OpenSUSE 10.2 system.
* What up wit dat?
*/
char buf[MAX_BUFSIZE];
int f;
int g;
int i;
void stop_count(int);
void clean_up(int);
int sigalarm = 0;
/******************** MAIN ****************************/
int main(int argc, char *argv[])
{
/* The number of seconds to run for. */
int seconds = SECONDS;
/* The type of test to run. */
char test = 'c';
int status;
int i;
for (i = 1; i < argc; ++i) {
if (argv[i][0] == '-') {
switch (argv[i][1]) {
case 'c':
case 'r':
case 'w':
test = argv[i][1];
break;
case 'b':
bufsize = atoi(argv[++i]);
break;
case 'm':
max_blocks = atoi(argv[++i]);
break;
case 't':
seconds = atoi(argv[++i]);
break;
case 'd':
if (chdir(argv[++i]) < 0) {
perror("fstime: chdir");
exit(1);
}
break;
default:
fprintf(stderr, "Usage: fstime [-c|-r|-w] [-b <bufsize>] [-m <max_blocks>] [-t <seconds>]\n");
exit(2);
}
} else {
fprintf(stderr, "Usage: fstime [-c|-r|-w] [-b <bufsize>] [-m <max_blocks>] [-t <seconds>]\n");
exit(2);
}
}
if (bufsize < COUNTSIZE || bufsize > MAX_BUFSIZE) {
fprintf(stderr, "fstime: buffer size must be in range %d-%d\n",
COUNTSIZE, 1024*1024);
exit(3);
}
if (max_blocks < 1 || max_blocks > 1024*1024) {
fprintf(stderr, "fstime: max blocks must be in range %d-%d\n",
1, 1024*1024);
exit(3);
}
if (seconds < 1 || seconds > 3600) {
fprintf(stderr, "fstime: time must be in range %d-%d seconds\n",
1, 3600);
exit(3);
}
max_buffs = max_blocks * 1024 / bufsize;
count_per_k = 1024 / COUNTSIZE;
count_per_buf = bufsize / COUNTSIZE;
/*
if ((buf = malloc(bufsize)) == 0) {
fprintf(stderr, "fstime: failed to malloc %d bytes\n", bufsize);
exit(4);
}
*/
if((f = creat(FNAME0, 0600)) == -1) {
perror("fstime: creat");
exit(1);
}
close(f);
if((g = creat(FNAME1, 0600)) == -1) {
perror("fstime: creat");
exit(1);
}
close(g);
if( (f = open(FNAME0, 2)) == -1) {
perror("fstime: open");
exit(1);
}
if( ( g = open(FNAME1, 2)) == -1 ) {
perror("fstime: open");
exit(1);
}
/* fill buffer */
for (i=0; i < bufsize; ++i)
buf[i] = i & 0xff;
signal(SIGKILL,clean_up);
/*
* Run the selected test.
* When I got here, this program ran full 30-second tests for
* write, read, and copy, outputting the results for each. BUT
* only the copy results are actually used in the benchmark index.
* With multiple iterations and three sets of FS tests, that amounted
* to about 10 minutes of wasted time per run.
*
* So, I've made the test selectable. Except that the read and write
* passes are used to create the test file and calibrate the rates used
* to tweak the results of the copy test. So, for copy tests, we do
* a few seconds of write and read to prime the pump.
*
* Note that this will also pull the file into the FS cache on any
* modern system prior to the copy test. Whether this is good or
* bad is a matter of perspective, but it's how it was when I got
* here.
*
* Ian Smith <johantheghost at yahoo period com> 21 Sep 2007
*/
switch (test) {
case 'w':
status = w_test(seconds);
break;
case 'r':
w_test(2);
status = r_test(seconds);
break;
case 'c':
w_test(2);
r_test(2);
status = c_test(seconds);
break;
default:
fprintf(stderr, "fstime: unknown test \'%c\'\n", test);
exit(6);
}
if (status) {
clean_up(0);
exit(1);
}
clean_up(0);
exit(0);
}
static double getFloatTime(void)
{
struct timeval t;
gettimeofday(&t, 0);
return (double) t.tv_sec + (double) t.tv_usec / 1000000.0;
}
/*
* Run the write test for the time given in seconds.
*/
int w_test(int timeSecs)
{
unsigned long counted = 0L;
unsigned long tmp;
long f_blocks;
double start, end;
extern int sigalarm;
/* Sync and let it settle */
sync();
sleep(2);
sync();
sleep(2);
/* Set an alarm. */
sigalarm = 0;
signal(SIGALRM, stop_count);
alarm(timeSecs);
start = getFloatTime();
while (!sigalarm) {
for(f_blocks=0; f_blocks < max_buffs; ++f_blocks) {
if ((tmp=write(f, buf, bufsize)) != bufsize) {
if (errno != EINTR) {
perror("fstime: write");
return(-1);
}
stop_count(0);
counted += ((tmp+HALFCOUNT)/COUNTSIZE);
} else
counted += count_per_buf;
}
lseek(f, 0L, 0); /* rewind */
}
/* stop clock */
end = getFloatTime();
write_score = (long) ((double) counted / ((end - start) * count_per_k));
printf("Write done: %ld in %.4f, score %ld\n",
counted, end - start, write_score);
/*
* Output the test results. Use the true time.
*/
fprintf(stderr, "COUNT|%ld|0|KBps\n", write_score);
fprintf(stderr, "TIME|%.1f\n", end - start);
return(0);
}
/*
* Run the read test for the time given in seconds.
*/
int r_test(int timeSecs)
{
unsigned long counted = 0L;
unsigned long tmp;
double start, end;
extern int sigalarm;
extern int errno;
/* Sync and let it settle */
sync();
sleep(2);
sync();
sleep(2);
/* rewind */
errno = 0;
lseek(f, 0L, 0);
/* Set an alarm. */
sigalarm = 0;
signal(SIGALRM, stop_count);
alarm(timeSecs);
start = getFloatTime();
while (!sigalarm) {
/* read while checking for an error */
if ((tmp=read(f, buf, bufsize)) != bufsize) {
switch(errno) {
case 0:
case EINVAL:
lseek(f, 0L, 0); /* rewind at end of file */
counted += (tmp+HALFCOUNT)/COUNTSIZE;
continue;
case EINTR:
stop_count(0);
counted += (tmp+HALFCOUNT)/COUNTSIZE;
break;
default:
perror("fstime: read");
return(-1);
break;
}
} else
counted += count_per_buf;
}
/* stop clock */
end = getFloatTime();
read_score = (long) ((double) counted / ((end - start) * count_per_k));
printf("Read done: %ld in %.4f, score %ld\n",
counted, end - start, read_score);
/*
* Output the test results. Use the true time.
*/
fprintf(stderr, "COUNT|%ld|0|KBps\n", read_score);
fprintf(stderr, "TIME|%.1f\n", end - start);
return(0);
}
/*
* Run the copy test for the time given in seconds.
*/
int c_test(int timeSecs)
{
unsigned long counted = 0L;
unsigned long tmp;
double start, end;
extern int sigalarm;
sync();
sleep(2);
sync();
sleep(1);
/* rewind */
errno = 0;
lseek(f, 0L, 0);
/* Set an alarm. */
sigalarm = 0;
signal(SIGALRM, stop_count);
alarm(timeSecs);
start = getFloatTime();
while (!sigalarm) {
if ((tmp=read(f, buf, bufsize)) != bufsize) {
switch(errno) {
case 0:
case EINVAL:
lseek(f, 0L, 0); /* rewind at end of file */
lseek(g, 0L, 0); /* rewind the output too */
continue;
case EINTR:
/* part credit for leftover bytes read */
counted += ( (tmp * write_score) /
(read_score + write_score)
+ HALFCOUNT) / COUNTSIZE;
stop_count(0);
break;
default:
perror("fstime: copy read");
return(-1);
break;
}
} else {
if ((tmp=write(g, buf, bufsize)) != bufsize) {
if (errno != EINTR) {
perror("fstime: copy write");
return(-1);
}
counted += (
/* Full credit for part of buffer written */
tmp +
/* Plus part credit having read full buffer */
( ((bufsize - tmp) * write_score) /
(read_score + write_score) )
+ HALFCOUNT) / COUNTSIZE;
stop_count(0);
} else
counted += count_per_buf;
}
}
/* stop clock */
end = getFloatTime();
copy_score = (long) ((double) counted / ((end - start) * count_per_k));
printf("Copy done: %ld in %.4f, score %ld\n",
counted, end - start, copy_score);
/*
* Output the test results. Use the true time.
*/
fprintf(stderr, "COUNT|%ld|0|KBps\n", copy_score);
fprintf(stderr, "TIME|%.1f\n", end - start);
return(0);
}
void stop_count(int sig)
{
extern int sigalarm;
sigalarm = 1;
}
void clean_up(int sig)
{
unlink(FNAME0);
unlink(FNAME1);
}

View File

@@ -0,0 +1,75 @@
/*******************************************************************************
* The BYTE UNIX Benchmarks - Release 3
* Module: hanoi.c SID: 3.3 5/15/91 19:30:20
*
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith, Rick Grehan or Tom Yager
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
*
*******************************************************************************
* Modification Log:
* $Header: hanoi.c,v 3.5 87/08/06 08:11:14 kenj Exp $
* August 28, 1990 - Modified timing routines (ty)
* October 22, 1997 - code cleanup to remove ANSI C compiler warnings
* Andy Kahn <kahn@zk3.dec.com>
*
******************************************************************************/
char SCCSid[] = "@(#) @(#)hanoi.c:3.3 -- 5/15/91 19:30:20";
#define other(i,j) (6-(i+j))
#include <stdio.h>
#include <stdlib.h>
#include "timeit.c"
void mov(int n, int f, int t);
unsigned long iter = 0;
int num[4];
long cnt;
void report(int sig)
{
fprintf(stderr,"COUNT|%ld|1|lps\n", iter);
exit(0);
}
int main(int argc, char *argv[])
{
int disk=10, /* default number of disks */
duration;
if (argc < 2) {
fprintf(stderr,"Usage: %s duration [disks]\n", argv[0]);
exit(1);
}
duration = atoi(argv[1]);
if(argc > 2) disk = atoi(argv[2]);
num[1] = disk;
wake_me(duration, report);
while(1) {
mov(disk,1,3);
iter++;
}
exit(0);
}
void mov(int n, int f, int t)
{
int o;
if(n == 1) {
num[f]--;
num[t]++;
return;
}
o = other(f,t);
mov(n-1,f,o);
mov(1,f,t);
mov(n-1,o,t);
}

View File

@@ -0,0 +1,103 @@
/*******************************************************************************
* The BYTE UNIX Benchmarks - Release 1
* Module: looper.c SID: 1.4 5/15/91 19:30:22
*
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith or Tom Yager at BYTE Magazine
* ben@bytepb.byte.com tyager@bytepb.byte.com
*
*******************************************************************************
* Modification Log:
*
* February 25, 1991 -- created (Ben S.)
* October 22, 1997 - code cleanup to remove ANSI C compiler warnings
* Andy Kahn <kahn@zk3.dec.com>
*
******************************************************************************/
char SCCSid[] = "@(#) @(#)looper.c:1.4 -- 5/15/91 19:30:22";
/*
* Shell Process creation
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include "timeit.c"
unsigned long iter;
char *cmd_argv[28];
int cmd_argc;
void report(int sig)
{
fprintf(stderr,"COUNT|%lu|60|lpm\n", iter);
exit(0);
}
int main(int argc, char *argv[])
{
int slave, count, duration;
int status;
if (argc < 2)
{
fprintf(stderr,"Usage: %s duration command [args..]\n", argv[0]);
fprintf(stderr," duration in seconds\n");
exit(1);
}
if((duration = atoi(argv[1])) < 1)
{
fprintf(stderr,"Usage: %s duration command [arg..]\n", argv[0]);
fprintf(stderr," duration in seconds\n");
exit(1);
}
/* get command */
cmd_argc=argc-2;
for( count=2;count < argc; ++count)
cmd_argv[count-2]=argv[count];
#ifdef DEBUG
printf("<<%s>>",cmd_argv[0]);
for(count=1;count < cmd_argc; ++count)
printf(" <%s>", cmd_argv[count]);
putchar('\n');
exit(0);
#endif
iter = 0;
wake_me(duration, report);
while (1)
{
if ((slave = fork()) == 0)
{ /* execute command */
execvp(cmd_argv[0],cmd_argv);
exit(99);
}
else if (slave < 0)
{
/* woops ... */
fprintf(stderr,"Fork failed at iteration %lu\n", iter);
perror("Reason");
exit(2);
}
else
/* master */
wait(&status);
if (status == 99 << 8)
{
fprintf(stderr, "Command \"%s\" didn't exec\n", cmd_argv[0]);
exit(2);
}
else if (status != 0)
{
fprintf(stderr,"Bad wait status: 0x%x\n", status);
exit(2);
}
iter++;
}
}

View File

@@ -0,0 +1,66 @@
/*******************************************************************************
* The BYTE UNIX Benchmarks - Release 3
* Module: pipe.c SID: 3.3 5/15/91 19:30:20
*
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith, Rick Grehan or Tom Yager
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
*
*******************************************************************************
* Modification Log:
* $Header: pipe.c,v 3.5 87/06/22 14:32:36 kjmcdonell Beta $
* August 29, 1990 - modified timing routines (ty)
* October 22, 1997 - code cleanup to remove ANSI C compiler warnings
* Andy Kahn <kahn@zk3.dec.com>
*
******************************************************************************/
char SCCSid[] = "@(#) @(#)pipe.c:3.3 -- 5/15/91 19:30:20";
/*
* pipe -- test single process pipe throughput (no context switching)
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "timeit.c"
unsigned long iter;
void report(int sig)
{
fprintf(stderr,"COUNT|%ld|1|lps\n", iter);
exit(0);
}
int main(int argc, char *argv[])
{
char buf[512];
int pvec[2], duration;
if (argc != 2) {
fprintf(stderr,"Usage: %s duration\n", argv[0]);
exit(1);
}
duration = atoi(argv[1]);
pipe(pvec);
wake_me(duration, report);
iter = 0;
while (1) {
if (write(pvec[1], buf, sizeof(buf)) != sizeof(buf)) {
if ((errno != EINTR) && (errno != 0))
fprintf(stderr,"write failed, error %d\n", errno);
}
if (read(pvec[0], buf, sizeof(buf)) != sizeof(buf)) {
if ((errno != EINTR) && (errno != 0))
fprintf(stderr,"read failed, error %d\n", errno);
}
iter++;
}
}

View File

@@ -0,0 +1,78 @@
/*******************************************************************************
* The BYTE UNIX Benchmarks - Release 3
* Module: spawn.c SID: 3.3 5/15/91 19:30:20
*
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith, Rick Grehan or Tom Yagerat BYTE Magazine
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
*
*******************************************************************************
* Modification Log:
* $Header: spawn.c,v 3.4 87/06/22 14:32:48 kjmcdonell Beta $
* August 29, 1990 - Modified timing routines (ty)
* October 22, 1997 - code cleanup to remove ANSI C compiler warnings
* Andy Kahn <kahn@zk3.dec.com>
*
******************************************************************************/
char SCCSid[] = "@(#) @(#)spawn.c:3.3 -- 5/15/91 19:30:20";
/*
* Process creation
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include "timeit.c"
unsigned long iter;
void report(int sig)
{
fprintf(stderr,"COUNT|%lu|1|lps\n", iter);
exit(0);
}
int main(int argc, char *argv[])
{
int slave, duration;
int status;
if (argc != 2) {
fprintf(stderr,"Usage: %s duration \n", argv[0]);
exit(1);
}
duration = atoi(argv[1]);
iter = 0;
wake_me(duration, report);
while (1) {
if ((slave = fork()) == 0) {
/* slave .. boring */
#if debug
printf("fork OK\n");
#endif
/* kill it right away */
exit(0);
} else if (slave < 0) {
/* woops ... */
fprintf(stderr,"Fork failed at iteration %lu\n", iter);
perror("Reason");
exit(2);
} else
/* master */
wait(&status);
if (status != 0) {
fprintf(stderr,"Bad wait status: 0x%x\n", status);
exit(2);
}
iter++;
#if debug
printf("Child %d done.\n", slave);
#endif
}
}

View File

@@ -0,0 +1,107 @@
/*******************************************************************************
* The BYTE UNIX Benchmarks - Release 3
* Module: syscall.c SID: 3.3 5/15/91 19:30:21
*
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith, Rick Grehan or Tom Yager at BYTE Magazine
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
*
*******************************************************************************
* Modification Log:
* $Header: syscall.c,v 3.4 87/06/22 14:32:54 kjmcdonell Beta $
* August 29, 1990 - Modified timing routines
* October 22, 1997 - code cleanup to remove ANSI C compiler warnings
* Andy Kahn <kahn@zk3.dec.com>
*
******************************************************************************/
/*
* syscall -- sit in a loop calling the system
*
*/
char SCCSid[] = "@(#) @(#)syscall.c:3.3 -- 5/15/91 19:30:21";
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "timeit.c"
unsigned long iter;
void report(int sig)
{
fprintf(stderr,"COUNT|%ld|1|lps\n", iter);
exit(0);
}
int main(int argc, char *argv[])
{
char *test;
int duration;
if (argc < 2) {
fprintf(stderr,"Usage: %s duration [ test ]\n", argv[0]);
fprintf(stderr,"test is one of:\n");
fprintf(stderr," \"mix\" (default), \"close\", \"getpid\", \"exec\"\n");
exit(1);
}
if (argc > 2)
test = argv[2];
else
test = "mix";
duration = atoi(argv[1]);
iter = 0;
wake_me(duration, report);
switch (test[0]) {
case 'm':
while (1) {
close(dup(0));
getpid();
getuid();
umask(022);
iter++;
}
/* NOTREACHED */
case 'c':
while (1) {
close(dup(0));
iter++;
}
/* NOTREACHED */
case 'g':
while (1) {
getpid();
iter++;
}
/* NOTREACHED */
case 'e':
while (1) {
pid_t pid = fork();
if (pid < 0) {
fprintf(stderr,"%s: fork failed\n", argv[0]);
exit(1);
} else if (pid == 0) {
execl("/bin/true", (char *) 0);
fprintf(stderr,"%s: exec /bin/true failed\n", argv[0]);
exit(1);
} else {
if (waitpid(pid, NULL, 0) < 0) {
fprintf(stderr,"%s: waitpid failed\n", argv[0]);
exit(1);
}
}
iter++;
}
/* NOTREACHED */
}
exit(9);
}

View File

@@ -0,0 +1,573 @@
/* Programme to test how long it takes to select(2), poll(2) and poll2(2) a
large number of file descriptors.
Copyright 1997 Richard Gooch rgooch@atnf.csiro.au
Distributed under the GNU General Public License.
To compile this programme, use gcc -O2 -o time-polling time-polling.c
Extra compile flags:
Add -DHAS_SELECT if your operating system has the select(2) system call
Add -DHAS_POLL if your operating system has the poll(2) system call
Add -DHAS_POLL2 if your operating system has the poll2(2) system call
Usage: time-polling [num_iter] [num_to_test] [num_active] [-v]
NOTE: on many systems the default limit on file descriptors is less than
1024. You should try to increase this limit to 1024 before doing the test.
Something like "limit descriptors 1024" or "limit openfiles 1024" should do
the trick. On some systems (like IRIX), doing the test on a smaller number
gives a *much* smaller time per descriptor, which shows that time taken
does not scale linearly with number of descriptors, which is non-optimal.
In the tests I've done, I try to use 1024 descriptors.
The benchmark results are available at:
http://www.atnf.csiro.au/~rgooch/benchmarks.html
If you want to contribute results, please email them to me. Please specify
if you want to be acknowledged.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Richard Gooch may be reached by email at rgooch@atnf.csiro.au
The postal address is:
Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia.
*/
#ifdef UNIXBENCH
#define OUT stdout
#else
#define OUT stderr
#endif
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <sys/resource.h>
#ifdef HAS_POLL
# include <sys/poll.h>
#endif
#ifdef HAS_POLL2
# include <linux/poll2.h>
#endif
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#define TRUE 1
#define FALSE 0
#ifdef UNIXBENCH
#define MAX_ITERATIONS 1000
#else
#define MAX_ITERATIONS 30
#endif
#define MAX_FDS 40960
#define CONST const
#define ERRSTRING strerror (errno)
typedef int flag;
/*
static inline int find_first_set_bit (CONST void *array, int size)
*/
static int find_first_set_bit (CONST void *array, int size)
/* [SUMMARY] Find the first bit set in a bitfield.
<array> A pointer to the bitfield. This must be aligned on a long boundary.
<size> The number of bits in the bitfield.
[RETURNS] The index of the first set bit. If no bits are set, <<size>> + 1
is returned.
*/
{
int index;
unsigned long word;
unsigned int ul_size = 8 * sizeof (unsigned long);
CONST unsigned long *ul_array = array;
/* Find first word with any bit set */
for (index = 0; (*ul_array == 0) && (index < size);
index += ul_size, ++ul_array);
/* Find first bit set in word */
for (word = *ul_array; !(word & 1) && (index < size);
++index, word = word >> 1);
return (index);
} /* End Function find_first_set_bit */
/*
static inline int find_next_set_bit (CONST void *array, int size, int offset)
*/
static int find_next_set_bit (CONST void *array, int size, int offset)
/* [SUMMARY] Find the next bit set in a bitfield.
<array> A pointer to the bitfield. This must be aligned on a long boundary.
<size> The number of bits in the bitfield.
<offset> The offset of the current bit in the bitfield. The current bit is
ignored.
[RETURNS] The index of the next set bit. If no more bits are set,
<<size>> + 1 is returned.
*/
{
int index, tmp;
unsigned long word;
unsigned int ul_size = 8 * sizeof (unsigned long);
CONST unsigned long *ul_array = array;
if (++offset >= size) return (offset);
index = offset;
/* Jump to the long word containing the next bit */
tmp = offset / ul_size;
ul_array += tmp;
offset -= tmp * ul_size;
if ( (offset == 0) || (*ul_array == 0) )
return (find_first_set_bit (ul_array, size - index) + index);
/* There is a bit set somewhere in this word */
if ( ( (word = *ul_array) != 0 ) && ( (word = word >> offset) != 0 ) )
{
/* There is a bit set somewhere in this word at or after the offset
position */
for (; (word & 1) == 0; word = word >> 1, ++index);
return (index);
}
/* Have to go to subsequent word(s) */
index += ul_size - offset;
return (find_first_set_bit (++ul_array, size - index) + index);
} /* End Function find_next_set_bit */
struct callback_struct
{
void (*input_func) (void *info);
void (*output_func) (void *info);
void (*exception_func) (void *info);
void *info;
};
static int total_bits = 0;
struct callback_struct callbacks[MAX_FDS];
static void test_func (void *info)
{
++total_bits;
}
#ifdef HAS_SELECT
static void time_select (fd_set *input_fds, fd_set *output_fds,
fd_set *exception_fds, int max_fd, int num_iter,
long *times)
/* [SUMMARY] Time how long it takes to select(2) file descriptors.
<input_fds> The input masks.
<output_fds> The output masks.
<exception_fds> The exception masks.
<max_fd> The highest file descriptor in the fd_sets.
<num_iter> The number of iterations.
<times> The time taken (in microseconds) for each iteration.
[RETURNS] Nothing.
*/
{
int fd, count, nready;
fd_set i_fds, o_fds, e_fds;
struct timeval time1, time2, tv;
/* Warm the cache a bit */
memcpy (&i_fds, input_fds, sizeof i_fds);
memcpy (&o_fds, output_fds, sizeof i_fds);
memcpy (&e_fds, exception_fds, sizeof i_fds);
tv.tv_sec = 0;
tv.tv_usec = 0;
select (max_fd + 1, &i_fds, &o_fds, &e_fds, &tv);
for (count = 0; count < num_iter; ++count)
{
total_bits = 0;
gettimeofday (&time1, NULL);
memcpy (&i_fds, input_fds, sizeof i_fds);
memcpy (&o_fds, output_fds, sizeof i_fds);
memcpy (&e_fds, exception_fds, sizeof i_fds);
tv.tv_sec = 0;
tv.tv_usec = 0;
nready = select (max_fd + 1, &i_fds, &o_fds, &e_fds, &tv);
if (nready == -1)
{
fprintf (stderr, "Error selecting\t%s\n", ERRSTRING);
exit (2);
}
if (nready < 1)
{
fprintf (stderr, "Error: nready: %d\n", nready);
exit (1);
}
/* Scan the output */
for (fd = find_first_set_bit (&e_fds, sizeof e_fds * 8); fd <= max_fd;
fd = find_next_set_bit (&e_fds, sizeof e_fds * 8, fd) )
{
(*callbacks[fd].exception_func) (callbacks[fd].info);
}
for (fd = find_first_set_bit (&i_fds, sizeof i_fds * 8); fd <= max_fd;
fd = find_next_set_bit (&i_fds, sizeof i_fds * 8, fd) )
{
(*callbacks[fd].input_func) (callbacks[fd].info);
}
for (fd = find_first_set_bit (&o_fds, sizeof o_fds * 8); fd <= max_fd;
fd = find_next_set_bit (&o_fds, sizeof o_fds * 8, fd) )
{
(*callbacks[fd].output_func) (callbacks[fd].info);
}
gettimeofday (&time2, NULL);
times[count] = (time2.tv_sec - time1.tv_sec) * 1000000;
times[count] += time2.tv_usec - time1.tv_usec;
}
} /* End Function time_select */
#endif /* HAS_SELECT */
#ifdef HAS_POLL
static void time_poll (struct pollfd *pollfd_array, int start_index,
int num_to_test, int num_iter, long *times)
/* [SUMMARY] Time how long it takes to poll(2) file descriptors.
<pollfd_array> The array of pollfd structures.
<start_index> The start index in the array of pollfd structures.
<num_to_test> The number of file descriptors to test.
<num_iter> The number of iterations.
<times> The time taken (in microseconds) for each iteration.
[RETURNS] Nothing.
*/
{
short revents;
int fd, count, nready;
struct timeval time1, time2;
struct pollfd *pollfd_ptr, *stop_pollfd;
/* Warm the cache a bit */
poll (pollfd_array + start_index, num_to_test, 0);
for (count = 0; count < num_iter; ++count)
{
total_bits = 0;
gettimeofday (&time1, NULL);
nready = poll (pollfd_array + start_index, num_to_test, 0);
if (nready == -1)
{
fprintf (stderr, "Error polling\t%s\n", ERRSTRING);
exit (2);
}
if (nready < 1)
{
fprintf (stderr, "Error: nready: %d\n", nready);
exit (1);
}
stop_pollfd = pollfd_array + start_index + num_to_test;
for (pollfd_ptr = pollfd_array + start_index; TRUE; ++pollfd_ptr)
{
if (pollfd_ptr->revents == 0) continue;
/* Have an active descriptor */
revents = pollfd_ptr->revents;
fd = pollfd_ptr->fd;
if (revents & POLLPRI)
(*callbacks[fd].exception_func) (callbacks[fd].info);
if (revents & POLLIN)
(*callbacks[fd].input_func) (callbacks[fd].info);
if (revents & POLLOUT)
(*callbacks[fd].output_func) (callbacks[fd].info);
if (--nready == 0) break;
}
gettimeofday (&time2, NULL);
times[count] = (time2.tv_sec - time1.tv_sec) * 1000000;
times[count] += time2.tv_usec - time1.tv_usec;
}
} /* End Function time_poll */
#endif /* HAS_POLL */
#ifdef HAS_POLL2
static void time_poll2 (struct poll2ifd *poll2ifd_array, int start_index,
int num_to_test, int num_iter, long *times)
/* [SUMMARY] Time how long it takes to poll2(2) file descriptors.
<poll2ifd_array> The array of poll2ifd structures.
<start_index> The start index in the array of pollfd structures.
<num_to_test> The number of file descriptors to test.
<num_iter> The number of iterations.
<times> The time taken (in microseconds) for each iteration.
[RETURNS] Nothing.
*/
{
short revents;
int fd, count, nready, i;
struct timeval time1, time2;
struct poll2ofd poll2ofd_array[MAX_FDS];
/* Warm the cache a bit */
poll2 (poll2ifd_array + start_index, poll2ofd_array, num_to_test, 0);
for (count = 0; count < num_iter; ++count)
{
total_bits = 0;
gettimeofday (&time1, NULL);
nready = poll2 (poll2ifd_array + start_index, poll2ofd_array,
num_to_test, 0);
if (nready == -1)
{
times[count] = -1;
if (errno == ENOSYS) return; /* Must do this first */
fprintf (stderr, "Error calling poll2(2)\t%s\n", ERRSTRING);
exit (2);
}
if (nready < 1)
{
fprintf (stderr, "Error: nready: %d\n", nready);
exit (1);
}
for (i = 0; i < nready; ++i)
{
revents = poll2ofd_array[i].revents;
fd = poll2ofd_array[i].fd;
if (revents & POLLPRI)
(*callbacks[fd].exception_func) (callbacks[fd].info);
if (revents & POLLIN)
(*callbacks[fd].input_func) (callbacks[fd].info);
if (revents & POLLOUT)
(*callbacks[fd].output_func) (callbacks[fd].info);
}
gettimeofday (&time2, NULL);
times[count] = (time2.tv_sec - time1.tv_sec) * 1000000;
times[count] += time2.tv_usec - time1.tv_usec;
}
} /* End Function time_poll2 */
#endif /* HAS_POLL2 */
int main (argc, argv)
int argc;
char *argv[];
{
flag failed = FALSE;
flag verbose = FALSE;
int first_fd = -1;
int fd, max_fd, count, total_fds;
int num_to_test, num_active;
#ifdef UNIXBENCH
int max_iter = 1000;
#else
int max_iter = 10;
#endif
#ifdef HAS_SELECT
long select_total = 0;
fd_set input_fds, output_fds, exception_fds;
long select_times[MAX_ITERATIONS];
#endif
#ifdef HAS_POLL
int start_index;
long poll_total = 0;
struct pollfd pollfd_array[MAX_FDS];
long poll_times[MAX_ITERATIONS];
#endif
#ifdef HAS_POLL2
long poll2_total = 0;
struct poll2ifd poll2ifd_array[MAX_FDS];
struct poll2ofd poll2ofd_array[MAX_FDS];
long poll2_times[MAX_ITERATIONS];
#endif
#if 0
extern char *sys_errlist[];
#endif
#ifdef HAS_SELECT
FD_ZERO (&input_fds);
FD_ZERO (&output_fds);
FD_ZERO (&exception_fds);
#endif
#ifdef HAS_POLL
memset (pollfd_array, 0, sizeof pollfd_array);
#endif
/* Allocate file descriptors */
total_fds = 0;
max_fd = 0;
while (!failed)
{
if ( ( fd = dup (1) ) == -1 )
{
if (errno != EMFILE)
{
fprintf (stderr, "Error dup()ing\t%s\n", ERRSTRING);
exit (1);
}
failed = TRUE;
continue;
}
if (fd >= MAX_FDS)
{
fprintf (stderr, "File descriptor: %d larger than max: %d\n",
fd, MAX_FDS - 1);
exit (1);
}
callbacks[fd].input_func = test_func;
callbacks[fd].output_func = test_func;
callbacks[fd].exception_func = test_func;
callbacks[fd].info = NULL;
if (fd > max_fd) max_fd = fd;
if (first_fd < 0) first_fd = fd;
#ifdef HAS_POLL
pollfd_array[fd].fd = fd;
pollfd_array[fd].events = 0;
#endif
#ifdef HAS_POLL2
poll2ifd_array[fd].fd = fd;
poll2ifd_array[fd].events = 0;
#endif
}
total_fds = max_fd + 1;
/* Process the command-line arguments */
if (argc > 5)
{
fputs ("Usage:\ttime-polling [num_iter] [num_to_test] [num_active] [-v]\n",
stderr);
exit (1);
}
if (argc > 1) max_iter = atoi (argv[1]);
if (max_iter > MAX_ITERATIONS)
{
fprintf (stderr, "num_iter too large\n");
exit (1);
}
if (argc > 2) num_to_test = atoi (argv[2]);
else num_to_test = total_fds - first_fd;
if (argc > 3) num_active = atoi (argv[3]);
else num_active = 1;
if (argc > 4)
{
if (strcmp (argv[4], "-v") != 0)
{
fputs ("Usage:\ttime-polling [num_iter] [num_to_test] [num_active] [-v]\n",
stderr);
exit (1);
}
verbose = TRUE;
}
/* Sanity tests */
if (num_to_test > total_fds - first_fd) num_to_test = total_fds - first_fd;
if (num_active > total_fds - first_fd) num_active = total_fds - first_fd;
/* Set activity monitoring flags */
for (fd = total_fds - num_to_test; fd < total_fds; ++fd)
{
#ifdef HAS_SELECT
FD_SET (fd, &exception_fds);
FD_SET (fd, &input_fds);
#endif
#ifdef HAS_POLL
pollfd_array[fd].events = POLLPRI | POLLIN;
#endif
#ifdef HAS_POLL2
poll2ifd_array[fd].events = POLLPRI | POLLIN;
#endif
}
for (fd = total_fds - num_active; fd < total_fds; ++fd)
{
#ifdef HAS_SELECT
FD_SET (fd, &output_fds);
#endif
#ifdef HAS_POLL
pollfd_array[fd].events |= POLLOUT;
#endif
#ifdef HAS_POLL2
poll2ifd_array[fd].events |= POLLOUT;
#endif
}
fprintf (OUT, "Num fds: %d, polling descriptors %d-%d\n",
total_fds, total_fds - num_to_test, max_fd);
/* First do all the tests, then print the results */
#ifdef HAS_SELECT
time_select (&input_fds, &output_fds, &exception_fds, max_fd, max_iter,
select_times);
#endif
#ifdef HAS_POLL
start_index = total_fds - num_to_test;
time_poll (pollfd_array, start_index, num_to_test, max_iter, poll_times);
#endif
#ifdef HAS_POLL2
start_index = total_fds - num_to_test;
time_poll2 (poll2ifd_array, start_index, num_to_test, max_iter,
poll2_times);
#endif
/* Now print out all the times */
fputs ("All times in microseconds\n", OUT);
fputs ("ITERATION\t", OUT);
#ifdef HAS_SELECT
fprintf (OUT, "%-12s", "select(2)");
#endif
#ifdef HAS_POLL
fprintf (OUT, "%-12s", "poll(2)");
#endif
#ifdef HAS_POLL2
if (poll2_times[0] >= 0) fprintf (OUT, "%-12s", "poll2(2)");
#endif
for (count = 0; count < max_iter; ++count)
{
if (verbose) fprintf (OUT, "\n%d\t\t", count);
#ifdef HAS_SELECT
if (verbose) fprintf (OUT, "%-12ld", select_times[count]);
select_total += select_times[count];
#endif
#ifdef HAS_POLL
if (verbose) fprintf (OUT, "%-12ld", poll_times[count]);
poll_total += poll_times[count];
#endif
#ifdef HAS_POLL2
if ( verbose && (poll2_times[0] >= 0) )
fprintf (OUT, "%-12ld", poll2_times[count]);
poll2_total += poll2_times[count];
#endif
}
fputs ("\n\naverage\t\t", OUT);
#ifdef HAS_SELECT
fprintf (OUT, "%-12ld", select_total / max_iter);
#endif
#ifdef HAS_POLL
fprintf (OUT, "%-12ld", poll_total / max_iter);
#endif
#ifdef HAS_POLL2
if (poll2_times[0] >= 0)
fprintf (OUT, "%-12ld", poll2_total / max_iter);
#endif
putc ('\n', OUT);
fputs ("Per fd\t\t", OUT);
#ifdef HAS_SELECT
fprintf (OUT, "%-12.2f",
(float) select_total / (float) max_iter / (float) num_to_test);
#ifdef UNIXBENCH
fprintf (stderr, "lps\t%.2f\t%.1f\n",
1000000 * (float) max_iter * (float) num_to_test
/ (float) select_total, (float)select_total / 1000000);
#endif
#endif
#ifdef HAS_POLL
fprintf (OUT, "%-12.2f",
(float) poll_total / (float) max_iter / (float) num_to_test);
#ifdef UNIXBENCH
fprintf (stderr, "lps\t%.2f\t%.1f\n",
1000000 * (float) max_iter * (float) num_to_test
/ (float) poll_total, (float)poll_total / 1000000);
#endif
#endif
#ifdef HAS_POLL2
if (poll2_times[0] >= 0) {
fprintf (OUT, "%-12.2f",
(float) poll2_total / (float) max_iter / (float) num_to_test);
#ifdef UNIXBENCH
fprintf (stderr, "lps\t%.2f\t%.1f\n",
1000000 * (float) max_iter * (float) num_to_test
/ (float) poll2_total, (float)poll2_total / 1000000);
#endif
}
#endif
fputs ("<- the most important value\n", OUT);
exit(0);
} /* End Function main */

View File

@@ -0,0 +1,39 @@
/*******************************************************************************
*
* The BYTE UNIX Benchmarks - Release 3
* Module: timeit.c SID: 3.3 5/15/91 19:30:21
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith, Rick Grehan or Tom Yager
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
*
*******************************************************************************
* Modification Log:
* May 12, 1989 - modified empty loops to avoid nullifying by optimizing
* compilers
* August 28, 1990 - changed timing relationship--now returns total number
* of iterations (ty)
* October 22, 1997 - code cleanup to remove ANSI C compiler warnings
* Andy Kahn <kahn@zk3.dec.com>
*
******************************************************************************/
/* this module is #included in other modules--no separate SCCS ID */
/*
* Timing routine
*
*/
#include <signal.h>
#include <unistd.h>
void wake_me(int seconds, void (*func)(int))
{
/* set up the signal handler */
signal(SIGALRM, func);
/* get the clock running */
alarm(seconds);
}

View File

@@ -0,0 +1,650 @@
/*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* $XFree86: xc/programs/glxgears/glxgears.c,v 1.3tsi Exp $ */
/*
* This is a port of the infamous "gears" demo to straight GLX (i.e. no GLUT)
* Port by Brian Paul 23 March 2001
*
* Exact timing added by Behdad Esfahbod to achieve a fixed speed regardless
* of frame rate. November 2003
*
* Printer support added by Roland Mainz <roland.mainz@nrubsig.org>. April 2004
*
* This version modified by Ian Smith, 30 Sept 2007, to make ubgears.
* ubgears is cusoimised for use in the UnixBench benchmarking suite.
* Some redundant stuff is gone, and the -time option is added.
* Mainly it's forked so we don't use the host's version, which could change
* from platform to platform.
*
* Command line options:
* -display Set X11 display for output.
* -info Print additional GLX information.
* -time <t> Run for <t> seconds and produce a performance report.
* -h Print this help page.
* -v Verbose output.
*
*/
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GL/gl.h>
#include <GL/glx.h>
#include <sys/time.h>
#include <sched.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#ifndef M_PI
#define M_PI 3.14159265
#endif /* !M_PI */
/* Turn a NULL pointer string into an empty string */
#define NULLSTR(x) (((x)!=NULL)?(x):(""))
#define Log(x) { if(verbose) printf x; }
#define Msg(x) { printf x; }
/* Globla vars */
/* program name (from argv[0]) */
static const char *ProgramName;
/* verbose output what the program is doing */
static Bool verbose = False;
/* time in microseconds to run for; -1 means forever. */
static int runTime = -1;
/* Time at which start_time(void) was called. */
static struct timeval clockStart;
/* XXX this probably isn't very portable */
/* return current time (in seconds) */
static void
start_time(void)
{
(void) gettimeofday(&clockStart, 0);
}
/*
* return time (in microseconds) since start_time(void) was called.
*
* The older version of this function randomly returned negative results.
* This version won't, up to 2000 seconds and some.
*/
static long
current_time(void)
{
struct timeval tv;
long secs, micros;
(void) gettimeofday(&tv, 0);
secs = tv.tv_sec - clockStart.tv_sec;
micros = tv.tv_usec - clockStart.tv_usec;
if (micros < 0) {
--secs;
micros += 1000000;
}
return secs * 1000000 + micros;
}
static
void usage(void)
{
fprintf (stderr, "usage: %s [options]\n", ProgramName);
fprintf (stderr, "-display\tSet X11 display for output.\n");
fprintf (stderr, "-info\t\tPrint additional GLX information.\n");
fprintf (stderr, "-time t\t\tRun for t seconds and report performance.\n");
fprintf (stderr, "-h\t\tPrint this help page.\n");
fprintf (stderr, "-v\t\tVerbose output.\n");
fprintf (stderr, "\n");
exit(EXIT_FAILURE);
}
static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
static GLint gear1, gear2, gear3;
static GLfloat angle = 0.0;
static GLint speed = 60;
static GLboolean printInfo = GL_FALSE;
/*
*
* Draw a gear wheel. You'll probably want to call this function when
* building a display list since we do a lot of trig here.
*
* Input: inner_radius - radius of hole at center
* outer_radius - radius at center of teeth
* width - width of gear
* teeth - number of teeth
* tooth_depth - depth of tooth
*/
static void
gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
GLint teeth, GLfloat tooth_depth)
{
GLint i;
GLfloat r0, r1, r2, maxr2, minr2;
GLfloat angle, da;
GLfloat u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0;
maxr2 = r2 = outer_radius + tooth_depth / 2.0;
minr2 = r2;
da = 2.0 * M_PI / teeth / 4.0;
glShadeModel(GL_FLAT);
glNormal3f(0.0, 0.0, 1.0);
/* draw front face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
if (i < teeth) {
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
width * 0.5);
}
}
glEnd();
/* draw front sides of teeth */
glBegin(GL_QUADS);
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
width * 0.5);
r2 = minr2;
}
r2 = maxr2;
glEnd();
glNormal3f(0.0, 0.0, -1.0);
/* draw back face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
if (i < teeth) {
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
-width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
}
}
glEnd();
/* draw back sides of teeth */
glBegin(GL_QUADS);
da = 2.0 * M_PI / teeth / 4.0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
-width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
-width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
r2 = minr2;
}
r2 = maxr2;
glEnd();
/* draw outward faces of teeth */
glBegin(GL_QUAD_STRIP);
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
u = r2 * cos(angle + da) - r1 * cos(angle);
v = r2 * sin(angle + da) - r1 * sin(angle);
len = sqrt(u * u + v * v);
u /= len;
v /= len;
glNormal3f(v, -u, 0.0);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glNormal3f(cos(angle + 1.5 * da), sin(angle + 1.5 * da), 0.0);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
-width * 0.5);
u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
glNormal3f(v, -u, 0.0);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
-width * 0.5);
glNormal3f(cos(angle + 3.5 * da), sin(angle + 3.5 * da), 0.0);
r2 = minr2;
}
r2 = maxr2;
glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
glEnd();
glShadeModel(GL_SMOOTH);
/* draw inside radius cylinder */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glNormal3f(-cos(angle), -sin(angle), 0.0);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
}
glEnd();
}
static void
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1.0, 0.0, 0.0);
glRotatef(view_roty, 0.0, 1.0, 0.0);
glRotatef(view_rotz, 0.0, 0.0, 1.0);
glPushMatrix();
glTranslatef(-3.0, -2.0, 0.0);
glRotatef(angle, 0.0, 0.0, 1.0);
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1, -2.0, 0.0);
glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1, 4.2, 0.0);
glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
glCallList(gear3);
glPopMatrix();
glPopMatrix();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
/* fit width and height */
if (h >= 1.0)
glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
else
glFrustum(-1.0/h, 1.0/h, -1.0, 1.0, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
}
static void
init(void)
{
static GLfloat pos[4] = { 5.0, 5.0, 10.0, 0.0 };
static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
/* make the gears */
gear1 = glGenLists(1);
glNewList(gear1, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
gear(1.0, 4.0, 1.0, 20, 0.7);
glEndList();
gear2 = glGenLists(1);
glNewList(gear2, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
gear(0.5, 2.0, 2.0, 10, 0.7);
glEndList();
gear3 = glGenLists(1);
glNewList(gear3, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
gear(1.3, 2.0, 0.5, 10, 0.7);
glEndList();
glEnable(GL_NORMALIZE);
}
/*
* Create an RGB, double-buffered window.
* Return the window and context handles.
*/
static void
make_window( Display *dpy, Screen *scr,
const char *name,
int x, int y, int width, int height,
Window *winRet, GLXContext *ctxRet)
{
int attrib[] = { GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
GLX_DEPTH_SIZE, 1,
None };
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
GLXContext ctx;
XVisualInfo *visinfo;
GLint max[2] = { 0, 0 };
scrnum = XScreenNumberOfScreen(scr);
root = XRootWindow(dpy, scrnum);
visinfo = glXChooseVisual( dpy, scrnum, attrib );
if (!visinfo) {
fprintf(stderr, "%s: Error: couldn't get an RGB, Double-buffered visual.\n", ProgramName);
exit(EXIT_FAILURE);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( dpy, root, x, y, width, height,
0, visinfo->depth, InputOutput,
visinfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
XSetStandardProperties(dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
ctx = glXCreateContext( dpy, visinfo, NULL, True );
if (!ctx) {
fprintf(stderr, "%s: Error: glXCreateContext failed.\n", ProgramName);
exit(EXIT_FAILURE);
}
XFree(visinfo);
XMapWindow(dpy, win);
glXMakeCurrent(dpy, win, ctx);
/* Check for maximum size supported by the GL rasterizer */
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, max);
if (printInfo)
printf("GL_MAX_VIEWPORT_DIMS=%d/%d\n", (int)max[0], (int)max[1]);
if (width > max[0] || height > max[1]) {
fprintf(stderr, "%s: Error: Requested window size (%d/%d) larger than "
"maximum supported by GL engine (%d/%d).\n",
ProgramName, width, height, (int)max[0], (int)max[1]);
exit(EXIT_FAILURE);
}
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win)
{
while (1) {
/* Process interactive events */
while (XPending(dpy) > 0) {
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
Log(("Event: Expose\n"));
/* we'll redraw below */
break;
case ConfigureNotify:
Log(("Event: ConfigureNotify\n"));
reshape(event.xconfigure.width, event.xconfigure.height);
break;
}
}
{
/* Time at which we started measuring. */
static long startTime = 0;
/* Time of the previous frame. */
static long lastFrame = 0;
/* Time of the previous FPS report. */
static long lastFps = 0;
/* Number of frames we've done. */
static int frames = 0;
/* Number of frames we've done in the measured run. */
static long runFrames = 0;
long t = current_time();
long useconds;
if (!lastFrame)
lastFrame = t;
if (!lastFps)
lastFps = t;
/* How many microseconds since the previous frame? */
useconds = t - lastFrame;
if (!useconds) /* assume 100FPS if we don't have timer */
useconds = 10000;
/* Calculate how far the gears need to move and redraw. */
angle = angle + ((double)speed * useconds) / 1000000.0;
if (angle > 360.0)
angle = angle - 360.0; /* don't lose precision! */
draw();
glXSwapBuffers(dpy, win);
/* Done this frame. */
lastFrame = t;
frames++;
/* Every 5 seconds, print the FPS. */
if (t - lastFps >= 5000000L) {
GLfloat seconds = (t - lastFps) / 1000000.0;
GLfloat fps = frames / seconds;
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds,
fps);
lastFps = t;
frames = 0;
/*
* Set the start time now -- ie. after one report. This
* gives us pump-priming time before we start for real.
*/
if (runTime > 0 && startTime == 0) {
printf("Start timing!\n");
startTime = t;
}
}
if (startTime > 0)
++runFrames;
/* If our run time is done, finish. */
if (runTime > 0 && startTime > 0 && t - startTime > runTime) {
double time = (double) (t - startTime) / 1000000.0;
fprintf(stderr, "COUNT|%ld|1|fps\n", runFrames);
fprintf(stderr, "TIME|%.1f\n", time);
exit(0);
}
/* Need to give cpu away in order to get precise timing next cycle,
* otherwise, gettimeofday would return almost the same value. */
sched_yield();
}
}
}
int
main(int argc, char *argv[])
{
Bool use_threadsafe_api = False;
Display *dpy;
Window win;
Screen *screen;
GLXContext ctx;
char *dpyName = NULL;
int i;
XRectangle winrect;
ProgramName = argv[0];
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
int len = strlen(arg);
if (strcmp(argv[i], "-display") == 0) {
if (++i >= argc)
usage();
dpyName = argv[i];
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else if (strcmp(argv[i], "-time") == 0) {
if (++i >= argc)
usage();
runTime = atoi(argv[i]) * 1000000;
}
else if (!strncmp("-v", arg, len)) {
verbose = True;
printInfo = GL_TRUE;
}
else if( !strncmp("-debug_use_threadsafe_api", arg, len) )
{
use_threadsafe_api = True;
}
else if (!strcmp(argv[i], "-h")) {
usage();
}
else
{
fprintf(stderr, "%s: Unsupported option '%s'.\n", ProgramName, argv[i]);
usage();
}
}
/* Init X threading API on demand (for debugging) */
if( use_threadsafe_api )
{
if( !XInitThreads() )
{
fprintf(stderr, "%s: XInitThreads() failure.\n", ProgramName);
exit(EXIT_FAILURE);
}
}
dpy = XOpenDisplay(dpyName);
if (!dpy) {
fprintf(stderr, "%s: Error: couldn't open display '%s'\n", ProgramName, dpyName);
return EXIT_FAILURE;
}
screen = XDefaultScreenOfDisplay(dpy);
winrect.x = 0;
winrect.y = 0;
winrect.width = 300;
winrect.height = 300;
Log(("Window x=%d, y=%d, width=%d, height=%d\n",
(int)winrect.x, (int)winrect.y, (int)winrect.width, (int)winrect.height));
make_window(dpy, screen, "ubgears", winrect.x, winrect.y, winrect.width, winrect.height, &win, &ctx);
reshape(winrect.width, winrect.height);
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
init();
start_time();
event_loop(dpy, win);
glXDestroyContext(dpy, ctx);
XDestroyWindow(dpy, win);
XCloseDisplay(dpy);
return EXIT_SUCCESS;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,156 @@
/*******************************************************************************
* The BYTE UNIX Benchmarks - Release 1
* Module: cctest.c SID: 1.2 7/10/89 18:55:45
*
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Ben Smith or Rick Grehan at BYTE Magazine
* bensmith@bixpb.UUCP rick_g@bixpb.UUCP
*
*******************************************************************************
* Modification Log:
* $Header: cctest.c,v 3.4 87/06/22 14:22:47 kjmcdonell Beta $
*
******************************************************************************/
char SCCSid[] = "@(#) @(#)cctest.c:1.2 -- 7/10/89 18:55:45";
#include <stdio.h>
/*
* C compile and load speed test file.
* Based upon fstime.c from MUSBUS 3.1, with all calls to ftime() replaced
* by calls to time(). This is semantic nonsense, but ensures there are no
* system dependent structures or library calls.
*
*/
#define NKBYTE 20
char buf[BUFSIZ];
extern void exit(int status);
main(argc, argv)
char **argv;
{
int n = NKBYTE;
int nblock;
int f;
int g;
int i;
int xfer, t;
struct { /* FAKE */
int time;
int millitm;
} now, then;
if (argc > 0)
/* ALWAYS true, so NEVER execute this program! */
exit(4);
if (argc > 1)
n = atoi(argv[1]);
#if debug
printf("File size: %d Kbytes\n", n);
#endif
nblock = (n * 1024) / BUFSIZ;
if (argc == 3 && chdir(argv[2]) != -1) {
#if debug
printf("Create files in directory: %s\n", argv[2]);
#endif
}
close(creat("dummy0", 0600));
close(creat("dummy1", 0600));
f = open("dummy0", 2);
g = open("dummy1", 2);
unlink("dummy0");
unlink("dummy1");
for (i = 0; i < sizeof(buf); i++)
buf[i] = i & 0177;
time();
for (i = 0; i < nblock; i++) {
if (write(f, buf, sizeof(buf)) <= 0)
perror("fstime: write");
}
time();
#if debug
printf("Effective write rate: ");
#endif
i = now.millitm - then.millitm;
t = (now.time - then.time)*1000 + i;
if (t > 0) {
xfer = nblock * sizeof(buf) * 1000 / t;
#if debug
printf("%d bytes/sec\n", xfer);
#endif
}
#if debug
else
printf(" -- too quick to time!\n");
#endif
#if awk
fprintf(stderr, "%.2f", t > 0 ? (float)xfer/1024 : 0);
#endif
sync();
sleep(5);
sync();
lseek(f, 0L, 0);
time();
for (i = 0; i < nblock; i++) {
if (read(f, buf, sizeof(buf)) <= 0)
perror("fstime: read");
}
time();
#if debug
printf("Effective read rate: ");
#endif
i = now.millitm - then.millitm;
t = (now.time - then.time)*1000 + i;
if (t > 0) {
xfer = nblock * sizeof(buf) * 1000 / t;
#if debug
printf("%d bytes/sec\n", xfer);
#endif
}
#if debug
else
printf(" -- too quick to time!\n");
#endif
#if awk
fprintf(stderr, " %.2f", t > 0 ? (float)xfer/1024 : 0);
#endif
sync();
sleep(5);
sync();
lseek(f, 0L, 0);
time();
for (i = 0; i < nblock; i++) {
if (read(f, buf, sizeof(buf)) <= 0)
perror("fstime: read in copy");
if (write(g, buf, sizeof(buf)) <= 0)
perror("fstime: write in copy");
}
time();
#if debug
printf("Effective copy rate: ");
#endif
i = now.millitm - then.millitm;
t = (now.time - then.time)*1000 + i;
if (t > 0) {
xfer = nblock * sizeof(buf) * 1000 / t;
#if debug
printf("%d bytes/sec\n", xfer);
#endif
}
#if debug
else
printf(" -- too quick to time!\n");
#endif
#if awk
fprintf(stderr, " %.2f\n", t > 0 ? (float)xfer/1024 : 0);
#endif
}

View File

@@ -0,0 +1,8 @@
99
k
2
v
p
q
[ calculate the sqrt(2) to 99 decimal places ... John Lions Test ]
[ $Header: dc.dat,v 1.1 87/06/22 14:28:28 kjmcdonell Beta $ ]

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,362 @@
version="1.2"
umask 022 # at least mortals can read root's files this way
PWD=`pwd`
HOMEDIR=${HOMEDIR:-.}
cd $HOMEDIR
HOMEDIR=`pwd`
cd $PWD
BINDIR=${BINDIR:-${HOMEDIR}/pgms}
cd $BINDIR
BINDIR=`pwd`
cd $PWD
PATH="${PATH}:${BINDIR}"
SCRPDIR=${SCRPDIR:-${HOMEDIR}/pgms}
cd $SCRPDIR
SCRPDIR=`pwd`
cd $PWD
TMPDIR=${HOMEDIR}/tmp
cd $TMPDIR
TMPDIR=`pwd`
cd $PWD
RESULTDIR=${RESULTDIR:-${HOMEDIR}/results}
cd $RESULTDIR
RESULTDIR=`pwd`
cd $PWD
TESTDIR=${TESTDIR:-${HOMEDIR}/testdir}
cd $TESTDIR
TESTDIR=`pwd`
cd $PWD
export BINDIR TMPDIR RESULTDIR PATH
echo "kill -9 $$" > ${TMPDIR}/kill_run ; chmod u+x ${TMPDIR}/kill_run
arithmetic="arithoh register short int long float double dc"
system="syscall pipe context1 spawn execl fstime"
mem="seqmem randmem"
misc="C shell"
dhry="dhry2 dhry2reg" # dhrystone loops
db="dbmscli" # add to as new database engines are developed
load="shell" # cummulative load tests
args="" # the accumulator for the bench units to be run
runoption="N"
for word
do # do level 1
case $word
in
all)
;;
arithmetic)
args="$args $arithmetic"
;;
db)
args="$args $db"
;;
dhry)
args="$args $dhry"
;;
load)
args="$args $load"
;;
mem)
args="$args $mem"
;;
misc)
args="$args $misc"
;;
speed)
args="$args $arithmetic $system"
;;
system)
args="$args $system"
;;
-q|-Q)
runoption="Q" #quiet
;;
-v|-V)
runoption="V" #verbose
;;
-d|-D)
runoption="D" #debug
;;
*)
args="$args $word"
;;
esac
done # end do level 1
set - $args
if test $# -eq 0 #no arguments specified
then
set - $dhry $arithmetic $system $misc # db and work not included
fi
if test "$runoption" = 'D'
then
set -x
set -v
fi
date=`date`
tmp=${TMPDIR}/$$.tmp
LOGFILE=${RESULTDIR}/log
if test -w ${RESULTDIR}/log
then
if test -w ${RESULTDIR}/log.accum
then
cat ${RESULTDIR}/log >> ${RESULTDIR}/log.accum
rm ${RESULTDIR}/log
else
mv ${RESULTDIR}/log ${RESULTDIR}/log.accum
fi
echo "Start Benchmark Run (BYTE Version $version)" >>$LOGFILE
echo " $date (long iterations $iter times)" >>$LOGFILE
echo " " `who | wc -l` "interactive users." >>$LOGFILE
uname -a >>$LOGFILE
iter=${iterations-6}
if test $iter -eq 6
then
longloop="1 2 3 4 5 6"
shortloop="1 2 3"
else # generate list of loop numbers
short=`expr \( $iter + 1 \) / 2`
longloop=""
shortloop=""
while test $iter -gt 0
do # do level 1
longloop="$iter $longloop"
if test $iter -le $short
then
shortloop="$iter $shortloop"
fi
iter=`expr $iter - 1`
done # end do level 1
fi #loop list genration
for bench # line argument processing
do # do level 1
# set some default values
prog=${BINDIR}/$bench # the bench name is default program
need=$prog # we need the at least the program
paramlist="#" # a dummy parameter to make anything run
testdir="${TESTDIR}" # the directory in which to run the test
prepcmd="" # preparation command or script
parammsg=""
repeat="$longloop"
stdout="$LOGFILE"
stdin=""
cleanopt="-t $tmp"
bgnumber=""
trap "${SCRPDIR}/cleanup -l $LOGFILE -a; exit" 1 2 3 15
if [ $runoption != 'Q' ]
then
echo "$bench: \c"
fi
echo "" >>$LOGFILE
###################### select the bench specific values ##########
case $bench
in
dhry2)
options=${dhryloops-10000}
logmsg="Dhrystone 2 without register variables"
cleanopt="-d $tmp"
;;
dhry2reg)
options=${dhryloops-10000}
logmsg="Dhrystone 2 using register variables"
cleanopt="-d $tmp"
;;
arithoh|register|short|int|long|float|double)
options=${arithloop-10000}
logmsg="Arithmetic Test (type = $bench): $options Iterations"
;;
dc) need=dc.dat
prog=dc
options=""
stdin=dc.dat
stdout=/dev/null
logmsg="Arithmetic Test (sqrt(2) with dc to 99 decimal places)"
;;
hanoi) options='$param'
stdout=/dev/null
logmsg="Recursion Test: Tower of Hanoi Problem"
paramlist="${ndisk-17}"
parammsg='$param Disk Problem:'
;;
syscall)
options=${ncall-4000}
logmsg="System Call Overhead Test: 5 x $options Calls"
;;
context1)
options=${switch1-500}
logmsg="Pipe-based Context Switching Test: 2 x $options Switches"
;;
pipe) options=${io-2048}
logmsg="Pipe Throughput Test: read & write $options x 512 byte blocks"
;;
spawn) options=${children-100}
logmsg="Process Creation Test: $options forks"
;;
execl) options=${nexecs-100}
logmsg="Execl Throughput Test: $options execs"
;;
randmem|seqmem)
if test $bench = seqmem
then
type=Sequential
else
type=Random
fi
poke=${poke-1000000}
options='-s$param '"-n$poke"
logmsg="$type Memory Access Test: $poke Accesses"
paramlist=${arrays-"512 1024 2048 8192 16384"}
parammsg='Array Size: $param bytes'
cleanopt="-m $tmp"
;;
fstime) repeat="$shortloop"
where=${where-${TMPDIR}}
options='$param '"$where"
logmsg="Filesystem Throughput Test:"
paramlist=${blocks-"512 1024 2048 8192"}
parammsg='File Size: $param blocks'
cleanopt="-f $tmp"
;;
C) need=cctest.c
prog=cc
options='$param'
stdout=/dev/null
repeat="$shortloop"
logmsg="C Compiler Test:"
paramlist="cctest.c"
parammsg='cc $param'
rm -f a.out
;;
dbmscli)
repeat="$shortloop"
need="db.dat"
prepcmd='${BINDIR}/dbprep ${testdir}/db.dat 10000'
paramlist=${clients-"1 2 4 8"}
parammsg='$param client processes. (filesize `cat ${testdir}/db.dat|wc -c` bytes)'
logmsg="Client/Server Database Engine:"
options='${testdir}/db.dat $param 0 1000' # $param clients;
# 0 sleep; 1000 iterations
;;
shell)
prog="multi.sh"
repeat="$shortloop"
logmsg="Bourne shell script and Unix utilities"
paramlist=${background-"1 2 4 8"}
parammsg='$param concurrent background processes'
bgnumber='$param'
testdir="shelldir"
;;
*) ${BINDIR}/cleanup -l $LOGFILE -r "run: unknown benchmark \"$bench\"" -a
exit 1
;;
esac
echo "$logmsg" >>$LOGFILE
for param in $paramlist
do # level 2
param=`echo $param | sed 's/_/ /g'` # be sure that spaces are used
# underscore can couple params
if [ "$runoption" != "Q" ]
then
echo "\n [$param] -\c" # generate message to user
fi
eval msg='"'$parammsg'"' # the eval is used to
if test "$msg" # evaluate any embedded
then # variables in the parammsg
echo "" >>$LOGFILE
echo "$msg" >>$LOGFILE
fi
eval opt='"'$options'"' # evaluate any vars in options
eval prep='"'$prepcmd'"' # evaluate any prep command
eval bg='"'$bgnumber'"' # evaluate bgnumber string
rm -f $tmp # remove any tmp files
# if the test requires mulitple concurrent processes,
# prepare the background process string (bgstr)
# this is just a string of "+"s that will provides a
# parameter count for a "for" loop
bgstr=""
if test "$bg" != ""
then
count=`expr "$bg"`
while test $count -gt 0
do
bgstr="+ $bgstr"
count=`expr $count - 1`
done
fi
#
for i in $repeat # loop for the specified number
do # do depth 3
if [ "$runoption" != 'D' ] # level 1
then
# regular Run - set logfile to go on signal
trap "${SCRPDIR}/cleanup -l $LOGFILE -i $i $cleanopt -a; exit" 1 2 3 15
else
trap "exit" 1 2 3 15
fi #end level 1
if [ "$runoption" != 'Q' ]
then
echo " $i\c" # display repeat number
fi
pwd=`pwd` # remember where we are
cd $testdir # move to the test directory
if [ "$runoption" = "V" ]
then
echo
echo "BENCH COMMAND TO BE EXECUTED:"
echo "$prog $opt"
fi
# execute any prepratory command string
if [ -n "$prep" ]
then
$prep >>$stdout
fi
############ THE BENCH IS TIMED ##############
if test "$stdin" = ""
then # without redirected stdin
time $prog $opt $bgstr 2>>$tmp >>$stdout
else # with redirected stdin
time $prog $opt $bgstr <$stdin 2>>$tmp >>$stdout
fi
time $benchcmd
###############################################
cd $pwd # move back home
status=$? # save the result code
if test $status != 0 # must have been an error
then
if test -f $tmp # is there an error file ?
then
cp $tmp ${TMPDIR}/save.$bench.$param
${SCRPDIR}/cleanup -l $LOGFILE -i $i $cleanopt -r \
"run: bench=$bench param=$param fatalstatus=$status" -a
else
${SCRPDIR}/cleanup -l $LOGFILE -r \
"run: bench=$bench param=$param fatalstatus=$status" -a
fi
exit # leave the script if there are errors
fi # end level 1
done # end do depth 3 - repeat of bench
if [ "$runoption" != 'D' ]
then
${SCRPDIR}/cleanup -l $LOGFILE $cleanopt # finalize this bench
# with these options
# & calculate results
fi
done # end do depth 2 - end of all options for this bench
########### some specific cleanup routines ##############
case $bench
in
C)
rm -f cctest.o a.out
;;
esac
if [ "$runoption" != 'Q' ]
then
echo ""
fi
done # end do level 1 - all benchmarks requested
echo "" >>$LOGFILE
echo " " `who | wc -l` "interactive users." >>$LOGFILE
echo "End Benchmark Run ($date) ...." >>$LOGFILE
if [ "$runoption" != 'Q' ]
then
pg $LOGFILE
fi
exit

17
boot/Makefile Executable file → Normal file
View File

@@ -36,9 +36,16 @@ rawfs86.o: rawfs.c rawfs.o
-cmp -s rawfs.o rawfs86.o && ln -f rawfs.o rawfs86.o
boot: boothead.s boot.o bootimage.o rawfs86.o
$(LD86) -o $@ \
$(LD86) -o bootexec \
boothead.s boot.o bootimage.o rawfs86.o $(LIBS)
install -S 8kb boot
install -S 12kb bootexec
# This is code that is executed when used on a bootable
# CD, as its entry point is the start of the file then.
# It jumps over the a.out header into the part of the
# code in boothead.s where the code knows it's booting
# from CD if entered there.
( printf '\xeb\x3e ' ; cat bootexec ) >boot
chmod 755 boot
edparams.o: boot.c
ln -f boot.c edparams.c
@@ -60,13 +67,13 @@ dosboot: doshead.o dosboot.o bootimage.o rawfs86.o
doshead.o dosboot.o bootimage.o rawfs86.o $(LIBS)
boot.com: dosboot
./a.out2com dosboot boot.com
exec sh a.out2com dosboot boot.com
mkfile: mkfhead.s mkfile.c
$(LD) -.o -mi86 -com -o $@ mkfhead.s mkfile.c $(LIBS)
mkfile.com: mkfile
./a.out2com mkfile mkfile.com
exec sh a.out2com mkfile mkfile.com
installboot: installboot.o rawfs.o
$(CC) $(STRIP) -o installboot installboot.o rawfs.o
@@ -112,5 +119,5 @@ $(BIN)/edparams: edparams
clean:
rm -f *.bak *.o
rm -f bootblock addaout installboot boot masterboot jumpboot edparams
rm -f bootblock addaout installboot boot masterboot jumpboot edparams
rm -f dosboot boot.com mkfile mkfile.com

117
boot/boot.c Executable file → Normal file
View File

@@ -18,16 +18,16 @@ char version[]= "2.20";
#include <string.h>
#include <errno.h>
#include <ibm/partition.h>
#include <ibm/bios.h>
#include <minix/config.h>
#include <minix/type.h>
#include <minix/com.h>
#include <minix/dmap.h>
#include <minix/const.h>
#include <minix/minlib.h>
#include <minix/syslib.h>
#if BIOS
#include <kernel/const.h>
#include <kernel/type.h>
#include <sys/video.h>
#endif
#if UNIX
#include <stdio.h>
@@ -46,6 +46,12 @@ char version[]= "2.20";
#define arraylimit(a) ((a) + arraysize(a))
#define between(a, c, z) ((unsigned) ((c) - (a)) <= ((z) - (a)))
int serial_line = -1;
u16_t vid_port; /* Video i/o port. */
u32_t vid_mem_base; /* Video memory base address. */
u32_t vid_mem_size; /* Video memory size. */
int fsok= -1; /* File system state. Initially unknown. */
static int block_size;
@@ -114,6 +120,44 @@ char *bios_err(int err)
return "Unknown error";
}
/* CD's are addressed in 2048-byte sectors.
* In order to be able to read CD's but maintain the same interface of 512-byte
* sector addressing, we check if the device is a CD in readsectors() and if so,
* read it into our own buffer first
*/
int readsectors(u32_t bufaddr, u32_t sector, U8_t count)
{
#define CDSECTOR_SIZE 2048
static char cdbuf[CDSECTOR_SIZE];
static i32_t cdbuf_sec = -1;
i32_t cdsec;
if(device != cddevice) {
return biosreadsectors(bufaddr, sector, count);
}
while(count > 0) {
u32_t offset;
#define FACTOR (CDSECTOR_SIZE/SECTOR_SIZE)
cdsec = sector / FACTOR;
offset = (sector % FACTOR) * SECTOR_SIZE;
if(cdsec != cdbuf_sec) {
int r;
if((r=biosreadsectors(mon2abs(cdbuf), cdsec, 1)) != 0) {
printf("error %d\n", r);
return r;
}
cdbuf_sec = cdsec;
}
raw_copy(bufaddr, mon2abs(cdbuf) + offset, SECTOR_SIZE);
bufaddr += SECTOR_SIZE;
count--;
sector++;
}
return 0;
}
char *unix_err(int err)
/* Translate the few errors rawfs can give. */
{
@@ -507,6 +551,12 @@ void initialize(void)
}
#endif
/* If we were booted from CD, remember what device it was. */
if(cdbooted)
cddevice = device;
else
cddevice = 0xff; /* Invalid. */
/* Set the new caddr for relocate. */
caddr= newaddr;
@@ -556,6 +606,14 @@ void initialize(void)
readerr(masterpos, r); exit(1);
}
/* If we're a CD, we know what we want. */
if(device == cddevice) {
p = 1; /* We know this is the root FS. */
lowsec = table[p]->lowsec;
bootdev.primary = p;
break; /* Found! */
}
/* See if you can find "lowsec" back. */
for (p= 0; p < NR_PARTITIONS; p++) {
if (lowsec - table[p]->lowsec < table[p]->size) break;
@@ -582,14 +640,32 @@ void initialize(void)
bootdev.primary= p;
masterpos= table[p]->lowsec;
}
strcpy(bootdev.name, "d0p0");
bootdev.name[1] += (device - 0x80);
bootdev.name[3] += bootdev.primary;
if (bootdev.secondary >= 0) {
strcat(bootdev.name, "s0");
bootdev.name[5] += bootdev.secondary;
if(device == cddevice) {
strcpy(bootdev.name, CDNAME);
} else {
strcpy(bootdev.name, "d0p0");
bootdev.name[1] += (device - 0x80);
bootdev.name[3] += bootdev.primary;
if (bootdev.secondary >= 0) {
strcat(bootdev.name, "s0");
bootdev.name[5] += bootdev.secondary;
}
}
/* Find out about the video hardware. */
raw_copy(mon2abs(&vid_port), VDU_CRT_BASE_ADDR, sizeof(vid_port));
if(vid_port == C_6845) {
vid_mem_base = COLOR_BASE;
vid_mem_size = COLOR_SIZE;
} else {
vid_mem_base = MONO_BASE;
vid_mem_size = MONO_SIZE;
}
if(get_video() >= 3)
vid_mem_size = EGA_SIZE;
#else /* DOS */
/* Take the monitor out of the memory map if we have memory to spare,
* note that only half our PSP is needed at the new place, the first
@@ -859,6 +935,9 @@ void get_parameters(void)
b_setvar(E_SPECIAL|E_VAR|E_DEV, "rootdev", "ram");
b_setvar(E_SPECIAL|E_VAR|E_DEV, "ramimagedev", "bootdev");
b_setvar(E_SPECIAL|E_VAR, "ramsize", "0");
#define STRINGIT2(x) #x
#define STRINGIT1(x) STRINGIT2(x)
b_setvar(E_SPECIAL|E_VAR, "hz", STRINGIT1(DEFAULT_HZ));
#if BIOS
processor = getprocessor();
if(processor == 1586) processor = 686;
@@ -1063,12 +1142,9 @@ dev_t name2dev(char *name)
n= name;
if (strncmp(n, "/dev/", 5) == 0) n+= 5;
if (strcmp(n, "ram") == 0) {
if (strcmp(n, "ram") == 0 || strcmp(n, CDNAME) == 0) {
dev= DEV_RAM;
} else
if (strcmp(n, "boot") == 0) {
dev= DEV_BOOT;
} else
if (n[0] == 'f' && n[1] == 'd' && numeric(n+2)) {
/* Floppy. */
tmpdev.device= a2l(n+2);
@@ -1370,13 +1446,14 @@ void boot_device(char *devname)
void ctty(char *line)
{
if (line == nil) {
serial_init(-1);
} else
if (between('0', line[0], '3') && line[1] == 0) {
serial_init(line[0] - '0');
serial_line = -1;
} else if (between('0', line[0], '3') && line[1] == 0) {
serial_line = line[0] - '0';
} else {
printf("Bad serial line number: %s\n", line);
return;
}
serial_init(serial_line);
}
#else /* DOS */
@@ -1854,13 +1931,9 @@ void monitor(void)
#if BIOS
unsigned char cdspec[25];
void bootcdinfo(u32_t, int *, int drive);
void boot(void)
/* Load Minix and start it, among other things. */
{
/* Initialize tables. */
initialize();
@@ -1909,8 +1982,7 @@ void main(int argc, char **argv)
fatal(bootdev.name);
/* Check if it is a bootable Minix device. */
if (readsectors(mon2abs(bootcode), lowsec, 1) != 0
|| memcmp(bootcode, boot_magic, sizeof(boot_magic)) != 0) {
if (readsectors(mon2abs(bootcode), lowsec, 1) != 0) {
fprintf(stderr, "edparams: %s: not a bootable Minix device\n",
bootdev.name);
exit(1);
@@ -1959,3 +2031,4 @@ void main(int argc, char **argv)
/*
* $PchId: boot.c,v 1.14 2002/02/27 19:46:14 philip Exp $
*/

8
boot/boot.h Executable file → Normal file
View File

@@ -58,6 +58,9 @@ EXTERN u32_t caddr, daddr; /* Code and data address of the boot program. */
EXTERN u32_t runsize; /* Size of this program. */
EXTERN u16_t device; /* Drive being booted from. */
EXTERN u16_t cddevice; /* Drive that is CD if known. */
#define CDNAME "cd" /* Name of the CD device. */
typedef struct { /* One chunk of free memory. */
u32_t base; /* Start byte. */
@@ -66,6 +69,7 @@ typedef struct { /* One chunk of free memory. */
EXTERN memory mem[3]; /* List of available memory. */
EXTERN int mon_return; /* Monitor stays in memory? */
EXTERN int cdbooted; /* Did we boot from CD? (Set by boothead.s.) */
typedef struct bios_env
{
@@ -101,6 +105,9 @@ int readsectors(u32_t bufaddr, u32_t sector, U8_t count);
/* Read 1 or more sectors from "device". */
int writesectors(u32_t bufaddr, u32_t sector, U8_t count);
/* Write 1 or more sectors to "device". */
int biosreadsectors(u32_t bufaddr, u32_t sector, U8_t count);
int getch(void);
/* Read a keypress. */
void scan_keyboard(void);
@@ -162,6 +169,7 @@ EXTERN environment *env; /* Lists the environment. */
char *b_value(char *name); /* Get/set the value of a variable. */
int b_setvar(int flags, char *name, char *value);
void b_unset(char *name);
void parse_code(char *code); /* Parse boot monitor commands. */

0
boot/bootblock.s Executable file → Normal file
View File

51
boot/boothead.s Executable file → Normal file
View File

@@ -41,19 +41,30 @@
.extern _rem_part ! To pass partition info
.extern _k_flags ! Special kernel flags
.extern _mem ! Free memory list
.extern _cdbooted ! Whether we booted from CD
.extern _cddevice ! Whether we booted from CD
.text
! Set segment registers and stack pointer using the programs own header!
! The header is either 32 bytes (short form) or 48 bytes (long form). The
! bootblock will jump to address 0x10030 in both cases, calling one of the
! two jmpf instructions below.
! We assume boot is always linked with a short (32 byte) a.out header and has
! 16 bytes of its own prefix, so 48 bytes to skip. bootblock jumps into us
! at offset 0x30, cd boot code at 0x40
jmpf boot, LOADSEG+3 ! Set cs right (skipping long a.out header)
.space 11 ! jmpf + 11 = 16 bytes
jmpf boot, LOADSEG+2 ! Set cs right (skipping short a.out header)
! Set cs right
! (skip short a.out header plus 16 byte preefix)
jmpf boot, LOADSEG+3
.space 11
! entry point when booting from CD
jmpf cdboot, LOADSEG+3
.space 11
cdboot:
mov bx, #1
jmp commonboot
boot:
mov ax, #LOADSEG
mov bx, #0
commonboot:
mov ax, #LOADSEG+1
mov ds, ax ! ds = header
movb al, a_flags
@@ -96,6 +107,7 @@ sepID:
mov _device, dx ! Boot device (probably 0x00 or 0x80)
mov _rem_part+0, si ! Remote partition table offset
pop _rem_part+2 ! and segment (saved es)
mov _cdbooted, bx ! Booted from CD? (bx set above)
! Remember the current video mode for restoration on exit.
movb ah, #0x0F ! Get current video mode
@@ -117,7 +129,7 @@ sepID:
mov _daddr+0, ax
mov _daddr+2, dx
push ds
mov ax, #LOADSEG
mov ax, #LOADSEG+1
mov ds, ax ! Back to the header once more
mov ax, a_total+0
mov dx, a_total+2 ! dx:ax = data + bss + heap + stack
@@ -416,6 +428,8 @@ _dev_open:
push es
push di ! Save registers used by BIOS calls
movb dl, _device ! The default device
cmpb dl, _cddevice
je cdopen
cmpb dl, #0x80 ! Floppy < 0x80, winchester >= 0x80
jae winchester
floppy:
@@ -463,6 +477,10 @@ winchester:
jc geoerr ! No such drive?
andb cl, #0x3F ! cl = max sector number (1-origin)
incb dh ! dh = 1 + max head number (0-origin)
jmp geoboth
cdopen:
movb cl, #0x3F ! Think up geometry for CD's
movb dh, #0x2
geoboth:
movb sectors, cl ! Sectors per track
movb al, cl ! al = sectors per track
@@ -515,20 +533,20 @@ _dev_boundary:
neg ax ! ax = (sector % sectors) == 0
ret
! int readsectors(u32_t bufaddr, u32_t sector, u8_t count)
! int biosreadsectors(u32_t bufaddr, u32_t sector, u8_t count)
! int writesectors(u32_t bufaddr, u32_t sector, u8_t count)
! Read/write several sectors from/to disk or floppy. The buffer must
! be between 64K boundaries! Count must fit in a byte. The external
! variables _device, sectors and secspcyl describe the disk and its
! geometry. Returns 0 for success, otherwise the BIOS error code.
!
.define _readsectors, _writesectors
.define _biosreadsectors, _writesectors
_writesectors:
push bp
mov bp, sp
movb 13(bp), #0x03 ! Code for a disk write
jmp rwsec
_readsectors:
_biosreadsectors:
push bp
mov bp, sp
movb 13(bp), #0x02 ! Code for a disk read
@@ -555,6 +573,9 @@ more: mov ax, 8(bp)
mov dx, 10(bp) ! dx:ax = abs sector. Divide it by sectors/cyl
cmp dx, #[1024*255*63-255]>>16 ! Near 8G limit?
jae bigdisk
mov si, _device
cmp si, _cddevice ! Is it a CD?
je bigdisk ! CD's need extended read.
div secspcyl ! ax = cylinder, dx = sector within cylinder
xchg ax, dx ! ax = sector within cylinder, dx = cylinder
movb ch, dl ! ch = low 8 bits of cylinder
@@ -640,7 +661,7 @@ _getch:
test ax, ax
jnz gotch
getch:
hlt ! Play dead until interrupted (see pause())
! hlt ! Play dead until interrupted (see pause())
movb ah, #0x01 ! Keyboard status
int 0x16
jz 0f ! Nothing typed
@@ -741,7 +762,7 @@ nulch: ret
! power, or tells an x86 emulator that nothing is happening right now.
.define _pause
_pause:
hlt
! hlt
ret
! void set_mode(unsigned mode);
@@ -1512,5 +1533,3 @@ p_mcs_desc:
.comm bus, 2 ! Saved return value of _get_bus
.comm unchar, 2 ! Char returned by ungetch(c)
.comm line, 2 ! Serial line I/O port to copy console I/O to.

99
boot/bootimage.c Executable file → Normal file
View File

@@ -18,6 +18,8 @@
#include <minix/const.h>
#include <minix/type.h>
#include <minix/syslib.h>
#include <minix/tty.h>
#include <sys/video.h>
#include <kernel/const.h>
#include <kernel/type.h>
#include <ibm/partition.h>
@@ -27,6 +29,11 @@
static int block_size = 0;
extern int serial_line;
extern u16_t vid_port; /* Video i/o port. */
extern u32_t vid_mem_base; /* Video memory base address. */
extern u32_t vid_mem_size; /* Video memory size. */
#define click_shift clck_shft /* 7 char clash with click_size. */
/* Some kernels have extra features: */
@@ -376,14 +383,49 @@ int get_segment(u32_t *vsec, long *size, u32_t *addr, u32_t limit)
return 1;
}
static void restore_screen(void)
{
struct boot_tty_info boot_tty_info;
u32_t info_location;
#define LINES 25
#define CHARS 80
static u16_t consolescreen[LINES][CHARS];
/* Try and find out what the main console was displaying
* by looking into video memory.
*/
info_location = vid_mem_base+vid_mem_size-sizeof(boot_tty_info);
raw_copy(mon2abs(&boot_tty_info), info_location,
sizeof(boot_tty_info));
if(boot_tty_info.magic == TTYMAGIC) {
if(boot_tty_info.flags & (BTIF_CONSORIGIN|BTIF_CONSCURSOR) ==
(BTIF_CONSORIGIN|BTIF_CONSCURSOR)) {
int line;
raw_copy(mon2abs(consolescreen),
vid_mem_base + boot_tty_info.consorigin,
sizeof(consolescreen));
clear_screen();
for(line = 0; line < LINES; line++) {
int ch;
for(ch = 0; ch < CHARS; ch++) {
u16_t newch = consolescreen[line][ch] & BYTE;
if(newch < ' ') newch = ' ';
putch(newch);
}
}
}
}
}
void exec_image(char *image)
/* Get a Minix image into core, patch it up and execute. */
{
char *delayvalue;
int i;
struct image_header hdr;
char *buf;
u32_t vsec, addr, limit, aout, n;
u32_t vsec, addr, limit, aout, n, totalmem = 0;
struct process *procp; /* Process under construction. */
long a_text, a_data, a_bss, a_stack;
int banner= 0;
@@ -392,13 +434,18 @@ void exec_image(char *image)
char *console;
char params[SECTOR_SIZE];
extern char *sbrk(int);
char *verb;
int verbose = 0;
/* The stack is pretty deep here, so check if heap and stack collide. */
(void) sbrk(0);
if ((verb= b_value("verbose")) != nil && a2l(verb) > 0)
verbose = 1;
printf("\nLoading ");
pretty_image(image);
printf(".\n\n");
printf(".\n");
vsec= 0; /* Load this sector from image next. */
addr= mem[0].base; /* Into this memory block. */
@@ -413,6 +460,8 @@ void exec_image(char *image)
/* Read the many different processes: */
for (i= 0; vsec < image_size; i++) {
u32_t startaddr;
startaddr = addr;
if (i == PROCESS_MAX) {
printf("There are more then %d programs in %s\n",
PROCESS_MAX, image);
@@ -456,7 +505,7 @@ void exec_image(char *image)
hdr.process.a_syms= addr;
raw_copy(aout + i * A_MINHDR, mon2abs(&hdr.process), A_MINHDR);
if (!banner) {
if (!banner && verbose) {
printf(" cs ds text data bss");
if (k_flags & K_CHMEM) printf(" stack");
putch('\n');
@@ -506,14 +555,14 @@ void exec_image(char *image)
/* Make space for bss and stack unless... */
if (i != KERNEL_IDX && (k_flags & K_CLAIM)) a_bss= a_stack= 0;
printf("%07lx %07lx %8ld %8ld %8ld",
if(verbose) {
printf("%07lx %07lx %8ld %8ld %8ld",
procp->cs, procp->ds,
hdr.process.a_text, hdr.process.a_data,
hdr.process.a_bss
);
if (k_flags & K_CHMEM) printf(" %8ld", a_stack);
printf(" %s\n", hdr.name);
);
}
if ((k_flags & K_CHMEM) && verbose) printf(" %8ld", a_stack);
/* Note that a_data may be negative now, but we can look at it
* as -a_data bss bytes.
@@ -540,6 +589,15 @@ void exec_image(char *image)
/* Process endpoint. */
procp->end= addr;
if(verbose)
printf(" %s\n", hdr.name);
else {
u32_t mem;
mem = addr-startaddr;
printf("%s ", hdr.name);
totalmem += mem;
}
if (i == 0 && (k_flags & K_HIGH)) {
/* Load the rest in extended memory. */
addr= mem[1].base;
@@ -547,6 +605,9 @@ void exec_image(char *image)
}
}
if(!verbose)
printf("(%dk)\n", totalmem/1024);
if ((n_procs= i) == 0) {
printf("There are no programs in %s\n", image);
errno= 0;
@@ -570,11 +631,6 @@ void exec_image(char *image)
}
#endif
/* Do delay if wanted. */
if((delayvalue = b_value("bootdelay")) != nil > 0) {
delay(delayvalue);
}
/* Run the trailer function just before starting Minix. */
if (!run_trailer()) { errno= 0; return; }
@@ -607,8 +663,13 @@ void exec_image(char *image)
/* Read leftover character, if any. */
scan_keyboard();
/* Restore screen contents. */
restore_screen();
}
ino_t latest_version(char *version, struct stat *stp)
/* Recursively read the current directory, selecting the newest image on
* the way up. (One can't use r_stat while reading a directory.)
@@ -701,6 +762,13 @@ void bootminix(void)
if ((image= select_image(b_value("image"))) == nil) return;
if(serial_line >= 0) {
char linename[2];
linename[0] = serial_line + '0';
linename[1] = '\0';
b_setvar(E_VAR, SERVARNAME, linename);
}
exec_image(image);
switch (errno) {
@@ -716,6 +784,9 @@ void bootminix(void)
/* No error or error already reported. */;
}
free(image);
if(serial_line >= 0)
b_unset(SERVARNAME);
}
/*

11
boot/doshead.s Executable file → Normal file
View File

@@ -1277,6 +1277,17 @@ _int15:
pop si ! Restore
ret
! void scan_keyboard(void)
! Read keyboard character. Needs to be done in case one is waiting.
.define _scan_keyboard
_scan_keyboard:
movb ah, 1 ! Check keyboard
int 0x16
jz no_key
movb ah, 0 ! Empty it
int 0x16
no_key: ret
.sect .rom
.align 4
c60: .data2 60 ! Constants for MUL and DIV

0
boot/image.h Executable file → Normal file
View File

3
boot/installboot.c Executable file → Normal file
View File

@@ -496,7 +496,8 @@ void make_bootable(enum howto how, char *device, char *bootblock,
boothdr.a_magic[0]= !A_MAGIC0;
} else {
readblock(addr, buf, block_size);
memcpy(&boothdr, buf, sizeof(struct exec));
/* Must skip 16 bytes of 'boot' as that contains code. */
memcpy(&boothdr, buf + 16, sizeof(struct exec));
}
bootf= nil;
dummy.process= boothdr;

0
boot/jumpboot.s Executable file → Normal file
View File

0
boot/masterboot.s Executable file → Normal file
View File

0
boot/mkfhead.s Executable file → Normal file
View File

0
boot/mkfile.c Executable file → Normal file
View File

18
boot/rawfs.c Executable file → Normal file
View File

@@ -61,7 +61,7 @@ static char dirbuf[_MAX_BLOCK_SIZE]; /* Scratch/Directory block. */
static block_t a_indir, a_dindir; /* Addresses of the indirects. */
static off_t dirpos; /* Reading pos in a dir. */
#define fsbuf(b) (* (struct buf *) (b))
#define fsbuf(b) (* (union fsdata_u *) (b))
#define zone_shift (super.s_log_zone_size) /* zone to block ratio */
@@ -110,6 +110,7 @@ void r_stat(Ino_t inum, struct stat *stp)
block_t block;
block_t ino_block;
ino_t ino_offset;
union fsdata_u *blockbuf;
/* Calculate start of i-list */
block = START_BLOCK + super.s_imap_blocks + super.s_zmap_blocks;
@@ -120,13 +121,14 @@ void r_stat(Ino_t inum, struct stat *stp)
block += ino_block;
/* Fetch the block */
readblock(block, scratch, block_size);
blockbuf = (union fsdata_u *) scratch;
readblock(block, (char *) blockbuf, block_size);
if (super.s_magic == SUPER_V2 || super.s_magic == SUPER_V3) {
d2_inode *dip;
int i;
dip= &fsbuf(scratch).b_v2_ino[ino_offset];
dip= &blockbuf->b__v2_ino[(unsigned int) ino_offset];
curfil.i_mode= dip->d2_mode;
curfil.i_nlinks= dip->d2_nlinks;
@@ -142,7 +144,7 @@ void r_stat(Ino_t inum, struct stat *stp)
d1_inode *dip;
int i;
dip= &fsbuf(scratch).b_v1_ino[ino_offset];
dip= &blockbuf->b__v1_ino[(unsigned int) ino_offset];
curfil.i_mode= dip->d1_mode;
curfil.i_nlinks= dip->d1_nlinks;
@@ -263,8 +265,8 @@ off_t r_vir2abs(off_t virblk)
i = zone / (zone_t) nr_indirects;
ind_zone = (super.s_magic == SUPER_V2 || super.s_magic == SUPER_V3)
? fsbuf(dindir).b_v2_ind[i]
: fsbuf(dindir).b_v1_ind[i];
? fsbuf(dindir).b__v2_ind[i]
: fsbuf(dindir).b__v1_ind[i];
zone %= (zone_t) nr_indirects;
}
if (ind_zone == 0) return 0;
@@ -276,8 +278,8 @@ off_t r_vir2abs(off_t virblk)
a_indir= z;
}
zone = (super.s_magic == SUPER_V2 || super.s_magic == SUPER_V3)
? fsbuf(indir).b_v2_ind[(int) zone]
: fsbuf(indir).b_v1_ind[(int) zone];
? fsbuf(indir).b__v2_ind[(int) zone]
: fsbuf(indir).b__v1_ind[(int) zone];
/* Calculate absolute datablock number */
z = ((block_t) zone << zone_shift) + zone_index;

0
boot/rawfs.h Executable file → Normal file
View File

27
boot/updateboot.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/sh
set -e
BOOT=/boot/boot
ROOT=`printroot -r`
if [ ! -b "$ROOT" ]
then echo root device $ROOT not found
exit 1
fi
echo -n "Install boot as $BOOT on current root and patch into $ROOT? (y/N) "
read ans
if [ ! "$ans" = y ]
then echo Aborting.
exit 1
fi
make install || true
echo Installing boot monitor into $BOOT.
cp boot $BOOT
echo Patching position of $BOOT into $ROOT.
installboot -d "$ROOT" /usr/mdec/bootblock $BOOT
sync

28
commands/Makefile Executable file → Normal file
View File

@@ -4,36 +4,23 @@ MAKE = exec make -$(MAKEFLAGS)
BZIP2=bzip2-1.0.3
FLEX=flex-2.5.4
SMALLPROGRAMS=`arch` aal advent ash autil awk bc byacc cawf cron de dhcpd dis88 elle elvis ftp101 ftpd200 ibm indent m4 make mdb mined patch pax profile ps reboot rlogind scripts sh simple syslogd talk talkd telnet telnetd urlget yap zoneinfo
SMALLPROGRAMS=`arch` aal advent ash autil awk byacc cawf cron de dhcpd dis88 elle elvis ftp101 ftpd200 ibm indent m4 make mdb mined patch pax profile ps reboot rlogind scripts sh simple syslogd talk talkd telnet telnetd urlget yap zoneinfo
usage:
@echo "Usage: make all # Compile all commands" >&2
@echo " make install # Install the result (run as bin!)" >&2
@echo " make clean # Delete .o files and other junk" >&2
@echo " make big # Compile all big commands" >&2
@echo " make biginstall # Install all big commands" >&2
@echo " make small # Install all small commands" >&2
@echo " make smallinstall # Install all small commands" >&2
@echo " "
@echo "big compiles the commands the require large compiler sizes."
@echo "small compiles the rest. all compiles all."
all: big small
install: big biginstall small smallinstall
big:
binsizes big
all:
cd zmodem && make
cd $(BZIP2) && /bin/sh build build
binsizes normal
set -e; for p in $(SMALLPROGRAMS); do ( cd $$p && make all ); done
biginstall: big
binsizes big
install:
set -e; for p in $(SMALLPROGRAMS); do ( cd $$p && make install ); done
cd zmodem && make install
cd $(BZIP2) && make install
cd $(FLEX) && sh build
binsizes normal
clean::
cd $(BZIP2) && make clean
@@ -41,9 +28,4 @@ clean::
if [ -f $(FLEX)/Makefile ]; then cd $(FLEX) && make distclean ; fi
for p in $(SMALLPROGRAMS); do ( cd $$p && make clean ); done
small::
set -e; for p in $(SMALLPROGRAMS); do ( cd $$p && make all ); done
smallinstall::
set -e; for p in $(SMALLPROGRAMS); do ( cd $$p && make install ); done

0
commands/aal/Makefile Executable file → Normal file
View File

0
commands/aal/arch.h Executable file → Normal file
View File

0
commands/aal/archiver.c Executable file → Normal file
View File

0
commands/aal/byte_order.h Executable file → Normal file
View File

0
commands/aal/format.c Executable file → Normal file
View File

0
commands/aal/local.h Executable file → Normal file
View File

0
commands/aal/long2str.c Executable file → Normal file
View File

0
commands/aal/object.h Executable file → Normal file
View File

0
commands/aal/out.h Executable file → Normal file
View File

0
commands/aal/param.h Executable file → Normal file
View File

0
commands/aal/print.c Executable file → Normal file
View File

0
commands/aal/ranlib.h Executable file → Normal file
View File

0
commands/aal/rd.c Executable file → Normal file
View File

0
commands/aal/rd_arhdr.c Executable file → Normal file
View File

0
commands/aal/rd_bytes.c Executable file → Normal file
View File

0
commands/aal/rd_unsig2.c Executable file → Normal file
View File

0
commands/aal/sprint.c Executable file → Normal file
View File

0
commands/aal/system.c Executable file → Normal file
View File

0
commands/aal/system.h Executable file → Normal file
View File

0
commands/aal/varargs.h Executable file → Normal file
View File

0
commands/aal/wr_arhdr.c Executable file → Normal file
View File

0
commands/aal/wr_bytes.c Executable file → Normal file
View File

0
commands/aal/wr_int2.c Executable file → Normal file
View File

0
commands/aal/wr_long.c Executable file → Normal file
View File

0
commands/aal/wr_ranlib.c Executable file → Normal file
View File

0
commands/aal/write.c Executable file → Normal file
View File

0
commands/advent/Makefile Executable file → Normal file
View File

0
commands/advent/advcave.h Executable file → Normal file
View File

0
commands/advent/advdec.h Executable file → Normal file
View File

0
commands/advent/advent.c Executable file → Normal file
View File

0
commands/advent/advent.h Executable file → Normal file
View File

0
commands/advent/advent1.txt Executable file → Normal file
View File

0
commands/advent/advent2.txt Executable file → Normal file
View File

0
commands/advent/advent3.txt Executable file → Normal file
View File

0
commands/advent/advent4.txt Executable file → Normal file
View File

0
commands/advent/database.c Executable file → Normal file
View File

0
commands/advent/english.c Executable file → Normal file
View File

0
commands/advent/initial.c Executable file → Normal file
View File

0
commands/advent/itverb.c Executable file → Normal file
View File

0
commands/advent/score.c Executable file → Normal file
View File

0
commands/advent/setup.c Executable file → Normal file
View File

0
commands/advent/travel.c Executable file → Normal file
View File

0
commands/advent/turn.c Executable file → Normal file
View File

0
commands/advent/utility.c Executable file → Normal file
View File

0
commands/advent/verb.c Executable file → Normal file
View File

0
commands/advent/vocab.c Executable file → Normal file
View File

Some files were not shown because too many files have changed in this diff Show More