Download PDF Vol. II - Software Products Library
Transcript
System Service Input/Output Operations
23.17 Device Allocation
When you call the SYS$ALLOC system service, you must provide a device name.
The device name specified can be any of the following:
•
A physical device name, for example, the tape drive MTB3:
•
A logical name, for example, TAPE
•
A generic device name, for example, MT:
If you specify a physical device name, SYS$ALLOC attempts to allocate the
specified device.
If you specify a logical name, SYS$ALLOC translates the logical name and
attempts to allocate the physical device name equated to the logical name.
If you specify a generic device name (that is, if you specify a device type but
do not specify a controller or unit number, or both), SYS$ALLOC attempts to
allocate any device available of the specified type. For more information about
the allocation of devices by generic names, see Section 23.15.
When you specify generic device names, you must provide fields for the
SYS$ALLOC system service to return the name and the length of the physical
device that is actually allocated so that you can provide this name as input to the
SYS$ASSIGN system service.
The following example illustrates the allocation of a tape device specified by the
logical name TAPE:
#include
#include
#include
#include
#include
<descrip.h>
<lib$routines.h>
<ssdef.h>
<starlet.h>
<stdio.h>
main() {
unsigned int status;
char devstr[64];
unsigned short phylen, tapechan;
$DESCRIPTOR(logdev,"TAPE");
$DESCRIPTOR(devdesc,devstr);
/* Descriptor for logical name */
/* Descriptor for physical name */
/* Allocate a device */
status = SYS$ALLOC( &logdev,
/* devnam - device name */
!
&phylen,
/* phylen - length device name string */
&devdesc, /* phybuf - buffer for devnam string */
0, 0);
if (!$VMS_STATUS_SUCCESS( status ))
LIB$SIGNAL( status );
/* Assign a channel to the device */
status = SYS$ASSIGN( &devdesc,
&tapechan,
0, 0, 0);
if (!$VMS_STATUS_SUCCESS( status ))
LIB$SIGNAL( status );
/* Deassign the channel */
status = SYS$DASSGN( tapechan );
if (!$VMS_STATUS_SUCCESS( status ))
LIB$SIGNAL( status );
/* Deallocate the device */
status = SYS$DALLOC( &devdesc,
0 );
if (!$VMS_STATUS_SUCCESS( status ))
LIB$SIGNAL( status );
23–32 System Service Input/Output Operations
/* devnam - device name */ "
/* chan - channel number */
/* chan - channel number */#
/* devnam - device name */
/* acmode - access mode */
Related documents
PDF Part II
Grap — A Language for Typesetting Graphs Tutorial and User Manual
ARCO-UserManual
OpenVMS System Services Reference Manual: GETUTC–Z
AlphaFIX User`s Manual
User Manual FMS
Model 4200-SCS Semiconductor Characterization System
PDF Part I
032 Manual - Digi-Key
PDF Vol. II
POLYCENTER Software Installation Utility User`s Guide
About This User`s Manual - Fisher International, Inc.