On Fri, 07 Jun 2019 15:18:19 +0100 David Howells <dhowells@xxxxxxxxxx> wrote: > Add a key/keyring change notification facility whereby notifications about > changes in key and keyring content and attributes can be received. > > Firstly, an event queue needs to be created: > > fd = open("/dev/event_queue", O_RDWR); > ioctl(fd, IOC_WATCH_QUEUE_SET_SIZE, page_size << n); > > then a notification can be set up to report notifications via that queue: > > struct watch_notification_filter filter = { > .nr_filters = 1, > .filters = { > [0] = { > .type = WATCH_TYPE_KEY_NOTIFY, > .subtype_filter[0] = UINT_MAX, > }, > }, > }; > ioctl(fd, IOC_WATCH_QUEUE_SET_FILTER, &filter); > keyctl_watch_key(KEY_SPEC_SESSION_KEYRING, fd, 0x01); One little nit: it seems that keyctl_watch_key is actually spelled keyctl(KEYCTL_WATCH_KEY, ...). jon