Commit Graph

242584 Commits

Author SHA1 Message Date
kre 698541ceb7 More work on file descriptors... This is the copyfd() cleanup.
copyfd() duplicates file descriptors - it used to be widely used,
but these days has seen its popularity dwindle.   Strip it of an
option that ceased to be variable (simplifying code) and cause all
its users to check its result, so it does not need to handle errors
itself (simplifying code further), and make it become a private inernal
routine in redir.c (all callers from other places have switched to a
more modern interface.)  Make sure we error() if N>&N fails (if N is closed.)
2016-05-12 13:31:37 +00:00
kre f112b7e1a3 Document that a N>&N (or N<&N) redirection turns off close-on-exec for N
(where N is a decimal fd number) either when used as
	some-command N>&N
(where fd N is passed, open, to some-command - which is obviously what is
wanted)

Or as
	exec N>&N
which effects fd N for all future commands.

Note that this means
	exec N>foo N>&N
returns to the old behaviour of leaving the file descriptor open
when commands are run (as do most shells, other than ksh) and works for
both new and old NetBSD shells (old ones never set close-on-exec, and treat
N>&N as a rather meaingless no-op request, and just ignore it), new ones
set close-on-exec on the first redirection, then disable it again on the
second.

Everything here about >& for output fds applies to <& for input ones.

OK christos@
2016-05-12 13:15:43 +00:00
kre 1755d8e4a6 Fix the implementation of the ?: $(( )) operator. It is right associative...
ok christos@
2016-05-12 13:05:18 +00:00
skrll c384c5b3fa For earm use the compiler to determine sf vs hf 2016-05-12 12:51:53 +00:00
pooka 2d2ae8f1cf Test that reading /dev/random returns within a reasonable time. 2016-05-12 11:41:43 +00:00
skrll 74f1f7b042 Doh... don't add the ABI to 'os'. Hopefully arm is really fixed now. 2016-05-12 10:55:03 +00:00
maxv f4ea937e9d KNF, and reduce the diff between amd64 and i386. 2016-05-12 09:40:23 +00:00
maxv 64e6bd21bc Map the data+bss chunk independently on amd64, and remove the X
permission on it.
2016-05-12 09:05:16 +00:00
skrll 8a8024b50c Sync config.guess with upstream, but maintain earm* stuff.
Fixes tools build on arm platform.
2016-05-12 08:43:49 +00:00
maxv fd64ae1b5b Define fillkpt_nox, which sets up a set of pages and puts the NOX bit on
them by using nox_flag. Use fillkpt_nox to map the rodata segment
without X permissions.
2016-05-12 07:51:09 +00:00
maxv a819d82371 Map the rodata segment independently on amd64, and remove the W permission
on it.
2016-05-12 07:21:18 +00:00
maxv a23ebbfe56 KNF the Xen ld scripts on x86. 2016-05-12 06:57:55 +00:00
maxv 09b37bb062 Split the {text+rodata} chunk in two separate chunks on x86. The
rodata segment now loses the large page optimization, gets mapped inside
the data segment, and therefore becomes RWX. It may break the build on
Xen.
2016-05-12 06:45:16 +00:00
skrll e4c74434a0 More typos in previous 2016-05-12 05:30:17 +00:00
ozaki-r 278a4a7caa Remove duplicate routing flag list
We alreay have it in route(8) and shouldn't have another one.
(Actually the removed list is forgot to be updated.)
2016-05-12 03:44:11 +00:00
ozaki-r d5776d4c59 Add missing semicolon 2016-05-12 03:01:57 +00:00
ozaki-r 040205ae93 Protect ifnet list with psz and psref
The change ensures that ifnet objects in the ifnet list aren't freed during
list iterations by using pserialize(9) and psref(9).

