dragonfly.git
8 years agols(1): Return previous long format for C/POSIX locales
John Marino [Fri, 20 Nov 2015 15:32:52 +0000 (16:32 +0100)]
ls(1): Return previous long format for C/POSIX locales

The output of ls -l for POSIX locales is covered by the POSIX standard.
The previous implementation was not compliance with the handling of
future timestamps.  The standard requires that future timestamps always
show the year where as previously it would only show the year if the
file's modification time was less than 6 months into the future.

This change detects if C/POSIX LC_TIME is specified, and if so, it
implements the long format as specified by the POSIX standard.  The
ISO 8601 format is still used for named locales.

Reported by: swildner

8 years agosys/vfs/hammer: Fix comments
Tomohiro Kusumi [Thu, 19 Nov 2015 17:32:45 +0000 (02:32 +0900)]
sys/vfs/hammer: Fix comments

/* (not including atime/mtime) */
was supposed to be for HAMMER_INODE_DDIRTY according to ddfdf542.

8 years agosys/vfs/hammer: Remove HAMMER_RECTYPE_UNUSED02/03 macros
Tomohiro Kusumi [Thu, 19 Nov 2015 16:58:31 +0000 (01:58 +0900)]
sys/vfs/hammer: Remove HAMMER_RECTYPE_UNUSED02/03 macros

These macros aren't used.
Also macros from 0x4 to 0xF do not exist, then it's natural
not to have UNUSED macros for 0x2 and 0x3.

8 years agols(1): Alter time portion of "long format"
John Marino [Fri, 20 Nov 2015 12:49:26 +0000 (13:49 +0100)]
ls(1): Alter time portion of "long format"

One side effect of moving to the CLDR standard for locale definitions
is that abreviated months are no longer guaranteed to align.  We altered
the definitions for CJK to ensure this, but we do not want to manually
adjust every locale.

The most obvious manifestation is seen with ls(1) using the long format
(-l option).  Not only is the month abbreviation no longer guaranteed to
be 3 characters wide, it's not even guaranteed to be a uniform width.  As
a result, the file listing may no longer line up, as seen with French:

  ironwolf# env LANG=fr_FR.UTF-8 ls -l | head
  drwxr-xr-x  2 root  wheel   512 26 mars  2015 ariadne
  drwxr-xr-x  2 root  wheel   512 26 mars  2015 artemis
  drwxr-xr-x  3 root  wheel   512  9 sept. 19:45 avida
  drwxr-xr-x  3 root  wheel   512  9 sept. 19:45 babel
  drwxr-xr-x  3 root  wheel   512 15 juin 20:38 bcftools
  drwxr-xr-x  2 root  wheel   512 20 sept. 11:27 biococoa
  drwxr-xr-x  2 root  wheel   512 26 mars  2015 biojava
  drwxr-xr-x  3 root  wheel   512 26 mars  2015 blat
  drwxr-xr-x  3 root  wheel   512  7 nov. 08:44 bwa

  ironwolf# env LANG=fr_FR.UTF-8 ls -lT | head
  drwxr-xr-x  2 root  wheel   512 26 mars 10:15:28 2015 ariadne
  drwxr-xr-x  2 root  wheel   512 26 mars 10:15:28 2015 artemis
  drwxr-xr-x  3 root  wheel   512  9 sept. 19:45:04 2015 avida
  drwxr-xr-x  3 root  wheel   512  9 sept. 19:45:04 2015 babel
  drwxr-xr-x  3 root  wheel   512 15 juin 20:38:55 2015 bcftools
  drwxr-xr-x  2 root  wheel   512 20 sept. 11:27:40 2015 biococoa
  drwxr-xr-x  2 root  wheel   512 26 mars 10:15:28 2015 biojava
  drwxr-xr-x  3 root  wheel   512 26 mars 10:15:28 2015 blat
  drwxr-xr-x  3 root  wheel   512  7 nov. 08:44:24 2015 bwa

To address both issues (misalignment and differing widths as a function
of locale), I've modified ls(1) to use valid forms of ISO 8601, an
international standard for the representation of time.

The default long format produces the last modified timestamp in the form
of YYYYMMDDTHH (Year|Month|Day|T|Hour with no spaces).  This is known as
the "basic" format which includes the optional "T" concatenator.  The
result is the time is represented by a single column using 1-3 characters
less than before.

  ironwolf# env LANG=fr_FR.UTF-8 ls -l | head
  drwxr-xr-x  2 root  wheel   512 20150326T10 ariadne
  drwxr-xr-x  2 root  wheel   512 20150326T10 artemis
  drwxr-xr-x  3 root  wheel   512 20150909T19 avida
  drwxr-xr-x  3 root  wheel   512 20150909T19 babel
  drwxr-xr-x  3 root  wheel   512 20150615T20 bcftools
  drwxr-xr-x  2 root  wheel   512 20150920T11 biococoa
  drwxr-xr-x  2 root  wheel   512 20150326T10 biojava
  drwxr-xr-x  3 root  wheel   512 20150326T10 blat
  drwxr-xr-x  3 root  wheel   512 20151107T08 bwa

The -T option uses the extended format of ISO 8601 without the T symbol,
but with the minutes and seconds representation.  The result is two
characters wider than the approach FreeBSD is taking to address the same
issue (FreeBSD is padding the month section and expanding the field by
two characters to accommodate 5-character wide month names).  The output
on DragonFly looks like this:

  ironwolf# env LANG=fr_FR.UTF-8 ls -lT | head
  drwxr-xr-x  2 root  wheel   512 2015-03-26 10:15:28 ariadne
  drwxr-xr-x  2 root  wheel   512 2015-03-26 10:15:28 artemis
  drwxr-xr-x  3 root  wheel   512 2015-09-09 19:45:04 avida
  drwxr-xr-x  3 root  wheel   512 2015-09-09 19:45:04 babel
  drwxr-xr-x  3 root  wheel   512 2015-06-15 20:38:55 bcftools
  drwxr-xr-x  2 root  wheel   512 2015-09-20 11:27:40 biococoa
  drwxr-xr-x  2 root  wheel   512 2015-03-26 10:15:28 biojava
  drwxr-xr-x  3 root  wheel   512 2015-03-26 10:15:28 blat
  drwxr-xr-x  3 root  wheel   512 2015-11-07 08:44:24 bwa

