diff options
author | David Howells <dhowells@redhat.com> | 2019-10-31 13:22:22 +0000 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2020-07-07 16:57:54 +0100 |
commit | 1276eac95470369bfc1de3ae26103992ab8e4e9a (patch) | |
tree | 1c77dc009f2441f3e8dd3657bf471d42266a4747 /keyutils.c | |
parent | f3095f4901820d31cc5600ee46949bcdb246b3fa (diff) | |
download | keyutils-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 'keyutils.c')
-rw-r--r-- | keyutils.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -385,6 +385,11 @@ long keyctl_capabilities(unsigned char *buffer, size_t buflen) return sizeof(unsigned char); } +long keyctl_watch_key(key_serial_t id, int watch_queue_fd, int watch_id) +{ + return keyctl(KEYCTL_WATCH_KEY, id, watch_queue_fd, watch_id); +} + /*****************************************************************************/ /* * fetch key description into an allocated buffer |