3 years agobuild - use libressl md5.h for kernel
Matthew Dillon [Fri, 28 Oct 2016 00:22:27 +0000 (17:22 -0700)]
build - use libressl md5.h for kernel

* libressl's md5.h needs a minor mod for us to be able to use it
  in the kernel build.

3 years agobuildkernel - Fix -j race
Matthew Dillon [Thu, 27 Oct 2016 23:19:47 +0000 (16:19 -0700)]
buildkernel - Fix -j race

* Fix -j race with forwarded header files.  Multiple threads will try to
  create the same forwarded header file, causing users of the file to
  sometimes see a partially written file.

3 years agobuild - Rewire secure, remove conflicts from libmd, libcrypt
Matthew Dillon [Thu, 27 Oct 2016 23:11:22 +0000 (16:11 -0700)]
build - Rewire secure, remove conflicts from libmd, libcrypt

* Remove /usr/src/secure, folding all of its subsystems into
  /usr/src.  There's no point having a /usr/src/secure any more,
  the system won't run without the secure stuff, the idea that some foreign
  actor could segregate it in order to legally download code without crypto
  is absurd on the modern internet, and the U.S. government stopped caring
  decades ago.

* Remove conflicts from libmd and libcrypt.  Essentially this removes
  the SHA*_*() and MD5_*() APIs from libmd because these APIs already
  exist in lib[re]ssl.

  The older SHA*() and MD5*() APIs are partially retained for legacy base
  code, but will be removed in a later stage (moved to direct-linking the
  needed support source).

  Conflicting routines in libcrypt have been renamed and internalized to
  be libcrypt-only.

* Major rewiring of the Makefile's to support the changes.

3 years agoif_iwm - Adjust if_iwm_sta.h prototypes, don't pass iwm_node to rm_sta().
Imre Vadász [Thu, 27 Oct 2016 20:09:38 +0000 (22:09 +0200)]
if_iwm - Adjust if_iwm_sta.h prototypes, don't pass iwm_node to rm_sta().

* Since a RUN -> INIT/SCAN transition seems to immediately destroy the
  ieee80211_node for the AP, we can't read the in_assoc value from there.
  Instead just directly pass that information via a boolean_t argument.

* Adds iwm_mvm_rm_sta_id() function, which just unconditionally removes
  the station from the firmware.

