dragonfly.git
23 months agobug 2443: bin/cp: sync with FreeBSD (bug fixes + new options)
John Marino [Thu, 15 Nov 2012 20:57:01 +0000 (21:57 +0100)]
bug 2443: bin/cp: sync with FreeBSD (bug fixes + new options)

* Fix FTS_NOCHDIR behavior on empty directory.
* Add -a option (archive mode, equivalent to -RpP)
* Add -l option (create hard links instead of copying)
* Add -x option (FS mount points are not traversed)
* Preserve file flags on symlinks on cp -Rp
* Don't copy socket anyway after "xxx is a socket (not copied)"
* Avoid division-by-zero situations
* make -r synonym for -R but maintain -r behavior with -L

Taken-from: FreeBSD (multiple commits)
https://bugs.dragonflybsd.org/issues/2443

23 months agokernel - Fix off-by-1 error in semexit
Matthew Dillon [Thu, 15 Nov 2012 20:30:51 +0000 (12:30 -0800)]
kernel - Fix off-by-1 error in semexit

* Fix an off-by-1 error that was preventing semexit from properly undoing
  all the semaphores controlled by the exiting process.

Reported-by: lentferj, vsrinivas, others
23 months agoshare/misc/gdbinit - New function lstdtok
Antonio Huete Jimenez [Thu, 15 Nov 2012 19:13:03 +0000 (20:13 +0100)]
share/misc/gdbinit - New function lstdtok

- List tokens for a specified thread.

23 months agoinit(8): Resurrect kern.shutdown_timeout as kern.init_shutdown_timeout.
Sascha Wildner [Wed, 14 Nov 2012 22:57:04 +0000 (23:57 +0100)]
init(8): Resurrect kern.shutdown_timeout as kern.init_shutdown_timeout.

Taken from FreeBSD. Quoting their commit msg:

Fix system shutdown timeout handling by again supporting longer running
shutdown procedures (which have a duration of more than 120 seconds).

We have two user-space affecting shutdown timeouts: a "soft" one in
/etc/rc.shutdown and a "hard" one in init(8). The first one can be
configured via /etc/rc.conf variable "rcshutdown_timeout" and defaults
to 30 seconds. The second one was originally (in 1998) intended to be
configured via sysctl(8) variable "kern.shutdown_timeout" and defaults
to 120 seconds.

Unfortunately, the "kern.shutdown_timeout" was declared "unused" in 1999
(as it obviously is actually not used within the kernel itself) and
hence was intentionally but misleadingly removed in revision 1.107 from
init_main.c. Kernel sysctl(8) variables are certainly a wrong way to
control user-space processes in general, but in this particular case the
sysctl(8) variable should have remained as it supports init(8), which
isn't passed command line flags (which in turn could have been set via
/etc/rc.conf), etc.

As there is already a similar "kern.init_path" sysctl(8) variable which
directly affects init(8), resurrect the init(8) shutdown timeout under
sysctl(8) variable "kern.init_shutdown_timeout". But this time document
it as being intentionally unused within the kernel and used by init(8).
Also document it in the manpages init(8) and rc.conf(5).

23 months agolibk{core,info}: The kern.ccpu sysctl is gone, so remove *get_sched_ccpu().
Sascha Wildner [Wed, 14 Nov 2012 22:14:32 +0000 (23:14 +0100)]
libk{core,info}: The kern.ccpu sysctl is gone, so remove *get_sched_ccpu().

Interestingly, kcore_get_sched_ccpu() seems to never have returned ccpu,
but instead tk_nin, which is not related.

23 months agotop(1): Remove some code that is unused after the UP removal.
Sascha Wildner [Wed, 14 Nov 2012 21:24:23 +0000 (22:24 +0100)]
top(1): Remove some code that is unused after the UP removal.

23 months ago<sys/proc.h>: Adjust the names of two unused bits to use bit numbering.
Sascha Wildner [Wed, 24 Oct 2012 19:20:36 +0000 (21:20 +0200)]
<sys/proc.h>: Adjust the names of two unused bits to use bit numbering.

23 months agomount{,_ufs}: Fix wrong mountctl(2) error check.
Sascha Wildner [Wed, 14 Nov 2012 10:06:26 +0000 (11:06 +0100)]
mount{,_ufs}: Fix wrong mountctl(2) error check.

mountctl(2) returns the number of copied bytes when successful, and -1
if there was an error. This prevented ", local" from being printed in
mount output.

Reported-by: YONETANI Tomokazu
23 months agoSync zoneinfo database with tzdata2012j from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Tue, 13 Nov 2012 18:41:51 +0000 (19:41 +0100)]
Sync zoneinfo database with tzdata2012j from ftp://ftp.iana.org/tz/releases

* africa: Lybia set their time one hour back at 02:00 on November 10
    (last Saturday).

* Additional miscellaneous fixes in various comments.

23 months agotzfile.5: Little wording fix (from tzcode2012j).
Sascha Wildner [Tue, 13 Nov 2012 18:39:40 +0000 (19:39 +0100)]
tzfile.5: Little wording fix (from tzcode2012j).

