-.\"
.\" Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
.\" Written by David Howells (dhowells@redhat.com)
.\"
+.\" %%%LICENSE_START(GPLv2+_SW_ONEPARA)
.\" This program is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License
.\" as published by the Free Software Foundation; either version
.\" 2 of the License, or (at your option) any later version.
+.\" %%%LICENSE_END
.\"
.TH ADD_KEY 2 2010-02-25 Linux "Linux Key Management Calls"
.SH NAME
-add_key \- Add a key to the kernel's key management facility
+add_key \- add a key to the kernel's key management facility
.SH SYNOPSIS
.nf
.B #include <keyutils.h>
If the destination
.I keyring
already contains a key that matches the specified
-.IR type " and " description
+.IR type " and " description,
then, if the key type supports it, that key will be updated rather than a new
key being created; if not, a new key will be created and it will displace the
link to the extant key from the keyring.
.RB \*(lq afs:mykey \*(rq).
The
.I payload
-may be empty or
-.B NULL
-for keys of this type.
+may be empty or NULL for keys of this type.
.TP
.B \*(lqkeyring\*(rq
Keyrings are special key types that may contain links to sequences of other
keys of any type.
-If this interface is used to create a keyring, then a
-.B NULL
+If this interface is used to create a keyring, then a NULL
.I payload
should be specified, and
.I plen
On success
.BR add_key ()
returns the serial number of the key it created or updated.
-On error, the value
-.B -1
+On error, the value \-1
will be returned and errno will have been set to an appropriate error.
.SH ERRORS
.TP
.BR keyctl (1),
.BR keyctl (2),
.BR request_key (2)
+.SH COLOPHON
+This page is part of release 3.65 of the Linux
+.I man-pages
+project.
+A description of the project,
+and information about reporting bugs,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.