Specification for SLC Database Access Routines, 11/17/2004 We need a file called dbio.c (prototypes in dbio.h) with the following routines which will reside under $EPICS/site/src/slc/dbs where it will be used by the SLC IOC. Note: these routines will need to be reentrant. dblist (dbheader_ts **const dblist, const char * const prim, const char * const unit, const char * const secn) dblunits (dbheader_ts **const dbdata, const char * const prim) dblget (dbheader_ts **const dbdata, dbheader_ts * const dblist) dblput (dbheader_ts * const dbdata, dbheader_ts * const dblist) dballoc (dbheader_ts **const dbdata, const int2u bytes_in_element, const int2u num_elements) dbfree (dbheader_ts *const dbdata_or_list) dbunit2string(const int2u int_unit, char * const unit) dbexists (void) dbupdate (const char * const jobName) Except for dbexists, all of the above return a 4 byte unsigned VMS condition code defined in dbdef.hc. The dblist and dblunits routines first wait for the database if it doesn't exist and will return an error if it doesn't exist after waiting a fixed timeout. If the database is locked by another task's dblget or dblput, dblget and dblput will block until the database is free. The dblput routine includes setting a data update table so the next Alpha update includes the change. If this table is currently locked by an ongoing Alpha update, dblput will block until it is free (no longer than 15 seconds). The dbunit2string routine converts an integer unit to a unit name. The dbexists routines return 1 if the database is available and 0 if not. "ALL*" is allowed for unit in dblist and jobName in dbupdate. Note that prim, unit, secn, and jobName must be 4 chars with blank-padding to fill out to 4 chars if needed. IMPORTANT NOTE: dblunits returns a list of 4-char, non-null-terminated, blank-padded unit names. In addition to the above, the following routines which can be called from the EPICS iocsh prompt, RTEMS Cexp prompt, or vxWorks prompt will be provided. Note that "ALL*" is not allowed unless otherwise specified. dbgettype(const char * const prim, const char * const secn) Returns the native data type enum value. dbgetwidth(const char * const prim, const char * const secn) Returns the data width in number of bytes. dbgetcount(const char * const prim, const char * const unit, const char * const secn) Returns the number of elements. dbdump(const char * const prim, const char * const unit, const char * const secn) Dump the value(s); will need to know native data type. One of the following fields can be ALL* (not both): unit, secn. dbdumpunits(const char * const prim) Dump the unit(s). dbedit(const char * const prim, const char * const unit, const char * const secn, char * const value1, char * const value2, ...) Converts ASCII values to proper format and puts them into the SLC database; will need to know native data type. Supertype 1 data can be updated only if allowed by an environment variable. dbupdate(const char * const jobName) Force update of any outstanding supertype 2 and 3 data changes for the job to DBEX. If job is "ALL*", force update for all jobs. dbdumphash(no args) Dump the hash table. dbdumpdatabase(no args) Dump the whole SLC database.