Imported Upstream version 1.5.3
[platform/upstream/keyutils.git] / keyctl_get_keyring_ID.3
1 .\"
2 .\" Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
3 .\" Written by David Howells (dhowells@redhat.com)
4 .\"
5 .\" This program is free software; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License
7 .\" as published by the Free Software Foundation; either version
8 .\" 2 of the License, or (at your option) any later version.
9 .\"
10 .TH KEYCTL_GET_KEYRING_ID 3 "4 May 2006" Linux "Linux Key Management Calls"
11 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
12 .SH NAME
13 keyctl_get_keyring_ID \- Get the ID of a special keyring
14 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
15 .SH SYNOPSIS
16 .nf
17 .B #include <keyutils.h>
18 .sp
19 .BI "key_serial_t keyctl_get_keyring_ID(key_serial_t " key ","
20 .BI " int " create ");"
21 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
22 .SH DESCRIPTION
23 .BR keyctl_get_keyring_ID ()
24 maps a special
25 .I key
26 or keyring ID to the serial number of the key actually representing that
27 feature.  The serial number will be returned if that key exists.
28 .P
29 If the key or keyring does not yet exist, then if
30 .I create
31 is non-zero, the key or keyring will be created if it is appropriate to do so.
32 .P
33 The following special key IDs may be specified as
34 .IR key :
35 .TP
36 .B KEY_SPEC_THREAD_KEYRING
37 This specifies the caller's thread-specific keyring.
38 .TP
39 .B KEY_SPEC_PROCESS_KEYRING
40 This specifies the caller's process-specific keyring.
41 .TP
42 .B KEY_SPEC_SESSION_KEYRING
43 This specifies the caller's session-specific keyring.
44 .TP
45 .B KEY_SPEC_USER_KEYRING
46 This specifies the caller's UID-specific keyring.
47 .TP
48 .B KEY_SPEC_USER_SESSION_KEYRING
49 This specifies the caller's UID-session keyring.
50 .TP
51 .B KEY_SPEC_REQKEY_AUTH_KEY
52 This specifies the authorisation key created by
53 .BR request_key ()
54 and passed to the process it spawns to generate a key.
55 .P
56 If a valid keyring ID is passed in, then this will simply be returned if the
57 key exists; an error will be issued if it doesn't exist.
58 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
59 .SH RETURN VALUE
60 On success
61 .BR keyctl_get_keyring_ID ()
62 returns the serial number of the key it found.  On error, the value
63 .B -1
64 will be returned and errno will have been set to an appropriate error.
65 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
66 .SH ERRORS
67 .TP
68 .B ENOKEY
69 No matching key was found.
70 .TP
71 .B ENOMEM
72 Insufficient memory to create a key.
73 .TP
74 .B EDQUOT
75 The key quota for this user would be exceeded by creating this key or linking
76 it to the keyring.
77 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
78 .SH LINKING
79 This is a library function that can be found in
80 .IR libkeyutils .
81 When linking,
82 .B -lkeyutils
83 should be specified to the linker.
84 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
85 .SH SEE ALSO
86 .BR keyctl (1),
87 .br
88 .BR add_key (2),
89 .br
90 .BR keyctl (2),
91 .br
92 .BR request_key (2),
93 .br
94 .BR keyctl (3),
95 .br
96 .BR request-key (8)