Add PIE compilation flags
[platform/upstream/keyutils.git] / keyctl_link.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_LINK 3 "4 May 2006" Linux "Linux Key Management Calls"
11 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
12 .SH NAME
13 keyctl_link \- Link a key to a keyring
14 keyctl_unlink \- Unlink a key from a keyring
15 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
16 .SH SYNOPSIS
17 .nf
18 .B #include <keyutils.h>
19 .sp
20 .BI "long keyctl_link(key_serial_t " key ", key_serial_t " keyring ");"
21 .sp
22 .BI "long keyctl_unlink(key_serial_t " key ", key_serial_t " keyring ");"
23 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
24 .SH DESCRIPTION
25 .BR keyctl_link ()
26 creates a link from
27 .I keyring
28 to
29 .IR key ,
30 displacing any link to another key of the same type and description in that
31 keyring if one exists.
32 .P
33 .BR keyctl_unlink ()
34 removes the link from
35 .I keyring
36 to
37 .I key
38 if it exists.
39 .P
40 The caller must have
41 .B write
42 permission on a keyring to be able create or remove links in it.
43 .P
44 The caller must have
45 .B link
46 permission on a key to be able to create a link to it.
47 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
48 .SH RETURN VALUE
49 On success
50 .BR keyctl_link ()
51 and
52 .BR keyctl_unlink ()
53 return
54 .BR 0 .
55 On error, the value
56 .B -1
57 will be returned and errno will have been set to an appropriate error.
58 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
59 .SH ERRORS
60 .TP
61 .B ENOKEY
62 The key or the keyring specified are invalid.
63 .TP
64 .B EKEYEXPIRED
65 The key or the keyring specified have expired.
66 .TP
67 .B EKEYREVOKED
68 The key or the keyring specified have been revoked.
69 .TP
70 .B EACCES
71 The keyring exists, but is not
72 .B writable
73 by the calling process.
74 .P
75 For
76 .BR keyctl_link ()
77 only:
78 .TP
79 .B ENOMEM
80 Insufficient memory to expand the keyring
81 .TP
82 .B EDQUOT
83 Expanding the keyring would exceed the keyring owner's quota.
84 .TP
85 .B EACCES
86 The key exists, but is not
87 .B linkable
88 by the calling process.
89 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
90 .SH LINKING
91 This is a library function that can be found in
92 .IR libkeyutils .
93 When linking,
94 .B -lkeyutils
95 should be specified to the linker.
96 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
97 .SH SEE ALSO
98 .BR keyctl (1),
99 .br
100 .BR add_key (2),
101 .br
102 .BR keyctl (2),
103 .br
104 .BR request_key (2),
105 .br
106 .BR keyctl (3),
107 .br
108 .BR request-key (8)