dragonfly.git
2 months agoUpgrade make(1). 1/2
Antonio Huete Jimenez [Fri, 19 Feb 2021 18:02:04 +0000 (19:02 +0100)]
Upgrade make(1). 1/2

Merge branch 'vendor/BMAKE'

2 months agodsynth: Oops, parameters were reversed
Antonio Huete Jimenez [Fri, 19 Feb 2021 17:49:01 +0000 (18:49 +0100)]
dsynth: Oops, parameters were reversed

2 months agoching(6): Support to format with mandoc(1)
Aaron LI [Fri, 19 Feb 2021 10:51:44 +0000 (18:51 +0800)]
ching(6): Support to format with mandoc(1)

We don't ship nroff(1) anymore, so adapt ching(6) to support to use
mandoc(1) to format its output.  Mandoc(1) only implements part of
roff(7) language, but it's enough for ching(6), although minor
adjustments to the mandoc(1) output are needed to make it similar to
the nroff(1) output.

Prefer nroff(1) if it's available (provided by groff package).

2 months agoching(6): Tweak roff(7) macros to properly format with mandoc(1)
Aaron LI [Fri, 19 Feb 2021 10:07:59 +0000 (18:07 +0800)]
ching(6): Tweak roff(7) macros to properly format with mandoc(1)

The '\t' sequence (or the literal tab between two arguments) is ignored
by mandoc(1), so change it to spaces, which displays well with mandoc(1).

Quote the last argument of the .LX macro to fix warnings:
"whitespace at end of input line"

Change '.rm LH' to '.ds LH' in the .L macro to fix warnings:
"undefined string, using "": LH"

2 months agogames: Bring in ching(6) -- The Book of Changes -- from NetBSD
Aaron LI [Fri, 19 Feb 2021 01:43:16 +0000 (09:43 +0800)]
games: Bring in ching(6) -- The Book of Changes -- from NetBSD

The ching(6) game/utility was nuked from FreeBSD in 1994 ...
(see revision 2563)

It has been added back to NetBSD in June 30, 2005:
-----------------------------------------------------------------------
ching(6) -- The Book of Changes, not seen in BSD since 4.4BSD.

The C code is a complete rewrite done by Guy Harris for 4.4BSD and is
not the original from v7 at all. Unfortunately, the data file itself,
without which the rest isn't useful, was not freed until Caldera
released all of 32v a few years ago, so it was not in 4.4lite.

The data file, the ching nroff macros, and the driver script are under
Caldera or Caldera+Berkeley copyright.

I've partially redone the driver script from 4.4 (there was no point
in using a temporary file for the hexagram), which was already
partially redone from 32v. (As an aside, it is nutty that the script
needs a copyright so many times longer than the code.)

