DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
HDK Technical Reference

Clone device

A clone device is a unique node in the file system that can be opened to access any unused device controlled by the specific driver. This special node guarantees that the user is allocated a unique device on every open( ) call, without requiring the calling process to poll a driver's minor device nodes to find an unused device.. Cloning is most often used in STREAMS drivers, where it guarantees the user a separate Stream that is associated with an unused device instance or, for SCO OpenServer 5 drivers and DDI versions prior to version 8, device number.

The clone device is useful, for example, in a networking environment where a protocol pseudo-device driver requires each user to open a separate Stream over which it establishes communication.

DDI 8 implementation

Clone behavior in DDI 8 drivers is implemented as open redirection. See the open(D2) manual page for details. The $maxchan field of the Node(DSP/4dsp) file and the drv_maxchan member of the drvinfo(D4) structure should allow one channel for each special device file that is defined in the Node file plus one channel for each clone open( ) that is supported. So, if you anticipate needing 16 clone devices, set $maxchan to 16. Since the first channel is 0, this creates 16 clone nodes plus the original node. The $maxchan value determines the number of channels are allocated in the device table for the driver.

ODDI and pre-DDI 8 implementation

A clone device node can be created in the file system in one of two ways:

For both methods, the driver returns the new device number as

   *devp = makedevice(getemajor(*devp), newminor);


NOTE: makedevice is unique to the DDI. If the DDI is not used, makedev can be used instead of makedevice.

Note the following when using clone devices in ODDI and DDI versions prior to version 8:


© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005