4 hours agolibc - Fix bug in rcmdsh() master
Matthew Dillon [Wed, 26 Jul 2017 19:41:20 +0000 (12:41 -0700)]
libc - Fix bug in rcmdsh()

* rcmdsh() (which really nothing should be using any more anyway) used
  a generic wait(NULL) to wait for a child to exit, but this can wind
  up waiting for the wrong pid in a multi-threaded or multi-fork environment.

* Solved by waiting on the specific pid instead.

4 hours agosshlockout - Improve manual page
Matthew Dillon [Wed, 26 Jul 2017 19:39:46 +0000 (12:39 -0700)]
sshlockout - Improve manual page

* Rewrite the manual page, provide a more concise example.

* Suggest using pfctl -T expire <seconds> instead of -T flush for the
  crontab entry.

Reported-by: Miroslav Lachman <000.fbsd@quip.cz>
6 hours agolibc/libpthread: Add clock_getcpuclockid() and pthread_getcpuclockid().
Sascha Wildner [Wed, 26 Jul 2017 17:57:32 +0000 (19:57 +0200)]
libc/libpthread: Add clock_getcpuclockid() and pthread_getcpuclockid().

* Adjust clock_gettime() and clock_getres() to accept values obtained
  this way.

* Also set _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME, although we should
  really support values obtained by these functions in clock_settime()

Based on and taken from FreeBSD's code.

Reviewed-by: sephe
7 hours agoRemove <stab.h> and <struct.h>.
Sascha Wildner [Wed, 26 Jul 2017 16:53:26 +0000 (18:53 +0200)]
Remove <stab.h> and <struct.h>.

* <stab.h> had information about the a.out related symbol table

* <struct.h> has been removed from FreeBSD since 2001.

Both headers are not needed by anything in our tree or dports.

12 hours agokernel/time: Change get_curthread_cputime() to get_thread_cputime().
Sascha Wildner [Wed, 26 Jul 2017 12:05:42 +0000 (14:05 +0200)]
kernel/time: Change get_curthread_cputime() to get_thread_cputime().

12 hours ago<sys/types.h>: Add guard around lwpid_t, also put under __BSD_VISIBLE.
Sascha Wildner [Wed, 26 Jul 2017 12:05:03 +0000 (14:05 +0200)]
<sys/types.h>: Add guard around lwpid_t, also put under __BSD_VISIBLE.

2 days agoaltq/cbq: Drain pending callout and the cooresponding netmsg.
Sepherosa Ziehau [Mon, 24 Jul 2017 13:31:03 +0000 (21:31 +0800)]
altq/cbq: Drain pending callout and the cooresponding netmsg.

2 days agoaltq/cbq: Redispatch restart function to netisr0.
Sepherosa Ziehau [Mon, 24 Jul 2017 12:59:03 +0000 (20:59 +0800)]
altq/cbq: Redispatch restart function to netisr0.

Now, all pseudo interfaces' if_start run in netisr_ncpus netisrs.

40 hours agohammer2 - Update DESIGN document
Matthew Dillon [Tue, 25 Jul 2017 07:40:04 +0000 (00:40 -0700)]
hammer2 - Update DESIGN document

* Update the DESIGN document to reflect changes.

45 hours agohammer2 - correct readdir bug
Matthew Dillon [Tue, 25 Jul 2017 02:50:47 +0000 (19:50 -0700)]
hammer2 - correct readdir bug

* Correct a readdir iteration bug for the new DIRENT type.

46 hours agohammer2 - Initial HARDLINK -> DIRENT replacement code
Matthew Dillon [Tue, 25 Jul 2017 02:05:33 +0000 (19:05 -0700)]
hammer2 - Initial HARDLINK -> DIRENT replacement code

* Initial removal of the vestiges of the old embedded inode code.  Inodes
  were moved to the root directory long ago but directories still contain
  dummy OBJTYPE_HARDLINK inodes instead of real directory entries to point
  to the moved inodes.  These inodes ate 1024 bytes of disk space for each
  directory entry.

* Remove the dummy OBJTYPE_HARDLINK inodes and replace with new
  BREF_TYPE_DIRENT blockrefs.  These blockrefs represent directory
  entries, and the entire dirent will fit in the blockref (requiring
  no data ref) if the filename is <= 64 bytes.

* This new DIRENT mechanic significantly improves performance and reduces
  storage overage vs the previous mechanicn, for obvious reasons.

  Directory entries are now 128 bytes instead of 1024 bytes, and since they
  are collected together in indirect blocks or (if <= 4 entries) simply
  placed in the 4 blockrefs embedded in the directory inode, the related
  I/O tends to be fairly optimal.

  Only directory entries whos filenames are > 64 bytes long require an
  additional data block reference.  For now, due to other constraints,
  we use the minimum H2 allocation size of 1KB for these, so certainly
  space is wasted.  But in real life there aren't actually a whole lot
  of filenames that are that long so it should be fine.

