12 "github.com/coreos/go-systemd/activation"
15// listenFdsStart corresponds to `SD_LISTEN_FDS_START`.
16// Since the 3 first file descriptors in every linux process is
17// stdin, stdout and stderr. The first usable file descriptor is 3.
18// systemd-socket-activate will always assume that the first socket will be
19// 3 and the rest follow.
24// convert a string filedescriptor to an actual listener
25func (s *server) fdToListener(bindAddress string) (net.Listener, error) {
26 fd, err := strconv.Atoi(bindAddress)
28 return nil, errors.New("listen failed: fd with name is not implemented yet")
30 fdIndex := fd - listenFdsStart
32 if len(s.fdFiles) == 0 {
33 s.fdFiles = activation.Files(true)
38 if fdIndex < 0 || fdIndex >= l || l == 0 {
39 return nil, errors.New("listen failed: fd outside of range of available file descriptors")
42 return net.FileListener(s.fdFiles[fdIndex])
45func (s *server) checkSystemdSocketSupport(opts Opts) error {
46 listenAddr := opts.BindAddress[3:]
47 listener, err := s.fdToListener(listenAddr)
49 err = fmt.Errorf("listen (file, %s) failed: %w", listenAddr, err)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list