]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/pty-session: add log callbacks
authorKarel Zak <kzak@redhat.com>
Wed, 2 Oct 2019 15:34:51 +0000 (17:34 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 8 Oct 2019 11:11:54 +0000 (13:11 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
include/pty-session.h

index c139d6f97e0060e8f7f062c43e20289fc6e85134..66b62a1dea581c3f56c2622e895e90b67417f4e4 100644 (file)
 #include <signal.h>
 #include <sys/time.h>
 
+#include <sys/signalfd.h>
+
+/*
+ * Callbacks -- the first argument is always callback data, see
+ * ul_pty_set_callback_data().
+ */
 struct ul_pty_callbacks {
+       /*
+        * Executed on SIGCHLD when ssi_code is EXITED, KILLED or DUMPED
+        * @
+        */
        void (*child_wait)(void *);
+
+       /*
+        * Executed on SIGCHLD when ssi_status is SIGSTOP
+        */
        void (*child_sigstop)(void *);
 
+       /*
+        * Executed in master loop before ul_pty enter poll() and in time set by
+        * ul_pty_set_mainloop_time(). The callback is no used when time is not set.
+        */
        int (*mainloop)(void *);
+
+       /*
+        * Executed on master or stdin activity, arguments:
+        *   2nd - file descriptor
+        *   3rd - buffer with data
+        *   4th - size of the data
+        */
+       int (*log_stream_activity)(void *, int, char *, size_t);
+
+       /*
+        * Executed on signal, arguments:
+        *   2nd - signal info
+        *   3rd - NULL or signal specific data (e.g. struct winsize on SIGWINCH
+        */
+       int (*log_signal)(void *, struct signalfd_siginfo, void *);
 };
 
 struct ul_pty {