The long format no longer changes if the last modified time is within six
months (future or past), thus file times are more quickly comparable with
a quick visual scan versus switching between year and hours:seconds.

Reported by: bapt@FreeBSD.org

8 years agoig: Factor out functions for flow control
Sepherosa Ziehau [Fri, 20 Nov 2015 07:34:52 +0000 (15:34 +0800)]
ig: Factor out functions for flow control

8 years agoigb: Support flow control change and default to RX pause
Sepherosa Ziehau [Fri, 20 Nov 2015 06:40:27 +0000 (14:40 +0800)]
igb: Support flow control change and default to RX pause

8 years agoem: Support flow control change and default to RX pause
Sepherosa Ziehau [Fri, 20 Nov 2015 06:03:54 +0000 (14:03 +0800)]
em: Support flow control change and default to RX pause

8 years agoemx: Add per-device flow control tunable support
Sepherosa Ziehau [Fri, 20 Nov 2015 03:41:24 +0000 (11:41 +0800)]
emx: Add per-device flow control tunable support

8 years agodevice: Add device_getenv_string()
Sepherosa Ziehau [Fri, 20 Nov 2015 03:23:55 +0000 (11:23 +0800)]
device: Add device_getenv_string()

8 years agodevice: Prefer dev.driver.unit.knob for per-device tunables.
Sepherosa Ziehau [Fri, 20 Nov 2015 03:13:14 +0000 (11:13 +0800)]
device: Prefer dev.driver.unit.knob for per-device tunables.

This is consistent w/ the sysctl tree structure.

8 years agoemx: Support flow control change and default to RX pause
Sepherosa Ziehau [Fri, 20 Nov 2015 02:57:09 +0000 (10:57 +0800)]
emx: Support flow control change and default to RX pause

Tested-by: dillon@
8 years agokern/lwp: Check lwp_lock before remove lwp from process lwp tree
Sepherosa Ziehau [Fri, 20 Nov 2015 02:12:57 +0000 (10:12 +0800)]
kern/lwp: Check lwp_lock before remove lwp from process lwp tree

This makes sure that lwp tree iteration with blocking operation
will not be broken.

While I'm here, add assertion lwp_lock == 0 in lwp_dispose()

8 years agoradeonkms.4: Document drm.radeon.backlight tunable.
Imre Vadász [Thu, 19 Nov 2015 23:10:00 +0000 (00:10 +0100)]
radeonkms.4: Document drm.radeon.backlight tunable.

After the update of radeonkms(4) to Linux 3.18 level, I have to set
drm.radeon.backlight=1 in my loader.conf to get backlight control
via hw.backlight_level on my HP6715s notebook with an RS690 IGP.

8 years agodrm: Plug memleak on module unload, in linux_workqueue.c again.
Imre Vadasz [Thu, 19 Nov 2015 20:51:31 +0000 (21:51 +0100)]
drm: Plug memleak on module unload, in linux_workqueue.c again.

Destroy the system_power_efficient_wq on module unload, like the
other workqueues.

8 years agofortune: Do not recommend obsolete encodings
François Tigeot [Thu, 19 Nov 2015 16:52:36 +0000 (17:52 +0100)]
fortune: Do not recommend obsolete encodings

8 years agosys/dev/disk/dm: Add dm-flakey target
Tomohiro Kusumi [Sun, 15 Nov 2015 10:22:47 +0000 (19:22 +0900)]
sys/dev/disk/dm: Add dm-flakey target

This commit adds a new dm target dm-flakey.

This target simulates failing devices for testing purposes.
See dm_target_flakey(4) for details.

Note that using this dm target may results in some unstable
status including kernel panic. For example hammer is likely
to cause kernel panic by write data corruption by dm-flakey.
Don't use this target over any block device in production.

  ===== Example1 - Error write I/Os
  # kldload dm_target_flakey
  # dmsetup create flakey1 --table "0 234436482 flakey ${DEV} 0 1 1"
  # newfs_hammer -L TEST /dev/mapper/flakey1
  Volume 0 DEVICE /dev/mapper/flakey1 size 111.79GB
  initialize freemap volume 0
  initializing the undo map (504 MB)
  newfs_hammer: Write volume 0 (/dev/mapper/flakey1): Input/output error
  # dmsetup remove /dev/mapper/flakey1

  ===== Example2 - Silently drop write I/Os
  # newfs_hammer -L TEST ${DEV} > /dev/null
  # mount_hammer ${DEV} /HAMMER
  # cd /HAMMER
  # git clone /usr/local/src/dragonfly
  Cloning into 'dragonfly'...
  done.
  Checking out files: 100% (34434/34434), done.
  # cd
  # umount /HAMMER
  # dmsetup create flakey2 --table "0 234436482 flakey ${DEV} 0 1 1 1 drop_writes"
  # mount_hammer /dev/mapper/flakey2 /HAMMER
  # dmesg | tail -3
  HAMMER() Critical error inode=-1 error=5 while flushing meta-data
  HAMMER() Forcing read-only mode
  HAMMER(TEST) mounted clean, no recovery needed
  # hammer volume-list /HAMMER
  /dev/mapper/flakey2
  # mount | grep "/HAMMER"
  TEST on /HAMMER (hammer, local, read-only)
  # cd /HAMMER/dragonfly
  # git log -p > /dev/null; echo $?
  0
  # cd
  # umount /HAMMER
  # dmsetup remove /dev/mapper/flakey2

  ===== Example3 - Corrupt read I/Os
  # dd if=/dev/zero of=${DEV} bs=1024 count=10000 >/dev/null 2>&1
  # dmsetup create flakey3 --table "0 234436482 flakey ${DEV} 0 1 1 5 corrupt_bio_byte 1 r 65 0"
  # od -tx1 /dev/mapper/flakey3 | head -10
  0000000    41  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0000020    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  *
  0010000    41  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0010020    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  *
  0020000    41  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0020020    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  *
  0030000    41  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  # dmsetup remove /dev/mapper/flakey3
  # kldunload dm_target_flakey

