dragonfly.git
7 years agosbin/hammer: Use . for pfs-status if no arg
Tomohiro Kusumi [Sat, 27 Aug 2016 09:29:45 +0000 (18:29 +0900)]
sbin/hammer: Use . for pfs-status if no arg

hammer pfs-status can take 1 or more args unlike other pfs-xxx,
so allow 0 arg for default ".".

7 years agosys/vfs/hammer: Remove wrong comment
Tomohiro Kusumi [Sat, 27 Aug 2016 03:48:57 +0000 (12:48 +0900)]
sys/vfs/hammer: Remove wrong comment

7 years agosbin/hammer: Use "objid" for inode#
Tomohiro Kusumi [Sat, 27 Aug 2016 02:13:30 +0000 (11:13 +0900)]
sbin/hammer: Use "objid" for inode#

"objid" is a commonly used one in kprintf as well as this command.
so change "obj", "ino" to "objid" which are all inode#.

7 years agosbin/newfs_hammer: Set HAMMER_OBJTYPE_DIRECTORY for ondisk PFS#0 data
Tomohiro Kusumi [Thu, 25 Aug 2016 12:40:12 +0000 (21:40 +0900)]
sbin/newfs_hammer: Set HAMMER_OBJTYPE_DIRECTORY for ondisk PFS#0 data

Ondisk PFS data is a record part of the root ip (inode) when
a new PFS is created via ioctl, so it's normal for ondisk PFS
data to have HAMMER_OBJTYPE_DIRECTORY for obj_type. It's
rather insane that PFS#0 (the only PFS created without ioctl)
has 0 (HAMMER_OBJTYPE_UNKNOWN) for obj_type while the root ip
(not PFS root but HAMMER root) is apparently a directory.

Although PFS#0 and the rest of the PFS are a bit different,
PFS ioctls treat all the ondisk PFS data in the same fashion.
Having consistent obj_type value for the same data type is
considered better than not having.

This change does affect 1 byte of ondisk PFS#0 data initially
created by newfs_hammer, but doesn't break compatibility.
Also see hammer_mkroot_pseudofs().

7 years agoacpi: Save I/O ports for I/O ports range, as long as its reasonable.
Sepherosa Ziehau [Wed, 24 Aug 2016 11:36:33 +0000 (19:36 +0800)]
acpi: Save I/O ports for I/O ports range, as long as its reasonable.

Reported-by: karu.pruun <karu.pruun gmail com>
7 years agosbin/hammer: Sync dce7ae2c format with zone statistics
Tomohiro Kusumi [Wed, 24 Aug 2016 10:54:31 +0000 (19:54 +0900)]
sbin/hammer: Sync dce7ae2c format with zone statistics

Add "zone #" and change "next_tid" to "vol0_next_tid".

7 years agoCorrect some spelling mistakes/typos in manual pages.
Sascha Wildner [Wed, 24 Aug 2016 11:51:14 +0000 (13:51 +0200)]
Correct some spelling mistakes/typos in manual pages.

7 years agolib/libhammer: Fix segmentation fault by null dereference
Tomohiro Kusumi [Tue, 23 Aug 2016 14:48:35 +0000 (23:48 +0900)]
lib/libhammer: Fix segmentation fault by null dereference

If libhammer cares about mountpoints of hammer and null,
it needs to care about the case where pfs0 happens to be NULL.
This occurs when a PFS(>#0) is null mounted on the mountpoint of PFS#0.

This commit avoids segmentation fault, but that doesn't mean the
result is correct. It's basically that this library doesn't fully
consider the complexity of ondisk PFS data within HAMMER's B-Tree.

7 years agoAdd/fix some HISTORY sections in bin/ manual pages.
Sascha Wildner [Tue, 23 Aug 2016 13:21:05 +0000 (15:21 +0200)]
Add/fix some HISTORY sections in bin/ manual pages.

Submitted-by: Sevan Janiyan
Dragonfly-bugs: 2937-2945

7 years agosbin/hammer: Don't print mountpoint of PFS
Tomohiro Kusumi [Tue, 23 Aug 2016 10:59:26 +0000 (19:59 +0900)]
sbin/hammer: Don't print mountpoint of PFS

/sbin/hammer should not care if PFS are null mounted or where PFS are
mounted. It has nothing to do with the filesystem itself. PFS is just
a pointer to jump into a subset of HAMMER's B-Tree (clustered by
localization parameter). Just because DragonFly's installer used to
use PFS (not anymore) and null mount by default doesn't mean /sbin
/hammer needs to provide null mount info.

If someone does mount PFS to somewhere and want to know where PFS are
mounted, one needs to just type mount. In fact this is much better
than getting mountpoints info via hammer info command because mount(8)
doesn't use hammer's ioctl which may cause B-Tree lookup, but instead
retrieves mountpoints directly from vfs.

Also note that printing such info gives users wrong assumption that
PFS in HAMMER is something equivalent of ZFS (created out of storage
zpool) which is not true. As mentioned above, PFS is just a pointer to
a subset of a single HAMMER filesystem. These are not independent fs.

Also note that hammer info still has bugs due to bugs from libhammer
and its attached ioctl as mentioned in e0f42079, including things under
investigation now. Whatever it is, hammer info needs to be rewritten
(as a different command like hammer fsinfo) in short and straight
forward code like other commands, without unnecessary abstraction.
I've been fixing and adding missing stuff to this hammer info command,
however hammer info is basically going nowhere because this command is
too tightly attached to libhammer.