46 hours agohammer2 - Adjust blockref to create an embedded area, start dirent work
Matthew Dillon [Sun, 23 Jul 2017 07:57:20 +0000 (00:57 -0700)]
hammer2 - Adjust blockref to create an embedded area, start dirent work

* Create a type-specific embedded area in the blockref structure.  Move
  data_count and inode_count into the new area.  The blockref structure
  size does not change.

* Adjust code to access data_count and inode_count conditionally for

* Now that we have abandoned embedding inodes directly in directories for
  normal operation, start working on removing HAMMER2_OBJTYPE_HARDLINK and
  creating a real directory entry abstraction.

  The real directory entry abstraction will allow directory entries to be
  directly embedded in blockref structures, without requiring a data
  reference for any filename <= 64 bytes.  This will be accomplished by
  using the new embedded area in the blockref for the directory entry
  header and the check area for the filename (up to 64 bytes).

  This will significantly improve directory compactness and I/O efficiency
  by reducing the directory entry overhead from 1152 bytes (1024 + 128) to
  just 128 bytes and guaranteeing locality since the blockrefs are
  collected together in indirect blocks.  Another nice facet is that since
  inodes can embed up to four direct blockrefs, any directory with <=
  4 entries in it can embed those entries in the directory inode itself.
  So small directories will wind up being VERY compact.

  We haven't entirely abandoned embedding inodes in directories as
  directory entries.  In fact, the feature is still used for superroot
  entries, and may be allowed in the future mixed into normal directories
  for 'special' non-hardlinkable directory inodes for quota control,
  snapshot, and (NFS) export purposes.

46 hours agohammer2 - Cleanup pass, remove unused fields and code
Matthew Dillon [Sun, 23 Jul 2017 06:24:19 +0000 (23:24 -0700)]
hammer2 - Cleanup pass, remove unused fields and code

* Remove the unused per-inode cluster cache.  The code isn't really
  compatible with the XOP mechanism.

* Remove unused hammer2_xop_nlink() and related structures.  Hardlinking
  is handled through normal hammer2_inode_*() functions and no longer
  needs an explicit backend.

* Remove the unused iocb.cluster field.  iocb's are now exclusively
  backend entities.

2 days agoaltq: Fix typo
Sepherosa Ziehau [Mon, 24 Jul 2017 03:38:43 +0000 (11:38 +0800)]
altq: Fix typo

2 days agoipflow: Use per-cpu callout, instead of pr_slowtimo.
Sepherosa Ziehau [Fri, 21 Jul 2017 12:21:17 +0000 (20:21 +0800)]
ipflow: Use per-cpu callout, instead of pr_slowtimo.

The dynamically allocated per-cpu data structure may race the
ip_flowtimo, which calls ipflow_slowtimo.

Reported-by: zrj
3 days agosys: Add size directives to assembly functions.
zrj [Sun, 23 Jul 2017 14:21:09 +0000 (17:21 +0300)]
sys: Add size directives to assembly functions.

No functional change intended.

3 days agosys: Some whitespace cleanup.
zrj [Sun, 23 Jul 2017 14:20:04 +0000 (17:20 +0300)]
sys: Some whitespace cleanup.

While there, fix indentation and few typos a bit.
No functional change.

3 days agoFix few typos.
zrj [Sun, 23 Jul 2017 13:54:50 +0000 (16:54 +0300)]
Fix few typos.

While there, make few whitespace adjustments.

3 days agohack(6): Allow to play without setgid.
zrj [Sun, 23 Jul 2017 07:21:45 +0000 (10:21 +0300)]
hack(6): Allow to play without setgid.

Lockfile hardlinking requires that user should own the perm file.

3 days agoRemove kernbb(8).
Sascha Wildner [Sun, 23 Jul 2017 05:40:46 +0000 (07:40 +0200)]
Remove kernbb(8).

It likely never worked in DragonFly (or until some early compiler
upgrade). FreeBSD stopped building it in 2004 (r132787).

Reported-by: zrj
4 days agoRemove scsi_low.ko via 'make upgrade' (leftover from 075c6d38244abd0b0).
Sascha Wildner [Sat, 22 Jul 2017 09:30:55 +0000 (11:30 +0200)]
Remove scsi_low.ko via 'make upgrade' (leftover from 075c6d38244abd0b0).

4 days agolibstdcxx5: Add profiled library support.
zrj [Sun, 2 Jul 2017 14:17:21 +0000 (17:17 +0300)]
libstdcxx5: Add profiled library support.

