Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / getrbuf.9f
blobd1381ed5922a39ee39d54f42b317281cc4e26120
1 '\" te
2 .\" Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
3 .\" Copyright 1989 AT&T
4 .\" Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
5 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
7 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
8 .TH GETRBUF 9F "Jan 27, 2015"
9 .SH NAME
10 getrbuf \- get a raw buffer header
11 .SH SYNOPSIS
12 .LP
13 .nf
14 #include <sys/buf.h>
15 #include <sys/kmem.h>
16 #include <sys/ddi.h>
20 \fBstruct buf *\fR\fBgetrbuf\fR(\fBint\fR \fIsleepflag\fR);
21 .fi
23 .SH INTERFACE LEVEL
24 .LP
25 Architecture independent level 1 (DDI/DKI).
26 .SH PARAMETERS
27 .ne 2
28 .na
29 \fB\fIsleepflag\fR\fR
30 .ad
31 .RS 13n
32 Indicates whether driver should sleep for free space.
33 .RE
35 .SH DESCRIPTION
36 .LP
37 The \fBgetrbuf()\fR function allocates the space for a buffer header to the
38 caller. It is used in cases where a block driver is performing raw (character
39 interface) I/O and needs to set up a buffer header that is not associated with
40 the buffer cache.
41 .sp
42 .LP
43 The \fBgetrbuf()\fR function calls \fBkmem_alloc\fR(9F) to perform the memory
44 allocation. \fBkmem_alloc()\fR requires the information included in the
45 \fIsleepflag\fR argument. If \fIsleepflag\fR is set to \fBKM_SLEEP\fR, the
46 driver may sleep until the space is freed up. If \fIsleepflag\fR is set to
47 \fBKM_NOSLEEP\fR, the driver will not sleep.  In either case, a pointer to the
48 allocated space is returned or \fBNULL\fR to indicate that no space was
49 available.
50 .SH RETURN VALUES
51 .LP
52 The \fBgetrbuf()\fR function returns a pointer to the allocated buffer header,
53 or \fBNULL\fR if no space is available.
54 .SH CONTEXT
55 .LP
56 The \fBgetrbuf()\fR function can be called from user, interrupt, or kernel
57 context. (Drivers must not allow \fBgetrbuf()\fR to sleep if called from an
58 interrupt routine.)
59 .SH SEE ALSO
60 .LP
61 \fBbioinit\fR(9F), \fBfreerbuf\fR(9F), \fBkmem_alloc\fR(9F),
62 \fBkmem_free\fR(9F)
63 .sp
64 .LP
65 \fIWriting Device Drivers\fR