Add PIE compilation flags
[platform/upstream/keyutils.git] / keyctl_describe.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_DESCRIBE 3 "4 May 2006" Linux "Linux Key Management Calls"
11 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
12 .SH NAME
13 keyctl_describe \- Describe a key
14 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
15 .SH SYNOPSIS
16 .nf
17 .B #include <keyutils.h>
18 .sp
19 .BI "long keyctl_describe(key_serial_t " key ", char *" buffer ,
20 .BI "size_t" buflen ");"
21 .sp
22 .BI "long keyctl_describe_alloc(key_serial_t " key ", char **" _buffer ");"
23 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
24 .SH DESCRIPTION
25 .BR keyctl_describe ()
26 describes the attributes of a key as a NUL-terminated string.
27 .P
28 The caller must have
29 .B view
30 permission on a key to be able to get a description of it.
31 .P
32 .I buffer
33 and
34 .I buflen
35 specify the buffer into which the key description will be placed.  If the
36 buffer is too small, the full size of the description will be returned, and no
37 copy will take place.
38 .P
39 .BR keyctl_describe_alloc ()
40 is similar to
41 .BR keyctl_describe ()
42 except that it allocates a buffer big enough to hold the description and
43 places the description in it.  If successful, A pointer to the buffer is
44 placed in
45 .IR *_buffer .
46 The caller must free the buffer.
47 .P
48 The description will be a string of format:
49 .IP
50 .B "\*(lq%s;%d;%d;%08x;%s\*(rq"
51 .P
52 where the arguments are: key type name, key UID, key GID, key permissions mask
53 and key description.
54 .P
55 .B NOTE!
56 The key description will not contain any semicolons, so that should be
57 separated out by working backwards from the end of the string.  This permits
58 extra information to be inserted before it by later versions of the kernel
59 simply by inserting more semicolon-terminated substrings.
60 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
61 .SH RETURN VALUE
62 On success
63 .BR keyctl_describe ()
64 returns the amount of data placed into the buffer.  If the buffer was too
65 small, then the size of buffer required will be returned, but no data will be
66 transferred.  On error, the value
67 .B -1
68 will be returned and errno will have been set to an appropriate error.
69 .P
70 On success
71 .BR keyctl_describe_alloc ()
72 returns the amount of data in the buffer, less the NUL terminator.  On error, the value
73 .B -1
74 will be returned and errno will have been set to an appropriate error.
75 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
76 .SH ERRORS
77 .TP
78 .B ENOKEY
79 The key specified is invalid.
80 .TP
81 .B EKEYEXPIRED
82 The key specified has expired.
83 .TP
84 .B EKEYREVOKED
85 The key specified had been revoked.
86 .TP
87 .B EACCES
88 The key exists, but is not
89 .B viewable
90 by the calling process.
91 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
92 .SH LINKING
93 This is a library function that can be found in
94 .IR libkeyutils .
95 When linking,
96 .B -lkeyutils
97 should be specified to the linker.
98 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
99 .SH SEE ALSO
100 .BR keyctl (1),
101 .br
102 .BR add_key (2),
103 .br
104 .BR keyctl (2),
105 .br
106 .BR request_key (2),
107 .br
108 .BR keyctl (3),
109 .br
110 .BR request-key (8)