4 days agolib/libexecinfo: Fix static and profiled archives.
zrj [Sun, 2 Jul 2017 14:12:41 +0000 (17:12 +0300)]
lib/libexecinfo: Fix static and profiled archives.

Previously archives were embedded within archives.

Reported-by: tuxillo
4 days agocpu/asm.h: Use optimal alignment for assembly functions on x86_64.
zrj [Sun, 2 Jul 2017 10:46:11 +0000 (13:46 +0300)]
cpu/asm.h: Use optimal alignment for assembly functions on x86_64.

Entry point at 16 byte boundary is better for x86_64.
Preserve previous alignment for sys/boot/ 32bit loader.

4 days agopg: Add missing dummy stack frames for mcount for x86_64.
zrj [Sun, 2 Jul 2017 10:41:19 +0000 (13:41 +0300)]
pg: Add missing dummy stack frames for mcount for x86_64.

Safer to do it in a single place than miss one in assembly function.
Fixes segfaults for c++ runtime library with profiled libc(strcmp.S).

Affects only -pg compilations.

4 days agopg: Use long for fptrdiff_t type.
zrj [Sun, 2 Jul 2017 10:39:47 +0000 (13:39 +0300)]
pg: Use long for fptrdiff_t type.

On x86_64 it can easily overflow and very hard to detect.

4 days agolibstdcxx5: Fix profiled library creation.
zrj [Sun, 2 Jul 2017 10:33:49 +0000 (13:33 +0300)]
libstdcxx5: Fix profiled library creation.

It was embedding archives within archives. Do not do it.
For now created library is still partially profiled, some expansion
to INTERNALLIB (like new INTERNALLIBPROF) handling will be needed.

This is a partial fix to have c++ -pg working.

While there, throw in ranlib for good measure.

Reported-by: tuxillo
4 days agobsd.lib.mk: Add INTERNALLIBPROF knob.
zrj [Sun, 2 Jul 2017 10:30:05 +0000 (13:30 +0300)]
bsd.lib.mk: Add INTERNALLIBPROF knob.

Allow to build profiled versions of internal libs without installing them.
Will be useful for the corner cases, spec. to build modern compilers or
libraries containing internal libraries like libexecinfo.a(libelf.a).

5 days ago<glob.h>/<sys/time.h>: Clean up the namespace a bit better.
Sascha Wildner [Fri, 21 Jul 2017 18:59:32 +0000 (20:59 +0200)]
<glob.h>/<sys/time.h>: Clean up the namespace a bit better.

These headers don't need the full weight of <sys/types.h>.

While here, sync glob()'s prototype with the standard and fix a typo
in a comment.

5 days ago<glob.h>/<sys/time.h>: Some minimal whitespace cleanup.
Sascha Wildner [Fri, 21 Jul 2017 18:52:35 +0000 (20:52 +0200)]
<glob.h>/<sys/time.h>: Some minimal whitespace cleanup.

5 days agovlan: It should only run in netisr_cpus netisrs
Sepherosa Ziehau [Fri, 21 Jul 2017 08:44:29 +0000 (16:44 +0800)]
vlan: It should only run in netisr_cpus netisrs

5 days agoipflow: Regroup percpu data.
Sepherosa Ziehau [Fri, 21 Jul 2017 08:23:29 +0000 (16:23 +0800)]
ipflow: Regroup percpu data.

5 days agoipflow: It can only run in first netisr_ncpus netisrs
Sepherosa Ziehau [Fri, 21 Jul 2017 07:41:04 +0000 (15:41 +0800)]
ipflow: It can only run in first netisr_ncpus netisrs

5 days agoipfw: ipfw only runs on netisr_ncpus
Sepherosa Ziehau [Fri, 21 Jul 2017 06:23:06 +0000 (14:23 +0800)]
ipfw: ipfw only runs on netisr_ncpus

5 days agonetisr: Add add support for netisr_ncpus
Sepherosa Ziehau [Fri, 21 Jul 2017 06:21:41 +0000 (14:21 +0800)]
netisr: Add add support for netisr_ncpus

- netisr_forwardmsg(), which only forwards netmsg to netisr_ncpus.
- ASSERT_NETISR_NCPUS, which asserts the thread is one of the netisrs
  on netisr_ncpus.

6 days agoIn <signal.h> and <sys/devicestat.h>, include <sys/types.h> explicitly.
Sascha Wildner [Thu, 20 Jul 2017 17:21:20 +0000 (19:21 +0200)]
In <signal.h> and <sys/devicestat.h>, include <sys/types.h> explicitly.