7 years agoAllow make.conf to override ssh's xauth location.
Peter Avalos [Mon, 22 Aug 2016 22:09:18 +0000 (15:09 -0700)]
Allow make.conf to override ssh's xauth location.

This allows dports to install xauth based on the make.conf definition,
and was the original reason this functionality was added in eb12d1cc.
Note that this is a slightly different implementation than eb12d1cc.
This centralizes the definition instead of scattering it across multiple
Makefiles. Also, since we're doing this via a Makefile, revert the
change to vendor code in e00185f1.

Requested-by: swildner, marino
7 years agosbin/hammer: Make sizetostr() print B if <1KB
Tomohiro Kusumi [Mon, 22 Aug 2016 12:23:32 +0000 (21:23 +0900)]
sbin/hammer: Make sizetostr() print B if <1KB

7 years agosbin/hammer: Add print_blockmap() for common blockmap output format
Tomohiro Kusumi [Sun, 21 Aug 2016 12:16:19 +0000 (21:16 +0900)]
sbin/hammer: Add print_blockmap() for common blockmap output format

This is for hammer blockmap,checkmap,show,show-undo commands.
These hammer commands print blockmap information prior to checking
whatever filesystem structure they're looking for, with slightly
different format but essentially the same thing.

print_blockmap() defines a common format so that these commands
can print blockmap information in the same format. print_blockmap()
is based on hammer blockmap command's output format since it has
the best readable format.

7 years agosbin/hammer: Make get_buffer() static
Tomohiro Kusumi [Sun, 21 Aug 2016 07:49:54 +0000 (16:49 +0900)]
sbin/hammer: Make get_buffer() static

This is always called via other get functions (but not directly)
from various hammer commands.

7 years agobuildworld - bootstrap compatibility compiling older DragonFly's
zrj [Sun, 21 Aug 2016 08:30:47 +0000 (11:30 +0300)]
buildworld - bootstrap compatibility compiling older DragonFly's

* Fix buildworld issue bootstrapping gencat/uudecode utilities which does not
  expect newer header files (POSIX getline general visibility from <stdio.h>).

Could be MFC'd to DragonFly 4.6 branch for easier switching <-> master.

7 years agolib/libexecinfo: Fix sysctl wrong argument order.
zrj [Sat, 20 Aug 2016 15:10:40 +0000 (18:10 +0300)]
lib/libexecinfo: Fix sysctl wrong argument order.

Not fatal, procfs fallback should still work (provided /proc is mounted).
Thus fix and prefer using the KERN_PROC_PATHNAME variant.

7 years agosed(1): Fix issue with basename()/dirname() invoke.
zrj [Sat, 20 Aug 2016 14:41:23 +0000 (17:41 +0300)]
sed(1): Fix issue with basename()/dirname() invoke.

Use copies when calling these POSIX functions.

Taken-from: FreeBSD r303047

7 years agolibc/readpassphrase: Sync with OpenBSD
zrj [Fri, 19 Aug 2016 11:07:27 +0000 (14:07 +0300)]
libc/readpassphrase: Sync with OpenBSD

Mainly for better terminal and signal handling.
Also include few fixes done by FreeBSD.

Taken-from: FreeBSD

7 years agoSync arc4random() with OpenBSD a bit.
zrj [Fri, 19 Aug 2016 10:39:18 +0000 (13:39 +0300)]
Sync arc4random() with OpenBSD a bit.

Simplify calculation of "2**32 % upper_bound".
While there, perform some stylistic changes.

Taken-from: OpenBSD

7 years agosbin/hammer: Remove unused AssertOnFailure
Tomohiro Kusumi [Sun, 21 Aug 2016 06:45:30 +0000 (15:45 +0900)]
sbin/hammer: Remove unused AssertOnFailure

After the previous commit, AssertOnFailure is no longer needed
as a global variable. It can be removed or replaced with DebugOpt
which is what AssertOnFailure was based on in some commands.

7 years agosbin/hammer: Remove AssertOnFailure assertion in blockmap lookup
Tomohiro Kusumi [Sun, 21 Aug 2016 06:07:30 +0000 (15:07 +0900)]
sbin/hammer: Remove AssertOnFailure assertion in blockmap lookup

This isn't necessary as blockmap_lookup() callers are going to
check returned offset and/or *errorp value. Callers don't want
blockmap_lookup() to kill the process instantly via errx()
especially when the callers are diagnostic commands like hammer
show or blockmap or checkmap.

This is also the only place where AssertOnFailure needs to be
a global variable. Once this gets removed, other ones can be
removed or changed to local variables.

7 years agosbin/hammer: Drop bug fix by 750beaef after 9376f71b
Tomohiro Kusumi [Sun, 21 Aug 2016 02:02:57 +0000 (11:02 +0900)]
sbin/hammer: Drop bug fix by 750beaef after 9376f71b

Since ondisk PFS data is no longer degraded or updated,
a bug fix made by 750beaef in 2015 can be removed.

7 years agosbin/hammer: Don't ioctl(SET_PFS) before attempt to destroy PFS
Tomohiro Kusumi [Thu, 18 Aug 2016 14:00:44 +0000 (23:00 +0900)]
sbin/hammer: Don't ioctl(SET_PFS) before attempt to destroy PFS