23 months agoipcs(1): Fix the "ipcs: kvm_nlist: No such file or directory" error.
Sascha Wildner [Tue, 13 Nov 2012 17:35:17 +0000 (18:35 +0100)]
ipcs(1): Fix the "ipcs: kvm_nlist: No such file or directory" error.

The "semu" variable was removed in 79757ed082, causing this breakage.
Strangely, even before its removal it wasn't used for anything in
ipcs(1).

Reported-by: beket
23 months agoipcs(8): Raise WARNS to 6.
Sascha Wildner [Tue, 13 Nov 2012 17:13:30 +0000 (18:13 +0100)]
ipcs(8): Raise WARNS to 6.

23 months agoReally fix systat(1).
Sascha Wildner [Mon, 12 Nov 2012 20:59:30 +0000 (21:59 +0100)]
Really fix systat(1).

23 months agoifconfig: Deprecate "pollcpu" and make "polling" same as "polling"
Sepherosa Ziehau [Mon, 12 Nov 2012 12:34:39 +0000 (20:34 +0800)]
ifconfig: Deprecate "pollcpu" and make "polling" same as "polling"

23 months agofwe: Switch from device_polling to ifpoll
Sepherosa Ziehau [Mon, 12 Nov 2012 12:21:31 +0000 (20:21 +0800)]
fwe: Switch from device_polling to ifpoll

23 months agosystat - Do not use ccpu for %cpu calculation in pigs view.
Antonio Huete Jimenez [Sun, 11 Nov 2012 23:18:01 +0000 (00:18 +0100)]
systat - Do not use ccpu for %cpu calculation in pigs view.

- ccpu went away after the new scheduler work so sync with
  the current status of the kernel.
- Also remove all the unused kvm* stuff and get fscale via sysctl.

Reported-by: tpchin <tpchin@telstra.com>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issues/2245>

23 months agoRemove an ancient file that is no longer used.
Sascha Wildner [Sun, 11 Nov 2012 20:51:34 +0000 (21:51 +0100)]
Remove an ancient file that is no longer used.

23 months agoloader: Detect SMBIOS and export its information into the environment.
Sascha Wildner [Sun, 11 Nov 2012 11:30:20 +0000 (12:30 +0100)]
loader: Detect SMBIOS and export its information into the environment.

Useful to check motherboard vendor/version, BIOS version and so forth.
Use kenv(1) for viewing the information.

This information can be accessed from the kernel but should only be
as a last resort.

Might also help in the future to better detect virtual machine types.

Taken-from: FreeBSD

23 months agovge: Switch from device_polling to ifpoll
Sepherosa Ziehau [Sun, 11 Nov 2012 11:10:50 +0000 (19:10 +0800)]
vge: Switch from device_polling to ifpoll

23 months agonge: Switch from device_polling to ifpoll
Sepherosa Ziehau [Sun, 11 Nov 2012 10:20:17 +0000 (18:20 +0800)]
nge: Switch from device_polling to ifpoll

23 months agodc: Add missing ifpoll_compat_setup
Sepherosa Ziehau [Sun, 11 Nov 2012 09:44:04 +0000 (17:44 +0800)]
dc: Add missing ifpoll_compat_setup

23 months agodc: Switch from device_polling to ifpoll
Sepherosa Ziehau [Sun, 11 Nov 2012 09:29:24 +0000 (17:29 +0800)]
dc: Switch from device_polling to ifpoll

23 months agohammer.8: Add back an .El that was removed by mistake.
Sascha Wildner [Sun, 11 Nov 2012 09:26:17 +0000 (10:26 +0100)]
hammer.8: Add back an .El that was removed by mistake.

23 months agorpc.statd(8): Remove a duplicate function.
Sascha Wildner [Sat, 10 Nov 2012 10:03:17 +0000 (11:03 +0100)]
rpc.statd(8): Remove a duplicate function.

By now, xdr_stat_chge() is in librpcsvc, unlike what the comments suggest.

23 months agoFix INVARIANT build issue
Adam Sakareassen [Thu, 8 Nov 2012 15:46:00 +0000 (02:46 +1100)]
Fix INVARIANT build issue

23 months agovquota(8): size information is expressed in bytes
François Tigeot [Fri, 9 Nov 2012 23:07:51 +0000 (00:07 +0100)]
vquota(8): size information is expressed in bytes

23 months agoMark some functions in userland __printflike.
Sascha Wildner [Fri, 9 Nov 2012 23:19:30 +0000 (00:19 +0100)]
Mark some functions in userland __printflike.

23 months agondis_events(8): Remove a bogus argument.
Sascha Wildner [Fri, 9 Nov 2012 23:19:05 +0000 (00:19 +0100)]
ndis_events(8): Remove a bogus argument.

23 months agobsd.init.mk: Establish compatibility with FreeBSD makefiles
John Marino [Thu, 8 Nov 2012 10:46:55 +0000 (11:46 +0100)]
bsd.init.mk: Establish compatibility with FreeBSD makefiles