This is in preparation for cleaning up <sys/time.h>'s namespace, which
<signal.h> and <sys/devicestat.h> relied on previously for bringing in
<sys/types.h>, but which does not actually need it for its own stuff.

7 days ago<sys/posix4.h>: Clean up a bit.
Sascha Wildner [Wed, 19 Jul 2017 20:10:11 +0000 (22:10 +0200)]
<sys/posix4.h>: Clean up a bit.

* This is only supposed to be included by the kernel. Error if _KERNEL
  isn't defined.

* Adjust #endif comments.

* Move include guard down.

8 days agonetisr: netisr_forwardmsg -> netisr_forwardmsg_all
Sepherosa Ziehau [Tue, 18 Jul 2017 08:58:38 +0000 (16:58 +0800)]
netisr: netisr_forwardmsg -> netisr_forwardmsg_all

This function actually forwards netmsg to all available netisrs,
instead of netisr_ncpus netisrs.

For some modules, this is obviously not necessary; they will be
fixed one-by-one later.

10 days agoSync time(1)'s manual page a bit with FreeBSD, too.
Sascha Wildner [Sun, 16 Jul 2017 09:50:30 +0000 (11:50 +0200)]
Sync time(1)'s manual page a bit with FreeBSD, too.

10 days agoUpdate the pciconf(8) database.
Sascha Wildner [Sun, 16 Jul 2017 00:30:50 +0000 (02:30 +0200)]
Update the pciconf(8) database.

July 13, 2017 snapshot from http://pciids.sourceforge.net/

11 days agotime: Use clock_gettime
Markus Pfeiffer [Sat, 15 Jul 2017 22:16:12 +0000 (23:16 +0100)]
time: Use clock_gettime

gettimeofday is not suitable for measuring runtimes, as it is
not guaranteed to be monotonic.

11 days agotime: Handle SIGINFO in time(1)
Markus Pfeiffer [Sat, 15 Jul 2017 22:52:23 +0000 (23:52 +0100)]
time: Handle SIGINFO in time(1)

If the process receives SIGINFO print the elapsed time.

Taken-From: FreeBSD r158560 and r283073

11 days agotime: Handle SIGINFO in time(1)
Markus Pfeiffer [Sat, 15 Jul 2017 22:51:35 +0000 (23:51 +0100)]
time: Handle SIGINFO in time(1)

SIGINFO printing the time the given command is running.

Taken-From: FreeBSD r158560

11 days agotime: Use close-on-exec instead of fclose() in the child process.
Markus Pfeiffer [Sat, 15 Jul 2017 21:58:07 +0000 (22:58 +0100)]
time: Use close-on-exec instead of fclose() in the child process.

Taken-From: FreeBSD r244034

11 days agotime: FreeBSD r169346
Markus Pfeiffer [Sat, 15 Jul 2017 22:49:39 +0000 (23:49 +0100)]
time: FreeBSD r169346

- Cast to intmax_t to print tv_sec in struct timeval.
- Avoid shadowing a global variable with a function argument.

11 days agotime: Close an output file -o flag opened before execvp(3) in a child.
Markus Pfeiffer [Sat, 15 Jul 2017 21:38:44 +0000 (22:38 +0100)]
time: Close an output file -o flag opened before execvp(3) in a child.

Taken-From: FreeBSD r157796

11 days agopthread: Add pthread_getthreadid_np() function, bump __DragonFly_version.
Imre Vadász [Sat, 15 Jul 2017 09:13:36 +0000 (11:13 +0200)]
pthread: Add pthread_getthreadid_np() function, bump __DragonFly_version.

Using pthread_getthreadid_np() can directly use the thread-ID value that is
already cached in the pthread_t struct.

Partly Taken-From: FreeBSD

11 days agoifnet: Fix typo.
Sascha Wildner [Sat, 15 Jul 2017 08:31:29 +0000 (10:31 +0200)]
ifnet: Fix typo.

2 weeks agoDefine __* symbols for the malloc(3) functions to make wrapping easier.
Imre Vadász [Sun, 9 Jul 2017 12:08:38 +0000 (14:08 +0200)]
Define __* symbols for the malloc(3) functions to make wrapping easier.

This should match what FreeBSD and other systems do. Where the __* variants
always refer to the libc function, but the actual malloc(), free() etc.
symbols can be overrided by a malloc wrapper.

2 weeks agoResolve issue with libusb C++ header file inclusion.
Imre Vadász [Sat, 1 Jul 2017 20:42:48 +0000 (22:42 +0200)]
Resolve issue with libusb C++ header file inclusion.

Taken-From: FreeBSD (svn r302171)