This is part 1/2 of what's mentioned in below post.
Two ondisk PFS data (deleted PFS followed by undeleted PFS data) will
still appear with this commit, like what's mentioned in below post.
(This comes from HAMMER's flushing mechanism, so it's basically a bad
idea to try to fix it unless it's possible without touching core part
of HAMMER's flusher code, provided that this extra ondisk PFS data
does nothing bad. This may be fixed in the future as part 2/2 patch.)

http://lists.dragonflybsd.org/pipermail/users/2016-August/313004.html

This part 1/2 patch alone is still effective even without part 2/2.

If the PFS is successfully destroyed, the ondisk PFS data written by
ioctl(HAMMERIOC_SET_PSEUDOFS) prior to destroying (which is the code
removed by this commit) gets shadowed by the one with deleted flag,
so no one is to (or no one needs to) access that.

If failed to destroy the PFS, the original ondisk PFS data is restored
using a copy of the original data, so ioctl(HAMMERIOC_SET_PSEUDOFS)
prior to destroying is still unnecessary. Also see 750beaef.
Restoring part by 750beaef could be removed too since the PFS is not
downgraded or updated anymore.

7 years agosys/vfs/hammer: Add comments on filesystem capacity
Tomohiro Kusumi [Sat, 20 Aug 2016 04:14:54 +0000 (13:14 +0900)]
sys/vfs/hammer: Add comments on filesystem capacity

7 years agosys/vfs/hammer: Integrate ondisk uint32 reserveds into []
Tomohiro Kusumi [Sat, 20 Aug 2016 04:01:56 +0000 (13:01 +0900)]
sys/vfs/hammer: Integrate ondisk uint32 reserveds into []

Reserved field id's aren't in order from 00 to 11, so keeping them
with id's isn't that important, but rather confusing.

Also remove obsolete comment from ddfdf542 in 2008.
The idea of "birth time" was never explained in neither source nor
commit messages.

7 years agokernel/msdosfs: Add pathconf(3) support for FILESIZEBITS.
Sascha Wildner [Thu, 18 Aug 2016 20:10:16 +0000 (22:10 +0200)]
kernel/msdosfs: Add pathconf(3) support for FILESIZEBITS.

7 years agokernel/msdosfs: Sort pathconf cases in msdosfs_pathconf().
Sascha Wildner [Thu, 18 Aug 2016 20:08:12 +0000 (22:08 +0200)]
kernel/msdosfs: Sort pathconf cases in msdosfs_pathconf().

While here, break a long line.

7 years agokernel/vfs: Sort pathconf cases in the default pathconf.
Sascha Wildner [Thu, 18 Aug 2016 20:03:11 +0000 (22:03 +0200)]
kernel/vfs: Sort pathconf cases in the default pathconf.

7 years agosys/vfs/hammer: Remove unused HAMMER_IOC_PFS_XXX macros
Tomohiro Kusumi [Thu, 18 Aug 2016 14:25:11 +0000 (23:25 +0900)]
sys/vfs/hammer: Remove unused HAMMER_IOC_PFS_XXX macros

These were added in 5fa5c92f in 2008, but never used.

7 years agosbin/hammer: Remove if(QuietOpt) conditionals in hammer show/checkmap
Tomohiro Kusumi [Thu, 18 Aug 2016 12:35:39 +0000 (21:35 +0900)]
sbin/hammer: Remove if(QuietOpt) conditionals in hammer show/checkmap

mostly since it doesn't make much difference anyway.

The only QuietOpt conditional left is for print_record(elm) in
print_btree_elm() which makes amount of output text quite diffrent.

7 years agosbin/hammer: Add inode size check to hammer show
Tomohiro Kusumi [Thu, 18 Aug 2016 11:33:58 +0000 (20:33 +0900)]
sbin/hammer: Add inode size check to hammer show

Do the same sanity check as what hammer_crc_set|test_leaf()
do in kernel space.

7 years agosbin/hammer: Minor hammer show cleanups
Tomohiro Kusumi [Thu, 18 Aug 2016 11:28:55 +0000 (20:28 +0900)]
sbin/hammer: Minor hammer show cleanups

7 years agosys/vfs/hammer: Fix wrong comment and unnecessary argument
Tomohiro Kusumi [Wed, 17 Aug 2016 11:08:01 +0000 (20:08 +0900)]
sys/vfs/hammer: Fix wrong comment and unnecessary argument

B-Tree code isn't aware of PFS (or other HAMMER record types built
on top of B-Tree) by design. In fact pfsm argument is unused and
no longer necessary after sometime in 2008.

7 years agosbin/hammer: Fix memory leak
Tomohiro Kusumi [Tue, 16 Aug 2016 11:45:44 +0000 (20:45 +0900)]
sbin/hammer: Fix memory leak

strsep moves * by taking **, so the caller need to keep a pointer to strdup'd address.

7 years agosbin/hammer: Refactoring
Tomohiro Kusumi [Tue, 16 Aug 2016 11:11:46 +0000 (20:11 +0900)]
sbin/hammer: Refactoring

7 years agosbin/newfs_hammer: Add -h option
Tomohiro Kusumi [Mon, 15 Aug 2016 12:11:31 +0000 (21:11 +0900)]
sbin/newfs_hammer: Add -h option