8 years agosys/dev/disk/dm: Cleanup header includes
Tomohiro Kusumi [Thu, 19 Nov 2015 12:22:22 +0000 (21:22 +0900)]
sys/dev/disk/dm: Cleanup header includes

dm.h depends on <sys/vnode.h>, so dm.h should include it
instead of having c files that depend on dm.h include it.

8 years agosys/kern/vfs: Fix panic message
Tomohiro Kusumi [Wed, 18 Nov 2015 16:50:01 +0000 (01:50 +0900)]
sys/kern/vfs: Fix panic message

Show # of pushed bios.

8 years agocontrib/lvm2: Remove unnecessary space at the end of line
Tomohiro Kusumi [Wed, 18 Nov 2015 12:04:47 +0000 (21:04 +0900)]
contrib/lvm2: Remove unnecessary space at the end of line

Having " %s" at the end of printf format prints unnecessary
space at the end of line when dm targets have nothing to print
for dmsetup status/table.

If dm targets don't implement status/table, use printf format
without " %s", since those targets only initialize the string
with "".

(This fix doesn't exist in upstream lvm2)

8 years agopthread: Add lwp_setname(2) and implement pthread_set_name_np(3)
Sepherosa Ziehau [Thu, 19 Nov 2015 03:37:28 +0000 (11:37 +0800)]
pthread: Add lwp_setname(2) and implement pthread_set_name_np(3)

- Return thread name through kinfo.
- Show thread name in ps(1) for 'Hc'.
- Show thread name in top(1), if it is different from process name.

8 years agodrm/radeon: Update to Linux 3.18
François Tigeot [Thu, 19 Nov 2015 08:03:20 +0000 (09:03 +0100)]
drm/radeon: Update to Linux 3.18

Mostly bugfixes and audio refactoring, no new functionalities.

This update has been prepared by Rimvydas Jasinskas.

8 years agokinfo/proc: Set nthreads properly for kernel threads
Sepherosa Ziehau [Thu, 19 Nov 2015 07:45:01 +0000 (15:45 +0800)]
kinfo/proc: Set nthreads properly for kernel threads

8 years agodrm: Add jiffies_to_usecs and nsecs_to_jiffies64()
François Tigeot [Thu, 19 Nov 2015 07:31:48 +0000 (08:31 +0100)]
drm: Add jiffies_to_usecs and nsecs_to_jiffies64()

8 years agotop: Fix header name and width for process running cpu.
Sepherosa Ziehau [Thu, 19 Nov 2015 07:07:13 +0000 (15:07 +0800)]
top: Fix header name and width for process running cpu.

While I'm here, remove no longer displayed columns from manpage.

8 years agohammer2 - stabilization pass on slave sync (2)
Matthew Dillon [Thu, 19 Nov 2015 06:58:19 +0000 (22:58 -0800)]
hammer2 - stabilization pass on slave sync (2)

* Augment xop_scanall to allow flags to be passed in.

* Implement HMNT2_LOCAL (-o local) flag for debugging cluster elements.

* Fix missing data panic by resolving chain data in the slave sync scan.

* Fix PFS installation ioctl to add the new PFS to the cluster as
  appropriate.

* Numerous cleanups and fixes to the slave sync code which was previously
  ripped up by the XOPs work.  Note that the slave sync code still has tons
  of issues and races.

8 years agohammer2 - hammer2_mount work
Matthew Dillon [Thu, 19 Nov 2015 06:56:45 +0000 (22:56 -0800)]
hammer2 - hammer2_mount work

* Add mount options parsing.

* Add '-o local' which on the initial device mount will forcefully
  disable clustering, allowing individual elements to be mounted
  separately and compared (for debugging).

8 years agohammer2 - stabilization pass on slave sync
Matthew Dillon [Wed, 18 Nov 2015 22:54:01 +0000 (14:54 -0800)]
hammer2 - stabilization pass on slave sync

* Add a temporary hack which avoids a NULL pointer panic.  This goes a long
  way to stabilizing the backend slave sync threads.

8 years agohammer2 - Add 'info' and 'mountall' directives
Matthew Dillon [Wed, 18 Nov 2015 07:02:00 +0000 (23:02 -0800)]
hammer2 - Add 'info' and 'mountall' directives

* hammer2 info - scans all block devices with hammer2 partitions and
  displays available super-root entries.

* hammer2 mountall - scans all block devices with hammer2 partitions
  and mounts their @LOCAL PFS in /var/hammer2/LOCAL.serno.s%d%c
  in the background, waiting until the mounts complete or 15 seconds
  without a status change.

  The idea here is to bring all local block devices online, allowing
  all PFS's related to the H2 block devices to become active (mounting
  one makes them all available), but still giving the system operator
  the ability to idle a block device for maintenance by dismounting
  all of its actively-mounted PFSs.

  A bit confusing, the feature will be ironed out later.

8 years agokern: Hold lwp before possible blocking operation
Sepherosa Ziehau [Wed, 18 Nov 2015 06:52:51 +0000 (14:52 +0800)]
kern: Hold lwp before possible blocking operation

Confirmed-by: dillon@
8 years agoloader - Add nfsroot tunables to manual.
Matthew Dillon [Wed, 18 Nov 2015 02:55:28 +0000 (18:55 -0800)]
loader - Add nfsroot tunables to manual.

* Add nfsroot.iosize and nfsroot.rahead to the loader.8 manual page.

