attilio [Thu, 19 Aug 2010 22:37:43 +0000 (22:37 +0000)]
Revert part of the r211149 as I erroneously ported the logical_cpus from
Yahoo! patchset as a mask (and according manipulating variables) while
it is actually a CPU count.
jhb [Thu, 19 Aug 2010 16:40:30 +0000 (16:40 +0000)]
There isn't really a need to hold the ktrace mutex just to read the value
of p_traceflag that is stored in the kinfo_proc structure. It is still
racey even with the lock and the code will read a consistent snapshot of
the flag without the lock.
jhb [Thu, 19 Aug 2010 16:38:58 +0000 (16:38 +0000)]
Fix a whitespace nit and remove a questioning comment. STAILQ_CONCAT()
does require the STAILQ the existing list is being added to to already
be initialized (it is CONCAT() vs MOVE()).
adrian [Thu, 19 Aug 2010 16:25:15 +0000 (16:25 +0000)]
Implement PLL generalisation in preparation for use in if_arge.
* Add a function to write to the relevant PLL register
* Break out the PLL configuration for the AR71XX into the CPU ops,
lifted from if_arge.c.
* Add the AR91XX PLL configuration ops, using the AR91XX register
definitions.
rpaulo [Thu, 19 Aug 2010 12:59:57 +0000 (12:59 +0000)]
Remove unneeded casts in inline assembly in contrib/gcc/longlong.h,
which are apparently "heinous" GNU extensions, so clang can
compile this without using the -fheinous-gnu-extensions option.
Results in *no* binary change, neither with clang, nor with gcc.
Submitted by: Dimitry Andric <dimitry at andric.com>
adrian [Thu, 19 Aug 2010 11:40:10 +0000 (11:40 +0000)]
Add initial Atheros AR91XX support.
This works well enough to bring a system up to single-user mode
using an MDROOT.
Known Issues:
* The EHCI USB doesn't currently work and will panic the kernel during
attach.
* The onboard ethernet won't work until the PLL routines have been
fleshed out and shoe-horned into if_arge.
* The WMAC device glue (and quite likely the if_ath support)
hasn't yet been implemented.
anchie [Thu, 19 Aug 2010 11:31:03 +0000 (11:31 +0000)]
MFp4: anchie_soc2009 branch:
Add kernel side support for Secure Neighbor Discovery (SeND), RFC 3971.
The implementation consists of a kernel module that gets packets from
the nd6 code, sends them to user space on a dedicated socket and reinjects
them back for further processing.
Hooks are used from nd6 code paths to divert relevant packets to the
send implementation for processing in user space. The hooks are only
triggered if the send module is loaded. In case no user space
application is connected to the send socket, processing continues
normaly as if the module would not be loaded. Unloading the module
is not possible at this time due to missing nd6 locking.
The native SeND socket is similar to a raw IPv6 socket but with its own,
internal pseudo-protocol.
imp [Thu, 19 Aug 2010 06:11:06 +0000 (06:11 +0000)]
This patch to pc-sysinstall allows the setting of a new config
variable for installation, which lets the user/front-end select
between MBR or GPT partitioning schemes when doing a dedicated disk
installation.
adrian [Thu, 19 Aug 2010 02:03:12 +0000 (02:03 +0000)]
Preparation work for supporting the AR91xx and AR724x.
* Implement a SoC probe function, from Linux, which determines the
SoC family, type and revision. This only probes the AR71xx series
SoC and (currently) panics on others.
* Migrate some of the AR71XX specific hardware init (USB device, determining
system frequencies) into using the cpuops introduced in an earlier commit.
Other SoC specific hardware stuff (per-device flush/WB, GPIO pin wiring,
Ethernet PLL setup, other things I've likely missed) will be introduced in
subsequent commits.
Reviewed by: imp@
Obtained from: (partially) Linux
andre [Wed, 18 Aug 2010 18:05:54 +0000 (18:05 +0000)]
If a TCP connection has been idle for one retransmit timeout or more
it must reset its congestion window back to the initial window.
RFC3390 has increased the initial window from 1 segment to up to
4 segments.
The initial window increase of RFC3390 wasn't reflected into the
restart window which remained at its original defaults of 4 segments
for local and 1 segment for all other connections. Both values are
controllable through sysctl net.inet.tcp.local_slowstart_flightsize
and net.inet.tcp.slowstart_flightsize.
The increase helps TCP's slow start algorithm to open up the congestion
window much faster.
gabor [Wed, 18 Aug 2010 17:40:10 +0000 (17:40 +0000)]
- Refactor file reading code to use pure syscalls and an internal buffer
instead of stdio. This gives BSD grep a very big performance boost,
its speed is now almost comparable to GNU grep.
andre [Wed, 18 Aug 2010 17:39:47 +0000 (17:39 +0000)]
Untangle the net.inet.tcp.log_in_vain and net.inet.tcp.log_debug
sysctl's and remove any side effects.
Both sysctl's share the same backend infrastructure and due to the
way it was implemented enabling net.inet.tcp.log_in_vain would also
cause log_debug output to be generated. This was surprising and
eventually annoying to the user.
The log output backend is kept the same but a little shim is inserted
to properly separate log_in_vain and log_debug and to remove any side
effects.
jchandra [Wed, 18 Aug 2010 12:52:21 +0000 (12:52 +0000)]
MIPS n64 support - continued...
1. On n64, use XKPHYS to map page table pages instead of KSEG0. Maintain
just one freepages list on n64.
The changes are mainly to introduce MIPS_PHYS_TO_DIRECT(pa),
MIPS_DIRECT_TO_PHYS(), which will use KSEG0 in 32 bit compilation
and XKPHYS in 64 bit compilation.
2. Change macro based PMAP_LMEM_MAP1(), PMAP_LMEM_MAP2(), PMAP_LMEM_UNMAP()
to inline functions.
3. Introduce MIPS_DIRECT_MAPPABLE(pa), which will further reduce the cases
in which we will need to have a special case for 64 bit compilation.
4. Update CP0 hazard definitions for CPU_RMI - the cpu does not need any
nops
bz [Wed, 18 Aug 2010 09:28:12 +0000 (09:28 +0000)]
When calculating the expected memory size for userspace, also take the
number of syncache entries into account for the surplus we add to account
for a possible increase of records in the re-entry window.
adrian [Wed, 18 Aug 2010 08:22:09 +0000 (08:22 +0000)]
Bring over the first cut of the Atheros-specific SoC operations.
Each of these SoCs have different devices, different hardware initialisation
methods and, quite likely, different quirks. These functions will abstract
out the SoC differences and keep these differences out of the drivers (eg
USB init, if_arge, etc.)
rpaulo [Tue, 17 Aug 2010 20:39:28 +0000 (20:39 +0000)]
For every instance of '.if ${CC} == "foo"' or '.if ${CC} != "foo"' in
Makefiles or *.mk files, use ${CC:T:Mfoo} instead, so only the basename
of the compiler command (excluding any arguments) is considered.
This allows you to use, for example, CC="/nondefault/path/clang -xxx",
and still have the various tests in bsd.*.mk identify your compiler as
clang correctly.
ICC if cases were also changed.
Submitted by: Dimitry Andric <dimitry at andric.com>
des [Tue, 17 Aug 2010 20:26:17 +0000 (20:26 +0000)]
Split kernel stage 3.2 (build everything) into 3.2 (build the kernel)
and 3.3 (build the modules). IMHO, this makes it a little easier to
track the progress of a kernel build using whereintheworld et al.
jhb [Tue, 17 Aug 2010 16:41:16 +0000 (16:41 +0000)]
Ensure a minimum "slop" of 10 extra pcb structures when providing a
memory size estimate to userland for pcb list sysctls. The previous
behavior of a "slop" of n/8 does not work well for small values of n
(e.g. no slop at all if you have less than 8 open UDP connections).
jhb [Tue, 17 Aug 2010 15:44:52 +0000 (15:44 +0000)]
Add a new method to the PCI bridge interface, PCIB_POWER_FOR_SLEEP(). This
method is used by the PCI bus driver to query the power management system
to determine the proper device state to be used for a device during suspend
and resume. For the ACPI PCI bridge drivers this calls
acpi_device_pwr_for_sleep(). This removes ACPI-specific knowledge from
the PCI and PCI-PCI bridge drivers.
rpaulo [Tue, 17 Aug 2010 13:02:08 +0000 (13:02 +0000)]
Make sure any -U CFLAGS are not filtered out when calling mkdep, as
gnu/usr.bin/cc/libiberty first defines the PREFIX macro, and then
undefines it again, so mkdep with clang complains.
Submitted by: Dimitry Andric <dimitry at andric.com>
Reviewed by: ru
brucec [Tue, 17 Aug 2010 09:51:08 +0000 (09:51 +0000)]
Since top displays the uptime including seconds, there is no need to add 30
onto it, which may have been used for rounding purposes in other utilities.
PR: bin/147934
Submitted by: Janne Snabb <snabb at epipe.com>
Approved by: rrs (mentor)
MFC after: 2 weeks
kib [Tue, 17 Aug 2010 09:42:50 +0000 (09:42 +0000)]
Add simple test to check the functioning of retrieval of
pagesize()/pagesizes() after change to use aux vector. Note that
public function getosreldate() is different from libc-internal
__getosreldate() and does not use aux to fetch osreldate value.
brucec [Tue, 17 Aug 2010 09:39:06 +0000 (09:39 +0000)]
To restart, sysinstall calls execl. Since it will create a new process, we
can't check to see if sysinstall is running as init just by checking if the
PID is 0. Introduce a new option that sets the RunningAsInit flag, and update
the code to check RunningAsInit intstead of getpid().
PR: bin/38854
Submitted by: Peter Sedeffow <peter at trumanbrewery.com>
Approved by: rrs (mentor)
MFC after: 1 month
kib [Tue, 17 Aug 2010 09:05:39 +0000 (09:05 +0000)]
Use the newly provided aux vectors to get pagesize and osreldate information.
Use local version of getpagesize(), rtld_getpagesize() in private allocator.
Override the __getosreldate() previously fetched from libc_pic.a with
local version that uses aux value if present. Note that __getosreldate()
is used by rtld indirectly, by mmap(2) libc wrapper.
To be able to utilize aux, split digest_dynamic() for use by init_rtld()
into two parts, where the first one does not call malloc(), and the
second part uses it. init_rtld() is able to initialize global variables
before digest_dynamic2() calls. In particular, pagesize and osreldate are
set up from the aux values.
kib [Tue, 17 Aug 2010 08:55:45 +0000 (08:55 +0000)]
Supply some useful information to the started image using ELF aux vectors.
In particular, provide pagesize and pagesizes array, the canary value
for SSP use, number of host CPUs and osreldate.
davidxu [Tue, 17 Aug 2010 02:50:12 +0000 (02:50 +0000)]
Tweak code a bit to be POSIX compatible, when a cancellation request
is acted upon, or when a thread calls pthread_exit(), the thread first
disables cancellation by setting its cancelability state to
PTHREAD_CANCEL_DISABLE and its cancelability type to
PTHREAD_CANCEL_DEFERRED. The cancelability state remains set to
PTHREAD_CANCEL_DISABLE until the thread has terminated.
It has no effect if a cancellation cleanup handler or thread-specific
data destructor routine changes the cancelability state to
PTHREAD_CANCEL_ENABLE.
pjd [Mon, 16 Aug 2010 21:59:56 +0000 (21:59 +0000)]
The 'size' variable is there to limit how many bytes we want to copy from
'addr'. It is very likely that size of 'addr' is larger than 'size', so checking
strlcpy() return value is bogus.
jilles [Mon, 16 Aug 2010 17:18:08 +0000 (17:18 +0000)]
sh: Get rid of unnecessary non-standard empty lists.
POSIX does not allow constructs like:
if cmd; then fi
{ }
Add a colon dummy command, except in a test that verifies that such empty
lists do not cause crashes when used as a function definition.
andre [Mon, 16 Aug 2010 14:24:00 +0000 (14:24 +0000)]
Add uma_zone_get_max() to obtain the effective limit after a call
to uma_zone_set_max().
The UMA zone limit is not exactly set to the value supplied but
rounded up to completely fill the backing store increment (a page
normally). This can lead to surprising situations where the number
of elements allocated from UMA is higher than the supplied limit
value. The new get function reads back the effective value so that
the supplied limit value can be adjusted to the real limit.
ed [Mon, 16 Aug 2010 12:19:36 +0000 (12:19 +0000)]
Mark functions and variables as static.
All these functions and variables are local to this compilation unit, so
there is no reason why we shouldn't mark them static. This slightly
reduces the binary size.
des [Mon, 16 Aug 2010 11:32:20 +0000 (11:32 +0000)]
In setusercontext(), do not apply user settings unless running as the
user in question (usually but not necessarily because we were called
with LOGIN_SETUSER). This plugs a hole where users could raise their
resource limits and expand their CPU mask.
gabor [Sun, 15 Aug 2010 22:15:04 +0000 (22:15 +0000)]
- Revert strlcpy() changes to memcpy() because it's more efficient and
former may be safer but in this case it doesn't add extra
safety [1]
- Fix -w option [2]
- Fix handling of GREP_OPTIONS [3]
- Fix --line-buffered
- Make stdin input imply --line-buffered so that tail -f can be piped
to grep [4]
- Imply -h if single file is grepped, this is the GNU behaviour
- Reduce locking overhead to gain some more performance [5]
- Inline some functions to help the compiler better optimize the code
- Use shortcut for empty files [6]
jilles [Sun, 15 Aug 2010 21:06:53 +0000 (21:06 +0000)]
sh: Fix break/continue/return sometimes not skipping the rest of dot script.
In our implementation and most others, a break or continue in a dot script
can break or continue a loop outside the dot script. This should cause all
further commands in the dot script to be skipped. However, cmdloop() did not
know about this and continued to parse and execute commands from the dot
script.
As described in the man page, a return in a dot script in a function returns
from the function, not only from the dot script. There was a similar issue
as with break and continue. In various other shells, the return appears to
return from the dot script, but POSIX seems not very clear about this.