Bruce Evans [Wed, 15 Jul 1998 11:47:58 +0000 (11:47 +0000)]
Don't cast pointers to longs in asm statements.
These asm statments are not quite as pessimal as when I complained
about them in rev.1.9 of audio.c. They seem to be only 40% slower
than the C version on P5's and the same speed on K6's.
Bruce Evans [Wed, 15 Jul 1998 09:01:18 +0000 (09:01 +0000)]
Don't cast pointers to longs in asms. Changed all remaining longs
to int32_t's and all unsigned longs to u_int32_t's. Fixed the one
printf format broken by this. The old math emulator now compiles
cleanly on i386's with 64-bit longs. It may even work, provided
suword() doesn't actually write a long.
Bruce Evans [Wed, 15 Jul 1998 06:51:14 +0000 (06:51 +0000)]
Cast between longs and pointers via intptr_t. There shouldn't be
nearly so many casts here. Casting an pointer that was an integer
back to an integer just to compare it with -1 is bad, and casting
it back just to compare it with NULL is just wrong.
Bruce Evans [Wed, 15 Jul 1998 06:39:12 +0000 (06:39 +0000)]
Cast between u_longs and object pointers via uintptr_t.
Access the entry address as a uintfptr_t, not as a long, and not
necessarily as what modload(8) passes (it takes a u_long from the
exec header and passes a u_int).
Correct improper use of .Sm. Document -d flag. Correct use of .Nm. Remove
unused #includes. Add usage(). Use warnx(). Correct spelling. Abort when
malloc() fails.
Bruce Evans [Wed, 15 Jul 1998 05:21:48 +0000 (05:21 +0000)]
Cast pointers to intptr_t instead of or before casting to long.
Fixed bitrot in K&R support (suword() now takes a long word).
Didn't fix corresponding bitrot in store.9 and fetch.9.
The correct types for the store and fetch families are problematic.
The `word' functions are unfortunately named and need to be split
to handle ints/longs/object pointers/function pointers. Storing
argv[] as longs is quite broken when longs are longer than pointers,
but usually works because it clobbers variables that will soon be
reinitialized.
Bruce Evans [Wed, 15 Jul 1998 05:00:26 +0000 (05:00 +0000)]
Cast u_longs to uintptr_t before casting them to pointers. Don't
attempt to even partially support systems with function pointers
larger than object pointers.
John Polstra [Wed, 15 Jul 1998 04:22:45 +0000 (04:22 +0000)]
Add support for a new archetype "printf0" for the "format" function
attribute. It is like the existing "printf" archetype, except that
it doesn't complain if the format string is a null pointer. See
the node "Function Attributes" in the GCC info pages if you don't
know what this is all about.
This change will allow us to add format string checking for the
err(3) family of functions.
Bruce Evans [Wed, 15 Jul 1998 04:03:54 +0000 (04:03 +0000)]
Cast the value returned by strtoul() to a uintptr_t before casting
it to a pointer. There's nothing better than strtoul() for reading
pointers from strings, but the range checking should be better.
Bruce Evans [Wed, 15 Jul 1998 03:58:57 +0000 (03:58 +0000)]
Cast virtual addresses that happen to be represented as u_longs to
uintptr_t before casting them to pointers. Explicit u_longs should
never be used to represent virtual addresses... (vm_offset_t is
normally right).
Bruce Evans [Wed, 15 Jul 1998 02:32:35 +0000 (02:32 +0000)]
Cast pointers to uintptr_t/intptr_t instead of to u_long/long,
respectively. Most of the longs should probably have been
u_longs, but this changes is just to prevent warnings about
casts between pointers and integers of different sizes, not
to fix poorly chosen types.
Guy Helmer [Tue, 14 Jul 1998 19:07:30 +0000 (19:07 +0000)]
Revert "POSIX saved uids change". seteuid(2) is not POSIX, and
FreeBSD does not have _POSIX_SAVED_IDS enabled. Thanks to Warner Losh
and Ollivier Robert for pointing this out, and Bruce Evans for explaining
the role of _POSIX_SAVED_IDS.
Bruce Evans [Tue, 14 Jul 1998 12:26:15 +0000 (12:26 +0000)]
Print pointers using %p instead of attempting to print them by
casting them to long, etc. Fixed some nearby printf bogons (sign
errors not warned about by gcc, and style bugs, but not truncation
of vm_ooffset_t's).
Bruce Evans [Tue, 14 Jul 1998 12:14:58 +0000 (12:14 +0000)]
Print pointers using %p instead of attempting to print them by
casting them to long, etc. Fixed some nearby printf bogons (sign
errors not warned about by gcc, and style bugs, but not truncation
of vm_ooffset_t's).
Use slightly less bogus casts for passing pointers to ddb command
functions.
Bruce Evans [Tue, 14 Jul 1998 10:32:27 +0000 (10:32 +0000)]
ioctl() request args are unsigned longs, so don't attempt to store
them as ints. Among other bugs, doing so at best caused benign
overflow followed by fatal sign extension on machines with 32-bit
ints and 64-bit longs.
Bruce Evans [Tue, 14 Jul 1998 06:17:28 +0000 (06:17 +0000)]
Don't pretend to support ix86's with 16-bit ints and 32-bit registers
by using longs just to ensure 32-bit variables. Long variables don't
fit in 32-bit registers on ix86's with 64-bit longs.
Bruce Evans [Tue, 14 Jul 1998 05:09:48 +0000 (05:09 +0000)]
Changed to the C9x draft spelling of the (unsigned) integral type
suitable for holding object pointers (ptrint_t -> uintptr_t).
Added corresponding signed type (intptr_t). Changed/added
corresponding non-C9x types for function pointers to match. Don't
use nonstandard types to implement these types, and don't comment
on them in <machine/types.h>.
Bill Paul [Mon, 13 Jul 1998 18:15:48 +0000 (18:15 +0000)]
Declare pointers to CSR register space to be volatile. This seems to
cure the problems I was having with interrupts not being acknowledged
on time. This fixes a problem I observed where starting two ping -f
processes at 10Mbps would cause an adapter check due to TX GO commands
being issued before TXEOC interrupts were being acked.
Also fix a small problem with tl_start(): the mechanism I was using
to queue new packets onto the TX chain was bogus.
Change adapter check handler so that it resets card state after
tl_softreset() is stored.
Moved all EEPROM-related macro definitions into if_tlreg.h.
Don't allow an autoneg session to start until after the TX queue has
been drained, and don't transmit anything until after the autoneg
session is complete.
Also add support for two more Compaq ThunderLAN-based cards, and three
cards from Olicom which also use the ThunderLAN chip. The only thing
different about the Olicom cards is that they store the station address
at a different location within the EEPROM.
Bruce Evans [Mon, 13 Jul 1998 11:53:59 +0000 (11:53 +0000)]
Fixed overflow and sign extension bugs in
`len = min(so->so_snd.sb_cc, win) - off;'. min() has type u_int
and `off' has type int, so when min() is 0 and `off' is 1, the RHS
overflows to 0U - 1 = UINT_MAX. `len' has type long, so when
sizeof(long) == sizeof(int), the LHS normally overflows to to the
correct value of -1, but when sizeof(long) > sizeof(int), the LHS
is UINT_MAX.
Fixed some u_long's that should have been fixed-sized types.
Bruce Evans [Mon, 13 Jul 1998 11:09:52 +0000 (11:09 +0000)]
Declare tcp_seq and tcp_cc as fixed-size types. Half fixed type
mismatches exposed by this (the prototype for tcp_respond() didn't
match the function definition lexically, and still depends on a
gcc feature to match if ints have more than 32 bits).
Bruce Evans [Mon, 13 Jul 1998 10:44:02 +0000 (10:44 +0000)]
Don't attempt to optimize the space allocated for bpf headers if
sizeof(struct bpf_hdr) > 20. 20 is normal on 32-bit systems with
32-bit alignment, but we still assume that the last 2 bytes of the
struct are unnecessary padding on such systems. On systems with
64-bit longs, struct timeval is bloated to 16 bytes, so bpf headers
certainly don't fit in 18 bytes.
SLICE probing becomes asynchronous. It can now be triggered by
interupt level events. This needs a lot of cleanup, but has been working
here for a month or two.. originally needed for CAM integration
but that hasn't happenned yet. The probing state machines for each
handler should be replaced by a more generic state-service. It's
still quite messy in there..
Bruce Evans [Mon, 13 Jul 1998 06:45:23 +0000 (06:45 +0000)]
Added macros __printflike() and __scanflike() to <sys/cdefs.h>.
Use them to `make gcc -Wformat' check formats for all printf-like
and scanf-like functions in /usr/src except for the err()/warn()
family. err() isn't quite printf-like since its format arg can
legitimately be NULL. syslog() isn't quite printf-like, but gcc
already accepts %m, even for plain printf() when it shouldn't.
Stefan Eßer [Sun, 12 Jul 1998 20:26:45 +0000 (20:26 +0000)]
Fix size of time stamps (had been time_t before the variable "time" was
hidden). Now "ticks" are used, which are 4 byte, not 8 byte in size.
The size mismatch did not matter due to sufficient padding at the end
of the structure that holds time stamps (there is an unused member).
The fix suggested by Bruce Evans used "sizeof (ticks_t)", but I prefer
to use "sizeof ticks", and didn't seem to object in his last mail on
this topic.
Bruce Evans [Sun, 12 Jul 1998 10:47:32 +0000 (10:47 +0000)]
Removed historical dependencies on `Makefile'. They had rotted to being
mostly for objects that have the fewest dependencies on `Makefile'
(since they were mostly for utilities and objects generated from *.s
and these don't depend on profiling flags).
Give an explicit rule for building vnode_if.o. This fixes building
it without ${PROF}.
Use .ORDER instead of a stamp file to avoid building vnode_if.[ch]
concurrently.
Removed explicit dependencies that will be generated by `make' (.c.o)
or will be generated by mkdep.
Added missing dependencies of special objects on opt_global.h.
Use ${NORMAL_C} instead of special rules for special objects where
possible.
Stefan Eßer [Sun, 12 Jul 1998 09:07:36 +0000 (09:07 +0000)]
Fix proxy authorization code:
- failed to use authorization parameters passed in the environment, if
/dev/tty could not be opened (i.e. if running from cron)
- mixed use of /dev/tty and stdin for prompt and reading of the result