Commit Graph

148826 Commits

Author SHA1 Message Date
Jilles Tjoelker
4f6e4215a0 Do not fork for a subshell if it is the last thing this shell is doing
(EV_EXIT). The fork is still done as normal if any traps are active.

In many cases, the fork can be avoided even without this change by using {}
instead of (), but in practice many scripts use (), likely because the
syntax is simpler.

Example:
  sh -c '(/bin/sleep 10)& sleep 1;ps -p $! -o comm='
Now prints "sleep" instead of "sh". $! is more useful this way.
Most shells (dash, bash, pdksh, ksh93, zsh) seem to print "sleep" for this.

Example:
  sh -c '( ( ( (ps jT))))'
Now shows no waiting shell processes instead of four.
Most shells (dash, bash, pdksh, ksh93, zsh) seem to show zero or one.

PR:		bin/74404
Approved by:	ed (mentor) (implicit)
2009-06-23 21:50:06 +00:00
Rick Macklem
73f4ccbd29 When mountd.c parses the nfsv4 root line(s) in /etc/exports, it
allocates data structures that are never linked into the tree or free'd.
As such, mountd would leak memory every time it parsed an nfsv4 root line.
This patch frees up those structures to plug the leak.

Approved by:	kib (mentor)
2009-06-23 21:48:04 +00:00
Alexander Motin
96c5d068d8 Rework r193814:
While general idea of patch was good, it was not working properly due the way
it was implemented. When we are using same timer interrupt for several of
hard/prof/stat purposes we should not send several IPIs same time to other
CPUs. Sending several IPIs same time leads to terrible accounting/profiling
results due to strong synchronization effect, when the second interrupt
handler accounts processing of the first one.
Interlink timer events in a such way, that no more then one IPI is sent for
any original timer interrupt.
2009-06-23 21:45:33 +00:00
Ed Schouten
9801591468 Improve my last commit: use a separate condvar to serialize.
The advantage of using a separate condvar is that we can just use
cv_signal(9) instead of cv_broadcast(9). It makes no sense to wake up
multiple threads. It also makes the TTY code easier to understand.
t_dcdwait sounds totally unrelated.
2009-06-23 21:43:02 +00:00
Joel Dahl
0930c50786 Add one more reference to SEE ALSO. Sort while here.
Submitted by:	ariff
2009-06-23 21:37:12 +00:00
Ed Schouten
2d41cf3a24 Use dcdwait to block threads to serialize writes.
I suspect the usage of bgwait causes a lot of spurious wakeups when
threads are blocked in the background, because they will be woken up
each time a write() call is performed.

Also wakeup dcdwait when the TTY is abandoned.
2009-06-23 21:33:26 +00:00
Joel Dahl
d775d1b346 Bring in a few mdoc/language fixes.
Submitted by:	ru
2009-06-23 21:24:21 +00:00
Konstantin Belousov
c9253e931d Usermode portion of the support for swap allocation accounting:
- update for getrlimit(2) manpage;
- support for setting RLIMIT_SWAP in login class;
- addition to the limits(1) and sh and csh limit-setting builtins;
- tuning(7) documentation on the sysctls controlling overcommit.

In collaboration with:	pho
Reviewed by:	alc
Approved by:	re (kensmith)
2009-06-23 20:57:27 +00:00
Konstantin Belousov
3364c323e6 Implement global and per-uid accounting of the anonymous memory. Add
rlimit RLIMIT_SWAP that limits the amount of swap that may be reserved
for the uid.

The accounting information (charge) is associated with either map entry,
or vm object backing the entry, assuming the object is the first one
in the shadow chain and entry does not require COW. Charge is moved
from entry to object on allocation of the object, e.g. during the mmap,
assuming the object is allocated, or on the first page fault on the
entry. It moves back to the entry on forks due to COW setup.

The per-entry granularity of accounting makes the charge process fair
for processes that change uid during lifetime, and decrements charge
for proper uid when region is unmapped.

The interface of vm_pager_allocate(9) is extended by adding struct ucred *,
that is used to charge appropriate uid when allocation if performed by
kernel, e.g. md(4).