I've renamed "cno" to "castching", "phx" to "printching", (the
traditional names were opaque), and put them in /usr/libexec/ching
instead of the v7 /usr/games/ching.d. The data file and nroff macros
are in /usr/share/games/ching
-----------------------------------------------------------------------
(see https: //github.com/NetBSD/src/commit/5175ead765ed41e9db0f9f59d83ddf8966f6568a)

2 months agolibthread_xu: Add clock_nanosleep symbols to pthread.map
Aaron LI [Thu, 18 Feb 2021 10:31:50 +0000 (18:31 +0800)]
libthread_xu: Add clock_nanosleep symbols to pthread.map

Although pthread.map is currently unused (commented in the Makefile),
add 'clock_nanosleep' and '_clock_nanosleep' symbols to it anyway.

2 months agovendor/bmake: upgrade from 20200710 to 20210206
Antonio Huete Jimenez [Fri, 19 Feb 2021 11:54:15 +0000 (12:54 +0100)]
vendor/bmake: upgrade from 20200710 to 20210206

Summary of notable changes:

  o meta.c: target flagged .META is out-of-date if meta file missing
  o var.c: each flag type gets its own prefix.
  o optimize some buffer operations - avoid strlen
  o parse.c: remove VARE_WANTRES for LINT, we just want to check
    parsing (for now).
  o cond.c: make CondGetString easier to debug
  o var.c: support for read-only variables eg .SHELL being the shell
    used to run scripts.
  o enum.c: distinguish between bitsets containing flags and ordinary enums
  o main.c: do not attempt to read .MAKE.DEPENFILE if set to /dev/null or
    anything starting with "no"
  o parse.c: remove unused, undocumented .NOEXPORT
  o rename VAR_CMD to VAR_CMDLINE
  o .MAKE.{UID,GID} represent uid and gid running make.
  o fix error handling for .BEGIN and .END dependency in -k mode
  o compat.c: fix .ERROR_TARGET in compat -k mode

For detailed list see ChangeLog.

2 months agoUpgrade libressl. 2/2
Daniel Fojt [Fri, 19 Feb 2021 10:59:41 +0000 (11:59 +0100)]
Upgrade libressl. 2/2

Update README.DRAGONFLY.

2 months agoUpgrade libressl. 1/2
Daniel Fojt [Fri, 19 Feb 2021 10:58:10 +0000 (11:58 +0100)]
Upgrade libressl. 1/2

Merge branch 'vendor/LIBRESSL' into master.

2 months agovendor/libressl: upgrade from 3.2.3 to 3.2.4
Daniel Fojt [Wed, 17 Feb 2021 18:29:12 +0000 (19:29 +0100)]
vendor/libressl: upgrade from 3.2.3 to 3.2.4

Bug and interoperability fixes:

 * Switch back to certificate verification code from LibreSSL 3.1.x. The
   new verifier is not bug compatible with the old verifier causing issues
   with applications expecting behavior of the old verifier.

 * Unbreak DTLS retransmissions for flights that include a CCS

 * Only check BIO_should_read() on read and BIO_should_write() on write

 * Implement autochain for the TLSv1.3 server

 * Use the legacy verifier for autochain

 * Implement exporter for TLSv1.3

 * Free alert_data and phh_data in tls13_record_layer_free()

 * Plug leak in x509_verify_chain_dup()

 * Free the policy tree in x509_vfy_check_policy()

2 months agokernel: Move sys_{get,set}rlimit() to where their kern_* functions are.
Sascha Wildner [Fri, 19 Feb 2021 10:03:47 +0000 (11:03 +0100)]
kernel: Move sys_{get,set}rlimit() to where their kern_* functions are.

2 months agolibthread_xu: Remove some unused declarations from thr_private.h.
Sascha Wildner [Thu, 18 Feb 2021 10:50:21 +0000 (11:50 +0100)]
libthread_xu: Remove some unused declarations from thr_private.h.

2 months agosys/vfs/hammer: modify inode's ctime after successful chmod()
Daniel Fojt [Wed, 13 Jan 2021 20:35:26 +0000 (21:35 +0100)]
sys/vfs/hammer: modify inode's ctime after successful chmod()

On successful completion of chmod() (ie. the call is gonna return 0),
modify inode's ctime.

Issue: https://bugs.dragonflybsd.org/issues/3251
Link: https://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.html
2 months agosys/vfs/hammer2: modify inode's ctime after successful chmod()
Daniel Fojt [Wed, 13 Jan 2021 20:29:39 +0000 (21:29 +0100)]
sys/vfs/hammer2: modify inode's ctime after successful chmod()

On successful completion of chmod() (ie. the call is gonna return 0),
modify inode's ctime.

Issue: https://bugs.dragonflybsd.org/issues/3251
Link: https://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.html
2 months agodsynth: Make the mount process a bit more portable
Antonio Huete Jimenez [Thu, 18 Feb 2021 00:04:03 +0000 (01:04 +0100)]
dsynth: Make the mount process a bit more portable

2 months ago<utmpx.h>: Small whitespace fix.
Sascha Wildner [Wed, 17 Feb 2021 19:43:26 +0000 (20:43 +0100)]
<utmpx.h>: Small whitespace fix.

2 months ago<net/if.h>: Preparation for removing <sys/types.h> from <sys/socket.h>.
Sascha Wildner [Wed, 17 Feb 2021 19:23:53 +0000 (20:23 +0100)]
<net/if.h>: Preparation for removing <sys/types.h> from <sys/socket.h>.

* Include <sys/types.h> for the non-standard parts.

2 months ago<utmpx.h>: Preparation for removing <sys/types.h> from <sys/socket.h>.
Sascha Wildner [Wed, 17 Feb 2021 19:20:55 +0000 (20:20 +0100)]
<utmpx.h>: Preparation for removing <sys/types.h> from <sys/socket.h>.

* Define pid_t as POSIX specifies.

* Use internal integer types for some non-standard struct utmpx members.

2 months agolibc: Change microseconds args of ualarm() and usleep() to useconds_t.
Sascha Wildner [Wed, 17 Feb 2021 18:40:04 +0000 (19:40 +0100)]
libc: Change microseconds args of ualarm() and usleep() to useconds_t.

It's a standard type and more expressive.

No functional change, unsigned int becomes uint32_t.

2 months agousr.sbin/autofs: Fix absolute path when creating a mountpoint
Tomohiro Kusumi [Wed, 17 Feb 2021 15:20:11 +0000 (00:20 +0900)]
usr.sbin/autofs: Fix absolute path when creating a mountpoint

from freebsd 63640b2f552c0476f50484635eb9888eafcd22dc

FreeBSD finally fixed a bug I reported in 2017,
in a bit different way from a workaround in DragonFly and NetBSD.
Apply FreeBSD fix in place of 108ed43a1e5e7ff8f890085e206d970562bf4a7c.

2 months agonanosleep.2: Mark up defines with .Dv
Sascha Wildner [Tue, 16 Feb 2021 06:11:39 +0000 (07:11 +0100)]
nanosleep.2: Mark up defines with .Dv

2 months agoUpdate the pciconf(8) database.
Sascha Wildner [Mon, 15 Feb 2021 18:39:39 +0000 (19:39 +0100)]
Update the pciconf(8) database.

February 12, 2021 snapshot from https://pci-ids.ucw.cz

2 months agokernel/nfs: Initialize a sometimes uninitialized variable.
Sascha Wildner [Mon, 15 Feb 2021 09:07:56 +0000 (10:07 +0100)]
kernel/nfs: Initialize a sometimes uninitialized variable.

Just for style reasons. In the case where it was passed uninitialized,
it was not used by the called function.

2 months agokernel: Comment out some two unused functions.
Sascha Wildner [Mon, 15 Feb 2021 07:53:05 +0000 (08:53 +0100)]
kernel: Comment out some two unused functions.

2 months ago<sys/stdint.h>: Add missing typedef guards for uint*_t.
Sascha Wildner [Sun, 14 Feb 2021 19:26:32 +0000 (20:26 +0100)]
<sys/stdint.h>: Add missing typedef guards for uint*_t.

2 months agokernel/drm: Remove duplicate type definitions.
Sascha Wildner [Sun, 14 Feb 2021 19:25:49 +0000 (20:25 +0100)]
kernel/drm: Remove duplicate type definitions.

* <linux/spinlock.h>: A definition of 'spinlock_t' is already present
      from <linux/spinlock_types.h>.

* <linux/types.h>: A definition of 'bool' is already present from
      <sys/types.h>. Also, the defined() check was just wrong because
      it can only check for preprocessor macros, not for typedefs.

2 months agorc.d/mounttmpfs: Avoid duplicate tmpfs mount at /tmp
Aaron LI [Sun, 14 Feb 2021 14:45:13 +0000 (22:45 +0800)]
rc.d/mounttmpfs: Avoid duplicate tmpfs mount at /tmp

Newer DragonFly installation already mounts a tmpfs at /tmp, as
configured in /etc/fstab.  So check whether /tmp is already a mount
point before mounting a tmpfs there to prevent the duplicate mounts.

Reported-by: swildner
2 months agokernel - Remove the #define AF_MAX from sys/mount.h
Matthew Dillon [Sun, 14 Feb 2021 05:24:56 +0000 (21:24 -0800)]
kernel - Remove the #define AF_MAX from sys/mount.h

* Not sure how that managed to wind up in sys/mount.h but
  it doesn't belong there.  Bye bye.

2 months agodsynth: Add phase string for the new phases
Antonio Huete Jimenez [Thu, 11 Feb 2021 23:53:32 +0000 (00:53 +0100)]
dsynth: Add phase string for the new phases

2 months ago<sys/iconv.h>: Add <sys/types.h> for u_char and fix a comment.
Sascha Wildner [Fri, 12 Feb 2021 19:44:22 +0000 (20:44 +0100)]
<sys/iconv.h>: Add <sys/types.h> for u_char and fix a comment.

2 months agoFix several typos in calendars, READMEs and other files.
Sascha Wildner [Tue, 9 Feb 2021 18:16:12 +0000 (19:16 +0100)]
Fix several typos in calendars, READMEs and other files.

2 months agoregdomain.xml: Correct various country names.
Sascha Wildner [Tue, 9 Feb 2021 18:15:15 +0000 (19:15 +0100)]
regdomain.xml: Correct various country names.

2 months ago<sys/iconv.h>: Include <sys/cdefs.h> for __{BEGIN,END}_DECLS.
Sascha Wildner [Tue, 9 Feb 2021 04:48:46 +0000 (05:48 +0100)]
<sys/iconv.h>: Include <sys/cdefs.h> for __{BEGIN,END}_DECLS.

2 months agokernel/vm: Fix a wrong check in vm_fault_page().
Sascha Wildner [Mon, 8 Feb 2021 07:31:29 +0000 (08:31 +0100)]
kernel/vm: Fix a wrong check in vm_fault_page().

It was calling pmam_remove() more often than intended because of
wrong COW detection (the if() was always true).

Approved-by: dillon
3 months agotic: Fix wrong path in the Makefile.
Sascha Wildner [Sat, 6 Feb 2021 17:02:40 +0000 (18:02 +0100)]
tic: Fix wrong path in the Makefile.

It doesn't change the contents of term.h, though.

3 months agolibkinfo/Makefile: Oops, fix typo in the MLINKS.
Sascha Wildner [Sat, 6 Feb 2021 15:31:21 +0000 (16:31 +0100)]
libkinfo/Makefile: Oops, fix typo in the MLINKS.

3 months agoUse %U for URIs within reference blocks in various manual pages.
Sascha Wildner [Sat, 6 Feb 2021 07:24:30 +0000 (08:24 +0100)]
Use %U for URIs within reference blocks in various manual pages.

3 months agokinfo.3: Mention cputime_pcpu_statistics() and route_pcpu_statistics().
Sascha Wildner [Fri, 5 Feb 2021 05:31:53 +0000 (06:31 +0100)]
kinfo.3: Mention cputime_pcpu_statistics() and route_pcpu_statistics().

3 months agolibaura: Limit device/mount point comparison to PATH_MAX
Antonio Huete Jimenez [Fri, 5 Feb 2021 00:30:12 +0000 (01:30 +0100)]
libaura: Limit device/mount point comparison to PATH_MAX

3 months agolibaura: Restore local variable name 'args'.
Antonio Huete Jimenez [Fri, 5 Feb 2021 00:07:59 +0000 (01:07 +0100)]
libaura: Restore local variable name 'args'.

  - For consistency's sake across the tree where 'args' or 'ap'
    are widely used.

3 months agolibaura: Restore fspred CVD Id.
Antonio Huete Jimenez [Fri, 5 Feb 2021 00:05:21 +0000 (01:05 +0100)]
libaura: Restore fspred CVD Id.

  - It is still important for some people.

3 months agolibaura: Remove unused variable
Antonio Huete Jimenez [Thu, 4 Feb 2021 09:15:24 +0000 (10:15 +0100)]
libaura: Remove unused variable

Reported-by: daftaupe
3 months agolibaura: Several fixes to fs predicates
Antonio Huete Jimenez [Thu, 4 Feb 2021 00:14:30 +0000 (01:14 +0100)]
libaura: Several fixes to fs predicates

  - Make is_program() a bit more precise.
  - Fix is_device()
  - Simplify the code a bit.
  - Regression tests now pass.

Test case                                                   Result
--------------------------------------------------------------------------------
usr.sbin/installer/libaura/dict1/dict1                      PASS
usr.sbin/installer/libaura/dict2/dict2                      PASS
usr.sbin/installer/libaura/dict3/dict3                      PASS
usr.sbin/installer/libaura/fspred1/fspred1                  PASS

3 months agolibaura: Fix fspred test
Antonio Huete Jimenez [Thu, 4 Feb 2021 00:12:29 +0000 (01:12 +0100)]
libaura: Fix fspred test

3 months agokernel/bpf: Put a struct declaration (netmsg_bpf_output) into the NBPF check.
Sascha Wildner [Tue, 2 Feb 2021 11:45:57 +0000 (12:45 +0100)]
kernel/bpf: Put a struct declaration (netmsg_bpf_output) into the NBPF check.

3 months agokernel/rtsock: Remove no longer needed ns_count in struct route_cb.
Sascha Wildner [Tue, 2 Feb 2021 11:44:11 +0000 (12:44 +0100)]
kernel/rtsock: Remove no longer needed ns_count in struct route_cb.

This is a leftover from the XEROX Network Systems (NS) protocol removal
(62b5ec1d702a90f4c4f06347b3ad258a29ff8929 and later commits).

3 months agokernel: Remove two unused declarations.
Sascha Wildner [Tue, 2 Feb 2021 11:41:30 +0000 (12:41 +0100)]
kernel: Remove two unused declarations.

3 months agoregression: Initial runlist for the regression tests
Antonio Huete Jimenez [Mon, 1 Feb 2021 01:16:44 +0000 (02:16 +0100)]
regression: Initial runlist for the regression tests

3 months agolibaura: Regression test for fspred
Antonio Huete Jimenez [Mon, 1 Feb 2021 01:15:40 +0000 (02:15 +0100)]
libaura: Regression test for fspred

3 months agoregression: Force rm to avoid dfregress to hang in stdin
Antonio Huete Jimenez [Mon, 1 Feb 2021 01:11:04 +0000 (02:11 +0100)]
regression: Force rm to avoid dfregress to hang in stdin

3 months agodsynth: Add extra information to the build output
Antonio Huete Jimenez [Mon, 1 Feb 2021 00:52:08 +0000 (01:52 +0100)]
dsynth: Add extra information to the build output

  - Sort of bring what marino's synth used to output before
    starting the build of a port. Environment, some make
    variables and /etc/make.conf

3 months agodsynth: Warn the user about world/kernel being out of sync
Antonio Huete Jimenez [Mon, 1 Feb 2021 00:02:29 +0000 (01:02 +0100)]
dsynth: Warn the user about world/kernel being out of sync

3 months agodsynth: Set OPSYS according to the detection or profile config
Antonio Huete Jimenez [Sun, 31 Jan 2021 17:51:00 +0000 (18:51 +0100)]
dsynth: Set OPSYS according to the detection or profile config

3 months agokernel: Fix two typos in comments.
Sascha Wildner [Sun, 31 Jan 2021 08:36:13 +0000 (09:36 +0100)]
kernel: Fix two typos in comments.

3 months agoSync zoneinfo database with tzdata2021a from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Sat, 30 Jan 2021 19:06:21 +0000 (20:06 +0100)]
Sync zoneinfo database with tzdata2021a from ftp://ftp.iana.org/tz/releases

