summaryrefslogtreecommitdiff
path: root/keyctl.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2019-10-31 13:22:22 +0000
committerDavid Howells <dhowells@redhat.com>2020-07-07 16:57:54 +0100
commit1276eac95470369bfc1de3ae26103992ab8e4e9a (patch)
tree1c77dc009f2441f3e8dd3657bf471d42266a4747 /keyctl.h
parentf3095f4901820d31cc5600ee46949bcdb246b3fa (diff)
downloadkeyutils-1276eac95470369bfc1de3ae26103992ab8e4e9a.tar.gz
Add a notification facility for watching for key changes
Add keyctl commands and library functions to handle the setting and removal of watches on keys for notifications of change events. Five keyctl commands are defined: (1) keyctl watch <key> Watch the specified key for changes, logging notifications to stdout. (2) keyctl watch_session [-n <name>] <notifylog> <gclog> <fd> prog [<arg>...] Create a new session keyring and attach a watch to it that an auxiliary logging process monitors. The nominated program is run with the session program with the arguments given. The session keyring can be given a name. The logging process will log synchronous events to file notifylog and asynchronous events to file gclog. The specified file descriptor will be attached to the watch_queue and left open across the exec. This can be made use of by the next few commands. (3) keyctl watch_add <fd> <key> (4) keyctl watch_rm <fd> <key> Add/remove a watch on the specified key to/from the given watch_queue derived from watch_session. (5) keyctl watch_sync <fd> Wait for the logging process that's watching the given watch_queue to synchronise. Commands (2) to (5) are primarily provided for the testsuite's purposes. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'keyctl.h')
-rw-r--r--keyctl.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/keyctl.h b/keyctl.h
index e061334..ee86779 100644
--- a/keyctl.h
+++ b/keyctl.h
@@ -21,9 +21,20 @@ struct command {
* keyctl.c
*/
extern nr void do_command(int, char **, const struct command *, const char *);
-extern nr void error(const char *);
+extern nr void format(void) __attribute__((noreturn));
+extern nr void error(const char *) __attribute__((noreturn));
+extern key_serial_t get_key_id(char *);
/*
* keyctl_testing.c
*/
extern nr void act_keyctl_test(int, char *[]);
+
+/*
+ * keyctl_watch.c
+ */
+extern nr void act_keyctl_watch(int , char *[]);
+extern nr void act_keyctl_watch_add(int , char *[]);
+extern nr void act_keyctl_watch_rm(int , char *[]);
+extern nr void act_keyctl_watch_session(int , char *[]);
+extern nr void act_keyctl_watch_sync(int , char *[]);