* The iwm_mvm_rm_sta() function shouldn't actually remove the station from
  firmware when we are still associated (i.e. during a RUN -> INIT/SCAN

* So when disassociating we will first call iwm_mvm_rm_sta() to drain the
  queues/fifos. Later during disassociation we will then use
  iwm_mvm_rm_sta_id() to actually remove the station.

Inspired-By: Linux iwlwifi
3 years agoif_iwm - Make powersaving more similar to Linux iwlwifi behaviour.
Imre Vadász [Thu, 27 Oct 2016 19:58:48 +0000 (21:58 +0200)]
if_iwm - Make powersaving more similar to Linux iwlwifi behaviour.

* Add a per-vap ps_disabled flag, and use it for a workaround which fixes
  an association issue when powersaving is enabled.

* Compute flag that should correpsond to the mvmif->bss_conf.ps flag in
  Linux's iwlwifi (e.g. this disallows powersaving when not associated

Inspired-By: Linux iwlwifi
3 years agoif_iwm - Clean up if_iwm_power.c a bit. Fix iwm_power_scheme debug print.
Imre Vadász [Thu, 27 Oct 2016 18:51:54 +0000 (20:51 +0200)]
if_iwm - Clean up if_iwm_power.c a bit. Fix iwm_power_scheme debug print.

3 years agodrm: Implement and use the Linux i2c API
François Tigeot [Thu, 27 Oct 2016 19:17:22 +0000 (21:17 +0200)]
drm: Implement and use the Linux i2c API

* This is mainly to the benefit of the drm/i915 driver

* Sync key portions of code with Linux 4.4

* Key drm functions using the DragonFly-specific iic(4) API
  have been copied and renamed with an _iic suffix

* The drm/radeon driver no longer being actively developed, the
  intent is to keep it functional with a frozen API

Thanks to Johannes Hofmann for figuring out we could live with
a dummy default bit_xfer() implementation

3 years agodrm: Implement and use Linux struct device
François Tigeot [Thu, 27 Oct 2016 18:43:18 +0000 (20:43 +0200)]
drm: Implement and use Linux struct device

3 years agokernel: Rename the struct behind device_t to bsd_device
François Tigeot [Thu, 27 Oct 2016 18:22:06 +0000 (20:22 +0200)]
kernel: Rename the struct behind device_t to bsd_device

Thus making it not clash with the Linux struct device anymore

Inspired-by: proposed FreeBSD changes
3 years agokernel: Replace struct device* by device_t
François Tigeot [Thu, 27 Oct 2016 17:39:29 +0000 (19:39 +0200)]
kernel: Replace struct device* by device_t

We don't want to directly mention struct device anywhere.

3 years agocarp: Add net.inet.carp.setroute to disable routes changes.
Sepherosa Ziehau [Thu, 27 Oct 2016 13:57:52 +0000 (21:57 +0800)]
carp: Add net.inet.carp.setroute to disable routes changes.

It can be useful as described in the related DragonFly-bug.

DragonFly-bug: http://bugs.dragonflybsd.org/issues/2960
Submitted-by: Francis GUDIN
3 years agosys/vfs/hammer: Rename HAMMER_STRUCTURE_XXX to HAMMER_IOTYPE_XXX
Tomohiro Kusumi [Thu, 27 Oct 2016 07:53:54 +0000 (16:53 +0900)]

enum hammer_io_type has existed since 2007, but the name of each
element HAMMER_STRUCTURE_XXX doesn't clearly show the purpose of
this enum. It should be HAMMER_IOTYPE_XXX.

This isn't for ondisk structures, so it doesn't affect userspace.

3 years agosys/vfs/hammer: Add hammer_zone_to_iotype()/hammer_io_to_iostring()
Tomohiro Kusumi [Thu, 27 Oct 2016 06:03:35 +0000 (15:03 +0900)]
sys/vfs/hammer: Add hammer_zone_to_iotype()/hammer_io_to_iostring()

hammer_io_read() uses iotype string only for debugging purpose.
It has nothing to do with the code logic, so separate it from

3 years agosys/vfs/hammer: Fix zone/iotype/iostring conversion
Tomohiro Kusumi [Thu, 27 Oct 2016 05:01:07 +0000 (14:01 +0900)]
sys/vfs/hammer: Fix zone/iotype/iostring conversion

This isn't explcitly mentioned in documentations/comments/etc,
but HAMMER_STRUCTURE_META_BUFFER is mapped to zone-{2,4,8,9}.
Avoid using default: case when we know that.

hammer_io_read() needs a case for zone-2 with "buffer" string.
This avoids using a wrong message "meta?" for zone-2.

3 years agoif_iwm - Switch arguments from iwm_node* to iwm_vap* in if_iwm_power.c.
Imre Vadász [Tue, 25 Oct 2016 21:04:45 +0000 (23:04 +0200)]
if_iwm - Switch arguments from iwm_node* to iwm_vap* in if_iwm_power.c.

* Power management handling is per-vap, not per-node, so we should pass
  the iwm_vap in these arguments.

3 years agoLTO: Prevent -flto from creating crashing kernels.
zrj [Mon, 17 Oct 2016 17:34:19 +0000 (20:34 +0300)]
LTO: Prevent -flto from creating crashing kernels.

There is something peculiar how default count of lto partitions is created
and used when compiling them. For now just enforce the use of a single one.
GENERIC as it is right now is fine, however turning off certain features
in config, causes the kernel fatal trap 12 very early on boot and reboot.
Note that -g -flto -O2 compilations can easily slurp 1.5-1.8GB of ram!

3 years agoLTO: Use CC for kernel linking.
zrj [Thu, 13 Oct 2016 13:01:29 +0000 (16:01 +0300)]
LTO: Use CC for kernel linking.

This allows linker properly get invoked to deal with LTO objects.
Main differences extra .eh_frame_hdr section and RPATH to /usr/libexec/gcc50.
Both should be harmless. As for -rpath it is coming from gcc spec files,
it should not be set for -nostdlib case.

While there, add missing -Wl,.

3 years agocrunchgen(1): Switch to use cc for ld.
zrj [Wed, 12 Oct 2016 11:01:49 +0000 (14:01 +0300)]
crunchgen(1): Switch to use cc for ld.

Using CC is more preferable cause cc has more knowledge how to properly
invoke linker for given objects. This is needed for LTO compilations.

As a bonus this ensures that all objects are targeting correct arch.

3 years agogcc47: Disable use of -flto.
zrj [Thu, 13 Oct 2016 07:44:09 +0000 (10:44 +0300)]
gcc47: Disable use of -flto.

There are various issues when this older gcc gets compiled with LTO.
It would need same patches as gcc50 for libgcc* libstdc++.* and
given that linking stage in gcc47 is ordered(serial) it would blow up
buildworld time almost by third on big -jN.

3 years agoLTO: Prevent -flto being used by any of libstdc++ stuff.
zrj [Wed, 12 Oct 2016 14:10:37 +0000 (17:10 +0300)]
LTO: Prevent -flto being used by any of libstdc++ stuff.

There are some spooky stuff going in this lib (-Wodr, mismathing decl etc).
No reasons to expose that at linking step.

3 years agoLTO: Prevent -flto being used by main gcc libraries.
zrj [Wed, 12 Oct 2016 14:08:52 +0000 (17:08 +0300)]
LTO: Prevent -flto being used by main gcc libraries.

These need to be private by compiler and not affected at linking step.
(-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_pic)

3 years agoLTO: Prevent -flto being used in main system libraries.
zrj [Wed, 12 Oct 2016 14:04:52 +0000 (17:04 +0300)]
LTO: Prevent -flto being used in main system libraries.

There are subtle ways it can get broken specially in libc and libm.
Both libpthread.a and rtld-elf could have use of LTO but it is safer
for now not to expose internals. (affects only static libs)

3 years agoLTO: Prevent -flto exposing csu internals when linking v2.
zrj [Wed, 12 Oct 2016 14:00:23 +0000 (17:00 +0300)]
LTO: Prevent -flto exposing csu internals when linking v2.

Userland applications should not see what is happening in these sources,
let alone have behavioural changes for -fxxx flags during linking.

Also make sure -flto does *not* get near any of crt1 stuff.
Caused lost os version elf notes in utilities and even segfaults in pkg(8).

3 years agoLTO: Prevent -flto being used by host native tools.
zrj [Wed, 12 Oct 2016 13:57:35 +0000 (16:57 +0300)]
LTO: Prevent -flto being used by host native tools.

Having LTO enabled here will only cause troubles when abi of LTO changes.

3 years agolibstand: Add -fno-builtin in case of -flto.
zrj [Wed, 12 Oct 2016 13:49:13 +0000 (16:49 +0300)]
libstand: Add -fno-builtin in case of -flto.

Not strictly needed but will help a lot during devel.
No functional change for normal compilation.

3 years agobinutils225: Trim sources that create empty objects.
zrj [Wed, 5 Oct 2016 11:29:42 +0000 (14:29 +0300)]
binutils225: Trim sources that create empty objects.

3 years agogcc50: Build lto-wrapper when buildworld is LTO enabled.
zrj [Wed, 5 Oct 2016 11:33:53 +0000 (14:33 +0300)]
gcc50: Build lto-wrapper when buildworld is LTO enabled.

3 years agobinutils225: Symlink liblto_plugin.so from default base gcc compiler.
zrj [Mon, 3 Oct 2016 09:52:12 +0000 (12:52 +0300)]
binutils225: Symlink liblto_plugin.so from default base gcc compiler.

For now just for gcc50 cause there is little point for doing it on gcc47.
Also make ar, nm, ranlib utilities dynamic to avoid "Service unavailable".

Warning: even if is it tempting to go and add -flto to CFLAGS now, first
make sure that you are familiar with how -flto actually works!

3 years agobinutils225: Add bfd-plugins directory to mtree.
zrj [Sat, 1 Oct 2016 13:56:23 +0000 (16:56 +0300)]
binutils225: Add bfd-plugins directory to mtree.

This directory intended only for symlinks of binutils plugins.

3 years agobinutils225: Add plugin support in ar, nm, ranlib.
zrj [Sat, 1 Oct 2016 13:41:51 +0000 (16:41 +0300)]
binutils225: Add plugin support in ar, nm, ranlib.

This finally adds support for --plugin [libplugin.so] flag usage.

Default loadable plugins should be symlinked to binutils private
/usr/libexec/binutils225/bfd-plugins/ directory.
For now that directory is not created by mtree and gcc does not
install symlink to its private liblto_plugin.so.

TBD if we want this implicit LTO support without explicit --plugin.
Note that bfd plugin enabled utilities will try to load *anything*
residing in that directory, even hangman(6)!
Still, support for it is useful for local experimentation since this
allows to test even LLVMgold.so without lots of edits in Makefiles.

3 years agokernel/ddb: Fix type mismatch in different objects.
zrj [Tue, 25 Oct 2016 11:23:25 +0000 (14:23 +0300)]
kernel/ddb: Fix type mismatch in different objects.

Found while playing with LTO.

While there, use true/false types from <sys/types.h>.

3 years agoconfig(8): Comment out some linux emulation remains.
zrj [Tue, 25 Oct 2016 11:09:05 +0000 (14:09 +0300)]
config(8): Comment out some linux emulation remains.

Linux emulation is already removed, no point to have broken symlink
in buildkernel obj directory (X86_64_GENERIC/arch_linux).

3 years agoRemove <sys/stdbool.h>. The kernel has bool etc. in <sys/types.h> now.
Sascha Wildner [Tue, 25 Oct 2016 08:31:59 +0000 (10:31 +0200)]
Remove <sys/stdbool.h>. The kernel has bool etc. in <sys/types.h> now.

3 years agoif_iwm - Already call iwm_mvm_power_update_mac() during SCAN<->AUTH paths.
Imre Vadász [Mon, 24 Oct 2016 21:31:17 +0000 (23:31 +0200)]
if_iwm - Already call iwm_mvm_power_update_mac() during SCAN<->AUTH paths.

* Otherwise we would never update powersaving settings until we complete
  an association, after the first authentication attempt.

* This corresponds to what Linux iwlwifi seems to do.

3 years agoif_iwm - Refuse connection to APs with beacon interval < 16.
Imre Vadász [Mon, 24 Oct 2016 21:17:47 +0000 (23:17 +0200)]
if_iwm - Refuse connection to APs with beacon interval < 16.

Taken-From: Linux iwlwifi (git 48bc13072109ea58465542aa1ee31b4e1065468a)

3 years agorouted(8): Remove SGI specific code.
Sascha Wildner [Mon, 24 Oct 2016 17:13:40 +0000 (19:13 +0200)]
routed(8): Remove SGI specific code.

3 years agomtree(8): Use getcwd().
Sascha Wildner [Mon, 24 Oct 2016 17:13:14 +0000 (19:13 +0200)]
mtree(8): Use getcwd().

3 years agokernel: Mark some syscalls obsolete which are really libc functions.
Sascha Wildner [Mon, 24 Oct 2016 17:10:32 +0000 (19:10 +0200)]
kernel: Mark some syscalls obsolete which are really libc functions.

3 years agoznew(1): Convert to use sh.
zrj [Mon, 24 Oct 2016 15:00:22 +0000 (18:00 +0300)]
znew(1): Convert to use sh.

No Korn shell in base system.

3 years agogcc47: Allow gcc47 to compile itself at WORLD_CCOPTLEVEL=g.
zrj [Wed, 19 Oct 2016 10:51:13 +0000 (13:51 +0300)]
gcc47: Allow gcc47 to compile itself at WORLD_CCOPTLEVEL=g.

Override supplied -Og when gcc47 is bootstrapping itself.
-Og is very useful in some heavy debugging seasions so it is better to give
developers an easy workaround than fail for a single part of buildworld.

Only intended for WORLD_CCOPTLEVEL=g compilations to not require to explictly
disable the alternative compiler (NO_ALTCOMPILER=true).
Note that -Og is mostly -O1 with few optimizations disabled.

3 years agobsd.sys.mk: Make buildworld permissive for -Os and -Og.
zrj [Wed, 19 Oct 2016 13:54:35 +0000 (16:54 +0300)]
bsd.sys.mk: Make buildworld permissive for -Os and -Og.

Both -Os and -Og reduce amount of how much code can be inlined.
Since all real issues should be already addressed during standard -O and -O2
buildworlds, make -Winline and -Wmaybe-uninitialized as non fatal diagnostics.

Having -Os and -Og working out of the box will also help to crosscheck if
given WARNS level is not too high and just happened to barelly pass at -O.

3 years agoxlocale: Few style(9) fixes.
zrj [Fri, 7 Oct 2016 11:11:03 +0000 (14:11 +0300)]
xlocale: Few style(9) fixes.

3 years agoxlocale: Fix type of freelocale().
zrj [Fri, 7 Oct 2016 07:20:28 +0000 (10:20 +0300)]
xlocale: Fix type of freelocale().

Per POSIX specs return type should be void. Previous type is apple'ism.

While there, adjust manpages to use the correct <loacle.h> header.

Taken-from: FreeBSD

3 years agoxlocale: Fix LC_*_MASK bit shifting.
zrj [Fri, 7 Oct 2016 07:00:27 +0000 (10:00 +0300)]
xlocale: Fix LC_*_MASK bit shifting.

Order must match the one in xlocale_private.h.

This causes the abi breakage, but only two components were right,
others were broken in subtle ways.

Taken-from: FreeBSD (r304703)

3 years agoMove __weak_reference() after symbols it links to.
zrj [Thu, 6 Oct 2016 14:53:18 +0000 (17:53 +0300)]
Move __weak_reference() after symbols it links to.

Just for consistency. It also will help if prototype visibility would change.

Shouldn't lib/libc/gen/raise.c have weak refs to _raise() and raise()?

3 years ago<sys/cdefs.h>: Rework __weak_reference() macro.
zrj [Thu, 6 Oct 2016 09:13:25 +0000 (12:13 +0300)]
<sys/cdefs.h>: Rework __weak_reference() macro.

My LTO build blew away weak symbols from slim LTO objects.
Use __strong_reference() + weak attribute to allow the compiler to catch
extern declarations and not to fold weak symbols as local ones.

Keep previous version as __weak_reference_asm() in _pthread_stubs.c for
now due to several issues (there is a need to do it in a cleaner way).

  add missing __DECONST for ucp, shouldn't sigreturn take const ucontext_t?

  add missing #undef inet_ntoa_r

No symbol changes in libc and librt on normal compilation.

While there, add __weak_symbol attribute for future additions.

3 years agolibc: Rip out pthread_cancel stub symbol.
zrj [Tue, 4 Oct 2016 07:37:35 +0000 (10:37 +0300)]
libc: Rip out pthread_cancel stub symbol.

After looking through use cases i couldn't find any signs of libc
needing to provide stub for pthread_cancel() function.
It doesn't make much sense for any program to use this symbol but
not use the pthread_create(). With this assumption it should be safe
to move out pthread_cancel() from libc to libpthread.so dummy to be
together with weak symbol of pthread_create().

Add special WRlc() macro that creates only the internal version stub
to still provide the _pthread_cancel symbol even if it unused in libc.

Doing just that fixes how gcc libs check for pthread presence when
playing weak symbol chasing games withouto any confingure time tests.

3 years agomachine/endian.h: Mark bswap functions always inlineable.
zrj [Tue, 11 Oct 2016 09:49:46 +0000 (12:49 +0300)]
machine/endian.h: Mark bswap functions always inlineable.

This solves many cases where compiler decides to make them as a local
static functions to prevent code size growth and causing -Winline.
Also then it leads to less optimal code generation.
To prevent all of this just mark them as always inlineable.
These functions are intended to be inlined and should be thought as macros.

3 years agosbin/hammer: Mark few functions as always inlineable.
zrj [Tue, 11 Oct 2016 09:32:19 +0000 (12:32 +0300)]
sbin/hammer: Mark few functions as always inlineable.

This helps with -Os giving -Winline and exceeding
param inline-limit function-groth under -flto.
Only a temporary for -flto testing.

3 years agocamcontrol: Force scsi_8btou64() to be inlined.
zrj [Wed, 12 Oct 2016 13:44:15 +0000 (16:44 +0300)]
camcontrol: Force scsi_8btou64() to be inlined.

Causes issues with -flto and likely with -Os too.
Has to do with places where it is inlined to, small callsites thus
comparable code size with inlineable function itself. Since code growth
here is acceptable, make sure compiler does not decide otherwise.

3 years ago<stdio.h>: Always inline functions.
zrj [Tue, 4 Oct 2016 05:34:12 +0000 (08:34 +0300)]
<stdio.h>: Always inline functions.

These functions were intended to be the preprocessor macros, so
do not allow compiler to assume that those might not be inlined.
Happens on LTO builds were compiler sees more of a global picture.

While there, do the same to rune helpers in <ctype.h> too.

3 years agoUnbreak buildkernel.
zrj [Mon, 24 Oct 2016 09:27:12 +0000 (12:27 +0300)]
Unbreak buildkernel.

Follow up to 21137e2f155845448ff3979f5b05b12b642c40a2.
 * Update <sys/md5.h> to match sys/kern/md5c.c and lib/libmd/md5c.c.
 * Limit exposure of MD5 functions in kernel, only 3 are needed.

TBI: what about casts (void *) for *Init() in sys/opencrypto/xform.c ?

3 years agolibcrypt - Internalize additional symbols
Matthew Dillon [Mon, 24 Oct 2016 06:38:34 +0000 (23:38 -0700)]
libcrypt - Internalize additional symbols

* Internalize additional symbols which conflict with libssl or libressl.
  This works around the apache https issue we had by avoiding a buggy
  error path that will be fixed upstream.  This also fixes a bogus fetch
  failures we were having while testing https.

* Make the *_Init() API for MD5, SHA*, etc in libmd compatible with libssl
  and libressl.

* Note that libmd is inheritently incompatible with lib[re]ssl, so look
  for an upcoming fix for that (maybe we can remove it entirely).

3 years agoif_iwm - Handle AUTH->SCAN/INIT and ASSOC->SCAN/INIT better
Imre Vadász [Sat, 22 Oct 2016 19:41:00 +0000 (21:41 +0200)]
if_iwm - Handle AUTH->SCAN/INIT and ASSOC->SCAN/INIT better

* Tear down the relevant firmware state (i.e. the station, the vif binding)
  in these transition cases.

* Before this case would leave the firmware state lying around, resulting
  in errors and firmware panics in the subsequent association attempts.

3 years agoif_iwm - Factor out firmware station handling into if_iwm_sta.c.
Imre Vadász [Sun, 23 Oct 2016 21:10:29 +0000 (23:10 +0200)]
if_iwm - Factor out firmware station handling into if_iwm_sta.c.

* This adds iwm_mvm_rm_sta(), which will be used to tear down firmware
  state for better/cleaner iwm_newstate() handling.

* Makes iwm_enable_txq() and iwm_mvm_flush_tx_path() non-static, add
  the declarations to if_iwm_util.h for now.

Taken-From: Linux iwlwifi

3 years agoif_iwm - Deduplicate code in iwm_auth() from an if condition.
Imre Vadász [Sun, 23 Oct 2016 15:25:51 +0000 (17:25 +0200)]
if_iwm - Deduplicate code in iwm_auth() from an if condition.

3 years agoif_iwm - No need for iwm_assoc() in AUTH->ASSOC transition.
Imre Vadász [Sun, 23 Oct 2016 21:08:47 +0000 (23:08 +0200)]
if_iwm - No need for iwm_assoc() in AUTH->ASSOC transition.

* Hence no need to keep stuff in separate iwm_assoc() function, just
  inline the stuff into iwm_newstate().

3 years agoif_iwm - Properly implement iwm_wme_update callback function.
Imre Vadász [Sun, 23 Oct 2016 19:34:08 +0000 (21:34 +0200)]
if_iwm - Properly implement iwm_wme_update callback function.

* Inspired by iwn(4) and Linux iwlwifi.

* Read wme parameters into a buffer within struct iwm_vap in

* If we aren't associated yet, the new settings will soon be sent
  by iwm_mvm_mac_ctxt_changed() during association.

* If we are already associated, explicitly call iwm_mvm_mac_ctxt_changed()
  from iwm_wme_update() to send the new settings to the firmware.

* Change iwm_mvm_ac_to_tx_fifo mapping, to fit the freebsd net80211
  WME stream class numbering, instead of Linux's enum ieee80211_ac_numbers.

3 years agokernel - Minor documentation adjustment for arc4random
Matthew Dillon [Fri, 21 Oct 2016 21:36:25 +0000 (14:36 -0700)]
kernel - Minor documentation adjustment for arc4random

* Minor documentation adjustment for arc4random

3 years agokernel - Fix directory scanning bug in msdosfs
Matthew Dillon [Fri, 21 Oct 2016 20:37:07 +0000 (13:37 -0700)]
kernel - Fix directory scanning bug in msdosfs

* Fix a directory scanning bug in msdosfs where an incorrect d_namlen
  was being returned.

Reported-by: htse, t_dfbsd, tuxillo
3 years agogdb: Trim sources that create empty objects.
zrj [Wed, 12 Oct 2016 13:14:49 +0000 (16:14 +0300)]
gdb: Trim sources that create empty objects.

Shouldn't wctype-h.c produce symbols?

3 years agodiffutils: Trim sources that create empty objects.
zrj [Wed, 12 Oct 2016 13:08:14 +0000 (16:08 +0300)]
diffutils: Trim sources that create empty objects.

There are several things that need to be addressed here.
Should (like in grep(1)) wctype-h.c produce symbols?

3 years agolibrpcsvc: Trim sources that create empty objects.
zrj [Wed, 12 Oct 2016 12:49:50 +0000 (15:49 +0300)]
librpcsvc: Trim sources that create empty objects.

Here I'm not sure why this was compiled at all or why it has no symbols.

3 years agolvm2: Trim sources that create empty objects.
zrj [Tue, 11 Oct 2016 10:29:43 +0000 (13:29 +0300)]
lvm2: Trim sources that create empty objects.

Source is empty, not implemented.

3 years agolibstdcxx5: Trim sources that create empty objects.
zrj [Tue, 11 Oct 2016 10:23:29 +0000 (13:23 +0300)]
libstdcxx5: Trim sources that create empty objects.

Only when targetting ARM.

3 years agolibgomp5: Trim sources that create empty objects.
zrj [Tue, 11 Oct 2016 10:19:18 +0000 (13:19 +0300)]
libgomp5: Trim sources that create empty objects.

Source files are stub ones, implemented in headers.

3 years agogroff: Trim sources that create empty objects.
zrj [Tue, 11 Oct 2016 07:53:03 +0000 (10:53 +0300)]
groff: Trim sources that create empty objects.

3 years agolibusbhid: Trim sources that create empty objects.
zrj [Tue, 11 Oct 2016 07:33:23 +0000 (10:33 +0300)]
libusbhid: Trim sources that create empty objects.

3 years agoncurses: Trim sources that create empty objects.
zrj [Tue, 11 Oct 2016 07:28:51 +0000 (10:28 +0300)]
ncurses: Trim sources that create empty objects.

3 years agolibssh: Trim sources that create empty objects.
zrj [Tue, 11 Oct 2016 07:27:24 +0000 (10:27 +0300)]
libssh: Trim sources that create empty objects.

3 years agolibpam: Trim sources that create empty objects.
zrj [Tue, 11 Oct 2016 07:16:31 +0000 (10:16 +0300)]
libpam: Trim sources that create empty objects.

3 years agolibmagic: Trim sources that create empty objects.
zrj [Tue, 11 Oct 2016 07:13:12 +0000 (10:13 +0300)]
libmagic: Trim sources that create empty objects.

3 years agolibedit: Trim sources that create empty objects.
zrj [Tue, 11 Oct 2016 06:22:10 +0000 (09:22 +0300)]
libedit: Trim sources that create empty objects.

3 years agogcc50: Trim sources that create empty objects.
zrj [Wed, 5 Oct 2016 11:32:04 +0000 (14:32 +0300)]
gcc50: Trim sources that create empty objects.

 * Disable gen source of HAVE_peephole, only applies for gcc <= 5.x.
 * Exclude {hw,loop}-doloop.c, protected by HAVE_doloop_end guard (gcc < 6).

3 years agolibmgmp: Trim sources that create empty objects.
zrj [Wed, 5 Oct 2016 08:21:42 +0000 (11:21 +0300)]
libmgmp: Trim sources that create empty objects.

3 years agolibmpfr: Trim sources that create empty objects.
zrj [Wed, 5 Oct 2016 08:21:00 +0000 (11:21 +0300)]
libmpfr: Trim sources that create empty objects.

3 years agogrep(1): Trim sources that create empty objects.
zrj [Wed, 5 Oct 2016 07:57:11 +0000 (10:57 +0300)]
grep(1): Trim sources that create empty objects.

There are several things that need to be addressed here.

3 years agosys/boot: Remove empty source.
zrj [Fri, 21 Oct 2016 06:05:26 +0000 (09:05 +0300)]
sys/boot: Remove empty source.

3 years agobootstrap: Add workaround for chflagsat() from 4.0.
zrj [Fri, 21 Oct 2016 10:35:12 +0000 (13:35 +0300)]
bootstrap: Add workaround for chflagsat() from 4.0.

Avoid failing syscalls during installworld while updating from DragonFly 4.0.
Add special private version of chflagsat() to aid while performing migration.
Add triple protection for this private implementation variant.
Hopefully chflags-compat.h would never need any newer additions.

Since there are other issues that require both installkernel and installworld,
standard installkernel, reboot and installworld is not possible while updating
to recent DragonFly releases. chflags(1) must be handled with care.

Tested-on: kern.osreldate == 400000 updating straight to master (4.7).
  installworld step fail only on single non fatal chflags: invalid flag: xlink
  For make upgrade to work sendmail must be removed from /etc/mail/mailer.conf
  reboot(8) must be used cause shutdown is only functional only on new kernel.

Submitted-by: dillon@
3 years agobootstrap: Fix old boostrapping issue once and for all part 2.
zrj [Fri, 21 Oct 2016 10:20:13 +0000 (13:20 +0300)]
bootstrap: Fix old boostrapping issue once and for all part 2.

In f08f1baa605ef8f4a93a42e1d790a9fcfb44df35 I forgot to git add -p the line to
export WORLD_VERSION variable to make it constant through buildworld process.
This time add it close so it would not get lost again, fail window was 1 month.
make buildworld WORLD_VERSION=400300 still have worked.

While there, add bootstrap workaround to bootstrap from 4.0-RELEASE too.
chflags(1) issue with chflagsat() is a bit more subtle, will be pushed later.

Tested-on: dfly-x86_64-4.0.6_REL.img updating straight to 4.7-DEVELOPMENT.
  Not bad considering DragonFly 4.0 had gcc44 + gcc47 and was still able to
  bootstrap the DragonFly 4.7 having gcc v5.0 as main compiler.

Reported-by: dillon@
3 years ago<wchar.h>: Add support for compilers -fshort-wchar.
zrj [Thu, 20 Oct 2016 09:50:58 +0000 (12:50 +0300)]
<wchar.h>: Add support for compilers -fshort-wchar.

Both clang and gcc need to be able to override wchar_t type.

3 years agoinstaller: Init payload to NULL.
zrj [Fri, 14 Oct 2016 13:41:31 +0000 (16:41 +0300)]
installer: Init payload to NULL.

Code checks for payload if it is allocated or not, so technically
this is a case where this pointer is used not initialized.

3 years agoppp: Avoid gcc warnings.
zrj [Wed, 12 Oct 2016 05:19:49 +0000 (08:19 +0300)]
ppp: Avoid gcc warnings.

ncprange_getip4mask() will not initialize mask for cases other than AF_INET
so give default value of INADDR_ANY (0x0) even if compiler misses that
ncprange_getip4mask() called only for AF_INET case in main function.

3 years agosetkey(8): Fix m_len type to match real one.
zrj [Tue, 11 Oct 2016 14:55:47 +0000 (17:55 +0300)]
setkey(8): Fix m_len type to match real one.

Given that it is used in places for sizeof() etc it should be unsigned.

3 years agomlxcontrol(8): Provide defaults to few variables.
zrj [Tue, 11 Oct 2016 14:47:17 +0000 (17:47 +0300)]
mlxcontrol(8): Provide defaults to few variables.

GCC is right here, mlxd_find_ctrlr() will not initiallize these on failure.

3 years agotelnet(1): Fix line definition to match extern one.
zrj [Tue, 11 Oct 2016 14:26:19 +0000 (17:26 +0300)]
telnet(1): Fix line definition to match extern one.

In telnetd it is extern char[16] so just use that.

3 years agowall(1): Avoid gcc warning.
zrj [Tue, 11 Oct 2016 14:19:39 +0000 (17:19 +0300)]
wall(1): Avoid gcc warning.

3 years agousers(1): Avoid gcc warning.
zrj [Tue, 11 Oct 2016 14:16:11 +0000 (17:16 +0300)]
users(1): Avoid gcc warning.

3 years agosystat(1): Fix curscale type to match other one.
zrj [Tue, 11 Oct 2016 14:07:08 +0000 (17:07 +0300)]
systat(1): Fix curscale type to match other one.

Also avoid triggering the the warning for ep.

3 years agousr.bin/rfcomm_sppd: Avoid gcc warnings.
zrj [Tue, 11 Oct 2016 14:00:58 +0000 (17:00 +0300)]
usr.bin/rfcomm_sppd: Avoid gcc warnings.

3 years agocal(1): Avoid gcc warnings.
zrj [Tue, 11 Oct 2016 13:25:33 +0000 (16:25 +0300)]
cal(1): Avoid gcc warnings.

Looks like here the compiler is right.

3 years agosbin/quotacheck: Rename maxino to remove globals conflict.
zrj [Tue, 11 Oct 2016 09:44:26 +0000 (12:44 +0300)]
sbin/quotacheck: Rename maxino to remove globals conflict.

fsck/fsck.h has it as ufs1_ino_t so to avoid type mismatches rename it.

3 years agoadventure(6): Fix type to match public one.
zrj [Mon, 10 Oct 2016 10:00:29 +0000 (13:00 +0300)]
adventure(6): Fix type to match public one.

3 years agodm(8): Avoid warning on gcc with -flto.
zrj [Mon, 10 Oct 2016 09:59:58 +0000 (12:59 +0300)]
dm(8): Avoid warning on gcc with -flto.

3 years agotalkd(8): Avoid warning on gcc with -flto.
zrj [Mon, 10 Oct 2016 07:52:29 +0000 (10:52 +0300)]
talkd(8): Avoid warning on gcc with -flto.

3 years agoless(1): Fix type mismatches in different objects.
zrj [Tue, 11 Oct 2016 13:38:42 +0000 (16:38 +0300)]
less(1): Fix type mismatches in different objects.

Not sure which one is better int or long. For now downgrade to int,
cause it is less changes in contrib code.

3 years agocvs: Use mempcpy() from libc.
zrj [Tue, 11 Oct 2016 11:13:51 +0000 (14:13 +0300)]
cvs: Use mempcpy() from libc.

Helps with LTO builds.

3 years agodevd(8): Make it possible to compile with LTO.
zrj [Tue, 11 Oct 2016 09:20:51 +0000 (12:20 +0300)]
devd(8): Make it possible to compile with LTO.

Make -Wodr warning (internal to c++ headers) under -flto non fatal.
Also give initial value, pidfile_open() has too many return points.

3 years agobackgammon(6): Prevent LTO seeing details for now.
zrj [Mon, 10 Oct 2016 09:43:25 +0000 (12:43 +0300)]
backgammon(6): Prevent LTO seeing details for now.

init.c should contain "back.h" for types (TBI later).
-flto gives lots of error: type of 'args' does not match original declaration [-Werror]

 extern char *args[16]; /* args passed to teachgammon and back */
 char args[100];

 extern int  old; /* original tty status */
 struct termios tty, old, noech, raw;

 extern int  raw; /* raw tty status, no echo */
 struct termios tty, old, noech, raw;

 extern int  noech; /* original tty status without echo */
 struct termios tty, old, noech, raw;
lto1: all warnings being treated as errors

3 years agocsh(1): Allow to bootstrap with -flto.
zrj [Wed, 5 Oct 2016 11:35:30 +0000 (14:35 +0300)]
csh(1): Allow to bootstrap with -flto.

tcsh(1) replaces malloc, thus with LTO sees multiple symbols.