8 years agokernel - Improve netbooted root NFS mounts and allow tunable overrides.
Matthew Dillon [Wed, 18 Nov 2015 02:46:11 +0000 (18:46 -0800)]
kernel - Improve netbooted root NFS mounts and allow tunable overrides.

* Add two tunables and set the default read-ahead for netbooted root
  mounts to 4.

  nfsroot.iosize defaults to 8192
  nfsroot.rahead defaults to 4

* The default iosize must remain 8192 as many NFS servers can't handle
  32768, but if your nfs server is on a DragonFly box you can override it
  in your /boot/loader.conf, setting it to 32768.

  With the improved read-ahead default, read performance should improve
  significantly on netbooted root mounts.  With the combination of the new
  default read ahead and nfsroot.iosize=32768, read performance should be
  able to max-out a GigE link (100+ MBytes/sec) (assuming the originating
  storage can push that rate).

* Does not effect add-on nfs mounts in /etc/fstab which already used a
  reasonable read-ahead setting.

8 years agotop: Put kernel idle threads, i.e. idle_X to the end of the processes list
Sepherosa Ziehau [Wed, 18 Nov 2015 02:00:43 +0000 (10:00 +0800)]
top: Put kernel idle threads, i.e. idle_X to the end of the processes list

8 years agotop: Fix up processes cpu usage percentage using uticks+sticks+iticks
Sepherosa Ziehau [Tue, 17 Nov 2015 12:55:29 +0000 (20:55 +0800)]
top: Fix up processes cpu usage percentage using uticks+sticks+iticks

8 years agohammer2 - Present hardlink solution, misc stability work
Matthew Dillon [Wed, 18 Nov 2015 01:21:14 +0000 (17:21 -0800)]
hammer2 - Present hardlink solution, misc stability work

* The H2 design has had a long-standing problem of losing track of
  hardlinks when intermediate directories are renamed, breaking the
  common-parent-directory design for the inode target.

  Fix this issue by placing the hardlink target in the first common
  parent directory chflagged 'xlink' (or the root of the mount if
  no parent is chflagged 'xlink').  Thus, by default, hardlink targets
  for cross-directory situations will be placed in the root of the mount
  and thus no confusion can ever occur if a mid-path directory is moved
  within the hierarchy.

* This change does not modify the behavior of placing the hardlink target
  in the same directory as the hardlink pointers when they are all in the
  same directory.

