blob: 6603cdc69cac29d704a8d1152082225b8eaf5332 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// SPDX-FileCopyrightText: © 2021 Grégoire Duchêne <gduchene@awhk.org>
// SPDX-License-Identifier: ISC
// Package gosdd provides simple wrappers around useful functions
// provided by systemd.
//
// On systems that are not Linux, or if the nosystemd build tag is set,
// safe defaults are returned: zero or nil values, and no error will be
// returned.
//
// Reference
//
// https://www.freedesktop.org/software/systemd/man/sd_listen_fds.html
// is the documentation for the C API.
package gosdd
import (
"errors"
"os"
)
// ErrNoSDSupport is a generic error that is returned when gosdd has no
// systemd support, either because the library is compiled on a system
// that is not Linux or because it was explicitly disabled with the
// ‘nosystemd’ build tag.
var ErrNoSDSupport = errors.New("no systemd support")
// SDListenFDs is a wrapper around sd_listen_fds.
func SDListenFDs(unsetenv bool) ([]*os.File, error) {
return sdListenFDs(unsetenv)
}
// SDListenFDsWithNames is a wrapper around sd_listen_fds_with_names.
func SDListenFDsWithNames(unsetenv bool) (map[string]*os.File, error) {
return sdListenFDsWithNames(unsetenv)
}
|