7 years agosbin/newfs_hammer: Add exit_code arg to usage()
Tomohiro Kusumi [Mon, 15 Aug 2016 12:06:14 +0000 (21:06 +0900)]
sbin/newfs_hammer: Add exit_code arg to usage()

7 years agosbin/hammer: Cleanups
Tomohiro Kusumi [Mon, 15 Aug 2016 11:48:37 +0000 (20:48 +0900)]
sbin/hammer: Cleanups

7 years agosbin/newfs_hammer: Add -C option from hammer(8)
Tomohiro Kusumi [Sun, 14 Aug 2016 15:54:05 +0000 (00:54 +0900)]
sbin/newfs_hammer: Add -C option from hammer(8)

Just to support the same options given that these are both based
on the same volume/buffer structure.

7 years agoUpdate the pciconf(8) database.
Sascha Wildner [Mon, 15 Aug 2016 06:45:33 +0000 (08:45 +0200)]
Update the pciconf(8) database.

July 31, 2016 snapshot from http://pciids.sourceforge.net/

7 years agosys/vfs/hammer: Drop redundant error initialization
Tomohiro Kusumi [Sun, 14 Aug 2016 06:37:03 +0000 (15:37 +0900)]
sys/vfs/hammer: Drop redundant error initialization

error is always 0 when it hits here.
(It would have already returned non-zero error otherwise)

7 years agosys/vfs/hammer: Rename HAMMERIOC_PFS_ITERATE to HAMMERIOC_SCAN_PSEUDOFS
Tomohiro Kusumi [Sat, 13 Aug 2016 07:03:39 +0000 (16:03 +0900)]
sys/vfs/hammer: Rename HAMMERIOC_PFS_ITERATE to HAMMERIOC_SCAN_PSEUDOFS

The name of this ioctl is misleading.
It has nothing to do with iteration, as all it does is a single lookup.
This ioctl is just a variant of the existing HAMMER_IOC_GET_PSEUDOFS
as mentioned in the previous commit.

This commit breaks userspace, and requires buildworld, though it
only affects libhammer and hammer info command. See the previous
commit for justification of doing this.

7 years agosys/vfs/hammer: Change/Fix ioctl API for HAMMERIOC_PFS_ITERATE
Tomohiro Kusumi [Sat, 13 Aug 2016 05:52:29 +0000 (14:52 +0900)]
sys/vfs/hammer: Change/Fix ioctl API for HAMMERIOC_PFS_ITERATE

Rewrite hammer_ioc_iterate_pseudofs() as a proper hammer ioctl.
This commit requires buildworld, but it only affects libhammer and
hammer info command.

This ioctl has had lots of design issues as mentioned in 898f9540
and d8c56f70 in 2015. This ioctl is also just a variant of the
existing HAMMER_IOC_GET_PSEUDOFS which originally existed before
HAMMERIOC_PFS_ITERATE was added.

(It can't be replaced with HAMMER_IOC_GET_PSEUDOFS at the moment,
because of the difference in handling ondisk PFS data with deleted
flag set, but it should be replaced or removed in the future.
This interface is too tightly coupled with libhammer that no one
else really needs this, and there is a way to do the same thing
without using this ioctl. There is also a possible bug that comes
from the way this ioctl and libhammer is assuming about PFS data
with deleted flag set)

This commit breaks userspace that's been directly using this ioctl,
but I doubt anyone has done except for libhammer, as the existence
of such an ioctl has never been mentioned in DragonFly manpages or
other documents. Also note that this ioctl was added for libhammer,
so no one else is likely to really care about it.

7 years agosbin/hammer: Cleanups
Tomohiro Kusumi [Sat, 13 Aug 2016 04:29:17 +0000 (13:29 +0900)]
sbin/hammer: Cleanups

7 years agoUnbreak build.
Peter Avalos [Sun, 14 Aug 2016 02:50:50 +0000 (19:50 -0700)]
Unbreak build.

Somehow I forgot to include version.h in the servconf.c change that
appended our DragonFly-specific VersionAddendum to sshd.

7 years agoPatch ssh vendor code for xauth's default location.
Peter Avalos [Sat, 13 Aug 2016 21:54:53 +0000 (14:54 -0700)]
Patch ssh vendor code for xauth's default location.

This puts the change in one obvious place instead of scattering it
around different Makefiles and makes documention correct.

7 years agosshd(8): Disable tunneled cleartext passwords.
Peter Avalos [Sat, 13 Aug 2016 20:49:59 +0000 (13:49 -0700)]
sshd(8): Disable tunneled cleartext passwords.

This was previously our default that got wiped away when I removed our
local changes to OpenSSH. It's unlikely that anyone running master saw
any change to their sshd behavior, because they likely had the
PasswordAuthentication line uncommented in their configuration file.

7 years ago<sys/errno.h>: Use __BSD_VISIBLE instead of !_POSIX_SOURCE.
Sascha Wildner [Sat, 13 Aug 2016 19:24:19 +0000 (21:24 +0200)]
<sys/errno.h>: Use __BSD_VISIBLE instead of !_POSIX_SOURCE.

_POSIX_SOURCE is no longer set since it was superseded by
_POSIX_C_SOURCE. In other words, #ifndef _POSIX_SOURCE is
always true, unless IEEE Std 1003.1-1988 is explicitly
requested.