* installworld now chflags /*, /usr/*, /var/*, and /home/* 'xlink'.

* Note that hardlink and rename operations across 'xlink' boundaries
  are disallowed (for obvious reasons), but system operators have very
  rarely used hardlinks in major directory crossings.  However, we might
  be pushing it a bit much to automatically chflag /home/*.

  In the past there have been a few minor situations where major-crossing
  hardlinks are attempted.  'lpr' for example tries to hardlink a user
  file into /var/spool, but will copy it if it cannot.  Similarly there
  have been situations in the past where hardlinks between home directories
  have been used to save space, but franklyl softlinks can be used almost
  as easily and such situations have fallen into disfavor.

* Stability improvements to the XOP FIFO mechanics, locking cleanups.

8 years agolibc - Add 'xlink' chflags
Matthew Dillon [Tue, 17 Nov 2015 23:19:42 +0000 (15:19 -0800)]
libc - Add 'xlink' chflags

* Add the xlink flag.  This will be used by hammer2 to demark boundaries
  where cross-link hardlinks will not be allowed.  In otherwords, this tells
  hammer2 how far up the directory tree it has to store the inode used for
  a hardlink.

* Automatically set the xlink flag for /*, /usr/*, and /var/*.

* Note that for the case where all hardlinks are situated in the same
  directory, hammer2 will place the hardlink inode in that directory.
  It is when hardlinks cross directories that hammer2 has to emplace the
  target inode in some parent directory where it can find it.  This is
  where the xlink flag helps.

  It is not required to use the xlink flag, but if you have cross-directory
  hardlinks in hammer2 and you do not use the flag the inodes for those
  hardlinks will be consolidated at the root of the mount which will have
  obvious performance issues and cause snapshots of subdirectories to be
  imprecise because they won't cover the hardlink target.

* Represents a trade-off for a very difficult problem that I haven't been
  able to solve.  While HAMMER2 can easily calculate a common parent
  directory for the hardlink target inode when hardlinks are created or
  deleted or renamed, problems arise when a directory in the directory
  path leading from that point to the hardlink is radically moved within
  the larger directory hierarchy, breaking the ability for hammer2 to locate
  the hardlink target using the above method.

  Rather than force hardlinks to be stored in the root of the mount, which
  reduces the usefulness of subdirectory snapshots, this new mechanism is
  being added to give the sysop the ability to retain nearly all the
  advantages of hardlinks without losing the ability to snapshot reasonable
  subdirectory elements.

8 years agosyscons: Keep screen content and cursor pos when switching to kms console.
Imre Vadász [Wed, 11 Nov 2015 20:53:03 +0000 (21:53 +0100)]
syscons: Keep screen content and cursor pos when switching to kms console.

8 years agovknet - Avoid zombie ssh processes being left when reconnecting.
Imre Vadasz [Wed, 22 Oct 2014 10:31:16 +0000 (12:31 +0200)]
vknet - Avoid zombie ssh processes being left when reconnecting.

8 years agodrm/i915: Use signal_pending()
François Tigeot [Tue, 17 Nov 2015 20:43:44 +0000 (21:43 +0100)]
drm/i915: Use signal_pending()

8 years agosys/dev/disk/dm: Minor targets fixes
Tomohiro Kusumi [Sun, 15 Nov 2015 11:36:25 +0000 (20:36 +0900)]
sys/dev/disk/dm: Minor targets fixes

8 years agosys/dev/disk/dm: Cleanup header includes
Tomohiro Kusumi [Tue, 17 Nov 2015 07:36:02 +0000 (16:36 +0900)]
sys/dev/disk/dm: Cleanup header includes

8 years agosys/dev/disk/dm: Cleanups
Tomohiro Kusumi [Fri, 13 Nov 2015 11:39:43 +0000 (20:39 +0900)]
sys/dev/disk/dm: Cleanups

* Fix comments.
* Add a blank line between functions.
* Some minor fixes on dm core.

8 years agokinfo: Set kernel idle threads state to SIDL.
Sepherosa Ziehau [Tue, 17 Nov 2015 07:53:31 +0000 (15:53 +0800)]
kinfo: Set kernel idle threads state to SIDL.

So idle threads could be detected in a better way.  Utilize this
in top(1).

8 years agoudp: Wakeup callers sleeping on failed to connect socket.
Sepherosa Ziehau [Tue, 17 Nov 2015 06:51:00 +0000 (14:51 +0800)]
udp: Wakeup callers sleeping on failed to connect socket.

8 years agosound/dsp: Fix nonblocking support.
Sepherosa Ziehau [Tue, 17 Nov 2015 06:25:29 +0000 (14:25 +0800)]
sound/dsp: Fix nonblocking support.

Discussed-with: dillon@
Tested-by: dillon@ and me
8 years agobus: Fix devctl nonblocking support.
Sepherosa Ziehau [Tue, 17 Nov 2015 02:36:37 +0000 (10:36 +0800)]
bus: Fix devctl nonblocking support.

Discussed-with: dillon@

8 years agokernel: Remove more syslink remains (headers and a define).
Sascha Wildner [Mon, 16 Nov 2015 19:56:23 +0000 (20:56 +0100)]
kernel: Remove more syslink remains (headers and a define).

The only related header remaining is <sys/syslink_rpc.h> which is
heavily used (struct syslink_desc), so we'd have to untangle that
first.

8 years ago<unistd.h>: Remove unwhiteout() prototype. We never had this function.
Sascha Wildner [Mon, 16 Nov 2015 17:35:46 +0000 (18:35 +0100)]
<unistd.h>: Remove unwhiteout() prototype. We never had this function.

8 years agokernel: Fix three declarations of (obsolete) syscalls.
Sascha Wildner [Mon, 16 Nov 2015 17:22:31 +0000 (18:22 +0100)]
kernel: Fix three declarations of (obsolete) syscalls.

This mainly fixes some comments and strings in generated files.

8 years agokernel/slip: Remove opt_slip.h inclusion, which is no longer needed.
Sascha Wildner [Mon, 16 Nov 2015 16:54:59 +0000 (17:54 +0100)]
kernel/slip: Remove opt_slip.h inclusion, which is no longer needed.

8 years agokinfo: Zero-out pctcpu for zombie processes
Sepherosa Ziehau [Mon, 16 Nov 2015 14:04:27 +0000 (22:04 +0800)]
kinfo: Zero-out pctcpu for zombie processes

8 years agotop: Use kp_ktaddr as kernel thread 'id'
Sepherosa Ziehau [Mon, 16 Nov 2015 13:52:26 +0000 (21:52 +0800)]
top: Use kp_ktaddr as kernel thread 'id'

Thread names are not unique, e.g. "usbusX" and "usched X"

8 years agokinfo: Deliver address of kernel thread
Sepherosa Ziehau [Mon, 16 Nov 2015 13:51:33 +0000 (21:51 +0800)]
kinfo: Deliver address of kernel thread

It could be used as "relatively" unique id for kernel threads.

8 years agoRemove obsolete SLIP_IFF_OPTS kernel option (now net.sliffopts tunable).
Sascha Wildner [Mon, 16 Nov 2015 10:05:19 +0000 (11:05 +0100)]
Remove obsolete SLIP_IFF_OPTS kernel option (now net.sliffopts tunable).

8 years agoUpdate the pciconf(8) database.
Sascha Wildner [Mon, 16 Nov 2015 09:56:01 +0000 (10:56 +0100)]
Update the pciconf(8) database.

November 8, 2015 snapshot from http://pciids.sourceforge.net/

8 years agoAlways build world under C/POSIX locale
John Marino [Sun, 15 Nov 2015 17:41:58 +0000 (18:41 +0100)]
Always build world under C/POSIX locale

8 years agogold linker: Fix SYSROOT definition (unbreaks world for some)
John Marino [Sun, 15 Nov 2015 23:11:53 +0000 (00:11 +0100)]
gold linker: Fix SYSROOT definition (unbreaks world for some)

The linkers are supposed to have a different system rool for the
crosstool versions, but this was not working for the gold linker.  As
a result, the host libraries are getting picked up instead of the
world object lib directories.

This commit fixes the build problem.  As a result, a local modification
to a gold source file is been removed (for 2.24 and 2.25)

8 years agoRemove offsetof definitions from binutils* sysdep.h
John Marino [Sun, 15 Nov 2015 16:23:21 +0000 (17:23 +0100)]
Remove offsetof definitions from binutils* sysdep.h

There's a guard to prevent redefinition of offsetof.  The problem is that
the <sys/cdefs.h> definition comes in just after, so it's still redefined.
Just remove the definition from sysdep.h and use the DF version (this
avoids a bunch of redefinition warnings during building)

8 years agoBlock out two more _Noreturn redefinitions
John Marino [Sun, 15 Nov 2015 14:30:40 +0000 (15:30 +0100)]
Block out two more _Noreturn redefinitions

8 years agoinpcb: Unbreak SO_REUSEPORT support.
Sepherosa Ziehau [Sun, 15 Nov 2015 14:58:53 +0000 (22:58 +0800)]
inpcb: Unbreak SO_REUSEPORT support.

inp_lport must not be whacked when inpcb is removed from local
port hash, since the inp_lport will be used to locate local group
Use inp_phd instead to detect whether the inpcb is on local port
hash or not.

This is a bug introduced by part of:
296c350d3c63a181744b80a4b7973dac5fc162a3

8 years agoudp: Fix bind races due to async close and random socket inital msgport
Sepherosa Ziehau [Sun, 15 Nov 2015 14:02:55 +0000 (22:02 +0800)]
udp: Fix bind races due to async close and random socket inital msgport

Bind for UDP sockets is now serialized by local port based netisr.  And
on detach path, the UDP inpcb is removed from local port hash before
other netisrs are synchronized, so that the local port for the detaching
UDP inpcb could be recycled timely.

8 years agotcp: Fix bind races due to async close and random socket inital msgport
Sepherosa Ziehau [Sun, 15 Nov 2015 12:19:11 +0000 (20:19 +0800)]
tcp: Fix bind races due to async close and random socket inital msgport

Bind for TCP sockets is now serialized by netisr0.  Add comment about
this bind race.

Reported-by: Justin Sherrill
8 years agolibstdc++ (5.0): Modify to allow clang 3.6+ to used C99 functions
John Marino [Sun, 15 Nov 2015 12:17:13 +0000 (13:17 +0100)]
libstdc++ (5.0): Modify to allow clang 3.6+ to used C99 functions

The "throw()" attributes in libstdc++ are unique to GCC, so when clang 3.6+
tries to use them, a prototype mismatch error comes up.  This modification
allows clang to use the entire libstdc++.

8 years agolibdiffutils: Don't "predefine" _Noreturn
John Marino [Sun, 15 Nov 2015 12:15:54 +0000 (13:15 +0100)]
libdiffutils: Don't "predefine" _Noreturn

Libdiffutils config.h defines _Noreturn which causes a redefinition warning
when <sys/cdefs> defines it afterward.  Comment it out to prevent the warnings.

8 years agoTweak cdefs.h (no functional change)
John Marino [Sun, 15 Nov 2015 10:49:21 +0000 (11:49 +0100)]
Tweak cdefs.h (no functional change)

This check was bothering me so I tighted it up.

We should think about removing all these GNUC version checks for at
least GCC 4.2.1 and below.  I suspect DF will not build with less
than GCC 4.4 in any case, but certainly GCC 3 and below could never
be used, so these definitions that depend on GCC 2, 3 will never
fail thus they should be set uncondionally to clean this header up.

8 years agoSwitch to using gold linker by default
John Marino [Sat, 14 Nov 2015 14:26:33 +0000 (15:26 +0100)]
Switch to using gold linker by default

DragonFly has always used the "GNU ld" linker to build itself.  Now that
the ELF boot loader has been fixed to handle zero-offset headers (seen
with zero-length ELF notes), the newer gold linker can handle being the
default.  That's what this commit does.

People can continue with the classic linker by putting the following in
/etc/make.conf:  WORLD_LDVER=ld.bfd
... and setting "LDVER=ld.bfd" in their environment.

The gold linker does not use the bfd library and thus is limited to the
ELF format (fine for DF).  It's code is much cleaner (c++), so it's easy
to understand and modify, and it reportedly links complex c++ object
files significantly faster than the BFD-based linker.  Both linkers are
written by the same person, Ian Lance Taylor.

8 years agoRestore buildworld from clang (adjust libm)
John Marino [Sat, 14 Nov 2015 17:12:05 +0000 (18:12 +0100)]
Restore buildworld from clang (adjust libm)

Functions like "isinff" come from GCC only, causes a missed reference when
the world is built with clang.  To solve, bring back FreeBSD versions of
round(|f|l).  An additional benefit is that these functions appear to be
improved over the OpenBSD versions (avoids unnecessary conversions).  The
FreeBSD roundl uses ENTERI/RETURNI macros so I left these off meaning DF
will still not able to raise exceptions on roundl.

Since isinff and friends are no longer used, clang can continue further with
building the world.

8 years agoRestore buildworld using clang (XZ)
John Marino [Sat, 14 Nov 2015 15:03:25 +0000 (16:03 +0100)]
Restore buildworld using clang (XZ)

The new XZ was configured using GCC and thus clang will fail when building
liblzma due to missing a gcc-specific header.  This added check will restore
building DragonFly with clang.

8 years agodrm: Fix previous commit
Imre Vadasz [Sat, 14 Nov 2015 14:06:43 +0000 (15:06 +0100)]
drm: Fix previous commit

8 years agodrm: Handle DRM_CAP IOCTLs for querying cursor width and height.
Imre Vadasz [Sat, 14 Nov 2015 14:06:43 +0000 (15:06 +0100)]
drm: Handle DRM_CAP IOCTLs for querying cursor width and height.

Fixes cursor corruption on my AMD Kaveri APU.

Taken-from: 8716ed4e7bed4e4c7e3f37940e950ddc0362f450 (linux)

8 years agodrm: Import memchr_inv() from NetBSD
François Tigeot [Sat, 14 Nov 2015 14:19:47 +0000 (15:19 +0100)]
drm: Import memchr_inv() from NetBSD

8 years agoboot loader: Improve code of elf header initialization
John Marino [Sat, 14 Nov 2015 13:26:11 +0000 (14:26 +0100)]
boot loader: Improve code of elf header initialization

This has been driving me crazy.  This change has no practical difference,
but I didn't like seeing the code loop through headers twice for no good
reason.  This moves all the initialization to a single loop.

8 years agodrm: Implement a few missing functions from linux/timer.h
François Tigeot [Sat, 14 Nov 2015 11:15:59 +0000 (12:15 +0100)]
drm: Implement a few missing functions from linux/timer.h

8 years agodrm: Add list_replace_init()
François Tigeot [Sat, 14 Nov 2015 11:11:38 +0000 (12:11 +0100)]
drm: Add list_replace_init()

Obtained from: drm/radeon's mkregtable.c

8 years agodrm: Implement signal_pending()
François Tigeot [Sat, 14 Nov 2015 10:44:23 +0000 (11:44 +0100)]
drm: Implement signal_pending()

8 years agotop: Fix system process cpu usage percentage display
Sepherosa Ziehau [Sat, 14 Nov 2015 09:02:46 +0000 (17:02 +0800)]
top: Fix system process cpu usage percentage display

Not accurate, but much better than 0.00%

8 years agotop: Fix 'c' for -S and -I
Sepherosa Ziehau [Sat, 14 Nov 2015 07:15:00 +0000 (15:15 +0800)]
top: Fix 'c' for -S and -I

8 years agostyle: Fix white spaces
Sepherosa Ziehau [Sat, 14 Nov 2015 07:12:02 +0000 (15:12 +0800)]
style: Fix white spaces

8 years agouipc: Port Unix socket domain GC from FreeBSD.
Sepherosa Ziehau [Fri, 6 Nov 2015 07:24:22 +0000 (15:24 +0800)]
uipc: Port Unix socket domain GC from FreeBSD.

The new GC code records struct file in unpcb when the unpcb
is used as one of the rights.  And GC only scans all unpcbs,
instead of all files, and GC only takes unpcbs used as rights
as targets.  Unlike FreeBSD:
- We don't scan sockets on so_comp, since they are on unpcb
  global lists.
- We don't allocate a temporary array for all unreachable
  Unix domain sockets, since it could be pretty large.
  Instead, the unreachable Unix domain sockets are processed
  chunk by chunk (in the same style as our original GC code).

The original GC code is still kept around for reference
(under UNP_GC_ALLFILES).

And optimize unp_discard() a little bit by calling fdrop()
directly, if the right is not a Unix domain socket.  This is
also taken from FreeBSD.

While I'm here, reorder unpcb fields (moving most commonly
used fields to the beginning of unpcb) and add more comment.

8 years agokernel - Fix comment type-o
Matthew Dillon [Sat, 14 Nov 2015 01:44:42 +0000 (17:44 -0800)]
kernel - Fix comment type-o

* Fix comment type-o

8 years agokernel - Fixes for usb modems
Matthew Dillon [Sat, 14 Nov 2015 01:39:46 +0000 (17:39 -0800)]
kernel - Fixes for usb modems

* Separate t_sc into t_sc and t_slsc to allow line disciplines to
  coexsist with USB serial.  This allows SLIP to work.  Please don't
  ask me why I still need to use SLIP.

* Fix several panics in usb_serial.c.  Missing initializations,
  deadlocks due to locks held during blocking operations,
  missing unlocks, etc.

* Fix improper signed-char promotion to int causing high-bits to be
  set in calls to linesw[].l_rint(), which prevented SLIP from recognizing
  packets.

* Allow flags to be adjusted for SLIPs sl%d interfaces, in particular
  allow them to be setup as broadcast interfaces instead of point-to-point
  interfaces if desired.  Settable via /boot/loader.conf.

* Still TODO: Bugs present related to detection of modem control bits.

8 years agoSome adjustments to the recent dsched removal.
Sascha Wildner [Fri, 13 Nov 2015 21:10:50 +0000 (22:10 +0100)]
Some adjustments to the recent dsched removal.

* Make 'options DSCHED_FQ' a no-op for now. It used to be in our
  default config, so give people some time to edit their custom
  configs derived from X86_64_GENERIC, like we did for other such
  options. It will be completely removed at a later point in time
  after the release.

* Add a quick note to UPGRADING about this.

* While here, remove associated manual pages and MLINKS too.

8 years agokernel/drm: Fix an unitialized variable warning when building with -O0.
François Tigeot [Mon, 9 Nov 2015 20:04:10 +0000 (21:04 +0100)]
kernel/drm: Fix an unitialized variable warning when building with -O0.

Reported-by: tuxillo
8 years agoRemove <malloc.h> from the system.
Sascha Wildner [Fri, 13 Nov 2015 17:24:00 +0000 (18:24 +0100)]
Remove <malloc.h> from the system.

Originally, I wanted to follow FreeBSD which errors if __STDC__ is
defined and silently includes <stdlib.h>, which has the malloc()
and friends prototypes, if it is not defined. The only case where
__STDC__ isn't defined used to be when -traditional was passed to
GCC, which used to attempt an emulation of a pre-standard compiler.
But -traditional has since been made a cpp(1) specific option in
newer releases of GCC, so it becomes more and more pointless to
support <malloc.h>, even if we went with FreeBSD's version.

Therefore, remove it completely.

Also disable its usage in a number of contrib/ software which
expected it due to its presence at the time when the software was
configured.

Suggested-by: marino, who also fixed the resultant dports breakage
8 years agosys/dev/disk/dm: Don't expect destroy() to set config to NULL
Tomohiro Kusumi [Thu, 12 Nov 2015 11:04:43 +0000 (20:04 +0900)]
sys/dev/disk/dm: Don't expect destroy() to set config to NULL

Having a comment like below in dm core that expects programmers
to code their dm targets in a certain way is not efficient.
They may not read such a rule written in the source.

  /*
   * Remove target specific config data. After successfull
   * call table_en->target_config must be set to NULL.
   */