2 weeks agoImplement libusb_hotplug_register_callback() and _deregister_callback().
Imre Vadász [Sat, 1 Jul 2017 20:37:03 +0000 (22:37 +0200)]
Implement libusb_hotplug_register_callback() and _deregister_callback().

  Implement libusb_hotplug_register_callback() and
  libusb_hotplug_deregister_callback() for the LibUSB v1.0 API and
  update the libusb(3) manual page.

Taken-From: FreeBSD (svn r302080)

2 weeks agoifnet: Log rarely used ifnet address destruction.
Sepherosa Ziehau [Tue, 11 Jul 2017 02:15:45 +0000 (10:15 +0800)]
ifnet: Log rarely used ifnet address destruction.

2 weeks agoifnet: Break long lines.
Sepherosa Ziehau [Tue, 11 Jul 2017 02:11:54 +0000 (10:11 +0800)]
ifnet: Break long lines.

2 weeks agoifnet: ifa_addr should always be configured.
Sepherosa Ziehau [Tue, 11 Jul 2017 02:06:29 +0000 (10:06 +0800)]
ifnet: ifa_addr should always be configured.

2 weeks agoifnet: Delete INET address should not fail; panic upon failure.
Sepherosa Ziehau [Tue, 11 Jul 2017 02:03:57 +0000 (10:03 +0800)]
ifnet: Delete INET address should not fail; panic upon failure.

This helps catch the root cause of a tun(4) related crash.

Reported-by: dillon
2 weeks agolibthread_xu: Some small fixes.
Sascha Wildner [Mon, 10 Jul 2017 17:56:19 +0000 (19:56 +0200)]
libthread_xu: Some small fixes.

* Add some parentheses for readability.

* 'count' is already unsigned, so remove useless <0 check.

2 weeks agoipflow: Unroll the first iteration of the hash generation loop.
Sepherosa Ziehau [Mon, 10 Jul 2017 06:27:06 +0000 (14:27 +0800)]
ipflow: Unroll the first iteration of the hash generation loop.

Right shifting 32 bits w/ 32 bits is undefined behaviour.

Reported-by: swildner
2 weeks agokernel: Remove old unused #defines in kern_lock.c
Sascha Wildner [Sun, 9 Jul 2017 19:35:51 +0000 (21:35 +0200)]
kernel: Remove old unused #defines in kern_lock.c

The code using them was removed in 2003 (8a8d5d85f4fb81fc5b1dd4).

Repoted-by: Mateusz Guzik (mjg_)
2 weeks agokernel/acpi: Untangle the wakecode generation during buildkernel.
Sascha Wildner [Sat, 8 Jul 2017 21:18:23 +0000 (23:18 +0200)]
kernel/acpi: Untangle the wakecode generation during buildkernel.

* Use file2c instead of hexdump and remove hexdump from the bootstrap

* Remove the nested make invocation and the genwakecode.sh script
  too. Instead, do all the steps from acpica's Makefile and

* Finally, comment it all out because right now all of this isn't

* This commit also silences a "Object directory not changed from
  original" make warning.

Reported-by: zrj
Based-on:    FreeBSD

2 weeks agosshlockout - Also lockout on max authentication attempts
Matthew Dillon [Sat, 8 Jul 2017 17:38:26 +0000 (10:38 -0700)]
sshlockout - Also lockout on max authentication attempts

* Also lockout on max authentication attempts, because its really annoying
  to have log files filled with them.

2 weeks agoUnbreak VKERNEL64 after apple_gmux module addition.
zrj [Sat, 8 Jul 2017 12:12:04 +0000 (15:12 +0300)]
Unbreak VKERNEL64 after apple_gmux module addition.

Better and more flexible DEV_SUPPORT checking logic is needed.
For now just fix the build.

2 weeks agokernel: Let thread IDs start at 1 instead of 0.
Sascha Wildner [Sat, 8 Jul 2017 09:19:19 +0000 (11:19 +0200)]
kernel: Let thread IDs start at 1 instead of 0.

This is helpful in various places, for example Chromium.

Reported-by: ivadasz
Submitted-by: sephe
Approved-by: dillon
2 weeks agosbin/hammer: Drop rerundant ()
Tomohiro Kusumi [Sun, 2 Jul 2017 20:01:40 +0000 (23:01 +0300)]
sbin/hammer: Drop rerundant ()

2 weeks agosbin/hammer: Fix get_buffer_data()'s wrong xor for undo buffer caching
Tomohiro Kusumi [Sat, 24 Jun 2017 23:17:09 +0000 (02:17 +0300)]
sbin/hammer: Fix get_buffer_data()'s wrong xor for undo buffer caching

As mentioned in 830ab40e
"sbin/hammer: Redo e4323571 partly (after reverted by 03d5db37)",
830ab40e (originally by e4323571) fixed a bug for get_buffer_data()
wrongly taking xor of zone-X offset and zone-2 offset, where X is
one of the direct zones other than zone-2.