Several syscalls, among them is fork(2), may now return ENOMEM when
global or per-uid limits are enforced.

In collaboration with:	pho
Reviewed by:	alc
Approved by:	re (kensmith)
2009-06-23 20:45:22 +00:00
Jilles Tjoelker
224fbf9fd6 sh: Improve handling of setjmp/longjmp volatile:
- remove ineffective and unnecessary (void) &var; [1]
- remove some unnecessary volatile keywords
- add a necessary volatile keyword
- save the old handler before doing something that could use the saved
  value

Submitted by:	Christoph Mallon [1]
Approved by:	ed (mentor)
2009-06-23 20:45:12 +00:00
Marius Strobl
d54384d976 - Update regarding the support for SBus GEM added in r194763.
- Improve the description a bit and add a reference to vlan(4).
2009-06-23 20:38:35 +00:00
Marius Strobl
9ba2b298df - Initialize the ifnet structure, especially if_dname, before probing
the PHYs as some PHY drivers use it (but probably shouldn't). How
  gem(4) has worked with brgphy(4) on powerpc without this so far is
  unclear to me.
- Introduce a dying flag which is set during detach and checked in
  gem_ioctl() in order to prevent active BPF listeners to clear
  promiscuous mode which may lead to the tick callout being restarted
  which will trigger a panic once it's actually gone.
- In gem_stop() reset rather than just disable the transmitter and
  receiver in order to ensure we're not unloading DMA maps still in
  use by the hardware. [1]
- The blanking time is specified in PCI clocks so we should use twice
  the value when operating at 66MHz.
- Spell some 2 as ETHER_ALIGN and a 19 as GEM_STATUS_TX_COMPLETION_SHFT
  to make the actual intentions clear.
- As we don't unload the peak attempts counter ignore its overflow
  interrupts.
- Remove a stale setting of a variable to GEM_TD_INTERRUPT_ME which
  isn't used afterwards.
- For optimum performance increment the TX kick register in multiples
  of 4 if possible as suggested by the documentation.
- Partially revert r164931; drivers should only clear the watchdog
  timer if all outstanding TX descriptors are done.
- Fix some debugging strings.
- Add a missing BUS_DMASYNC_POSTWRITE in gem_rint().
- As the error paths in the interrupt handler are generally unlikely
  predict them as false.
- Add support for the SBus version of the GEM controller. [2]
- Add some lock assertions.
- Improve some comments.
- Fix some more or less cosmetic issues in the code of the PCI front-end.
- Change some softc members to be unsigned where more appropriate and
  remove unused ones.

Approved by:	re (kib)
Obtained from:	NetBSD (partially) [2], OpenBSD [1]
MFC after:	2 weeks
2009-06-23 20:36:59 +00:00
Jamie Gritton
b97457e2e6 Add a limit for child jails via the "children.cur" and "children.max"
parameters.  This replaces the simple "allow.jails" permission.

Approved by:	bz (mentor)
2009-06-23 20:35:51 +00:00
Andrew Gallatin
bb8ddc66ea - Fix bug where device would loose promisc setting when reset.
- Allow all rss hash modes to be chosen
2009-06-23 20:22:34 +00:00
Robert Watson
8c0fec805f Modify most routines returning 'struct ifaddr *' to return references
rather than pointers, requiring callers to properly dispose of those
references.  The following routines now return references:

  ifaddr_byindex
  ifa_ifwithaddr
  ifa_ifwithbroadaddr
  ifa_ifwithdstaddr
  ifa_ifwithnet
  ifaof_ifpforaddr
  ifa_ifwithroute
  ifa_ifwithroute_fib
  rt_getifa
  rt_getifa_fib
  IFP_TO_IA
  ip_rtaddr
  in6_ifawithifp
  in6ifa_ifpforlinklocal
  in6ifa_ifpwithaddr
  in6_ifadd
  carp_iamatch6
  ip6_getdstifaddr

Remove unused macro which didn't have required referencing:

  IFP_TO_IA6

This closes many small races in which changes to interface
or address lists while an ifaddr was in use could lead to use of freed
memory (etc).  In a few cases, add missing if_addr_list locking
required to safely acquire references.

Because of a lack of deep copying support, we accept a race in which
an in6_ifaddr pointed to by mbuf tags and extracted with
ip6_getdstifaddr() doesn't hold a reference while in transmit.  Once
we have mbuf tag deep copy support, this can be fixed.

Reviewed by:	bz
Obtained from:	Apple, Inc. (portions)
MFC after:	6 weeks (portions)
2009-06-23 20:19:09 +00:00
Robert Noland
abcd328be6 Add some sysctl info so that we can see what is going on with vblanks.
MFC after:	3 days
2009-06-23 20:19:02 +00:00
Sam Leffler
ea158edaa6 Now that we have UARTs running with fast interrupt handlers the ata
driver's i/o ops must be locked to avoid chaos.  Extend the cambria
bus tag to support ata and add a spin lock.  The ata driver is
hacked to use that instead of it's builtin hack for ixp425.  Once
the ata driver is fixed to not be confused about byte order we can
generalize the cambria bus tag code and make it generally useful.

While here take advantage of our being ixp435-specific to remove
delays when switching between byte+word accesses and to eliminate
the 2us delay for the uarts (the spin lock overhead looks to do
this for us).
2009-06-23 19:29:23 +00:00
Sam Leffler
dbdc502de6 use consistent style 2009-06-23 19:05:02 +00:00
Andrew Gallatin
710328322a Revert most of 193311 so as to track mxge transmit stats
on a per-ring basis and avoid racy (and costly) updates
to the ifp stats via drbr by defining NO_SLOW_STATS

Discussed with: kmacy
2009-06-23 19:04:25 +00:00
Olivier Houchard
9d53036ff1 Include sys/lock.h before sys/rwlock.h. If anything used to bring it for us
before, it does not anymore.
2009-06-23 18:36:42 +00:00
Robert Noland
128512d705 Only release irq resources if we were actually using them.
MFC after:	3 days
2009-06-23 18:24:09 +00:00
Robert Noland
179ab71fdd Using signals for vblank events is prone to issues. There have never
been any consumers and likely will never be.  Furthermore, we have
never enabled the code for it, so just get rid of it.

MFC after:	3 days
2009-06-23 18:09:35 +00:00
Andrew Gallatin
f9298d3901 Update mxge firmware from 1.4.39 to 1.4.43. Changes include:
- Support for 10G-PCIE*-8B*-C (dual-port CX4)  NICs
- For dual-port NICs, f/w failover is now a few microsecs
    instead of a few millisecs.
-  On failover, f/w sends RARP broadcast to make the change
   immediately known to the network
- Fixed a bug observed on IBM X3 architecture where
   some spurious ecrc errors would be reported when OS enabled
   ecrc support.

Sponsored by: Myricom Inc.
2009-06-23 18:00:43 +00:00
Robert Noland
a2d33c4900 Given that vblanks generally occur 60 times a second, waiting 3 seconds
seems rather excessive.

MFC after:	3 days
2009-06-23 17:52:41 +00:00
Robert Noland
3a5185e13a vblank[crtc].last represents the hardware counter while request.sequence
represents the software counter.  Don't currupt things here.

MFC after:	3 days
2009-06-23 17:50:35 +00:00
Andrew Gallatin
eb6219e337 Implement minimal set of changes suggested by bz to make
mxge no longer depend on INET.
2009-06-23 17:42:06 +00:00
Robert Noland
5880b860f8 Hold the lock while we save/restore register for suspend/resume.
MFC after:	3 days
2009-06-23 17:38:28 +00:00
Bjoern A. Zeeb
5736e6fb9d After cleaning up rt_tables from vnet.h and cleaning up opt_route.h
a lot of files no longer need route.h either. Garbage collect them.
While here remove now unneeded vnet.h #includes as well.
2009-06-23 17:03:45 +00:00
Rui Paulo
07bed1516d Fix build with ACPI_DEBUG.
MFC after:	2 weeks
2009-06-23 15:08:03 +00:00
Rui Paulo
597c30a83f Fix double path issue and other nits.
MFC after:	2 weeks
2009-06-23 14:57:06 +00:00
Bjoern A. Zeeb
0c88be0499 In r194702 I meant to remove vnet.h which is no longer needed, not route.h. 2009-06-23 14:54:42 +00:00
Jamie Gritton
5b4a0a4fb5 Whitespace fix.
Approved by:	bz (mentor)
2009-06-23 14:40:08 +00:00
Jamie Gritton
ded788478f Remove obsolete comment describing how the command line is
no longer parsed.

Approved by:	bz (mentor)
2009-06-23 14:39:51 +00:00
Jamie Gritton
399645e1b9 Remove unnecessary/redundant includes.
Approved by:	bz (mentor)
2009-06-23 14:39:21 +00:00
Coleman Kane
7c1a5c7c93 Code cleanup by moving some repetitive code into an ndis_get_bssid_list
helper function. Also, add ieee80211_announce() call for bootverbose case.

Submitted by:	Paul B. Mahol <onemda@gmail.com>
2009-06-23 14:37:07 +00:00
Ed Schouten
26d0788e89 Fix a typo in the same comment, one line below.
Submitted by:	bf1783 googlemail com
2009-06-23 14:12:49 +00:00
Ed Schouten
dc428c2ffe Remove unneeded stdlib directories.
It's not necessary to add stdlib directories for each architecture, even
if the architecture doesn't implement any files of its own.

Submitted by:	Christoph Mallon
2009-06-23 14:11:41 +00:00
Ed Schouten
87fbd35f4f Simplify. We can just use .sinclude here.
Submitted by:	Christoph Mallon
2009-06-23 14:10:46 +00:00
Bjoern A. Zeeb
14a20db534 in6_rtqdrain() has been unused. Cleanup.
As this was the only consumer of net/route.h left remove that as well.
2009-06-23 13:22:19 +00:00
Rui Paulo
df849145b5 * Driver for ACPI WMI (Windows Management Instrumentation)
* Driver for ACPI HP extra functionations, which required
  ACPI WMI driver.

Submitted by:	Michael <freebsdusb at bindone.de>
Approved by:	re
MFC after:	2 weeks
2009-06-23 13:17:25 +00:00
Bjoern A. Zeeb
a877d0cffa Remove duplicate #include <net/route.h> from the middle of the file. 2009-06-23 13:16:16 +00:00
Alexander Motin
c1b8a9edab Mark ng_ether node hooks as HI_STACK. It is usually the last point when
netgraph may unroll the call stack, and I have found that in some cases 2K
guarantied there for i386 may be not enough for NIC driver and BPF.
2009-06-23 12:30:21 +00:00
Peter Holm
401679debe vn_open_cred() needs a non NULL ucred pointer
Reviewed by:	kib
2009-06-23 11:29:54 +00:00
Ed Schouten
75b872ee53 Fix typo in comment.
Submitted by:	Christoph Mallon
2009-06-23 09:50:50 +00:00
Ed Schouten
e71280c7bc Remove hand-written labs/abs implementations. GCC is smart enough.
It turns out GCC generates code that's a couple of bytes big bigger, but
performs no branching whatsoever.

Submitted by:	Christoph Mallon
2009-06-23 09:04:59 +00:00
Roman Divacky
03cd51df00 Fix what seems to be an obvious typo preventing the body of the
if statement to ever be executed.

Approved by:	ed (mentor)
2009-06-23 09:02:24 +00:00
Maxim Konovalov
fe7bc8cbab o Fix usage() prototype [1] and correct its call.
Submitted by:	ed [1]
2009-06-23 08:51:11 +00:00
Jeff Roberson
c8eb786c8d - Add a new cpuset macro, CPU_FILL(), for setting the set to all 1s. 2009-06-23 06:57:46 +00:00
John Hay
db87e2dc03 time_t does not always fit into long, for instance on arm. So rather cast
it intmax_t and use %j in printf.
2009-06-23 06:46:14 +00:00
Marko Zec
991633af2e Connect ng_pipe to the default build.
Approved by:	julian (mentor)
2009-06-23 06:11:04 +00:00