While here, clean up the visibility of all errno defines.
Those not mentioned in any standard are __BSD_VISIBLE now.
We can further restrict the standard ones at some later
point.

7 years ago<sys/errno.h>: Adjust whitespace (no functional change).
Sascha Wildner [Sat, 13 Aug 2016 19:23:54 +0000 (21:23 +0200)]
<sys/errno.h>: Adjust whitespace (no functional change).

7 years agosbin/hammer: Don't include libhammer.h unconditionally
Tomohiro Kusumi [Fri, 12 Aug 2016 13:29:10 +0000 (22:29 +0900)]
sbin/hammer: Don't include libhammer.h unconditionally

Though /sbin/hammer links to libhammer, only two commands use it.

Move SNAPSHOTS_BASE from cmd_cleanup.c to hammer.h.
This macro is defined in both sbin/hammer and libhammer.
It apparently doesn't need to ask an external library for snapshot location.

 # grep libhammer sbin/hammer sbin/newfs_hammer -rIl
 sbin/hammer/cmd_info.c
 sbin/hammer/cmd_snapshot.c
 sbin/hammer/hammer.h

7 years agosbin/hammer: Rewrite hammer bstats/iostats
Tomohiro Kusumi [Fri, 12 Aug 2016 12:44:38 +0000 (21:44 +0900)]
sbin/hammer: Rewrite hammer bstats/iostats

- Detach from libhammer.
- Add sysctls that were missing in libhammer.
- It's simply better and clearer without an external library wrappers
  for hammer command itself to just read hammer sysctls.

7 years agosys/boot: Unbreak WORLD_CCVER=gcc47
zrj [Tue, 9 Aug 2016 14:29:49 +0000 (17:29 +0300)]
sys/boot: Unbreak WORLD_CCVER=gcc47

Fix -Ox flags mess that exploded boot2_32 image size, by ensuring
that intended -Ox flags were used were needed (gcc50 unaffected).

There is still compilation issue for buildkernel w/ gcc47 but that
-Werror=maybe-uninitialized on i915_gem_stolen.c can wait a bit.

7 years agosys.mk: Introduce WORLD_CFLAGS.
zrj [Mon, 8 Aug 2016 15:03:26 +0000 (18:03 +0300)]
sys.mk: Introduce WORLD_CFLAGS.

Main purpose of this flag is to provide user a way to safely add extra
compiler flags to the build system without accidentally removing things
like -pipe or -Ox flags. Also it will help to ensure that none of user
set world flags will propagate to dports compilation to cause ruckus.
CFLAGS is still available as before provided it will be handled with care.

While there, adjust make.conf(5) to promote WORLD_CFLAGS usage instead of
manipulating CFLAGS directly. Also fix typo, ld.gold is default.

7 years agosys.mk: Introduce WORLD_CCOPTLEVEL.
zrj [Tue, 9 Aug 2016 12:38:28 +0000 (15:38 +0300)]
sys.mk: Introduce WORLD_CCOPTLEVEL.

After checking out what other compilers than gcc do decided to cave in
and leave 3 recently added NO_* knobs (yep, there are worse compilers).
Not to make matters worse and continue with the work, now pushing just
infrastructure bits for further testing.

WORLD_CCOPTLEVEL controls the optimization level for used -Ox
compiler flag. For now make it default to previous -O.
Also make initial separation between kernel and userland.

Optimization level can be selected globally from /etc/make.conf like:
WORLD_CCOPTLEVEL=2 # valid values are 0,1,2,3,s,g,fast

Use of -O3 and -Ofast is strongly discouraged.

7 years agobsd.sys.mk: Make build permissive for pre gcc 5 compilers.
zrj [Tue, 9 Aug 2016 11:42:58 +0000 (14:42 +0300)]
bsd.sys.mk: Make build permissive for pre gcc 5 compilers.

GCC 4.7 4.8 4.9 are known to have certain bugs, so instead of
forcing developers to use NO_WERROR=yes it is better to allow
certain diagnostics to happen, than cripple the primary gcc50.

7 years agoxz: Don't use SSE headers for gcc < 5.
zrj [Tue, 9 Aug 2016 10:51:17 +0000 (13:51 +0300)]
xz: Don't use SSE headers for gcc < 5.

liblzma was configured against gcc50 private SSE headers.
Avoid using SSE features for pre gcc5.
Mainly to unbreak WORLD_CCVER=gcc47.

7 years agostrcoll(3): Make source compatible to more compilers.
zrj [Tue, 9 Aug 2016 10:41:35 +0000 (13:41 +0300)]
strcoll(3): Make source compatible to more compilers.

Mainly to unbreak the WORLD_CCVER=gcc47 for now.
While there, fix a typo.

7 years agoTRE: Fix const discard issue for all compilers.
zrj [Tue, 9 Aug 2016 10:30:28 +0000 (13:30 +0300)]
TRE: Fix const discard issue for all compilers.

Mainly to unbreak WORLD_CCVER=gcc47 and avoid use of #pragma diagnostic.

7 years agosbin/hammer: Cleanup sbin/hammer/hammer_util.h
Tomohiro Kusumi [Thu, 11 Aug 2016 10:55:46 +0000 (19:55 +0900)]
sbin/hammer: Cleanup sbin/hammer/hammer_util.h

