Commit Graph

70 Commits

Author SHA1 Message Date
Bruce Evans a23d65bfc8 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.
1998-07-15 02:32:35 +00:00
Doug Rabson ecbb00a262 This commit fixes various 64bit portability problems required for
FreeBSD/alpha.  The most significant item is to change the command
argument to ioctl functions from int to u_long.  This change brings us
inline with various other BSD versions.  Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.

The prototype FreeBSD/alpha machdep will follow in a couple of days
time.
1998-06-07 17:13:14 +00:00
Poul-Henning Kamp 227ee8a188 Eradicate the variable "time" from the kernel, using various measures.
"time" wasn't a atomic variable, so splfoo() protection were needed
around any access to it, unless you just wanted the seconds part.

Most uses of time.tv_sec now uses the new variable time_second instead.

gettime() changed to getmicrotime(0.

Remove a couple of unneeded splfoo() protections, the new getmicrotime()
is atomic, (until Bruce sets a breakpoint in it).

A couple of places needed random data, so use read_random() instead
of mucking about with time which isn't random.

Add a new nfs_curusec() function.

Mark a couple of bogosities involving the now disappeard time variable.

Update ffs_update() to avoid the weird "== &time" checks, by fixing the
one remaining call that passwd &time as args.

Change profiling in ncr.c to use ticks instead of time.  Resolution is
the same.

Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call
hzto() which subtracts time" sequences.

Reviewed by:	bde
1998-03-30 09:56:58 +00:00
Poul-Henning Kamp a4daaa09f2 Implement the spirit but not the letter of Terrys hot-char patch.
The differences Terrys patch and this patch are:
 * Remove a lot of un-needed comments.
 * Don't put l_hotchar at the front of stuct linesw, there is no need to.
 * Use the #defines for the hotchar in the SLIP and PPP line disciplines
1998-02-13 12:46:28 +00:00
Eivind Eklund 303b270b0a Staticize. 1998-02-09 06:11:36 +00:00
Eivind Eklund 1d5e9e2255 Make INET a proper option.
This will not make any of object files that LINT create change; there
might be differences with INET disabled, but hardly anything compiled
before without INET anyway.  Now the 'obvious' things will give a
proper error if compiled without inet - ipx_ip, ipfw, tcp_debug.  The
only thing that _should_ work (but can't be made to compile reasonably
easily) is sppp :-(

This commit move struct arpcom from <netinet/if_ether.h> to
<net/if_arp.h>.
1998-01-08 23:42:31 +00:00
Andrey A. Chernov f3a4092ca2 MALLOC->malloc
Suggested-by: bde
1997-12-19 19:39:01 +00:00
Andrey A. Chernov 17b6b6d61d SUNIT: use MALLOC/FREE and M_NOWAIT 1997-12-19 09:48:57 +00:00
Bruce Evans 239b7b699e Use ENOIOCTL instead of -1 (= ERESTART) for tty ioctls that are
not handled at a particular level.  This fixes mainly restarting
of interrupted TIOCDRAINs and TIOCSETA{W,F}s.
1997-12-06 13:25:01 +00:00
Andrey A. Chernov 44a8636f2a Preserve old SC_STATIC value after units exchange 1997-10-07 09:13:06 +00:00
Justin T. Gibbs 6c951b4441 Update for new callout interface. 1997-09-21 22:02:25 +00:00
Andrey A. Chernov 6e5334121f SUNIT: exchange up/down states too 1997-08-13 14:57:14 +00:00
Bruce Evans 1fd0b0588f Removed unused #includes. 1997-08-02 14:33:27 +00:00
Andrey A. Chernov 4886ec1198 Use malloc to save space for temp SUNIT variable
Submitted by: bde
1997-07-28 14:57:10 +00:00
Andrey A. Chernov 8e6c45c8b4 Move tmpnc struct out of stack, too large
Suggested by: bde
1997-07-27 19:28:26 +00:00
Andrey A. Chernov 1d7adc8bea SUNIT: exchange back whole ifnet structures since they are in the linked
list, not device numbers only
1997-07-26 20:13:56 +00:00
Andrey A. Chernov b2296ca150 Forget to change units in prev. SUNIT commit. Move variales to local
section for SUNIT.
1997-07-26 19:09:12 +00:00
Andrey A. Chernov 0229106442 Exchange whole structures on SUNIT, not unit+flags fields only.
It is needed because if_attach() assumes fixed units order
and pass it to ifconfig
1997-07-26 18:47:56 +00:00
Bruce Evans 51a534883a Don't include <sys/ioctl.h> in the kernel. Stage 2: include
<sys/sockio.h> instead of <sys/ioctl.h> in network files.
1997-03-24 11:33:46 +00:00
Bruce Evans 3ac4d1ef0c Don't #include <sys/fcntl.h> in <sys/file.h> if KERNEL is defined.
Fixed everything that depended on getting fcntl.h stuff from the wrong
place.  Most things don't depend on file.h stuff at all.
1997-03-23 03:37:54 +00:00
Bruce Evans ed637f8f5f Fixed clist limits. I got them wrong several years ago in rev.1.9
(1994/11/26).  Packets with more than approximately 128 0xc0's or
0xdb's in them were untransmittable.
1997-03-11 19:39:21 +00:00
Peter Wemm 6875d25465 Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.
1997-02-22 09:48:43 +00:00
Garrett Wollman c7e54a6a04 Don't try to do anything with the `ifr' parameter for SIOCADDMULTI
and SIOCDELMULTI; it is guaranteed to be null in the new system.
1997-01-17 19:38:16 +00:00
Jordan K. Hubbard 1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Garrett Wollman 294121822b Use queue macros for the list of interfaces. Next stop: ifaddrs! 1996-12-11 20:38:25 +00:00
Garrett Wollman a3af8d44a3 Add primitive link MIB support. 1996-10-11 18:40:48 +00:00
Gary Palmer 545f9f440b Remove another extraneous setting of if_lastchange 1996-06-24 21:56:39 +00:00
Gary Palmer a614bfe060 Since the updates to ifnet.if_lastchange are so rare (relatively
speaking), go for the extra accuracy and call microtime() to get
the current time.

Pointed Out By:		bde
1996-06-12 19:24:03 +00:00
Gary Palmer e39a0280cb Change the use if ifnet.if_lastchange to be more in line with
SNMP requirements. Update description of ifnet.if_lastchange in if.h
to indicate this.
1996-06-10 23:07:36 +00:00
Andrey A. Chernov 49968bb8cf When two units swapped, copy SC_STATIC flag too, not clear it 1996-05-13 14:18:18 +00:00
Andrey A. Chernov d99bab06b5 Prevent mixing of static and dynamic unit allocation strategies 1996-05-13 14:09:34 +00:00
David Greenman 2a8d579fc8 Regardless of whether or not the check for IPv4 is useful, we certainly
don't need to assign the "ip" pointer twice.
1996-04-25 02:34:37 +00:00
Poul-Henning Kamp 3fb9e5a20b Reject all IP versions but 4. 1996-04-24 15:44:34 +00:00
Bruce Evans 6ffde942bf Removed never-used #includes of <machine/cpu.h>. Many were apparently
copied from bad examples.
1996-04-07 17:39:28 +00:00
Garrett Wollman 9b44ff2214 Clean up Ethernet drivers:
- fill in and use ifp->if_softc
	- use if_bpf rather than private cookie variables
	- change bpf interface to take advantage of this
	- call ether_ifattach() directly from Ethernet drivers
	- delete kludge in if_attach() that did this indirectly
1996-02-06 18:51:28 +00:00
Poul-Henning Kamp f708ef1b9e Another mega commit to staticize things. 1995-12-14 09:55:16 +00:00
Bruce Evans 286f8561e2 Replaced bogus macros for entry points to unconfigured line disciplines
by functions.

tty_conf.c:
Cleaned up formatting of tables.

Removed another ARGSUSED for consistency.

conf.h:
Introduced typedefs for line discipline functions.

Backed out most of previous revision (it is done elsewhere).
1995-11-05 20:25:59 +00:00
Peter Wemm 71b9cf739a slcompress: split one of the functions into two parts, to allow use by both
if_sl and if_ppp (from ppp-2.2), eliminating the nearly identical
 pppcompress.[ch] code.  Add maximum VJ compression states argument to
 sl_compress_init().
if_sl: call sl_compress_init() with the extra argument.
1995-10-31 19:22:32 +00:00
Andrey A. Chernov f7f7fe111b Clear SC_OUTWAIT after checking of free clists, not before 1995-09-17 23:38:29 +00:00
Bruce Evans 6b435e575c Call output process in slstart() whether or not there is any output. As
in pppstart(), the output process may be overloaded to handle hardware
flow control and hardware output completions.

Don't wait for output to drain in slclose().  Discard output immediately.
New output is not prevented while processes are waiting for output to
drain (this is a bug), so the wait was sometimes forever.  Infinite
waits are also possible when CCTS_OFLOW is enabled and CTS is down.
Infinite waits were also caused by the above bug in slstart().

Start changing new init stuff yet again: rename unused arg `dummy'.

Reviewed by:	davidg
1995-09-10 12:22:59 +00:00
David Greenman 4590fd3a2a Fixed init functions argument type - caddr_t -> void *. Fixed a couple of
compiler warnings.
1995-09-09 18:10:37 +00:00
Bruce Evans b6f5c0b824 Fix several sysinit functions that had the wrong type and unnecessarily
external linkage.

Remove useless comments saying that SYSINIT() does system initialization.
1995-08-30 00:33:22 +00:00
Bruce Evans 9fa18570a2 Obtained from: partly from ancient patches of mine via 1.1.5
Introduce TS_CONNECTED and TS_ZOMBIE states.  TS_CONNECTED is set
while a connection is established.  It is set while (TS_CARR_ON or
CLOCAL is set) and TS_ZOMBIE is clear.  TS_ZOMBIE is set for on to
off transitions of TS_CARR_ON that occur when CLOCAL is clear and
is cleared for off to on transitions of CLOCAL.  I/o can only occur
while TS_CONNECTED is set.  TS_ZOMBIE prevents further i/o.

Split the input-event sleep address TSA_CARR_ON(tp) into TSA_CARR_ON(tp)
and TSA_HUP_OR_INPUT(tp).  The former address is now used only for
off to on carrier transitions and equivalent CLOCAL transitions.
The latter is used for all input events, all carrier transitions
and certain CLOCAL transitions.  There are some harmless extra
wakeups for rare connection- related events.  Previously there were
too many extra wakeups for non-rare input events.

Drivers now call l_modem() instead of setting TS_CARR_ON directly
to handle even the initial off to on transition of carrier.  They
should always have done this.  l_modem() now handles TS_CONNECTED
and TS_ZOMBIE as well as TS_CARR_ON.

gnu/isdn/iitty.c:
Set TS_CONNECTED for first open ourself to go with bogusly setting
CLOCAL.

i386/isa/syscons.c, i386/isa/pcvt/pcvt_drv.c:
We fake carrier, so don't also fake CLOCAL.

kern/tty.c:
Testing TS_CONNECTED instead of TS_CARR_ON fixes TIOCCONS forgetting to
test CLOCAL.  TS_ISOPEN was tested instead, but that broke when we disabled
the clearing of TS_ISOPEN for certain transitions of CLOCAL.

Testing TS_CONNECTED fixes ttyselect() returning false success for output
to devices in state !TS_CARR_ON && !CLOCAL.

Optimize the other selwakeup() call (this is not related to the other
changes).

kern/tty_pty.c:
ptcopen() can be declared in traditional C now that dev_t isn't short.
1995-07-31 21:02:00 +00:00
Bruce Evans 267513a942 Obtained from: partly from ancient patches by ache and me via 1.1.5
Remove nullmodem().

It may be useful to have a null modem routine, but nullmodem()
wasn't one.  nullmodem() was identical to ttymodem() except it
didn't implement MDMBUF (carrier) flow control, didn't do any
wakeups for off to on carrier transitions, and didn't flush the
i/o queues for on to off carrier transitions (flushing has the side
effect of waking up readers and writers) although it did generate
SIGHUPs.  The wakeups must normally be done even if nullmodem() is
null in case something is sleeping waiting for a carrier transition.
In any case, the wakeups should be harmless.  They may cause bogus
results for select(), but select() is already bogus for nonstandard
line disciplines.
1995-07-29 13:40:13 +00:00
David Greenman ef59de8517 Worked around a bug with if.c setting the interface up even when we don't
want it to.
1995-07-07 01:13:49 +00:00
David Greenman 93ff4e36e3 Modified joerg's last change to only set the interface "up" when setting
the address if the device is a SLIP device (i.e. "attached").
1995-07-06 11:55:18 +00:00
Joerg Wunsch 1394aff0cd Revision 1.21 of if_sl.c broke the traditional behaviour that
assigning an address to an interface automatically marks this
interface IFF_UP.  The fix corrects this (and closes PR sys/577).
This is consistent with the way ethernet interfaces are being handled.
1995-07-02 09:01:02 +00:00
David Greenman 0a779360e5 Killed a couple lines of redundant code. 1995-06-21 10:13:23 +00:00
David Greenman 92678d4679 Protect the call to if_up() with an splnet(). 1995-06-21 09:11:22 +00:00
David Greenman 2cd67fdafd 1) Set interface up/down correctly as a function of open and close of the
SLIP device.
2) Don't directly frob the IFF_UP flag - use if_up/if_down as it was
   intended.
3) Return ENETDOWN if IFF_UP isn't set when outputing, drop the packet if
   if IFF_UP isn't set when inputing.
1995-06-21 08:48:19 +00:00