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.
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.
Merge commit 'mvpel/sys_uptime'

Conflicts:
	libpromises/sysinfo.c
Add tests for $(sys.uptime/systime/sysday).
Merge pull request #803 from McAtte/master

Fix solaris 9 unit test failure of policy_test
reindent libraries/*.cf and lib/*/*.cf
reindent the rest of masterfiles/**/*.cf
fix up XML indentation for guest environments
Merge pull request #809 from kacfengine/sys_uptime

Sys uptime
Merge pull request #808 from tzz/master

reindent masterfiles contents, including stdlib
Fix test compile error.
Merge pull request #811 from kacfengine/master

Fix test
Indent all policy code according to style guide.

Squashed commit of the following:

commit 88b99377b9319e156d2f82b33086a866ff375028
Author: Ted Zlatanov <tzz@lifelogs.com>
Date:   Wed Jul 10 10:37:36 2013 -0400

    fix up reindent of tests/**/*.cf

commit 86d20cf6c5195ed6cc548a0bc439b00ddef366d2
Author: Ted Zlatanov <tzz@lifelogs.com>
Date:   Wed Jul 10 10:31:20 2013 -0400

    fix up reindent of examples/**/*.cf

commit 26e6b41d02f25acb03f0a2d43152e0d8c5dad239
Author: Ted Zlatanov <tzz@lifelogs.com>
Date:   Wed Jul 10 10:28:22 2013 -0400

    contrib/cfengine.el: do not indent AT ALL when inside a continued string

commit 7c09cf58bae4fedf69129a07c36e70cdfdadf564
Author: Ted Zlatanov <tzz@lifelogs.com>
Date:   Wed Jul 10 09:35:33 2013 -0400

    undo reindent of tests/10_files/{09_insert,07_delete}_lines/**/*.cf

commit bd109b29cd314b000c78a503cb94546502b997e0
Author: Ted Zlatanov <tzz@lifelogs.com>
Date:   Wed Jul 10 09:14:22 2013 -0400

    reindent tests/**/*.cf

commit 1daa1a0e8ca5d4fa83334bae90d7f32c402789e5
Author: Ted Zlatanov <tzz@lifelogs.com>
Date:   Wed Jul 10 09:14:13 2013 -0400

    reindent examples/**/*.cf
Merge pull request #789 from CedricCabessa/syslog

add process name and pid in syslog message sent by RemoteSysLog
Update changelog with first 3.6 changes
Fix uptime matching pcre_compile call and reset errno.

pcre_compile requires errptr to be present, and we should not tie the
match to the beginning of the line.

Additionally, reset errno before we try to call any uptime functions,
since otherwise we may get an error message even when there is no
error.
Merge pull request #814 from kacfengine/uptime_pcre_fix

Fix uptime matching pcre_compile call and reset errno.
Fix wrong test for MinGW.