Just check a return value of destroy() and set config to NULL
on dm core side since it's also visible to dm core. There is
nothing targets can/would do with the config pointer other than
setting it to NULL considering targets have just freed it.

8 years agosys/dev/disk/dm: Add a comment on race on unload
Tomohiro Kusumi [Wed, 11 Nov 2015 11:46:25 +0000 (20:46 +0900)]
sys/dev/disk/dm: Add a comment on race on unload

There is a minor race window in dm_modcmd() after the below
conditional on unloading dm.ko. It's possible to create a new
device after it gets beyond the conditional with 0.

    if (dm_dev_counter > 0)
        return EBUSY;

Running the below a.sh and then b.sh concurrently causes
kernel panic. Avoiding this race seems to be difficult using
the existing locks that are all file local ones. The panic
can be reproduced with or without the previous commit.

===== a.sh
  #!/usr/local/bin/bash
  while [ 1 ]; do
      kldload dm
      kldunload dm
  done

===== b.sh
  #!/usr/local/bin/bash
  kldload dm
  while [ 1 ]; do
      dmsetup create zero1 --table '0 100 zero'
      dmsetup remove /dev/mapper/zero1
  done

8 years agosys/dev/disk/dm: Fix device counter handling
Tomohiro Kusumi [Tue, 10 Nov 2015 12:57:14 +0000 (21:57 +0900)]
sys/dev/disk/dm: Fix device counter handling