Note that the change adds a pslist(9) for ifnet but doesn't remove the
original ifnet list (ifnet_list) to avoid breaking kvm(3) users. We
shouldn't use the original list in the kernel anymore.
2016-05-12 02:24:16 +00:00
nonaka 048f8f1c7c If the negative number is passed to option '-c' or '-n',
it should occur an error.
2016-05-12 01:56:44 +00:00
mrg 27dfcf5333 make '$e' in here the whole structure instead of a pointer, to combine
several pointer derefs into one speaking this up significantly.
2016-05-12 00:35:10 +00:00
skrll e5260400d3 Typo in previous 2016-05-11 21:28:21 +00:00
skrll a841f46dcc More debug 2016-05-11 21:27:09 +00:00
skrll b5265dbe9e Remove incorrect comment 2016-05-11 21:05:12 +00:00
skrll 5f8a1e44c5 More debug 2016-05-11 21:03:01 +00:00
skrll 8c064c3637 The HCD should no longer restart a repeating transfer (i.e. an interrupt
transfer) as this is now handled in the usb core code.
2016-05-11 21:02:10 +00:00
maxv 1527136e67 There is a bug in the way the secondary CPUs are launched on amd64.
When CPU0 is launched, EFER_NXE is enabled in it, and it allows it to
handle pages that have the NOX bit. When the secondary CPUs are
launched, however, EFER_NXE is enabled only after paging is set in their
%cr0. And therefore, between the moment when paging is enabled and the
moment when EFER_NXE is enabled, the secondary CPUs cannot access pages
that have the NOX bit - they crash if they try to.

The funny thing is that in order to enable EFER_NXE, the secondary CPUs
give a look at cpu_feature[2], which is in the DATA segment, which in
turn could have the NOX bit. In other words, the secondary CPUs crash if
the DATA segment is mapped with the NOX bit.

Fix this by enabling EFER_NXE in the secondary CPUs before enabling
paging. CPU0 initializes nox_flag to the 32bit version of PG_NX if NOX
is supported; the secondary CPUs then use nox_flag to know whether NOX
is supported.

nox_flag will be used for other purposes soon.
2016-05-11 19:35:08 +00:00
bouyer ba413bf9c2 As proposed in
http://mail-index.netbsd.org/tech-kern/2016/04/28/msg020504.html
add gpio interrupt support to the gpio framework, and an implementation
for the allwinner gpio backend (tested on A20 only).
gpio(4) has new public functions:
- gpio_intr() called by backends when an interrupt condition for
  a gpio pin is present
- gpio_find_device() and gpio_get_name(), support functions for
  gpio(4) users, wich respectively returns a void * cookie for a gpio device
  given its name, and returns the name given the cookie.
- gpio_pin_ctl_intr(), which is used to configure interrupts on a gpio pin and
  registers a callback.
- gpio_pin_irqen(), which is used to mask/unmask interrupts on a pin.