FreeBSD changed NOMAN to NO_MAN and NOSHARED to NO_SHARED.  Rather than
follow suit, establish NO_MAN and NO_SHARED as aliases for the DragonFly
versions.  If both are defined, the DragonFly version takes precedence.

These were put in bsd.init.mk because they have to be loaded after the
makefile being processed but before bsd.prog.mk, bsd.lib.mk, etc.

23 months agodebug - Add a basic Makefile
Antonio Huete Jimenez [Thu, 8 Nov 2012 15:17:32 +0000 (16:17 +0100)]
debug - Add a basic Makefile

- Sync wildcardinfo with current state of affairs.

23 months agoobjcache.9: cluster_limit is no longer changed
Stathis Kamperis [Thu, 8 Nov 2012 16:18:29 +0000 (18:18 +0200)]
objcache.9: cluster_limit is no longer changed

23 months agokernel: Mark two more functions __printflike.
Sascha Wildner [Thu, 8 Nov 2012 08:50:27 +0000 (09:50 +0100)]
kernel: Mark two more functions __printflike.

23 months agompt(4): Mark two functions __printflike.
Sascha Wildner [Thu, 8 Nov 2012 08:28:04 +0000 (09:28 +0100)]
mpt(4): Mark two functions __printflike.

23 months agogetline(3): Fix segfault caused by NULL pointer
John Marino [Wed, 7 Nov 2012 20:15:35 +0000 (21:15 +0100)]
getline(3): Fix segfault caused by NULL pointer

This fixes a segfault seen with pkg's audit function, and effectively syncs
getdelim with FreeBSD.

Taken-from: FreeBSD SVN 197752 (04 OCT 2009)

- Tolerate applications that pass a NULL pointer for the buffer and
  claim that the capacity of the buffer is nonzero.

- If an application passes in a non-NULL buffer pointer and claims the
  buffer has zero capacity, we should free (well, realloc) it anyway.
  It could have been obtained from malloc(0), so failing to free it
  would be a small memory leak.

23 months agomfi(4): Don't assert lock holding when dumping or during a panic.
Sascha Wildner [Wed, 7 Nov 2012 21:10:51 +0000 (22:10 +0100)]
mfi(4): Don't assert lock holding when dumping or during a panic.

FreeBSD's mtx_assert() does it the same way, but we usually translate
mtx_assert() into a KKASSERT(lockstatus(&lock, curthread) != 0).

For now, replace all of these assertions in mfi(4) with a function that
mimics the mtx_assert() behavior of FreeBSD, since some of the asserting
functions are used by the dumping code.

We might think about a real lockassert() function in the future that
has this exception too.

This commit fixes dumping on most supported adapters. Thunderbolt series
adapters still have an (unrelated) command timeout issue which I'm
looking at.

Reported and tested (on a PERC 5/i) by Tim Howe <tim@130collective.org>.

23 months agoigb: Configure TX head write back before turn enable bit in TXDCTL
Sepherosa Ziehau [Wed, 7 Nov 2012 13:47:59 +0000 (21:47 +0800)]
igb: Configure TX head write back before turn enable bit in TXDCTL

The original configure sequence works on 82575 and 82576.  However,
it does not work on i350 and probably will not work on 82580.  For
these two chips TX head write back _must_ be configured before
turning on enable bit in TXDCTL according to their datasheet.

Reported-by: ftigeot@
Tested-by: ftigeot@ (i350), me w/ (82575, 82576)
23 months agovr: Switch from device_polling to ifpoll
Sepherosa Ziehau [Tue, 6 Nov 2012 14:19:10 +0000 (22:19 +0800)]
vr: Switch from device_polling to ifpoll

23 months agofxp: Switch device_polling to ifpoll
Sepherosa Ziehau [Tue, 6 Nov 2012 11:58:19 +0000 (19:58 +0800)]
fxp: Switch device_polling to ifpoll

23 months agorl: Switch from device_polling to ifpoll
Sepherosa Ziehau [Mon, 5 Nov 2012 13:31:43 +0000 (21:31 +0800)]
rl: Switch from device_polling to ifpoll

Optimize the RX path a little bit by reading the RL_CURRXADDR and
RL_CURRXBUF only if necessary; reading these two registers is quite
time consuming

23 months agoifpoll: Closely follow the old status polling fraction in the compat code
Sepherosa Ziehau [Mon, 5 Nov 2012 13:30:19 +0000 (21:30 +0800)]
ifpoll: Closely follow the old status polling fraction in the compat code

23 months agondiscvt(8): Add a missing space.
Sascha Wildner [Tue, 6 Nov 2012 06:06:41 +0000 (07:06 +0100)]
ndiscvt(8): Add a missing space.

Submitted-by: Eitan Adler <lists@eitanadler.com>
23 months agohptrr(4): Add missing intrhook description.
Sascha Wildner [Tue, 6 Nov 2012 06:05:14 +0000 (07:05 +0100)]
hptrr(4): Add missing intrhook description.

23 months agohpt27xx(4): Add missing bootverbose and intrhook description.
Sascha Wildner [Tue, 6 Nov 2012 06:04:59 +0000 (07:04 +0100)]
hpt27xx(4): Add missing bootverbose and intrhook description.

