KEYCTL_SET_TIMEOUT(3)

πŸ“¦
version 1.6.3 Β· 2 versions
  • 1.6.3 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 1.6.1 Β· ubuntu jammy
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– KEYCTL_SET_TIMEOUT(3) πŸ’–

okay bestie, welcome to section 3 of the Linux Key Management Calls β€” this one's all about giving your keys a lil expiration timer ⏰✨


🌸 NAME 🌸

keyctl_set_timeout β€” set the expiration timer on a key πŸŽ€


✨ SYNOPSIS ✨

#include <keyutils.h>

long keyctl_set_timeout(key_serial_t key, unsigned timeout);

πŸ’… DESCRIPTION πŸ’…

so basically, keyctl_set_timeout() sets the expiration timer on a key to timeout seconds into the future. like, you're picking a countdown for it πŸ•°οΈ

and if you set timeout to zero? that cancels the expiration entirely β€” assuming the key hasn't already expired, bestie. no takebacks if it's already gone πŸ’€

once the key expires, any further attempts to access it will be met with error EKEYEXPIRED. it's giving locked out of your own notes app πŸ™ˆ

also important: the caller must have setattr permission on the key to be able to change its permissions mask. no permission, no party 🚫

⭐ RETURN VALUE ⭐

on success, keyctl_set_timeout() returns 0. slay ✨

on error, the value -1 will be returned and errno will have been set to an appropriate error. not slay 😭


πŸ”₯ ERRORS πŸ”₯

  • ENOKEY β€” the specified key does not exist. it's not there, girl, it never was πŸ’€
  • EKEYEXPIRED β€” the specified key has already expired. too late bestie, the timer already ran out ⏳
  • EKEYREVOKED β€” the specified key has been revoked. it's been cancelled, we don't talk to it anymore πŸ™…
  • EACCES β€” the named key exists, but does not grant setattr permission to the calling process. it's there but it said no πŸ’…

πŸ¦‹ LINKING πŸ¦‹

this is a library function that can be found in libkeyutils. so when you're linking, you gotta pass -lkeyutils to the linker, periodt πŸ”—


🌈 SEE ALSO 🌈

keyctl(1), add_key(2), keyctl(2), request_key(2), keyctl(3), keyrings(7), keyutils(7)


and that's the whole page, bestie 🫢 this one came from the Linux key management crew, version dated 4 May 2006, filed under KEYCTL_SET_TIMEOUT(3) β€” go set some timeouts, ily, mwah πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from