* South Sudan changes from +03 to +02 on 2021-02-01 at 00:00.

* Also update leap second info.

For a detailed list of changes, see share/zoneinfo/NEWS.

3 months agosbin/hammer2: Fix compilation on Linux
Tomohiro Kusumi [Sat, 30 Jan 2021 17:31:46 +0000 (02:31 +0900)]
sbin/hammer2: Fix compilation on Linux

3 months agokernel: Move the flags for kern_dup() to <sys/filedesc.h>.
Sascha Wildner [Fri, 29 Jan 2021 20:33:50 +0000 (21:33 +0100)]
kernel: Move the flags for kern_dup() to <sys/filedesc.h>.

3 months agokernel/acpi: Remove bogus checks for < 0 of unsigned variables.
Sascha Wildner [Fri, 29 Jan 2021 11:28:47 +0000 (12:28 +0100)]
kernel/acpi: Remove bogus checks for < 0 of unsigned variables.

3 months agokernel/acpi: Fix some implementation specific shifting of signed ints.
Sascha Wildner [Fri, 29 Jan 2021 11:28:07 +0000 (12:28 +0100)]
kernel/acpi: Fix some implementation specific shifting of signed ints.

All these are stored as unsigned.

3 months agokernel/acpi: Remove an unused struct definition.
Sascha Wildner [Fri, 29 Jan 2021 10:41:55 +0000 (11:41 +0100)]
kernel/acpi: Remove an unused struct definition.