This commit fixes it for indirect zone which is zone-3 (and only
zone-3 in this case). The reason zone-3 being different is because
zone-3 to zone-2 translation isn't direct mapped, but instead the
volume header has a pointer to big-blocks that belong to zone-3.

Also see 0942cbbc which made this xor bug clear.

2 weeks agosbin/hammer: Move cache to tailq end when get_buffer_data() has a valid cache
Tomohiro Kusumi [Sun, 2 Jul 2017 18:30:08 +0000 (21:30 +0300)]
sbin/hammer: Move cache to tailq end when get_buffer_data() has a valid cache

This is the same as what get_buffer() does when new allocation
is not needed. This hasn't been done in get_buffer_data() when
the given non NULL buffer is the one to look for.

This seems to make newfs_hammer a bit faster, as the i/o size is
normally large enough to invoke eviction of HAMMER userspace buffer
cache while running, starting from the head of the tailq.

-- before this commit
 # for x in 1 2 3 4 5; do
 > (time newfs_hammer -L TEST /dev/da1 /dev/da2 /dev/da3 > /dev/null) 2>&1 | grep real
 > done
 real    0m20.291s
 real    0m20.574s
 real    0m22.347s
 real    0m21.562s
 real    0m20.991s

-- with this commit
 # for x in 1 2 3 4 5; do
 > (time newfs_hammer -L TEST /dev/da1 /dev/da2 /dev/da3 > /dev/null) 2>&1 | grep real
 > done
 real    0m18.023s
 real    0m18.064s
 real    0m18.104s
 real    0m17.646s
 real    0m18.310s

2 weeks agosys/vfs/hammer: Fix a comment on nresolving PFS
Tomohiro Kusumi [Sat, 24 Jun 2017 21:56:58 +0000 (00:56 +0300)]
sys/vfs/hammer: Fix a comment on nresolving PFS

On nresolving a PFS, the entry name to be resolved is the PFS itself,
whether it's pointed to by a symlink or not.