dm_dev_list and its element counter dm_dev_counter should be
protected by the same lock dm_dev_mutex. Having these updated
separately makes code logic more complex than it should.

If dm_dev_counter is protected by dm_dev_mutex, then no need
to care if dm_dev_counter++/-- are atomic or not.

8 years agosys/dev/disk/dm: Fix/refactor alloc/free functions [6/6]
Tomohiro Kusumi [Wed, 11 Nov 2015 11:37:36 +0000 (20:37 +0900)]
sys/dev/disk/dm: Fix/refactor alloc/free functions [6/6]

Rename dm_target_rem() to dm_target_remove() for consistency.

8 years agosys/dev/disk/dm: Fix/refactor alloc/free functions [5/6]
Tomohiro Kusumi [Wed, 11 Nov 2015 11:25:52 +0000 (20:25 +0900)]
sys/dev/disk/dm: Fix/refactor alloc/free functions [5/6]

Add dm_target_free().

8 years agosys/dev/disk/dm: Fix/refactor alloc/free functions [4/6]
Tomohiro Kusumi [Wed, 11 Nov 2015 10:51:21 +0000 (19:51 +0900)]
sys/dev/disk/dm: Fix/refactor alloc/free functions [4/6]

dm_target_alloc() takes char *name, but does nothing with it.
Add strlcpy and remove strlcpy from each target's init().