3 months agokernel/acpi: Remove unneeded bus number check.
Sascha Wildner [Fri, 29 Jan 2021 10:29:22 +0000 (11:29 +0100)]
kernel/acpi: Remove unneeded bus number check.

pcib_get_bus() never fails. Parent is pcib, so the bus number will be
valid.

3 months agokernel/acpi: Remove two redundant initializations.
Sascha Wildner [Fri, 29 Jan 2021 10:11:31 +0000 (11:11 +0100)]
kernel/acpi: Remove two redundant initializations.

3 months agokernel/acpi: Remove redundant NULL check.
Sascha Wildner [Fri, 29 Jan 2021 09:56:55 +0000 (10:56 +0100)]
kernel/acpi: Remove redundant NULL check.

AcpiGetObjectInfo() returned AE_OK and adinfo has already been
dereferenced at this point.

3 months agodsynth: Use semantic versioning-ish numbering for version
Antonio Huete Jimenez [Thu, 28 Jan 2021 12:23:07 +0000 (13:23 +0100)]
dsynth: Use semantic versioning-ish numbering for version

3 months agokernel - Separate XSAVE support from AVX support
Matthew Dillon [Thu, 28 Jan 2021 01:31:40 +0000 (17:31 -0800)]
kernel - Separate XSAVE support from AVX support

