1 .\" Copyright (c) 2018 Mariusz Zaborski <oshogbo@FreeBSD.org>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .Nd "library for syslog in capability mode"
39 .In casper/cap_syslog.h
41 .Fn cap_syslog "cap_channel_t *chan" "int pri" "const char *fmt" "..."
43 .Fn cap_vsyslog "cap_channel_t *chan" "int priority" "const char *fmt" "va_list ap"
45 .Fn cap_openlog "cap_channel_t *chan" "const char *ident" "int logopt" "int facility"
47 .Fn cap_closelog "cap_channel_t *chan"
49 .Fn cap_setlogmask "cap_channel_t *chan" "int maskpri"
57 are respectively equivalent to
63 except that the connection to the
65 service needs to be provided.
67 All of these functions are reentrant but not thread-safe.
68 That is, they may be called from separate threads only with different
70 arguments or with synchronization.
72 The following example first opens a capability to casper and then uses this
73 capability to create the
75 casper service to log messages.
77 cap_channel_t *capcas, *capsyslog;
79 /* Open capability to Casper. */
82 err(1, "Unable to contact Casper");
84 /* Enter capability mode sandbox. */
85 if (cap_enter() < 0 && errno != ENOSYS)
86 err(1, "Unable to enter capability mode");
88 /* Use Casper capability to create capability to the system.syslog service. */
89 capsyslog = cap_service_open(capcas, "system.syslog");
90 if (capsyslog == NULL)
91 err(1, "Unable to open system.syslog service");
93 /* Close Casper capability, we don't need it anymore. */
96 /* Let's log something. */
97 cap_syslog(capsyslog, LOG_NOTICE, "System logs from capability mode.");
112 service first appeared in
115 .An Mariusz Zaborski Aq Mt oshogbo@FreeBSD.org