Copyright 1989 AT&T Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
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.
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.
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]
devreserv [key [device-list]...]
devreserv reserves devices for exclusive use. When the device is no longer required, use devfree to release it.
devreserv reserves at most one device per device-list. Each list is searched in linear order until the first available device is found. If a device cannot be reserved from each list, the entire reservation fails.
When devreserv is invoked without arguments, it lists the devices that are currently reserved and shows to which key it was reserved. When devreserv is invoked with only the key argument, it lists the devices that are currently reserved to that key.
The following operands are supported:
device-list
Defines a list of devices that devreserv will search to find an available device. The list must be formatted as a single argument to the shell.
key
Designates a unique key on which the device will be reserved. The key must be a positive integer.
Example 1 Reserving a Floppy Disk and a Cartridge Tape
The following example reserves a floppy disk and a cartridge tape:
$ key=$$ $ echo "The current Process ID is equal to: $key" The Current Process ID is equal to: 10658 $ devreserv $key diskette1 ctape1
Example 2 Listing All Devices Currently Reserved
The following example lists all devices currently reserved:
$ devreserv disk1 2423 diskette1 10658 ctape1 10658
Example 3 Listing All Devices Currently Reserved to a Particular Key
The following example lists all devices currently reserved to a particular key:
$ devreserv $key diskette1 ctape1
The following exit values are returned:
0
Successful completion.
1
Command syntax was incorrect, an invalid was option used, or an internal error occurred.
2
Device table or device reservation table could not be opened for reading.
3
Device reservation request could not be fulfilled.
devfree(1M), attributes(5)
The commands devreserv and devfree are used to manage the availability of devices on a system. Their use is on a participatory basis and they do not place any constraints on the actual access to the device. They serve as a centralized bookkeeping point for those who wish to use them. Devices which have been reserved cannot be used by processes which utilize the device reservation functions until the reservation has been canceled. However, processes that do not use device reservation may use a device that has been reserved since such a process would not have checked for its reservation status.