* XSAVE may be supported without AVX, on certain CPUs and also under
  hypervisors that expose XSAVEOPT without AVX.

* Always use XSAVE, when supported, regardless of whether AVX is supported
  or not.

Submitted-by: chicken
Bug-ID: #3264

3 months agokernel - Add memory barriers to more __asm functions.
Matthew Dillon [Thu, 28 Jan 2021 01:20:03 +0000 (17:20 -0800)]
kernel - Add memory barriers to more __asm functions.

   * Add memory barriers to more __asm functions that have memory
     side-effects.  This should help prevent any unexpected instruction
     reordering around these functions.

Submitted-by: chicken
Bug-ID: #3263

3 months agomsdosfs: fix #3237 where reading the last sector of a file returned 0s
Krzysztof Piecuch [Wed, 27 Jan 2021 23:38:33 +0000 (23:38 +0000)]
msdosfs: fix #3237 where reading the last sector of a file returned 0s

cluster_readx would load the correct data to cache except for the last
sector of a file, where the cache was filled with zeroes.

On small files (2 clusters) cluster_readx wouldn't even call
msdosfs_bmap, correctly read first cluster and return zeroes for the
second cluster.

Fix this by telling cluster_readx that the file is bigger than it
is. cluster_readx's `nblk` will then include the last sector.

3 months agodsynth.1: Several fixes
Antonio Huete Jimenez [Tue, 26 Jan 2021 11:13:17 +0000 (12:13 +0100)]
dsynth.1: Several fixes

  - Add some options and directives that were missing.
  - Rearrange the manpage to match the output of 'dsynth help'
  - Fix some new sentence, new line warnings from lint.

3 months agogetipnodebyname.3: Fix missing whitespace.
Sascha Wildner [Mon, 25 Jan 2021 05:32:24 +0000 (06:32 +0100)]
getipnodebyname.3: Fix missing whitespace.

3 months agoClean up markup of AF_INET* in a few manual pages.
Sascha Wildner [Sat, 23 Jan 2021 20:16:39 +0000 (21:16 +0100)]
Clean up markup of AF_INET* in a few manual pages.

3 months agoRevert "Fix various mistakes (s/it were/it was/) in manual pages."
Sascha Wildner [Fri, 22 Jan 2021 17:15:48 +0000 (18:15 +0100)]
Revert "Fix various mistakes (s/it were/it was/) in manual pages."

