Implementing a new $(sys.uptime) variable (Mantis #1134)

The $(sys.uptime) variable contains the number of mintues the system
has been up and running. It uses various techniques depending on the OS
platform to find the system uptime:

* sysinfo() for Linux platforms
* kstat() for Solaris platforms
* pstat_getproc() for HP-UX
* sysctl() for BSD platforms

Any platform which doesn't have one of these methods available will default
to a stat(/proc/1) to get the create time of the init process, which falls
within a few seconds of the boot time of the system. (Even though Linux and
Solaris have /proc, this method is not used on those platforms even as a
fallback.)

If any of these approaches fail, the routine falls back to running the
"/usr/bin/uptime" or "/bin/uptime" command, and its output is parsed into
days, hours, and minutes with a PCRE regexp, and converted to a usable time
for the variable. Thanks to Ted Zlatanov for the suggestion: https://github.com/cfengine/core/pull/46#issuecomment-10066632

This popen() approach is unlikely to be used very frequently - probably only if
the /proc filesystem isn't mounted - but it's a decent backstop to give a
system the best possible chance to set $(sys.uptime) successfully.

Two other closely related variables are introduced: $(sys.systime) and
$(sys.sysday). The former is simply the result of the time() system call,
which is useful in manipulating timestamps in HP-UX TCB password databases,
for example, and the latter is that value divided by 86,400 - the number of
seconds in a day - expressed as an integer. This is, of course, useful in the
/etc/shadow file to indicate the password change date.

Three new documents are added in docs/reference/vars to describe the
$(sys.uptime), $(sys.systime), and $(sys.sysday) variables.
BSD <sys/param.h> include is required for <sys/sysctl.h> header checks

See also jail.h, sys/mount.h checks.
64-bit time_t snprintf; cf_popen needs pipes.h - for sys.uptime var

The cf_popen() and cf_pclose() calls now need to have pipes.h included,
because it was factored out in commit 5be64d09bc4c9c9659d53d2b5bf61286f768acbf.

The time_t type needs the proper printf format to support both 32- and 64-bit
platforms. On older platforms which don't have a C99-compliant snprintf, the
"pub/snprintf.c" replacement is used, so that a "%jd" format can be used even
on such platforms. Normally they would use the PRIdMAX definition from
inttypes.h. See commit f6ba42d5b2988be1f94ee4e55baa174fd7906362.
Remove unneeded static function (only used once).
Made file copies and edits preserve extended attributes.

This means that ACLs and security context information will be copied
along with a file if the "preserve" attribute is set and the copy is
local, or if the copy is part of an edit operation. For remote copies,
only Unix mode is preserved. If the preservation is unsuccessful, the
promise will fail.

Solves issue 2728.
Internal data coherence checks + removal of keys from lastseen and fs
Fix missing "promise kept" status for the last line in a file.

For the last line we shortcut out using MatchRegion, but previously
we did not set the promise status.

Fixes issue 2943.
Merge pull request #773 from kacfengine/preserveAllAttributes

Make file copies and edits preserve extended attributes.
Fixes Redmine #2553: different path for sys.crontab on redhat systems

See https://cfengine.com/dev/issues/2553.

Conflicts:
	src/sysinfo.c
Fix bad merge
Only check literal edit anchors.

Close #2778
Fix "changes" promise not receiving status when file is missing.

Fixes issue 2820.
Merge pull request #792 from jeffali/feature/delkeys9b

Internal data coherence checks + removal of keys from lastseen and fs
Fix linking problem in lastseen_load
Merge pull request #796 from jeffali/feature/delkeys9c

Fix linking problem in lastseen_load
libpromises: initialize variable, avoid gcc warning
libcfnet,promises: allow TCP port numbers from 32k-64k

Oddly enough, we had been using "signed short" for TCP port numbers,
limiting usable ports to max 32767. But there are more! I tried to
use the "53308" port and then stumbled upon this limitation.
files_lib.c: cast a const, avoid a gcc warning
server.c: after refusing transfer access, exit the function

Why would we want to continue with the flow and open the file?
add process name and pid in syslog message sent by RemoteSysLog

RemoteSysLog is usefull when real syslog is not available. As explained in
rfc3164 (§5.3) we should provide process information as process name and pid.
This make filtering message much more easy.