23 months agoFix some typos in user visible messages, etc.
Sascha Wildner [Tue, 6 Nov 2012 02:44:40 +0000 (03:44 +0100)]
Fix some typos in user visible messages, etc.

23 months agohexdump.3: Add missing .Sh LIBRARY and bump .Dd to when it was imported.
Sascha Wildner [Mon, 5 Nov 2012 08:27:54 +0000 (09:27 +0100)]
hexdump.3: Add missing .Sh LIBRARY and bump .Dd to when it was imported.

23 months agobsd-family-tree: Sync with FreeBSD (adds DragonFly 3.2 and OpenBSD 5.2).
Sascha Wildner [Mon, 5 Nov 2012 05:28:03 +0000 (06:28 +0100)]
bsd-family-tree: Sync with FreeBSD (adds DragonFly 3.2 and OpenBSD 5.2).

23 months agosysctl.9: Fix another typo. frequence -> frequency
Sascha Wildner [Mon, 5 Nov 2012 04:35:26 +0000 (05:35 +0100)]
sysctl.9: Fix another typo. frequence -> frequency

Found-with: igor

23 months agokernel: Remove unneeded #include <sys/devicestat.h> in disk/RAID drivers.
Sascha Wildner [Mon, 5 Nov 2012 04:18:45 +0000 (05:18 +0100)]
kernel: Remove unneeded #include <sys/devicestat.h> in disk/RAID drivers.

23 months agogit gc --aggressive only cleaned up 4 mb of disk and took 7 minutes to run.
Justin C. Sherrill [Sun, 4 Nov 2012 21:27:44 +0000 (16:27 -0500)]
git gc --aggressive only cleaned up 4 mb of disk and took 7 minutes to run.
It doesn't seem to be worth the (admittedly small) time penalty.

23 months agoboot - some VIA processors also have long mode!
Alex Hornung [Sun, 4 Nov 2012 15:53:22 +0000 (15:53 +0000)]
boot - some VIA processors also have long mode!

23 months agoFix some typos in the manpages.
Sascha Wildner [Sun, 4 Nov 2012 15:38:04 +0000 (16:38 +0100)]
Fix some typos in the manpages.

23 months agokgdb.1: Fix macro ordering.
Sascha Wildner [Sun, 4 Nov 2012 15:05:07 +0000 (16:05 +0100)]
kgdb.1: Fix macro ordering.

23 months agoRemove word duplicates in some manual pages.
Sascha Wildner [Sun, 4 Nov 2012 13:53:29 +0000 (14:53 +0100)]
Remove word duplicates in some manual pages.

23 months agocolldef.1: Do the last commit a bit better.
Sascha Wildner [Sun, 4 Nov 2012 13:36:49 +0000 (14:36 +0100)]
colldef.1: Do the last commit a bit better.

23 months agoSync zoneinfo database with tzdata2012i from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Sun, 4 Nov 2012 13:00:36 +0000 (14:00 +0100)]
Sync zoneinfo database with tzdata2012i from ftp://ftp.iana.org/tz/releases

* asia: Comment typo fix.

* northamerica: Cuba switched back to standard time on 2012-11-04, 01:00.

23 months agosis: Switch from device_polling to ifpoll
Sepherosa Ziehau [Sun, 4 Nov 2012 12:19:20 +0000 (20:19 +0800)]
sis: Switch from device_polling to ifpoll

23 months agoxl: Switch from device_polling to ifpoll
Sepherosa Ziehau [Sun, 4 Nov 2012 11:02:07 +0000 (19:02 +0800)]
xl: Switch from device_polling to ifpoll

23 months agostge: Switch from device_polling to ifpoll
Sepherosa Ziehau [Sun, 4 Nov 2012 10:25:49 +0000 (18:25 +0800)]
stge: Switch from device_polling to ifpoll

23 months agonfe: Switch from device_polling to ifpoll
Sepherosa Ziehau [Sun, 4 Nov 2012 10:04:03 +0000 (18:04 +0800)]
nfe: Switch from device_polling to ifpoll

23 months agore: Swicth from device_polling to ifpoll
Sepherosa Ziehau [Sun, 4 Nov 2012 08:44:44 +0000 (16:44 +0800)]
re: Swicth from device_polling to ifpoll

23 months agobce: Switch from device_polling to ifpoll
Sepherosa Ziehau [Sun, 4 Nov 2012 06:54:00 +0000 (14:54 +0800)]
bce: Switch from device_polling to ifpoll

23 months agoifpoll: Also check sysctl_tree in compat code setup
Sepherosa Ziehau [Sun, 4 Nov 2012 06:52:38 +0000 (14:52 +0800)]
ifpoll: Also check sysctl_tree in compat code setup

23 months agoelf_common.h: Add EM_AMD64 as alias to EM_X86_64
John Marino [Sat, 3 Nov 2012 17:06:18 +0000 (18:06 +0100)]
elf_common.h: Add EM_AMD64 as alias to EM_X86_64