Also note that a PFS doesn't necessarily require a symlink to point
to itself. A symlink is used only because the PFS itself isn't visible
to userspace via readdir(2) (i.e can't see with ls without a symlink...).

2 weeks agosys/vfs/hammer: Drop wrong info on inode# from hammer(5)
Tomohiro Kusumi [Sat, 24 Jun 2017 19:38:42 +0000 (22:38 +0300)]
sys/vfs/hammer: Drop wrong info on inode# from hammer(5)

PFS has nothing to do with namespace of inode#.

The only exception is the root inode# for PFS including PFS#0, which
are all 1. Another exceptional case is a master PFS and its slave PFS,
where corresponding files/dirs have the same inode#.

2 weeks agoipfw: Increate FIN states life time.
Sepherosa Ziehau [Thu, 6 Jul 2017 01:14:03 +0000 (09:14 +0800)]
ipfw: Increate FIN states life time.

So they will not be ripped prematurely, which may prevent FIN
retransmission from working.

2 weeks agoipfw: Don't allow state allocation to fail and use M_INTWAIT for states
Sepherosa Ziehau [Thu, 6 Jul 2017 00:39:57 +0000 (08:39 +0800)]
ipfw: Don't allow state allocation to fail and use M_INTWAIT for states

3 weeks agokernel - Automatically downscasle NPROC resource limit
Matthew Dillon [Wed, 5 Jul 2017 16:07:06 +0000 (09:07 -0700)]
kernel - Automatically downscasle NPROC resource limit

* Downscale the NPROC resource limit based on fork and chroot depth, up
  to 50%, and also make the limit apply to root processes.  This is intended
  to be a poor-man's safety, preventing run-away (root or other) process
  creation from completely imploding a system.

* Each level of fork() downscales the NPROC resource limit by 1/3%,
  capped at 32 levels (~10%)

* Each chroot (including that made by a jail) downscales the NPROC
  resource limit by 10%, up to 40%.

3 weeks agoRevert "Always use unix line endings"
zrj [Wed, 5 Jul 2017 10:05:19 +0000 (13:05 +0300)]
Revert "Always use unix line endings"

This reverts commit 74d54042dbade9a0b2e5830b9645fd12ebc978f4.

While Eitan Adler intension is understandable, it was done without normalizing
line endings in the repo first nor checking for contrib/ sources.
Global rule applied even for the binary files.

Discussed-with: swildner

3 weeks agosocket: Allow root to pass large buffer to getsockopt.
Sepherosa Ziehau [Wed, 5 Jul 2017 00:27:36 +0000 (08:27 +0800)]
socket: Allow root to pass large buffer to getsockopt.

This fixes IP_FW_GET with large amount of states; e.g. 30K~60K states.

3 weeks agoBump __DragonFly_version after PTHREAD_STACK_MIN increase
John Marino [Tue, 4 Jul 2017 17:20:06 +0000 (12:20 -0500)]
Bump __DragonFly_version after PTHREAD_STACK_MIN increase

3 weeks agoFix mixed line endings.
zrj [Tue, 4 Jul 2017 07:43:14 +0000 (10:43 +0300)]
Fix mixed line endings.

3 weeks agopthreads - Change PTHREAD_STACK_MIN
Matthew Dillon [Tue, 4 Jul 2017 02:58:19 +0000 (19:58 -0700)]
pthreads - Change PTHREAD_STACK_MIN

* Change PTHREAD_STACK_MIN from 1024 to 16384.  Most other platforms
  seems to use 16384.  Even 4096 can cause rtld failures.

* Fixes 'node', which defaults to configuring the pthreads stacksize to
  PTHREAD_STACK_MIN and then proceeded to implode.

Reported-by: tautology
3 weeks agokernel/acpica: Better check AcpiOsPredefinedOverride()'s InitVal argument.
Sascha Wildner [Mon, 3 Jul 2017 21:20:04 +0000 (23:20 +0200)]
kernel/acpica: Better check AcpiOsPredefinedOverride()'s InitVal argument.

Taken-from: FreeBSD

3 weeks agokernel/acpica: ACPI_THREAD_ID is unsigned.
Sascha Wildner [Mon, 3 Jul 2017 21:06:44 +0000 (23:06 +0200)]
kernel/acpica: ACPI_THREAD_ID is unsigned.

3 weeks agokernel/acpica: Remove no longer needed #include.
Sascha Wildner [Mon, 3 Jul 2017 19:09:46 +0000 (21:09 +0200)]
kernel/acpica: Remove no longer needed #include.

3 weeks agokernel/acpica: Return curthread as thread id from AcpiOsGetThreadId().
Sascha Wildner [Mon, 3 Jul 2017 18:53:23 +0000 (20:53 +0200)]
kernel/acpica: Return curthread as thread id from AcpiOsGetThreadId().

Discussed-with: ivadasz

3 weeks agoipfw: Remove context generation; the race it tries to fix no longer exists
Sepherosa Ziehau [Sun, 2 Jul 2017 18:40:20 +0000 (02:40 +0800)]
ipfw: Remove context generation; the race it tries to fix no longer exists

It was intend to fix the race when the configuration was running in the
deleted ifnet threads; now the configuration is running in the netisrs.

3 weeks agoSync ACPICA with Intel's version 20170629.
Sascha Wildner [Sat, 1 Jul 2017 10:08:04 +0000 (12:08 +0200)]
Sync ACPICA with Intel's version 20170629.

We skipped 20170531 due to a regression in the processing of resource
descriptors (see https://bugs.acpica.org/show_bug.cgi?id=1391) which
is fixed in 20170629.

* Support added for ACPI 6.2. Specification available at uefi.org.

* Fixes in ACPI table verification, signature validation, mutexes.

* Numerous other fixes and additions.

For a more detailed list, please see sys/contrib/dev/acpica/changes.txt

3 weeks agokernel/acpi: Call AcpiInitializeSubsystem() before AcpiInitializeTables().
Sascha Wildner [Sat, 1 Jul 2017 09:46:29 +0000 (11:46 +0200)]
kernel/acpi: Call AcpiInitializeSubsystem() before AcpiInitializeTables().

Per chapter "Required ACPICA Initialization Sequence" of the ACPICA
Programmer Reference.

Uncovered by recent table handling changes in ACPICA 20170629.

3 weeks agoroute: Cache align statistics.
Sepherosa Ziehau [Fri, 30 Jun 2017 01:23:57 +0000 (09:23 +0800)]
route: Cache align statistics.

Though these statistics are rarely updated; better safe the sorry.

Since it changes userland visible structure size, bump

3 weeks agoispfw.4: Remove extra .Pp
Sascha Wildner [Fri, 30 Jun 2017 08:44:23 +0000 (10:44 +0200)]
ispfw.4: Remove extra .Pp

3 weeks agonetinet: Static assert TCP/UDP/IP stats are cache line aligned.
Sepherosa Ziehau [Fri, 30 Jun 2017 00:37:25 +0000 (08:37 +0800)]
netinet: Static assert TCP/UDP/IP stats are cache line aligned.

3 weeks agokmalloc: Reduce ks_loosememuse update frequency.
Sepherosa Ziehau [Thu, 29 Jun 2017 19:39:32 +0000 (03:39 +0800)]
kmalloc: Reduce ks_loosememuse update frequency.

ks_loosememuse is shared by all CPUs, so this commit is intended to
reduce negative effect of cache pollution due to high ks_loosememuse
update frequency.

3 weeks agokernel/hptrr: Oops, fix some whitespace.
Sascha Wildner [Thu, 29 Jun 2017 19:34:53 +0000 (21:34 +0200)]
kernel/hptrr: Oops, fix some whitespace.

3 weeks agokernel: Sync hptrr(4) with FreeBSD.
Sascha Wildner [Thu, 29 Jun 2017 19:31:42 +0000 (21:31 +0200)]
kernel: Sync hptrr(4) with FreeBSD.

* A number of locking fixes, no longer grabs Giant in the ioctl() method
  (not relevant to us) and when scanning the bus. Also set D_MPSAFE and

* Use bus_dmamap_load_ccb(). Thanks, sephe!

* Additional fixes supplied by HighPoint.

* Fix some typos in comments.

3 weeks agokernel/isp: Unify firmware handling with the rest of the system.
Jan Sucan [Sun, 25 Jun 2017 10:27:24 +0000 (10:27 +0000)]
kernel/isp: Unify firmware handling with the rest of the system.

* Convert firmware binary data from C arrays in a header files to
  uuencode .uu files. Byte order of the firmware image is
  little-endian. As far as DragonFly BSD supports only little-endian
  architectures it's ok. But in case of a big-endian architecture the
  byte order must be changed before firmware is processed by the isp

* Move the .uu images to a sys/contrib/dev/isp.

* Add a script for conversion of firmware stored in arrays in the C
  header files to .uu files. This is for getting the firmware changes
  from the other BSD systems more easily.

* Remove use of ispfw module that contains firmwares for all of the
  isp.4 driver devices. User can pick a module for a particular device
  instead of having firmwares for all of the devices loaded.

* Document that the kitchen sink ispfw.ko module with all firmware is

Submitted-by: Jan Sucan
Dragonfly-bug: <https://bugs.dragonflybsd.org/issues/3044>

3 weeks agokmalloc: Avoid code duplication.
Sepherosa Ziehau [Thu, 29 Jun 2017 01:37:26 +0000 (09:37 +0800)]
kmalloc: Avoid code duplication.

3 weeks agokmalloc: Minor style changes; no functional changes.
Sepherosa Ziehau [Thu, 29 Jun 2017 01:14:41 +0000 (09:14 +0800)]
kmalloc: Minor style changes; no functional changes.

4 weeks agobusdma: Add bus_dmamap_load_ccb; ease driver porting from FreeBSD.
Sepherosa Ziehau [Thu, 29 Jun 2017 00:20:22 +0000 (08:20 +0800)]
busdma: Add bus_dmamap_load_ccb; ease driver porting from FreeBSD.

4 weeks agokmalloc: Minor style changes; no functional changes.
Sepherosa Ziehau [Thu, 29 Jun 2017 00:02:44 +0000 (08:02 +0800)]
kmalloc: Minor style changes; no functional changes.

4 weeks agokmalloc: Update comment
Sepherosa Ziehau [Wed, 28 Jun 2017 23:39:50 +0000 (07:39 +0800)]
kmalloc: Update comment

4 weeks agomalloc: Make # of calls statistic per-cpu.
Sepherosa Ziehau [Tue, 27 Jun 2017 23:13:22 +0000 (07:13 +0800)]
malloc: Make # of calls statistic per-cpu.

While I'm here, remove unused fields from malloc_type.

Bump __DragonFly_version.

4 weeks agoipfw3_nat: move housekeeping into callout func
Bill Yuan [Mon, 26 Jun 2017 15:41:26 +0000 (23:41 +0800)]
ipfw3_nat: move housekeeping into callout func

4 weeks agolibalias: pointer for house keeping func
Bill Yuan [Mon, 26 Jun 2017 15:31:59 +0000 (23:31 +0800)]
libalias: pointer for house keeping func

4 weeks agoipfw3_nat: callout func for nat record cleaning
Bill Yuan [Mon, 26 Jun 2017 15:18:38 +0000 (23:18 +0800)]
ipfw3_nat: callout func for nat record cleaning

4 weeks agoipfw3_nat: new sysctl node 'cleanup_interval'
Bill Yuan [Mon, 26 Jun 2017 15:08:48 +0000 (23:08 +0800)]
ipfw3_nat: new sysctl node 'cleanup_interval'

4 weeks agoipfw3_nat: move func prototype into header
Bill Yuan [Mon, 26 Jun 2017 15:03:36 +0000 (23:03 +0800)]
ipfw3_nat: move func prototype into header