Rename ul_sys_settings to ul_thread_data

... to clarify its scope, and account for caches contained there.  Next
commit will add per-process data, and having the smaller-scope structure
named "sys" would be confusing.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Make "facility" set by ul_openlog() per-process

... to match openlog(3).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Change the default facility to LOG_USER.

... to comply with openlog(3p).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Don't reset facility on closelog()

This is not defined by closelog(3p), and the BSD implementation doesn't
do it either.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Make "ident" (log tag) a per-process variable

... to comply with openlog(3p).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Don't include "program": "(null)" if ident is not set

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Default ident (log tag) to program_invocation_short_name

This is a glibc variable, so leave the "program" field missing on
platforms that don't support it.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Make "flags" a per-process variable

... to match openlog(3p).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Don't reset flags on closelog()

... to be compatible with BSD syslog.
Move the caches into ul_process_data

None of the cache items is thread-specific.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Mark missing PID cache data separately from flags.

This simplifies the syslog() path a little, and allows us to express
"PID should be cached but no value is set.".

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Initialize PID to "no value cached"

Now syslog () without openlog () will include a correct PID value instead
of 0.  Also reset the cache on closelog ().

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Fix return type of _get_gid ()

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Mark missing [UG]ID cache data separately from flags.

This simplifies the syslog() path a little, and allows us to express
"[UG]ID should be cached but no value is set.".

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Initialize [UG]ID to "no value cached"

Now syslog () without openlog () will include a correct [UG]ID value instead
of 0.  Also reset the cache on closelog ().

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Mark missing host name separately from flags.

This simplifies the syslog() path a little, and allows us to express
"host name should be cached but no value is set.".

Because host name field is already emptied by default and in closelog (),
this also means uncached data is used before openlog () and after
closelog ().

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Don't set up caches if UL_NO_DISCOVER is set

We won't need the data in that case.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Fix ul_recurse indicator, again.

Don't reset ul_recurse before exiting a recursive invocation.
Apparently I have send this patch before, followed by a patch that
immediately reverts it, so resending.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Add prototypes to old_*

to minimize the risk of type mistakes.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Remove some unused variables.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>