23 months agolibutil: Implement hexdump(3)
John Marino [Sat, 3 Nov 2012 15:32:51 +0000 (16:32 +0100)]
libutil: Implement hexdump(3)

Similar to hexdump(9) but available to userland.

Taken-from:
FreeBSD SVN 180161 (01 JUL 2008)
FreeBSD SVN 185729 (06 DEC 2008)

23 months agolibutil: Implement group file utilities
John Marino [Sat, 3 Nov 2012 15:19:12 +0000 (16:19 +0100)]
libutil: Implement group file utilities

Taken from FreeBSD's libutil

23 months agobge: Switch from device_polling to ifpoll
Sepherosa Ziehau [Sat, 3 Nov 2012 14:36:01 +0000 (22:36 +0800)]
bge: Switch from device_polling to ifpoll

Also fix a bug in the polling code when status tag is used:
status tag always needs to be written even if interrupt is not enabled.

23 months agoRevert "bge: Always configure MII mode register"
Sepherosa Ziehau [Sat, 3 Nov 2012 14:26:12 +0000 (22:26 +0800)]
Revert "bge: Always configure MII mode register"

This reverts commit dda43ff2bc5975a3cbd91838e7a46332039962f4.

Forcefully configure seems to break at least BCM5761 NIC auto-negotiation

23 months agoBring in recent mktemp(1) changes from FreeBSD
Eitan Adler [Sat, 3 Nov 2012 04:00:25 +0000 (00:00 -0400)]
Bring in recent mktemp(1) changes from FreeBSD

Support the Sun/GNU/FreeBSD extension of mktemp
returning a file1 in /tmp when called without a path.

This also minimizes the difference between the DragonflyBSD
and FreeBSD version of the man page.

23 months agokernel: Simplify simq releasing in some RAID drivers.
Sascha Wildner [Sat, 3 Nov 2012 11:23:14 +0000 (12:23 +0100)]
kernel: Simplify simq releasing in some RAID drivers.

23 months agokernel: Fix some wrong cam_simq_release() calls.
Sascha Wildner [Sat, 3 Nov 2012 11:08:13 +0000 (12:08 +0100)]
kernel: Fix some wrong cam_simq_release() calls.

Our (refcounted) simq can be released right after allocating the sim.
These drivers were not doing it correctly.

23 months agoRemove duplicate word.
Justin C. Sherrill [Sat, 3 Nov 2012 03:38:44 +0000 (23:38 -0400)]
Remove duplicate word.

Contributed-by: "eadler" <lists@eitanadler.com>
23 months agokernel - Force word-writes in syscons code (Intel hw character mode emulation)
Matthew Dillon [Fri, 2 Nov 2012 21:07:10 +0000 (14:07 -0700)]
kernel - Force word-writes in syscons code (Intel hw character mode emulation)

* Observed on the Intel D2500HN.  The system console in character map mode
  fails utterly when a normal bcopy() is used to move stuff around.  Employ
  a specialized bcopy that uses 16-bit writes to work around the problem.

* Just do this generally, we don't care about syscons performance.

* This is possibly due to a hardware/text-mode emulation in the Intel D2500HN
  and it will probably show up in the future as well.  This could be related
  to complaints about UEFI BIOSs (which the D2500HN mobo from Intel supports)
  not handling text mode, but it handles it just fine if we only use 16-bit
  writes.

