Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getdvagent(S) — System V/386 Software Development System 3.2.2b

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     GETDVAGENT(S)             UNIX System V             GETDVAGENT(S)



     Name
          getdvagent, getdvagnam, setdvagent, enddvagent, putdvagnam,
          copydvagent - manipulate device assignment database entry

     Syntax
          #include <sys/types.h>
          #include <sys/security.h>
          #include <sys/audit.h>
          #include <prot.h>

          struct dev_asg *getdvagent()

          struct dev_asg *getdvagnam (name)
          char *name;

          void setdvagent()

          void enddvagent()

          int putdvagnam (name, dv)
          char *name;
          struct dev_asg *dv;

          struct dev_asg *copydvagent(dv)
          struct dev_asg *dv;

     Description
          getdvagent, getdvagnam, and copydvagent each returns a
          pointer to an object with the following structure containing
          the broken-out fields of an entry in the Device Assignment
          database.  Each database entry is returned as a dev_asg
          structure, declared in the <prot.h> header file:

          struct dev_field {
               char *fd_name; /* external name */
               char **fd_devs;     /* device list */
               mask_t    fd_type[1];    /* tape, printer, terminal */
               char *fd_max_sl;    /* maximum sensitivity level */
               char *fd_min_sl;    /* minimum sensitivity level */
               char *fd_cur_sl;    /* currently assigned s.l. */
               mask_t    fd_assign[1];
                    /* single-level, multilevel, etc. */
          };

          /* bit offsets for fd_type */
          #define AUTH_DEV_PRINTER 0
               /* device is a printer (lp) */
          #define AUTH_DEV_TERMINAL     1
               /* device is a terminal (login) */
          #define AUTH_DEV_TAPE         2
               /* device can import/export data */
          /* bit offsets for fd_assign */
          #define AUTH_DEV_SINGLE       0
               /* single-level */
          #define AUTH_DEV_MULTI        1
               /* multilevel */
          #define AUTH_DEV_LABEL        2
               /* labeled import/export enabled */
          #define AUTH_DEV_NOLABEL      3
               /* unlabeled import/export enabled */
          #define AUTH_DEV_IMPORT       4
               /* enabled for import */
          #define AUTH_DEV_EXPORT       5
               /* enabled for export */

          /* this structure tells which of the corresponding fields
          /* in dev_field are valid (filled).
           */
          struct dev_flag {
               unsigned  fg_name : 1,
                         fg_devs : 1,
                         fg_max_sl : 1,
                         fg_min_sl : 1,
                         fg_cur_sl : 1,
                         fg_type   : 1,
                         fg_assign : 1,
                         fg_reserved : 25;

          };

          struct dev_asg {
               struct dev_field ufld;
               struct dev_flag  uflg;
          };

          The Device Assignment Database stores the relationship
          between device pathnames and real devices.  Each entry
          contains a name, which is a cross reference to the terminal
          control database, and a list of devices, each of which is a
          pathname which corresponds to that device.  Device drivers
          typically use different minor device numbers to correspond
          to different options on the same device, e.g., modem control
          on terminals or densities on tape drives.  This list allows
          the device assignment software of the SMP to invalidate all
          references to a device when re-assigning it.  The list is a
          table of character string pointers, whose last entry is a
          NULL pointer.

          For SMP versions supporting mandatory access control, the
          database also stores the maximum, minimum, and current
          sensitivity levels of assigned devices, as well as the
          current assignment mode.  On systems which do not support
          mandatory access control, the fd_min_sl , fd_max_sl ,

          fd_cur_sl , and fd_assign fields are not available.  All
          sensitivity levels are stored as external representations
          (character strings).  See the mand(S) page for routines that
          convert to internal representations.

          getdvagent when first called returns a pointer to the first
          device assignment entry.  Thereafter, it returns a pointer
          to the next entry, so successive calls can be used to search
          the database.  getdvagnam searches from the beginning of the
          database until an entry with device name matching name is
          found, and returns a pointer to that entry.  If an end of
          file or an error is encountered on reading, these functions
          return a NULL pointer.  copydvagent copies a device
          assignment structure and the fields to which it refers to a
          newly-allocated data area.  Since getdvagent, getdvagnam,
          and putdvagent re-use a static structure when accessing the
          database, the values of any entry must be saved if these
          routines are used again.  The dev_asg structure returned by
          copydvagent may be freed using free (see malloc(S)).

          A call to setdvagent has the effect of setting the device
          assignment database back to the first entry, to allow
          repeated searches of the database.  Enddvagent frees all
          memory and closes all files used to support these routines.

          putdvagnam re-writes or adds an entry to the database.  If
          there is an entry whose fd_name field matches the name
          argument, that entry is replaced with the contents of the dv
          structure.  Otherwise, that entry is added to the database.

     Files
          /etc/auth/system/devassign

     Diagnostics
          getdvagent and getdvagnam return a pointer to a static
          structure on success, or a NULL pointer on failure This
          static structure is overwritten by getdvagent, getdvagnam,
          and putdvagnam.  putdvagnam returns 1 on success, or 0 on
          failure.  copydvagent returns a pointer to the newly-
          allocated structure on success, or a NULL pointer if there
          was a memory allocation error.

     Value Added
          getdvagent is an extension of AT&T System V provided by the
          Santa Cruz Operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                (printed 6/20/89)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026