This reverts commit e4adeac153e9f588eff22befbf196d2fd3444bc3.

3 months agokernel/clock_getres: Improve CPU clock ID sanity checking.
Sascha Wildner [Fri, 22 Jan 2021 17:15:20 +0000 (18:15 +0100)]
kernel/clock_getres: Improve CPU clock ID sanity checking.

3 months agoclock_settime(2): Return EINVAL if tv_sec < 0
Aaron LI [Wed, 20 Jan 2021 14:01:39 +0000 (22:01 +0800)]
clock_settime(2): Return EINVAL if tv_sec < 0

The same argument check is also done in nanosleep(2)/clock_nanosleep(2),
and FreeBSD also does this check.

3 months agoUse 'sysmsg_result' macro for consistency
Aaron LI [Wed, 20 Jan 2021 02:40:13 +0000 (10:40 +0800)]
Use 'sysmsg_result' macro for consistency

Don't directly use the 'sm_result' union member in 'struct sysmsg',
consistent with other kernel code.

3 months ago<sys/sysmsg.h>: Remove a deprecated and duplicate union member
Aaron LI [Wed, 20 Jan 2021 02:26:40 +0000 (10:26 +0800)]
<sys/sysmsg.h>: Remove a deprecated and duplicate union member

In 'union sm_result', the 'int result' member is deprecated and replaced
by the 'int iresult' member.  So remove the 'result' one and change the
'sysmsg_result' macro accordingly.

3 months ago<sys/sysmsg.h>: Remove unused forward declarations
Aaron LI [Wed, 20 Jan 2021 02:09:37 +0000 (10:09 +0800)]
<sys/sysmsg.h>: Remove unused forward declarations

3 months agosyscall.9: Add some missing info and fix outdated contents
Aaron LI [Tue, 19 Jan 2021 14:41:43 +0000 (22:41 +0800)]
syscall.9: Add some missing info and fix outdated contents

* Update the syscall decleration (in syscalls.master) and generated
  prototype (in sysproto.h) examples to match the current syntax.
* Fix 'uap->sysmsg_result' to 'sysmsg->sysmsg_result', and be explicit
  that the function need to return 0 when the default 'sysmsg_result' is
  updated.
* Don't mention the 'SCARG' macro (to extract syscall argument) since
  it's now seldomly used in our codebase.  (Syscall argument can be
  intuitively extracted by 'uap->arg'.)
* Add a paragraph to describe the symbol exportation in libc via the
  'libc/sys/Symbol.map' file.
* Mention the syscall entry point in the kernel a bit.
* Add 'sys/sys/sysmsg.h' and 'sys/sys/sysunion.h' to the FILES section,
  while remove the obsolete 'sys/kern/syscalls.conf' (already folded
  into makesyscalls.sh).
* Some minor formatting and wording tweaks.

Reviewed-by: swildner
3 months agonanosleep.2: List clock_nanosleep() in the NAME section.
Sascha Wildner [Tue, 19 Jan 2021 19:05:49 +0000 (20:05 +0100)]
nanosleep.2: List clock_nanosleep() in the NAME section.

3 months ago<sys/sysmsg.h>: Add missing copyright and license header
Aaron LI [Mon, 18 Jan 2021 13:51:19 +0000 (21:51 +0800)]
<sys/sysmsg.h>: Add missing copyright and license header

3 months agoImplement clock_nanosleep(2) system call
Aaron LI [Sun, 17 Jan 2021 08:08:41 +0000 (16:08 +0800)]
Implement clock_nanosleep(2) system call

* Extend the nanosleep1() function in kern_time.c to support the
  clock_nanosleep(2) system call.  Add {kern,sys}_clock_nanosleep()
  functions and update kern_nanosleep() accordingly.

* Add clock_nanosleep() syscall to syscalls.master and regenerate
  syscall-related files.

* Update libc symbols with the new syscall.

* Add clock_nanosleep() warpper in libthread_xu.

* Update nanosleep.2 man page to describe clock_nanosleep().

* Update <time.h> and bump __DragonFly_version.

This work is loosely based on the FreeBSD implementation:
https://reviews.freebsd.org/rS315526

This clock_nanosleep(2) syscall passed all tests in the Open POSIX Test
Suite [0]:

conformance/interfaces/clock_nanosleep/1-1: execution: PASS
conformance/interfaces/clock_nanosleep/1-2: execution: PASS
conformance/interfaces/clock_nanosleep/1-3: execution: PASS
conformance/interfaces/clock_nanosleep/1-4: execution: PASS
conformance/interfaces/clock_nanosleep/1-5: execution: PASS
conformance/interfaces/clock_nanosleep/2-1: execution: PASS
conformance/interfaces/clock_nanosleep/2-2: execution: PASS
conformance/interfaces/clock_nanosleep/2-3: execution: PASS
conformance/interfaces/clock_nanosleep/3-1: execution: PASS
conformance/interfaces/clock_nanosleep/4-1: execution: PASS
conformance/interfaces/clock_nanosleep/5-1: execution: PASS
conformance/interfaces/clock_nanosleep/6-1: execution: PASS
conformance/interfaces/clock_nanosleep/9-1: execution: PASS
conformance/interfaces/clock_nanosleep/8-1: execution: PASS
conformance/interfaces/clock_nanosleep/10-1: execution: PASS
conformance/interfaces/clock_nanosleep/11-1: execution: PASS
conformance/interfaces/clock_nanosleep/13-1: execution: PASS
conformance/interfaces/clock_nanosleep/15-1: execution: PASS

[0] Open POSIX Test Suite: http://posixtest.sourceforge.net/

Reviewed-by: swildner, dillon, tuxillo, zach
3 months agonanosleep(2): Return EINVAL if tv_sec < 0 (POSIX-compliant)
Aaron LI [Mon, 18 Jan 2021 04:41:41 +0000 (12:41 +0800)]
nanosleep(2): Return EINVAL if tv_sec < 0 (POSIX-compliant)

When the requested sleep interval is negative, return EINVAL.  This
behavior is the same as Linux and makes our nanosleep(2) pass all tests
in the Open POSIX Test Suite [0].

conformance/interfaces/nanosleep/1-1: execution: PASS
conformance/interfaces/nanosleep/1-2: execution: PASS
conformance/interfaces/nanosleep/1-3: execution: PASS
conformance/interfaces/nanosleep/2-1: execution: PASS
conformance/interfaces/nanosleep/3-1: execution: PASS
conformance/interfaces/nanosleep/3-2: execution: PASS
conformance/interfaces/nanosleep/4-1: execution: PASS
conformance/interfaces/nanosleep/5-1: execution: PASS
conformance/interfaces/nanosleep/5-2: execution: PASS
conformance/interfaces/nanosleep/6-1: execution: PASS
conformance/interfaces/nanosleep/7-1: execution: PASS
conformance/interfaces/nanosleep/7-2: execution: PASS
conformance/interfaces/nanosleep/10000-1: execution: PASS

[0] Open POSIX Test Suite: http://posixtest.sourceforge.net/

3 months agonanosleep(2): Plug a memory disclourse and be POSIX-compliant
Aaron LI [Thu, 14 Jan 2021 05:06:02 +0000 (13:06 +0800)]
nanosleep(2): Plug a memory disclourse and be POSIX-compliant

The nanosleep1() called by sys_nanosleep() would only update rmt on
EINTR, but it can also return other errors, such as EINVAL.  And in that
case, sys_nanosleep() would update the user-space rmtp by copying
garbage from its stack frame.  This is not only a kernel memory
disclourse, but also not POSIX-compliant.

Fix sys_nanosleep() to update rmtp only on EINTR.  In addition, zero the
kernel rmt variable for double safety.

Obtained-from: FreeBSD (r315510)
Reviewd-by: dillon
3 months agokern/makesyscalls.sh: Revert change to '#endif' comment
Aaron LI [Tue, 19 Jan 2021 13:52:36 +0000 (21:52 +0800)]
kern/makesyscalls.sh: Revert change to '#endif' comment

Well, I misread the '#ifdef _KERNEL' with '#ifndef', so the comment of
'#endif' is right.  Revert the recent change to this part ;)

Reported-by: swildner
3 months ago<sys/sysproto.h>: Regenerate after 'makesyscalls.sh' update
Aaron LI [Thu, 14 Jan 2021 11:30:41 +0000 (19:30 +0800)]
<sys/sysproto.h>: Regenerate after 'makesyscalls.sh' update

3 months agokern/makesyscalls.sh: Better place #undef and fix #endif comments
Aaron LI [Thu, 14 Jan 2021 11:24:42 +0000 (19:24 +0800)]
kern/makesyscalls.sh: Better place #undef and fix #endif comments

* Move the placement of '#undef PAD_' so it just follows the end of
  syscall argument section.

* Fix the comments of '#endif', so that the '_SYS_SYSPROTO_H_' and
  '_KERNEL' hierachies are now correct.

3 months agotest/vmm: Refactor Makefile by using <bsd.prog.mk>
Aaron LI [Sat, 16 Jan 2021 09:02:41 +0000 (17:02 +0800)]
test/vmm: Refactor Makefile by using <bsd.prog.mk>

3 months agoUse ${} instead of $() in various makefiles
Aaron LI [Sat, 16 Jan 2021 09:00:59 +0000 (17:00 +0800)]
Use ${} instead of $() in various makefiles

Also use ${.TARGET} and ${.ALLSRC] wherever impossible.

Minor style adjustment in at(1)'s makefiles.

3 months agoFix various mistakes (s/it were/it was/) in manual pages.
Sascha Wildner [Tue, 19 Jan 2021 01:36:45 +0000 (02:36 +0100)]
Fix various mistakes (s/it were/it was/) in manual pages.