23 months agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Fri, 2 Nov 2012 21:06:58 +0000 (14:06 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

23 months agolibfetch: Implement HTTP digest authentication, HTTP 305, and HTTP 308
John Marino [Fri, 2 Nov 2012 19:56:28 +0000 (20:56 +0100)]
libfetch: Implement HTTP digest authentication, HTTP 305, and HTTP 308

Implement HTTP status 305: Use proxy
Implement HTTP status 308: Permanent redirect
Implement HTTP Digest Authentication

Taken-from:
FreeBSD SVN 202613 (19 JAN 2010)
FreeBSD SVN 202623 (19 JAN 2010)
FreeBSD SVN 203028 (26 JAN 2010)
FreeBSD SVN 209632 (01 JUL 2010)
FreeBSD SVN 210563 (28 JUL 2010)
FreeBSD SVN 221820 (12 MAY 2011)
FreeBSD SVN 221821 (12 MAY 2011)
FreeBSD SVN 221822 (12 MAY 2011)
FreeBSD SVN 221823 (12 MAY 2011)
FreeBSD SVN 234838 (30 APR 2012)
FreeBSD SVN 240496 (14 SEP 2012)
FreeBSD SVN 241840 (21 OCT 2012)
FreeBSD SVN 241841 (21 OCT 2012)

23 months agolibfetch: Use select(2) as a consequence of switching to non-blocking
John Marino [Fri, 2 Nov 2012 18:46:13 +0000 (19:46 +0100)]
libfetch: Use select(2) as a consequence of switching to non-blocking

Since the socket is non-blocking, it is necessary to use select(2) even
when there is no timeout, because read(2) will return immediately if there
is no data waiting in the TCP buffer, causing fetch_read() to busy-loop on
slow connections.

Taken-from: FreeBSD SVN 234837 (30 APR 2012)

23 months agolibfetch: Change FTP default to passive mode
John Marino [Fri, 2 Nov 2012 17:59:00 +0000 (18:59 +0100)]
libfetch: Change FTP default to passive mode

1. The caller can select active mode using "P" flag.
2. If the "p" passive flag is also present, it takes precedence over "P"
   so the connection will be attempted in passive mode.

Taken-from: FreeBSD SVN 225810 (27 SEP 2011)
Taken-from: FreeBSD SVN 225812 (27 SEP 2011)

23 months agolibfetch: what happened to ftp-cached commit?
John Marino [Fri, 2 Nov 2012 17:37:42 +0000 (18:37 +0100)]
libfetch: what happened to ftp-cached commit?

I thought I committed this fix last night.  I don't know how it
disappeared.  It's the fix documented in FreeBSD PR Kern/153748
where a ftp-cached connection will close the connection too early
when sending a request.

23 months agousb4bsd - Change M_NOWAIT to M_WAITOK
Matthew Dillon [Fri, 2 Nov 2012 00:46:03 +0000 (17:46 -0700)]
usb4bsd - Change M_NOWAIT to M_WAITOK

* M_NOWAIT really needs to be M_WAITOK in these places.  It is unclear
  why FreeBSD invites random device failures by using M_NOWAIT all over
  the place.

23 months agolibfetch: Avoid SIGPIPE on network connections
John Marino [Fri, 2 Nov 2012 00:26:34 +0000 (01:26 +0100)]
libfetch: Avoid SIGPIPE on network connections

To avoid unexpected process termination from SIGPIPE when writing to a
closed network connection, enable SO_NOSIGPIPE on all network connections.

The POSIX standard MSG_NOSIGNAL is not used since it requires modifying all
send calls to add this flag. This is particularly nasty for SSL connections.

Taken-from: FreeBSD SVN 236193 (28 May 2012)

23 months agoImplement SO_NOSIGPIPE
John Marino [Thu, 1 Nov 2012 22:54:16 +0000 (23:54 +0100)]
Implement SO_NOSIGPIPE

The SO_NOSIGPIPE socket option allows a user process to mark a socket so
that the socket does not generate SIGPIPE, only EPIPE, when a write is
attempted after socket shutdown.

Regression test added: tools/regression/sockets/sigpipe

23 months agofetch: Fix infinite loop on display progress
John Marino [Thu, 1 Nov 2012 21:21:52 +0000 (22:21 +0100)]
fetch: Fix infinite loop on display progress

As reported by FreeBSD PR bin/153240, fetch can loop forever if it is
interrupted by a signal at just the right time.

Verbatim from FreeBSD SVN 230307 (18 JAN 2012):
Fix two issues related to the use of SIGINFO in fetch(1) to display
progress information.  The first is that fetch_read() (used in the HTTP
code but not the FTP code) can enter an infinite loop if it has previously
been interrupted by a signal.  The second is that when it is interrupted,
fetch_read() will discard any data it may have read up to that point.
Luckily, both bugs are extremely timing-sensitive and therefore difficult

to trigger.

23 months agolibfetch: Change maximum redirect from 5 to 20
John Marino [Thu, 1 Nov 2012 20:51:30 +0000 (21:51 +0100)]
libfetch: Change maximum redirect from 5 to 20

Libfetch gives up a little too soon.  Chrome and Firefox allow 20
redirects with IE stops after 8.

Taken-from: FreeBSD SVN 241839 (21 OCT 2012)

23 months agolibfetch: Support percent-encoded user and password
John Marino [Thu, 1 Nov 2012 20:43:06 +0000 (21:43 +0100)]
libfetch: Support percent-encoded user and password

RFC 1738 specifies that any ":", "@", or "/" within a user name or
password in a URL is percent-encoded, to avoid ambiguity with the use
of those characters as URL component separators.

Taken-From: FreeBSD SVN 234138 (12 APR 2012)

23 months agolibfetch: Fix failure to return to caller on error
John Marino [Thu, 1 Nov 2012 20:17:48 +0000 (21:17 +0100)]
libfetch: Fix failure to return to caller on error

As described in FreeBSD PR kern/171187, several error conditions were
missing return statements.

Taken-from: FreeBSD SVN 240595

23 months agolibfetch: Mark all socket and file descriptors close-on-exec
John Marino [Thu, 1 Nov 2012 19:54:53 +0000 (20:54 +0100)]
libfetch: Mark all socket and file descriptors close-on-exec

This allows libfetch to close cached sockets.
Also add cast that helped FreeBSD move warns to 6

Taken-from: FreeBSD SVN 221822 (12 May 2011)
Taken-from: FreeBSD SVN 221830 (13 May 2011)

23 months agolibfetch: Fix hang due to SSL server closing before read completes
John Marino [Thu, 1 Nov 2012 19:31:08 +0000 (20:31 +0100)]
libfetch: Fix hang due to SSL server closing before read completes

If the server sends a close notification before before a SSL read
operation is complete, fetch will hang.  Fix this by reworking
fetch_read() to use non-blocking sockets.

Taken-From: FreeBSD SVN 210568 (28 JUL 2010)
Taken-From: FreeBSD SVN 214256 (23 OCT 2010)

23 months agolibfetch: Fix PROXY_HOST bug, socket leak, cache-crash
John Marino [Thu, 1 Nov 2012 19:02:52 +0000 (20:02 +0100)]
libfetch: Fix PROXY_HOST bug, socket leak, cache-crash

As described in FreeBSD PR kern/139751, NO_PROXY=localhost doesn't work
due to bad for loop count.

As described in FreeBSD PR kern/153748, an ftp-cached connection will
close the connection too early when trying to send a request.

There is a socket leak in ftp_request that occurs after a connection is
established.  Make sure socket is disconnected before exiting.

Taken-From: FreeBSD SVN 198339 (21 OCT 2009)
Taken-From: FreeBSD SVN 199801 (25 NOV 2009)
Taken-From: FreeBSD SVN 217505 (17 JAN 2011)

23 months agoioapic/i386: Allow GSI > 191
Sepherosa Ziehau [Thu, 1 Nov 2012 01:29:53 +0000 (09:29 +0800)]
ioapic/i386: Allow GSI > 191

23 months agoUnignore some files already present in repository
François Tigeot [Tue, 30 Oct 2012 08:01:26 +0000 (09:01 +0100)]
Unignore some files already present in repository

23 months agobuild - Fix handling of MACHINE_PLATFORM
Matthew Dillon [Wed, 31 Oct 2012 02:35:36 +0000 (19:35 -0700)]
build - Fix handling of MACHINE_PLATFORM

* Generate MACHINE_PLATFORM from sysctl -n hw.platform, bmake does not
  generate a default for this (it's DragonFly-specific).

* Fixes manual module builds e.g. building from the source dir instead of
  as part of a kernel build.

23 months agoImplement eaccess
John Marino [Tue, 30 Oct 2012 19:42:07 +0000 (20:42 +0100)]
Implement eaccess

It's just like access, but uses AT_EACCESS to check effective user ID
instead of the real user ID.

23 months agobug #2442: Fix bmake regression of kernel build
John Marino [Tue, 30 Oct 2012 18:14:57 +0000 (19:14 +0100)]
bug #2442: Fix bmake regression of kernel build

Kernel modules such as acpi.ko didn't load due to missing symbols after
bmake replaced legacy make.  The cause was traced back to a badly
generated header which in turn was caused by the file kern.fwd.mk.  That
file contained ":U" modifiers that should have been converted to ":tu"
modifiers.

The actual cause of the missing symbols were due to atomic.h not getting
included into atomic.c twice.  Case sensitivity prevented a macro from
being properly unset.  The modifiers in question turn everything to
upper case.

A full kernel build is required to fix the module loading.

23 months agoioapic/x86_64: Allow GSI > 191
Sepherosa Ziehau [Tue, 30 Oct 2012 02:53:59 +0000 (10:53 +0800)]
ioapic/x86_64: Allow GSI > 191

Some BIOSes seem to assume that all 256 IDT vectors could be used,
while we limit the available IDT vectors percpu to 192.   Find an
unused IRQ for these GSIs, if this ever happens.

Reported-by: thowe on EFnet #dragonflybsd
23 months agoFix cross-build
John Marino [Mon, 29 Oct 2012 19:59:07 +0000 (20:59 +0100)]
Fix cross-build

The introduction of BTOOLMAKE and BTOOLCONFIG did not work when
cross-building.  The value of BTOOLSDEST and CTOOLSDEST change when
starting stage 2 of the crossworld.  This was never detected before
because these variables were only used in stage 1.

However, the absolute path to these tools aren't needed.  The PATH
is defined in the environment to ensure the bootstrap tools are
used when appropriate.  Previous errors leading me to think the host
tool was being used may have been caused by other things.

At the same time, all the "${MAKE}" variables were replaced with "make".
The make program defines "MAKE" as whatever was used to invoke it,
including paths.  Since we are controlling the path, we don't want any
surprises.  In any cases, we want "${MAKE}" to equal "make", so just
hardcode it that way.

Tested on cross-build, bmake-equipped system, and legacy make equipped
system.

23 months agoUpdate files for OpenSSH-6.1p1 import.
Peter Avalos [Sun, 28 Oct 2012 19:42:44 +0000 (12:42 -0700)]
Update files for OpenSSH-6.1p1 import.

23 months agoMerge branch 'vendor/OPENSSH'
Peter Avalos [Sun, 28 Oct 2012 18:41:45 +0000 (11:41 -0700)]
Merge branch 'vendor/OPENSSH'

23 months agoImport OpenSSH-6.1p1. vendor/OPENSSH
Peter Avalos [Sun, 28 Oct 2012 17:58:12 +0000 (10:58 -0700)]
Import OpenSSH-6.1p1.

Features:

 * ssh-keygen(1): Add optional checkpoints for moduli screening
 * ssh-add(1): new -k option to load plain keys (skipping certificates)
 * sshd(8): Add wildcard support to PermitOpen, allowing things like
   "PermitOpen localhost:*".  bz #1857
 * ssh(1): support for cancelling local and remote port forwards via the
   multiplex socket. Use ssh -O cancel -L xx:xx:xx -R yy:yy:yy user@host"
   to request the cancellation of the specified forwardings
 * support cancellation of local/dynamic forwardings from ~C commandline
 * sshd(8): This release turns on pre-auth sandboxing sshd by default for
   new installs, by setting UsePrivilegeSeparation=sandbox in sshd_config.
 * ssh-keygen(1): Add options to specify starting line number and number of
   lines to process when screening moduli candidates, allowing processing
   of different parts of a candidate moduli file in parallel
 * sshd(8): The Match directive now supports matching on the local (listen)
   address and port upon which the incoming connection was received via
   LocalAddress and LocalPort clauses.
 * sshd(8): Extend sshd_config Match directive to allow setting AcceptEnv
   and {Allow,Deny}{Users,Groups}
 * Add support for RFC6594 SSHFP DNS records for ECDSA key types. bz#1978
 * ssh-keygen(1): Allow conversion of RSA1 keys to public PEM and PKCS8
 * sshd(8): Allow the sshd_config PermitOpen directive to accept "none" as
   an argument to refuse all port-forwarding requests.
 * sshd(8): Support "none" as an argument for AuthorizedPrincipalsFile
 * ssh-keyscan(1): Look for ECDSA keys by default. bz#1971
 * sshd(8): Add "VersionAddendum" to sshd_config to allow server operators
   to append some arbitrary text to the server SSH protocol banner.

Bugfixes:

 * ssh(1): ensure that $DISPLAY contains only valid characters before
   using it to extract xauth data so that it can't be used to play local
   shell metacharacter games.
 * ssh(1): unbreak remote portforwarding with dynamic allocated listen ports
 * scp(1): uppress adding '--' to remote commandlines when the first
   argument does not start with '-'. saves breakage on some
   difficult-to-upgrade embedded/router platforms
 * ssh(1)/sshd(8): fix typo in IPQoS parsing: there is no "AF14" class,
   but there is an "AF21" class
 * ssh(1)/sshd(8): do not permit SSH2_MSG_SERVICE_REQUEST/ACCEPT during
   rekeying
 * ssh(1): skip attempting to create ~/.ssh when -F is passed
 * sshd(8): unbreak stdio forwarding when ControlPersist is in use; bz#1943
 * sshd(1): send tty break to pty master instead of (probably already
   closed) slave side; bz#1859
 * sftp(1): silence error spam for "ls */foo" in directory with files;
   bz#1683
 * Fixed a number of memory and file descriptor leaks
 * ssh(1)/sshd(8): Don't spin in accept() in situations of file
   descriptor exhaustion. Instead back off for a while.
 * ssh(1)/sshd(8): Remove hmac-sha2-256-96 and hmac-sha2-512-96 MACs as
   they were removed from the specification. bz#2023,
 * sshd(8): Handle long comments in config files better. bz#2025
 * ssh(1): Delay setting tty_flag so RequestTTY options are correctly
   picked up. bz#1995
 * sshd(8): Fix handling of /etc/nologin incorrectly being applied to root
   on platforms that use login_cap.

23 months agousr.bin/make: Remove legacy make files
John Marino [Sun, 28 Oct 2012 13:27:26 +0000 (14:27 +0100)]
usr.bin/make: Remove legacy make files

usr.bin/make has been replaced with usr.bin/bmake, retaining the program
name "make".  usr.bin/make was previously disconnected from the build,
so these files were not longer used.

23 months agoReplace legacy make with bmake
John Marino [Sun, 28 Oct 2012 12:38:32 +0000 (13:38 +0100)]
Replace legacy make with bmake

The proper way to detect which make is building the makefile is to check
for .PARSEDIR.  If present, bmake is processing the makefile.  For the
time being, both make will be supported for bootstrapping purposes, but
in time the check can be removed, say for the DragonFly 3.6 release.

The abundance of .ORDER commands in bsd.dep.mk caused a breakage when
building world in parallel with bmake.  Likely some order constraints
were impossible to achieve, and bmake just stopped while legacy did the
best it could.  In any case, the majority of the .ORDER commands were
replaced by a single .ORDER command which solved the problem.

The legacy make is disconnected in this commit set, but the source files
will be removed soon.

23 months agoRandom makefile cleanup prior to bmake import
John Marino [Sun, 28 Oct 2012 12:32:36 +0000 (13:32 +0100)]
Random makefile cleanup prior to bmake import

Bmake does not like to encounter "exit 0" or "exit 1".  It fails using the
exec command.  Replace instances of "exit 1" with /usr/bin/false.  There
was one instance of "exit 0" but it was at the end the target and thus
unnecessary.

The groff/tmac makefile was improved by providing a cd command for
every installed file.

Finally, one of the test makefiles was missing a single quote in one of
the targets.