text
stringlengths
0
234
returns the serial number of the key it found or caused to be created.
on error, \-1 is returned and
.i errno
is set to indicate the error.
.sh errors
.tp
.b eacces
the keyring wasn't available for modification by the user.
.tp
.b edquot
the key quota for this user would be exceeded by creating this key or linking
it to the keyring.
.tp
.b efault
one of
.ir type ,
.ir description ,
or
.ir callout_info
points outside the process's accessible address space.
.tp
.b eintr
the request was interrupted by a signal; see
.br signal (7).
.tp
.b einval
the size of the string (including the terminating null byte) specified in
.i type
or
.i description
exceeded the limit (32 bytes and 4096 bytes respectively).
.tp
.b einval
the size of the string (including the terminating null byte) specified in
.i callout_info
exceeded the system page size.
.tp
.b ekeyexpired
an expired key was found, but no replacement could be obtained.
.tp
.b ekeyrejected
the attempt to generate a new key was rejected.
.tp
.b ekeyrevoked
a revoked key was found, but no replacement could be obtained.
.tp
.b enokey
no matching key was found.
.tp
.b enomem
insufficient memory to create a key.
.tp
.b eperm
the
.i type
argument started with a period (\(aq.\(aq).
.sh versions
this system call first appeared in linux 2.6.10.
the ability to instantiate keys upon request was added
.\" commit 3e30148c3d524a9c1c63ca28261bc24c457eb07a
in linux 2.6.13.
.sh conforming to
this system call is a nonstandard linux extension.
.sh notes
glibc does not provide a wrapper for this system call.
a wrapper is provided in the
.ir libkeyutils
library.
(the accompanying package provides the
.i <keyutils.h>
header file.)
when employing the wrapper in that library, link with
.ir \-lkeyutils .
.sh examples
the program below demonstrates the use of
.br request_key ().
the
.ir type ,
.ir description ,
and
.ir callout_info
arguments for the system call are taken from the values
supplied in the command-line arguments.
the call specifies the session keyring as the target keyring.
.pp
in order to demonstrate this program,
we first create a suitable entry in the file
.ir /etc/request\-key.conf .
.pp
.in +4n
.ex
$ sudo sh
# \fbecho \(aqcreate user mtk:* * /bin/keyctl instantiate %k %c %s\(aq \e\fp
\fb> /etc/request\-key.conf\fp
# \fbexit\fp
.ee
.in
.pp
this entry specifies that when a new "user" key with the prefix
"mtk:" must be instantiated, that task should be performed via the