all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 31450c731e9546df06ed4b92bcec100439fc2c71 5109 bytes (raw)
name: lib/sd-socket.h 	 # note: path name is non-authoritative(*)

  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
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
 
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* Copied and adapted from systemd source code. */
#ifndef _SD_SOCKET_H
#define _SD_SOCKET_H 1

#include <inttypes.h>
#include <sys/types.h>
#include <sys/socket.h>

/*
  The following functionality is provided:

  - Support for logging with log levels on stderr
  - File descriptor passing for socket-based activation
  - Daemon startup and status notification
  - Detection of systemd boots

  See sd-daemon(3) for more information.
*/

/* The first passed file descriptor is fd 3 */
#define SD_LISTEN_FDS_START 3

/*
  Helper call for identifying a passed file descriptor. Returns 1 if
  the file descriptor is a socket of type (SOCK_DGRAM, SOCK_STREAM,
  ...), 0 otherwise. If type is 0 a socket type check will not be done
  and the call only verifies if the file descriptor refers to a
  socket. If listening is > 0 it is verified that the socket is in
  listening mode. (i.e. listen() has been called) If listening is == 0
  it is verified that the socket is not in listening mode. If
  listening is < 0 no listening mode check is done. Returns a negative
  errno style error code on failure.

  See sd_is_socket(3) for more information.
*/
int sd_is_socket(int fd, int type, int listening);

/*
  Informs systemd about changed daemon state. This takes a number of
  newline separated environment-style variable assignments in a
  string. The following variables are known:

     MAINPID=...  The main PID of a daemon, in case systemd did not
                  fork off the process itself. Example: "MAINPID=4711"

     READY=1      Tells systemd that daemon startup or daemon reload
                  is finished (only relevant for services of Type=notify).
                  The passed argument is a boolean "1" or "0". Since there
                  is little value in signaling non-readiness the only
                  value daemons should send is "READY=1".

     RELOADING=1  Tell systemd that the daemon began reloading its
                  configuration. When the configuration has been
                  reloaded completely, READY=1 should be sent to inform
                  systemd about this.

     STOPPING=1   Tells systemd that the daemon is about to go down.

     STATUS=...   Passes a single-line status string back to systemd
                  that describes the daemon state. This is free-form
                  and can be used for various purposes: general state
                  feedback, fsck-like programs could pass completion
                  percentages and failing programs could pass a human
                  readable error message. Example: "STATUS=Completed
                  66% of file system check..."

     NOTIFYACCESS=...
                  Reset the access to the service status notification socket.
                  Example: "NOTIFYACCESS=main"

     ERRNO=...    If a daemon fails, the errno-style error code,
                  formatted as string. Example: "ERRNO=2" for ENOENT.

     BUSERROR=... If a daemon fails, the D-Bus error-style error
                  code. Example: "BUSERROR=org.freedesktop.DBus.Error.TimedOut"

     WATCHDOG=1   Tells systemd to update the watchdog timestamp.
                  Services using this feature should do this in
                  regular intervals. A watchdog framework can use the
                  timestamps to detect failed services. Also see
                  sd_watchdog_enabled() below.

     WATCHDOG_USEC=...
                  Reset watchdog_usec value during runtime.
                  To reset watchdog_usec value, start the service again.
                  Example: "WATCHDOG_USEC=20000000"

     FDSTORE=1    Store the file descriptors passed along with the
                  message in the per-service file descriptor store,
                  and pass them to the main process again on next
                  invocation. This variable is only supported with
                  sd_pid_notify_with_fds().

     FDSTOREREMOVE=1
                  Remove one or more file descriptors from the file
                  descriptor store, identified by the name specified
                  in FDNAME=, see below.

     FDNAME=      A name to assign to new file descriptors stored in the
                  file descriptor store, or the name of the file descriptors
                  to remove in case of FDSTOREREMOVE=1.

  Daemons can choose to send additional variables. However, it is
  recommended to prefix variable names not listed above with X_.

  Returns a negative errno-style error code on failure. Returns > 0
  if systemd could be notified, 0 if it couldn't possibly because
  systemd is not running.

  Example: When a daemon finished starting up, it could issue this
  call to notify systemd about it:

     sd_notify(0, "READY=1");

  See sd_notifyf() for more complete examples.

  See sd_notify(3) for more information.
*/

/* This is actually a simplified version that you can find right there :
   https://www.freedesktop.org/software/systemd/man/devel/sd_notify.html#Notes
 */
int sd_notify_ready(void);
int sd_notify_stopping(void);

#endif

debug log:

solving 31450c731e9 ...
found 31450c731e9 in https://yhetil.org/emacs/87msow5cm8.fsf@ngraves.fr/

applying [1/1] https://yhetil.org/emacs/87msow5cm8.fsf@ngraves.fr/
diff --git a/lib/sd-socket.h b/lib/sd-socket.h
new file mode 100644
index 00000000000..31450c731e9

Checking patch lib/sd-socket.h...
Applied patch lib/sd-socket.h cleanly.

index at:
100644 31450c731e9546df06ed4b92bcec100439fc2c71	lib/sd-socket.h

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.