3 months agolibutil/setusercontext: Apply FreeBSD's b149798e50fac1113a7.
Sascha Wildner [Tue, 19 Jan 2021 00:13:16 +0000 (01:13 +0100)]
libutil/setusercontext: Apply FreeBSD's b149798e50fac1113a7.

FBSD commit msg:

Fix a clang 3.5 warning about abs(3) being given an argument of type
quad_t in setusercontext().  While here, sanitize the clamping of the
priority value, and use the correct type for the return value of
login_getcapnum().

3 months agousr.sbin/fstyp: Fix exfat detection
Tomohiro Kusumi [Mon, 18 Jan 2021 16:34:09 +0000 (01:34 +0900)]
usr.sbin/fstyp: Fix exfat detection

from FreeBSD ddf61156132b610915325769cbb93ea11be0d433

3 months agoAdd a smbfs(5) manual page (taken from FreeBSD).
Sascha Wildner [Sat, 16 Jan 2021 16:08:48 +0000 (17:08 +0100)]
Add a smbfs(5) manual page (taken from FreeBSD).

3 months agolibc/citrus: Cleanup the DFprivate_1.0 section of the Symbol.map.
Sascha Wildner [Sat, 16 Jan 2021 15:59:47 +0000 (16:59 +0100)]
libc/citrus: Cleanup the DFprivate_1.0 section of the Symbol.map.

None of these symbols were ever in our libc.

3 months agolibc/citrus: Remove two unused header files.
Sascha Wildner [Sat, 16 Jan 2021 04:28:22 +0000 (05:28 +0100)]
libc/citrus: Remove two unused header files.

3 months agotalkd: Find users in more than one talk request.
Dan Cross [Wed, 13 Jan 2021 23:55:47 +0000 (23:55 +0000)]
talkd: Find users in more than one talk request.

talkd was written to use `utmpentry` from `who`, which
caches the results of read the `utmpx` file.  However,
talkd is usually invoked from inetd `wait` mode; it's
possible that a user might login after `talkd` starts;
with the cached utmpx data, one can't `talk` to that
user.

Further, consumption of the utmp data nulls it out for
subsequent requests.  The result is that the first talk
succeeds, but subsequent requests fail.

The fix is to avoid using the `utmpentry` machinery,
and just read `utmp` directly every time we need to.

Signed-off-by: Dan Cross <cross@gajendra.net>
3 months agotalk: talk into account sa_len field in sockaddr.
Dan Cross [Fri, 15 Jan 2021 03:16:17 +0000 (03:16 +0000)]
talk: talk into account sa_len field in sockaddr.

`osockaddr` predates the introduction of the sa_len
field in `struct sockaddr`.  The family has moved to
the second field in the structure, but `talk` didn't
account for this when it constructs a `sockaddr_in`
to send data to another system.

The failure case was kind of odd: one could `talk`
to a user on, say, a Linux machine, the remote user
could respond, and things would work as expected.
However, the inverse case, where a user on Linux
tried to `talk` to a user on Dragonfly failed: the
talk announcement would be made, but an attempt to
respond would fail with a protocol error since the
`sin_family` field would be zero.

Signed-off-by: Dan Cross <cross@gajendra.net>
3 months agoUpdate the pciconf(8) database.
Sascha Wildner [Fri, 15 Jan 2021 15:22:03 +0000 (16:22 +0100)]
Update the pciconf(8) database.

January 11, 2021 snapshot from https://pci-ids.ucw.cz

3 months agoSync cmp(1) with FreeBSD. Mainly for 80445b7a3f738e0b which fixes a bug.
Sascha Wildner [Fri, 15 Jan 2021 08:53:26 +0000 (09:53 +0100)]
Sync cmp(1) with FreeBSD. Mainly for 80445b7a3f738e0b which fixes a bug.

Reported-by: William Ahern <william@25thandclement.com>
3 months agohexdump.1/operator.7: Use Ta instead of literal tabs.
Sascha Wildner [Wed, 13 Jan 2021 13:16:45 +0000 (14:16 +0100)]
hexdump.1/operator.7: Use Ta instead of literal tabs.

3 months agokernel - Fix atime field for PTYs
Matthew Dillon [Tue, 12 Jan 2021 06:33:02 +0000 (22:33 -0800)]
kernel - Fix atime field for PTYs

* Fix the atime field for PTYs.  A calculation in the shortcut code
  that avoids having to update the timestamp on every read() or
  write() was reversed.

Reported-by: dancrossnyc
3 months agofinger - Take into account terminal session ID
Matthew Dillon [Tue, 12 Jan 2021 06:22:14 +0000 (22:22 -0800)]
finger - Take into account terminal session ID

* The 'w' command tries to figure out what process is running on a TTY
  line and emit that as part of its output. Update its heuristics to
  select the "most interesting" process.

Reported-by: dancrossnyc
Bug-report: #3260