Move externs for global variables from hammer_util.h to hammer.h.
These are either only accessible via /sbin/hammer getopt options,
or only locally used by /sbin/hammer commands.

7 years agosbin/newfs_hammer: Add -d option from hammer(8)
Tomohiro Kusumi [Thu, 11 Aug 2016 10:55:07 +0000 (19:55 +0900)]
sbin/newfs_hammer: Add -d option from hammer(8)

Let /sbin/newfs_hammer access debug tunable which is accessible
via the same -d option in /sbin/hammer.

The real problem here is that /sbin/newfs_hammer and /sbin/hammer
are having their own getopt call, while these two share the basic
volume/buffer structure that manages ondisk filesystem metadata,
and some options that have something to do with volume/buffer
structure are available only in /sbin/hammer.

This option isn't mentioned in newfs_hammer(8) because hammer(8)
doesn't either. There are only a few places that actually use
this debug flag, so no real users use this and no one cares.

7 years agosbin/newfs_hammer: Link against sbin/hammer/misc.o
Tomohiro Kusumi [Thu, 11 Aug 2016 07:44:39 +0000 (16:44 +0900)]
sbin/newfs_hammer: Link against sbin/hammer/misc.o

Make /sbin/newfs_hammer link to sbin/hammer/misc.o, and use
sizetostr() via sbin/hammer/misc.o instead of having its own one,
by moving sbin/hammer/misc.c prototypes to hammer_util.h.