8 years agosys/dev/disk/dm: Fix/refactor alloc/free functions [3/6]
Tomohiro Kusumi [Wed, 11 Nov 2015 10:02:10 +0000 (19:02 +0900)]
sys/dev/disk/dm: Fix/refactor alloc/free functions [3/6]

dm_dev_alloc()/free()
* Make them static.
* Make alloc() take name and uuid just like dm_pdev_alloc().
* Refactoring.

dm_pdev_alloc()/free()
* Fix memory leak.
* Rename dm_pdev_rem() to dm_pdev_free().
  A simple kfree function should be xxx_free() but not xxx_rem().
  xxx_rem() isn't necessarily a name used for just kfree() in
  other files, which makes naming very confusing.
* Refactoring.

8 years agosys/dev/disk/dm: Fix/refactor alloc/free functions [2/6]
Tomohiro Kusumi [Tue, 10 Nov 2015 11:50:13 +0000 (20:50 +0900)]
sys/dev/disk/dm: Fix/refactor alloc/free functions [2/6]

Rename dm_dev_rem() to dm_dev_lookup_evict(). There is
dm_dev_remove(), and having remove()/rem() is confusing.

Refactor dm_dev_lookup()/dm_dev_lookup_evict() using a common
lookup function.

Disable dm_dev_lookup_evict() by #if0. This function is only
used for renaming, but renaming is not implemented.

8 years agosys/dev/disk/dm: Fix/refactor alloc/free functions [1/6]
Tomohiro Kusumi [Tue, 10 Nov 2015 11:02:49 +0000 (20:02 +0900)]
sys/dev/disk/dm: Fix/refactor alloc/free functions [1/6]

There are way too many functions with similar names that do
something related to removing and/or freeing dm device.

dm_dev_rem_dev() doesn't need to be a function so get rid of it.
dm_dev_destroy() can be a static function.

8 years agoRemove dsched_bfq.4 manual page from the Makefile too.
Sascha Wildner [Thu, 12 Nov 2015 12:44:26 +0000 (13:44 +0100)]
Remove dsched_bfq.4 manual page from the Makefile too.

8 years agoFix module name in the drm.4 manual page.
Sascha Wildner [Thu, 12 Nov 2015 12:36:57 +0000 (13:36 +0100)]
Fix module name in the drm.4 manual page.

8 years agoRemove no longer used dsched modules & manpage via 'make upgrade'.
Sascha Wildner [Thu, 12 Nov 2015 12:36:03 +0000 (13:36 +0100)]
Remove no longer used dsched modules & manpage via 'make upgrade'.

8 years agouipc: Release token in the proper order on unconnected DGRAM send path
Sepherosa Ziehau [Thu, 12 Nov 2015 10:39:38 +0000 (18:39 +0800)]
uipc: Release token in the proper order on unconnected DGRAM send path

Reported-by: zrj
8 years agoUpdate some generated collate definitions
John Marino [Thu, 12 Nov 2015 08:22:48 +0000 (09:22 +0100)]
Update some generated collate definitions

Likely due to recently fixed bugs, four colldef files generated slightly
differently than before.  The changes look correct so let's just take the
latest version.

8 years agocldr2def: Use explicit target files when generating symlinks
John Marino [Thu, 12 Nov 2015 08:19:31 +0000 (09:19 +0100)]
cldr2def: Use explicit target files when generating symlinks

Update the generated makefiles to use a target filename on symlinks.
This avoids creating a directory symlink with the target directory
does not exist.

Taken from: FreeBSD

8 years agoRemove obsolete references to libedit from gdb
John Marino [Wed, 11 Nov 2015 21:50:19 +0000 (22:50 +0100)]
Remove obsolete references to libedit from gdb

We removed libedit from gdb a long time ago (readline is mandatory
so we used bundled version) but apparently these references were
missed.

8 years agokernel - Remove dsched
Matthew Dillon [Wed, 11 Nov 2015 18:52:23 +0000 (10:52 -0800)]
kernel - Remove dsched

* After consultation, remove dsched from the kernel.  The original idea
  is still valid but the current implementation has had lingering bugs for
  several years now and we've determined that it's just got its fingers into
  too many structures.

  Also, the implementation was designed before SSDs, and doesn't play well
  with SSDs.

* Leave various empty entry points in so we can revisit at some
  future date.