Nothing in the NetBSD tree uses this yet, but I have a i2c driver
(at https://github.com/mbouyer/marine_chartplotter/tree/master/software/NetBSD/driver) which uses it.
2016-05-11 18:33:40 +00:00
maxv 9acd6328a2 Switch to C-style comments, and reduce a little the diff between i386 and
amd64. No functional changes.
2016-05-11 17:48:05 +00:00
kre 5ab36d6022 Add a test for fd redirections on functions in loops (the etcupdate issue)
and also fix a quoting bug which was causing a test to fail, though
ATF was ignoring (an ATF bug to be investigated later.)

OK christos@
2016-05-11 17:43:17 +00:00
kre fa4e47f7be It was twenty(-two) years ago today
J.T. Conklin told us not this way
Berkeley 4.4 lite's changed which file
And it's traced differently all this while
2016-05-11 17:28:30 +00:00
nonaka f9c340b5f1 Don't establish interrupt in nvme_pci_attach() when multi queue isn't used. 2016-05-11 13:55:28 +00:00
martin 61342e9f06 Switch alpha and sparc64 back to gcc 4.8 and old binutils for now - too much
fallout from gcc 5.3 and no quick solution, it needs more work.
Binutils 2.26 does not play well with old gcc and causes random fallout
when building pkgs (e.g. /usr/pkg/lib/libgthread-2.0.so.0:
Trying to call undefined weak symbol `__deregister_frame_info' when
build gstremeer0.10)
2016-05-11 13:41:56 +00:00
skrll 55aaabd6e7 Add kernhist to SYS_GDBINIT 2016-05-11 10:39:31 +00:00
mrg 97e7e7950b add a gdb script to dump kernel histories. based upon a script by skrll,
updated by myself to run faster and more stupidly (but more workingly.)

normal gdb scripts don't seem to be able to call printf with the format
string as a variable, so we simply print the format itself as a string
and the (upto 4) arguments as unsigned long (how they're strored.)
2016-05-11 09:22:55 +00:00
skrll eb30461f6b Update with info about tty/storage reservations 2016-05-11 06:42:06 +00:00
skrll 7dda1ddd26 Pullin opt_usb for UPLCOM_DEBUG 2016-05-11 06:38:04 +00:00
skrll f70cf9b35a fix build 2016-05-11 06:07:52 +00:00
msaitoh 20025a8603 Add Precision Time Management (PTM) ECN. 2016-05-11 05:12:57 +00:00
msaitoh 9ea1e5fd3d Fix compile error on some archs (e.g. i386). 2016-05-11 04:37:09 +00:00
knakahara fef3d1b2f0 Interrupt handlers read wm_rxqueue or wm_txqueue, so they must be freed after
disestablishing interrupt handlers.
2016-05-11 03:46:06 +00:00
rtr a44831a800 provide const versions of container_of macros.
discussed with riastradh@ by email
2016-05-11 03:17:22 +00:00
riastradh 4637147e3e Use bus_space_subregion to get fifo channels out of mmio registers.
Evidently it is not enough to just map them separately.  Ran out of
time to investigate why, last time I poked at this and confirmed this
change works.
2016-05-11 02:28:33 +00:00
msaitoh 9da5129c92 Do I219 TX DMA workaround only when TDLEN(0) != 0 2016-05-11 02:23:50 +00:00
ozaki-r 472a3b6444 Fix builds of ALL kernels that define DEBUG_EXEC 2016-05-11 02:18:27 +00:00
riastradh fc1fa2bfde Enable nouveau in i386/ALL. Omit incorrect option NV_DEBUG.
NV_DEBUG does not appear except as a macro function in nouveau, which
is broken by defining it on the command line.

From coypu.
2016-05-11 02:09:10 +00:00
sjg 1ea1c693f3 Allow for ignoring paths that match a set of patterns.
This can be expensive, so use with caution.
2016-05-10 23:45:45 +00:00
skrll c1b93d26f6 Remove comment about splusb and replace with KASSERT(mutex_owned()) 2016-05-10 21:15:54 +00:00
skrll 5bb7bdaa1e More debug 2016-05-10 21:13:48 +00:00
pooka c8a34480e3 Avoid '.' in variable names which are expected to be passed to
this Makefile via the env.

That character is strictly speaking not allowed by POSIX in an exported
variable name, and at least dash >= 0.58 refuses to export such variables.

Furthermore, since the individual CFLAGS/CPPFLAGS/etc. variables
are not comprehensive enough for all cases (e.g. HURD), just
support the .includable version from now on, i.e.
RUMPCOMP_MAKEFILEINC_rumpdev_pci.

curious failure mode debugged by Martin Lucina
2016-05-10 19:38:29 +00:00
palle a86d6c4649 Update TODO: sun4v interrupts works (mostly) + note issue with mpt(4) on sun4v systems 2016-05-10 19:35:08 +00:00
mrg d8ed176f44 move the ufs_lookup hack to the global section and update it to current
reality.  add a section for the crt hacks.
2016-05-10 19:32:47 +00:00