It's okay to do this because /sbin/newfs_hammer fully depends on
data structures of sbin/hammer/*. It's just better to make use of
sbin/hammer/misc.o except that the binary becomes a bit larger.

The difference between hammer.h and hammer_util.h is that hammer.h
is specific to /sbin/hammer. hammer_util.h seems to have been made
for more general stuff that could be used by other programs like
/sbin/hammer (but not outbox programs as the header isn't exposed
to outside the dfly source).

7 years agosbin/hammer: Move score_printf()/hammer_check_restrict() to cmd_mirror.c
Tomohiro Kusumi [Thu, 11 Aug 2016 07:37:46 +0000 (16:37 +0900)]
sbin/hammer: Move score_printf()/hammer_check_restrict() to cmd_mirror.c

Make sbin/hammer/misc.c independent of /sbin/hammer's global variables
(used by two functions score_printf()/hammer_check_restrict()) that
aren't accessible from other programs such as /sbin/newfs_hammer
which already links to some of sbin/hammer/*.o's.

/sbin/newfs_hammer could make use of misc.o, but globals have been
preventing from linking against sbin/hammer/misc.o. If these are
to be used by other hammer commands, they need to be reimplemented
without dependencies.

7 years agosbin/hammer: Increment recovery scan offset regardless of get_buffer() result
Tomohiro Kusumi [Thu, 11 Aug 2016 05:53:37 +0000 (14:53 +0900)]
sbin/hammer: Increment recovery scan offset regardless of get_buffer() result

otherwise the loop may become an infinite loop though that's not
likely to actually happen in this case.

7 years agosbin/hammer: Add debug prints while scanning node during recovery
Tomohiro Kusumi [Tue, 9 Aug 2016 17:21:11 +0000 (02:21 +0900)]
sbin/hammer: Add debug prints while scanning node during recovery

Prints "zone2offset nodetype elmnum elmtypes" with -d.
Prints "zone2offset -" for invalid offsets in addition to above with -dd.

-- example
...
20000000207fd000 -
20000000207fe000 -
20000000207ff000 -
2000000020800000 L 2 RR
mkinode (dir) /tmp/xxxxx/PFS00000
2000000020801000 I 52 LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
2000000020802000 L 32 RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
mkdir /tmp/xxxxx/PFS00000/obj_0x0000000100010590
...

7 years agosbin/hammer: Use HAMMER_BTREE_TYPE_RECORD
Tomohiro Kusumi [Tue, 9 Aug 2016 17:24:32 +0000 (02:24 +0900)]
sbin/hammer: Use HAMMER_BTREE_TYPE_RECORD

7 years agoppp(8): Remove useless _POSIX_SOURCE checks (no functional change).
Sascha Wildner [Wed, 10 Aug 2016 17:43:52 +0000 (19:43 +0200)]
ppp(8): Remove useless _POSIX_SOURCE checks (no functional change).

7 years agotcsetattr.3: Adjust for recent termios.h changes.
Sascha Wildner [Wed, 10 Aug 2016 16:51:28 +0000 (18:51 +0200)]
tcsetattr.3: Adjust for recent termios.h changes.

7 years agokernel - Add workaround for improper yield in ACPI path
Matthew Dillon [Mon, 8 Aug 2016 17:46:35 +0000 (10:46 -0700)]
kernel - Add workaround for improper yield in ACPI path

* For now add a workaround for an improper yield that can occur indirectly
  via the ACPI path.  The problem is that the ACPI contrib code can hold
  a spinlock across a kmalloc() call.

* The ACPI code, in particular AcpiOsAcquireLock(), uses a spin lock.  At
  the same time it MUST use a spinlock because it might be called from
  the idle thread.  But it also appears that the code might call kmalloc()
  while holding a spinlock.

  The kmalloc path ACPI calls is with M_INTWAIT, which reduces the chance
  that kmalloc might try to block.  However, kmalloc is used to execute
  staged kfrees which can create a sequence:

  kmalloc -> kmem_slab_free -> (vm system) ->
  vm_object_page_remove_callback -> lwkt_user_yield().

7 years ago<sys/termios.h>: Clean up the namespace.
Sascha Wildner [Mon, 8 Aug 2016 17:35:33 +0000 (19:35 +0200)]
<sys/termios.h>: Clean up the namespace.

7 years ago<sys/termios.h>: Adjust whitespace (no functional change).
Sascha Wildner [Mon, 8 Aug 2016 17:35:01 +0000 (19:35 +0200)]
<sys/termios.h>: Adjust whitespace (no functional change).

7 years agomake upgrade: Remove one more file I forgot in 859c2e538.
Sascha Wildner [Mon, 8 Aug 2016 06:15:59 +0000 (08:15 +0200)]
make upgrade: Remove one more file I forgot in 859c2e538.

7 years agogold: Fix CFLAGS override.
zrj [Mon, 8 Aug 2016 04:40:29 +0000 (07:40 +0300)]
gold: Fix CFLAGS override.

This was not intended.

In-discussion-with: marino

7 years agokernel - Remove some debug output
Matthew Dillon [Mon, 8 Aug 2016 02:44:33 +0000 (19:44 -0700)]
kernel - Remove some debug output

* Remove "Warning: cache_resolve: ncp '%s' was unlinked" debug output.
  This was originally added to validate a particular code path and is
  no longer needed.

7 years agoi386 removal, part 57/x: Remove two i386 leftovers.
Sascha Wildner [Sun, 7 Aug 2016 17:49:40 +0000 (19:49 +0200)]
i386 removal, part 57/x: Remove two i386 leftovers.

7 years agokernel: Remove useless I586_PMC_GUPROF option.
Sascha Wildner [Sun, 7 Aug 2016 16:31:12 +0000 (18:31 +0200)]
kernel: Remove useless I586_PMC_GUPROF option.

7 years agoi386 removal, part 56/x: Remove old i386 specific manual pages.
Sascha Wildner [Sun, 7 Aug 2016 16:21:00 +0000 (18:21 +0200)]
i386 removal, part 56/x: Remove old i386 specific manual pages.

Shuffle a number of them to share/man/man4 because they didn't seem to
be i386 specific for one reason or another.

7 years agokernel: Remove the old vx(4) network driver.
Sascha Wildner [Sun, 7 Aug 2016 16:17:51 +0000 (18:17 +0200)]
kernel: Remove the old vx(4) network driver.

Aside from being quite obsolete, its documentation always was in the
i386 so i have my doubts that it still works.

If anyone needs it back for some reason I can't imagine currently,
we can take another look then.

7 years agoi386 removal, part 55/x: Remove if_sbni(4) remains.
Sascha Wildner [Sun, 7 Aug 2016 15:37:56 +0000 (17:37 +0200)]
i386 removal, part 55/x: Remove if_sbni(4) remains.

7 years agoi386 removal, part 54/x: Remove perfmon(4) remains.
Sascha Wildner [Sun, 7 Aug 2016 15:26:26 +0000 (17:26 +0200)]
i386 removal, part 54/x: Remove perfmon(4) remains.

It only ever was compilable into i386 kernels. I forgot to remove it
too in f4c88b0b86f1810db0482795bc097597d1197c54.

7 years agoi386 removal, part 53/x: Remove the code of the fe(4) driver too.
Sascha Wildner [Sun, 7 Aug 2016 14:22:04 +0000 (16:22 +0200)]
i386 removal, part 53/x: Remove the code of the fe(4) driver too.

It only ever was compilable into i386 kernels. I forgot to remove it
too in f4c88b0b86f1810db0482795bc097597d1197c54.

7 years agokernel: Remove the old ep(4) and ex(4) network drivers.
Sascha Wildner [Sun, 7 Aug 2016 14:08:27 +0000 (16:08 +0200)]
kernel: Remove the old ep(4) and ex(4) network drivers.

Aside from being quite obsolete, their documentation always was in the
i386 so i have my doubts that they still work.

If anyone needs them back for some reason I can't imagine currently,
we can take another look then.

7 years agoi386 removal, part 52/x: Remove the old cs(4) network driver.
Sascha Wildner [Sun, 7 Aug 2016 13:09:47 +0000 (15:09 +0200)]
i386 removal, part 52/x: Remove the old cs(4) network driver.

Looks like it was i386 specific and ended up in our x86_64 configs by
mistake. At least its manpage was in the i386 section and FreeBSD does
not have it in amd64's NOTES either.

7 years agoClean up some more after the sys/emulation/linux removal.
Sascha Wildner [Sun, 7 Aug 2016 12:49:22 +0000 (14:49 +0200)]
Clean up some more after the sys/emulation/linux removal.

7 years agosbin/hammer: Abort if failed to creat recover target dir
Tomohiro Kusumi [Sun, 7 Aug 2016 11:28:44 +0000 (20:28 +0900)]
sbin/hammer: Abort if failed to creat recover target dir

7 years agosbin/hammer: Add verbose volume message while recovering
Tomohiro Kusumi [Sun, 7 Aug 2016 08:59:07 +0000 (17:59 +0900)]
sbin/hammer: Add verbose volume message while recovering

sizetostr() is brought from newfs_hammer code.

newfs_hammer should use sizetostr() by linking sbin/hammer/misc.o,
as it already has dependencies on other sbin/hammer/*.o.
(Also note that hammer2 also has sizetostr() in both directories)

7 years ago<time.h>: Adjust the visibility of CLOCK_REALTIME and TIMER_ABSTIME.
Sascha Wildner [Sun, 7 Aug 2016 09:29:13 +0000 (11:29 +0200)]
<time.h>: Adjust the visibility of CLOCK_REALTIME and TIMER_ABSTIME.

Looks like they came in with IEEE Std 1003.1b-1993.

Helps building math/clblas with GCC.

Reported-by: zrj
7 years agoboot - Force -O
Matthew Dillon [Sun, 7 Aug 2016 08:34:54 +0000 (01:34 -0700)]
boot - Force -O

* Always force -O for the boot code.  -O2 will implode it.  This is a bit
  weird but -O will override any prior -O2.  We still want other CFLAGS
  that mk scripts supply so we can't just set CFLAGS=

7 years agotcsh - Work around gcc-5 bug
Matthew Dillon [Sun, 7 Aug 2016 08:04:48 +0000 (01:04 -0700)]
tcsh - Work around gcc-5 bug

* GCC-5 improperly tries to optimize tcsh's calloc() replacement into a
  tail-jmp to tcsh's calloc.  It tries to optimize the malloc+memset
  sequence into calloc, inside calloc itself.

  This is really a bug in GCC-5 but work around it for now by hacking
  tcsh's calloc().

7 years agobuild - prepare for higher optimization levels (2)
Matthew Dillon [Sun, 7 Aug 2016 07:21:55 +0000 (00:21 -0700)]
build - prepare for higher optimization levels (2)

* A couple more programs need Makefile mods.

7 years agobuild - Add support for new NO_* make variables
Matthew Dillon [Sun, 7 Aug 2016 07:07:29 +0000 (00:07 -0700)]
build - Add support for new NO_* make variables

* Add support for NO_STRICT_ALIASING, NO_STRICT_OVERFLOW,
  and NO_WARRAY_BOUNDS.

7 years agobuild - prepare for higher optimization levels
Matthew Dillon [Sun, 7 Aug 2016 07:04:51 +0000 (00:04 -0700)]
build - prepare for higher optimization levels

* Add NO_STRICT_ALIASING, NO_STRICT_OVERFLOW, and NO_WARRAY_BOUNDS
  make variables as-needed.

7 years agokernel - Fix minor bug in powermng
Matthew Dillon [Sun, 7 Aug 2016 07:00:30 +0000 (00:00 -0700)]
kernel - Fix minor bug in powermng

* Fix a minor array overflow (incorrect index used) bug in powermng.

7 years agokernel - Cleanup gcc warnings
Matthew Dillon [Sun, 7 Aug 2016 04:02:46 +0000 (21:02 -0700)]
kernel - Cleanup gcc warnings

* Cleanup gcc warnings at higher optimization levels.  This will allow
  us to build kernels -O2 or -O3.

7 years agolibc/strptime: Handle ISO 8601 time zone formats in %z.
zrj [Wed, 27 Jul 2016 16:17:54 +0000 (19:17 +0300)]
libc/strptime: Handle ISO 8601 time zone formats in %z.

Formats of +hh:mm +hh Z are now also accepted to previous +hhmm.

7 years agolibc/strptime: Fix "%Y %W %w %H:%M:%S".
zrj [Tue, 26 Jul 2016 12:29:59 +0000 (15:29 +0300)]
libc/strptime: Fix "%Y %W %w %H:%M:%S".

Also throw in the fix for "12:34:56 2016 30 0", "%H:%M:%S %Y %W %w".
Correct partial format reads are still not supported.

7 years agostrptime.3: Sync with FreeBSD.
zrj [Tue, 26 Jul 2016 13:48:35 +0000 (16:48 +0300)]
strptime.3: Sync with FreeBSD.

7 years agolibc/strptime: Attempt to fix up %U and %W.
zrj [Tue, 26 Jul 2016 12:14:49 +0000 (15:14 +0300)]
libc/strptime: Attempt to fix up %U and %W.

Thera are still few issues left.

Taken-from: FreeBSD

7 years agolibc/strptime: Add support for %t and %n per POSIX.
zrj [Tue, 26 Jul 2016 10:05:36 +0000 (13:05 +0300)]
libc/strptime: Add support for %t and %n per POSIX.

Only skip space for %e and fail on unknown specifiers.
Also remove magic year 1900 constants.

Taken-from: FreeBSD

7 years agolibc/strptime: Check for NULL, not 0.
zrj [Tue, 26 Jul 2016 06:59:42 +0000 (09:59 +0300)]
libc/strptime: Check for NULL, not 0.

Also add check for gmtime_r() result.

While there, perform license change as per FreeBSD r267544

7 years agokernel - Fix memcpy assembly ABI
Matthew Dillon [Sun, 7 Aug 2016 04:25:26 +0000 (21:25 -0700)]
kernel - Fix memcpy assembly ABI

* memcpy must return the original (dst) argument, and wasn't for the kernel.
  Nothing used it explicitly, but gcc sometimes decides to call memcpy and
  assumes the correct return value.  It was just luck that it hasn't up until
  now.