char *mrec;
INT crt;
SET_ENTRY *set_ptr;
-#ifndef SINGLE_USER
- int dbopen_sv;
-#endif
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
if ( ! curr_mem[set] )
RETURN( dberr( S_NOCM ) );
-#ifndef SINGLE_USER
- /* set up to allow unlocked read */
- dbopen_sv = dbopen;
- dbopen = 2;
-#endif
/* Read current member */
dio_read(curr_mem[set], (char **)&mrec, NOPGHOLD);
-#ifndef SINGLE_USER
- dbopen = dbopen_sv;
-#endif
if (db_status != S_OKAY)
RETURN( db_status );
/* Fetch record type from record header */
bytecpy(&crt, mrec, sizeof(INT));
-#ifndef SINGLE_USER
- crt &= ~RLBMASK; /* mask off rlb */
-#endif
*cmtype = (int)crt + RECMARK;
RETURN( db_status );
{
char *orec;
INT crt;
-#ifndef SINGLE_USER
- int dbopen_sv;
-#endif
SET_ENTRY *set_ptr;
DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
RETURN( dberr( S_NOCO ) );
/* set up to allow unlocked read */
-#ifndef SINGLE_USER
- dbopen_sv = dbopen;
- dbopen = 2;
-#endif
/* Read current owner */
dio_read(curr_own[set], (char * *)&orec, NOPGHOLD);
-#ifndef SINGLE_USER
- dbopen = dbopen_sv;
-#endif
if (db_status != S_OKAY)
RETURN( db_status );
DBN_DECL /* database number */
{
int fld, rec;
-#ifndef SINGLE_USER
- int dbopen_sv;
-#endif
RECORD_ENTRY *rec_ptr;
FIELD_ENTRY *fld_ptr;
RETURN( dberr(S_NOCR) );
/* set up to allow unlocked read */
-#ifndef SINGLE_USER
- dbopen_sv = dbopen;
- dbopen = 2;
-#endif
/* Read current record */
dio_read( curr_rec, (char * *)&crloc , NOPGHOLD);
-#ifndef SINGLE_USER
- dbopen = dbopen_sv;
-#endif
if (db_status != S_OKAY)
RETURN( db_status );
DBN_DECL
{
INT crt;
-#ifndef SINGLE_USER
- int dbopen_sv;
-#endif
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
RETURN( dberr( S_NOCR ) );
/* set up to allow unlocked read */
-#ifndef SINGLE_USER
- dbopen_sv = dbopen;
- dbopen = 2;
-#endif
/* Read current record */
dio_read(curr_rec, (char * *)&crloc, NOPGHOLD);
-#ifndef SINGLE_USER
- dbopen = dbopen_sv;
-#endif
if (db_status != S_OKAY)
RETURN( db_status );
DBN_DECL /* database number */
{
int fld, rec;
-#ifndef SINGLE_USER
- int dbopen_sv;
-#endif
char *recp;
SET_ENTRY *set_ptr;
RECORD_ENTRY *rec_ptr;
RETURN( dberr(S_NOCM) );
/* set up to allow unlocked read */
-#ifndef SINGLE_USER
- dbopen_sv = dbopen;
- dbopen = 2;
-#endif
/* Read current member */
dio_read( curr_mem[set], (char * *)&recp , NOPGHOLD);
-#ifndef SINGLE_USER
- dbopen = dbopen_sv;
-#endif
if (db_status != S_OKAY)
RETURN( db_status );
DBN_DECL /* database number */
{
int fld, rec;
-#ifndef SINGLE_USER
- int dbopen_sv;
-#endif
char *recp;
SET_ENTRY *set_ptr;
RECORD_ENTRY *rec_ptr;
RETURN( dberr(S_NOCO) );
/* set up to allow unlocked read */
-#ifndef SINGLE_USER
- dbopen_sv = dbopen;
- dbopen = 2;
-#endif
/* Read current owner */
dio_read( curr_own[set], (char * *)&recp , NOPGHOLD);
-#ifndef SINGLE_USER
- dbopen = dbopen_sv;
-#endif
if (db_status != S_OKAY)
RETURN( db_status );
calls would complete before a new task is run. If this assumption is
ever "broken" then lock_reply will need to be placed back within db_global
again */
-#ifndef SINGLE_USER
-static LR_LOCK lock_reply; /* This used to be in db_global */
-#endif
extern CHAR_P Dbpgbuff; /* allocated by dio_init used by o_update */
extern LOOKUP_ENTRY_P Db_lookup; /* database page lookup table */
/* Internal function prototypes */
-#ifndef SINGLE_USER
-static void pr_lock_descr(P1(struct lock_descr *) Pi(int)
- Pi(const char *));
-static int process_lock(P1(struct lock_descr *) Pi(char));
-static int keep_locks(P1(struct lock_descr *));
-static int free_files(P1(struct lock_descr *));
-#endif
static int bld_lock_tables(P0);
static int initses(P0);
static int lock_files(P1(int) Pi(LOCK_REQUEST *));
if ( dbopen ) d_close(TASK_ONLY);
-#ifndef SINGLE_USER
- if ( opentype ) {
- switch ( *opentype ) {
- case 's':
- case 'x':
-#ifndef GENERAL
- if ( netbios_chk() == 0 )
- RETURN( dberr( S_NONETBIOS ) );
-#endif
- db_lockmgr = 1;
- strcpy(type, opentype);
- break;
- case 'n':
- case 't':
- case 'o':
- db_lockmgr = 0;
- strcpy(type, "x");
- break;
- default:
- RETURN( dberr(S_BADTYPE) );
- }
- }
- else
- strcpy(type, "x");
-#endif
#ifdef MIKER /**@@@***/
#endif
if ( renfiles() != S_OKAY ) RETURN( db_status );
-#ifndef SINGLE_USER
-
- if ( db_lockmgr ) { /* [637] Only alloc file_refs for shared open */
- /* Macro references must be on one line for some compilers */
- if (ALLOC_TABLE(&db_global.File_refs, size_ft*sizeof(FILE_NO),old_size_ft*sizeof(FILE_NO), "file_refs")
- != S_OKAY) {
- RETURN( db_status );
- }
- }
-
- if ( *type == 's' ) {
- /* build application file lock tables */
- if ( bld_lock_tables() != S_OKAY )
- RETURN( db_status );
- dbopen = 1;
- }
- else
-#endif
dbopen = 2;
-#ifndef SINGLE_USER
-#ifndef GENERAL
- if ( db_lockmgr ) {
-#endif
- if ( initses() != S_OKAY ) {
- dbopen = 0;
- RETURN( db_status );
- }
-#ifndef GENERAL
- } /* [713] perform external recovery in one-user mode */
- else
- if ( recovery_check() != S_OKAY ) RETURN(db_status);
-#endif
-#else
-#endif
#ifdef DEBUG_DBLF
if (debugging_dopen) {
{
byteset(tsk, '\0', sizeof(TASK));
tsk->No_of_dbs = 1;
-#ifndef SINGLE_USER
- tsk->Lock_tries = 5;
- tsk->Dbwait_time = 1;
- tsk->Db_timeout = TIMEOUT_DEF;
- tsk->Db_lockmgr = 1;
-#endif
tsk->Dboptions = DCHAINUSE;
return( db_status );
}
-#ifndef SINGLE_USER
-/* Initial lock manager session
-*/
-static int initses()
-{
- LM_DBOPEN_P Send_pkt;
- LR_DBOPEN_P Recv_pkt;
- int ft_lc; /* loop control */
- LM_TREND trend_pkt;
- int send_size, recv_size, recvd_sz;
- struct stat stbuf;
- LM_FILEID *fi_ptr;
- FILE_ENTRY *file_ptr;
- FILE_NO *fref_ptr;
- INT *rcv_fref_ptr;
-
- if ( (net_status=nw_addnm(dbuserid, (int *)NULL) ) != N_OKAY )
- if ( net_status == N_DUPNAME ) {
- /* It is okay to reuse this name, but first be sure that all
- sessions are hung up.
- */
- nw_cleanup(dbuserid);
- }
- else
- return( neterr() );
-
- if ( nw_call("lockmgr", dbuserid, &lsn) ) {
- return( neterr() );
- }
- db_timeout = TIMEOUT_DEF; /* reset default timeout value */
-
-#ifdef GENERAL
-
- /* This section of code MUST be identical to else (DOS) below */
- send_size = 0;
- for (ft_lc = size_ft - old_size_ft, file_ptr = &file_table[old_size_ft];
- --ft_lc >= 0; ++file_ptr)
- send_size += strlen(file_ptr->ft_name) + 1;
- send_size += sizeof(LM_DBOPEN);
- send_size += send_size % 2;
-#else /* GENERAL */
- send_size = sizeof(LM_DBOPEN) + (size_ft-1)*sizeof(LM_FILEID);
-#endif /* GENERAL */
- send_pkt = (LM_DBOPEN *)ALLOC(&Send_pkt, send_size, "send_pkt");
- recv_size = sizeof(LR_DBOPEN) + (size_ft-1)*sizeof(INT);
- recv_pkt = (LR_DBOPEN *)ALLOC(&Recv_pkt, recv_size, "recv_pkt");
- if (send_pkt == NULL || recv_pkt == NULL) {
- nw_hangup(lsn);
- return(dberr(S_NOMEMORY));
- }
-
- send_pkt->fcn = L_DBOPEN;
- send_pkt->nfiles = size_ft;
- send_pkt->type = type[0];
- for (ft_lc = size_ft - old_size_ft, file_ptr = &file_table[old_size_ft],
- fi_ptr = send_pkt->fnames;
-#ifdef GENERAL
- --ft_lc >= 0; fi_ptr += strlen(file_ptr->ft_name)+1,++file_ptr) {
-#else
- --ft_lc >= 0; ++fi_ptr,++file_ptr) {
-#endif
- if (stat(file_ptr->ft_name, &stbuf) == -1) {
- nw_hangup(lsn);
- return(dberr(S_NOFILE));
- }
-#ifndef GENERAL
- fi_ptr->inode = stbuf.st_ino;
- fi_ptr->device = stbuf.st_dev;
-#else
- strcpy(fi_ptr,file_ptr->ft_name);
-#endif
- }
-send_open:
- if (nw_send(lsn, (MESSAGE *)send_pkt, send_size) ||
- nw_rcvmsg(lsn, (MESSAGE *)recv_pkt, recv_size, &recvd_sz)) {
- nw_hangup(lsn);
- return(neterr());
- }
-
- if ( recv_pkt->status == L_RECOVER ) {
- /* perform auto-recovery */
- d_recover( (const char *)recv_pkt->logfile CURRTASK_PARM );
-
- /* tell lock mgr we're done */
- trend_pkt.fcn = L_RECDONE;
- if ( nw_send(lsn, (MESSAGE *)&trend_pkt, sizeof(LM_TREND)) ) {
- nw_hangup(lsn);
- return(neterr());
- }
- /* re-issue open request */
- goto send_open;
- }
- if ( recv_pkt->fcn != L_DBOPEN ) {
- nw_hangup(lsn);
- return(dberr(S_NETSYNC));
- }
- if ( recv_pkt->status != L_OKAY ) {
- nw_hangup(lsn);
- nw_sestat();
-#ifndef GENERAL
- taf_close();
-#endif
- termfree();
- MEM_UNLOCK(&Send_pkt);
- FREE(&Send_pkt);
- MEM_UNLOCK(&Recv_pkt);
- FREE(&Recv_pkt);
- dbopen = 0;
- return(db_status = S_UNAVAIL);
- }
- if ( recv_pkt->nusers == 1 )
- if ( recovery_check() != S_OKAY ) {
- nw_hangup(lsn);
- return(db_status);
- }
-
- /* [656] perform initialization if not general lockmgr */
- if ( db_lockmgr ) {
- for (ft_lc = size_ft - old_size_ft, fref_ptr = &file_refs[old_size_ft],
- rcv_fref_ptr = recv_pkt->frefs;
- --ft_lc >= 0; ++fref_ptr, ++rcv_fref_ptr) {
- *fref_ptr = *rcv_fref_ptr;
- }
- }
- MEM_UNLOCK(&Send_pkt);
- FREE(&Send_pkt);
- MEM_UNLOCK(&Recv_pkt);
- FREE(&Recv_pkt);
-
- session_active = TRUE;
- return(db_status = S_OKAY);
-}
-#endif
#endif
#endif
-#ifndef SINGLE_USER
- d_freeall(TASK_ONLY);
-#endif
/* termfree();
key_close();
sk_free();
dio_free(); */
-#ifndef SINGLE_USER
- if ( db_lockmgr ) {
- termses();
- }
-#endif
}
if ( dbopen ) {
#ifndef NO_TIMESTAMP
setdb_on = FALSE;
curr_db = 0;
no_of_dbs = 1;
-#ifndef SINGLE_USER
- lock_tries = 5;
- dbwait_time = 1;
- db_lockmgr = 1;
- session_active = FALSE;
-#endif
db_status = S_OKAY;
curr_rec = NULL_DBA;
size_ft = 0;
-#ifndef SINGLE_USER
-/* Terminate lock manager session
-*/
-termses()
-{
- LM_DBCLOSE_P Send_pkt;
- int ft_lc; /* loop control */
- int send_size;
- FILE_NO *fref_ptr;
- INT *snd_fref_ptr;
-
- if ( session_active ) {
- send_size = sizeof(LM_DBCLOSE) + (size_ft-1)*sizeof(INT);
- send_pkt = (LM_DBCLOSE *)ALLOC(&Send_pkt, send_size, "send_pkt");
- if ( send_pkt == NULL ) return( dberr(S_NOMEMORY) );
- send_pkt->fcn = L_DBCLOSE;
- send_pkt->nfiles = size_ft;
- for (ft_lc = size_ft, fref_ptr = file_refs,
- snd_fref_ptr = send_pkt->frefs;
- --ft_lc >= 0; ++fref_ptr, ++snd_fref_ptr)
- *snd_fref_ptr = *fref_ptr;
- if ( nw_send(lsn, (MESSAGE *)send_pkt, send_size) )
- return( neterr() );
-
- nw_hangup(lsn);
- nw_sestat();
- MEM_UNLOCK(&Send_pkt);
- FREE(&Send_pkt);
- MEM_UNLOCK(&db_global.File_refs);
- FREE(&db_global.File_refs);
- session_active = FALSE;
- }
- return( db_status = S_OKAY );
-}
-#endif
*/
void termfree()
{
-#ifndef SINGLE_USER
- int i;
- struct lock_descr *ld_ptr;
-#endif
/* free all allocated memory */
if ( curr_mem ) {
MEM_UNLOCK(&db_global.File_table);
FREE(&db_global.File_table);
}
-#ifndef SINGLE_USER
- if ( app_locks ) {
- MEM_UNLOCK(&db_global.App_locks);
- FREE(&db_global.App_locks);
- }
- if ( excl_locks ) {
- MEM_UNLOCK(&db_global.Excl_locks);
- FREE(&db_global.Excl_locks);
- }
- if ( kept_locks ) {
- MEM_UNLOCK(&db_global.Kept_locks);
- FREE(&db_global.Kept_locks);
- }
- if ( rec_locks ) {
- for (i = 0, ld_ptr = rec_locks; i < size_rt; ++i, ++ld_ptr) {
- MEM_UNLOCK(&ld_ptr->fl_list);
- FREE(&ld_ptr->fl_list);
- }
- MEM_UNLOCK(&db_global.Rec_locks);
- FREE(&db_global.Rec_locks);
- }
- if ( set_locks ) {
- for (i = 0, ld_ptr = set_locks; i < size_st; ++i, ++ld_ptr) {
- MEM_UNLOCK(&ld_ptr->fl_list);
- FREE(&ld_ptr->fl_list);
- }
- MEM_UNLOCK(&db_global.Set_locks);
- FREE(&db_global.Set_locks);
- }
- if ( key_locks ) {
- for (i = 0, ld_ptr = key_locks; i < keyl_cnt; ++i, ++ld_ptr) { /*[637]*/
- MEM_UNLOCK(&ld_ptr->fl_list);
- FREE(&ld_ptr->fl_list);
- }
- MEM_UNLOCK(&db_global.Key_locks);
- FREE(&db_global.Key_locks);
- }
- if ( lock_pkt ) {
- MEM_UNLOCK(&db_global.Lock_pkt);
- FREE(&db_global.Lock_pkt);
- }
- if ( free_pkt ) {
- MEM_UNLOCK(&db_global.Free_pkt);
- FREE(&db_global.Free_pkt);
- }
-#endif
if ( db_table ) {
MEM_UNLOCK(&db_global.Db_table);
FREE(&db_global.Db_table);
-#ifndef SINGLE_USER
-/* Process set/record lock
-*/
-static process_lock(ld_ptr, type )
-struct lock_descr *ld_ptr;
-char type;
-{
- int fl_lc; /* loop control */
- int fno;
- int i;
- LM_LOCKREQ *lockreq_ptr;
- FILE_NO *fl_ptr, fref;
-
- db_status = S_OKAY;
- ld_ptr->fl_prev = ld_ptr->fl_type;
- switch( type ) {
- case 'k':
- if ( !trans_id )
- dberr( S_TRNOTACT );
- else if ( ld_ptr->fl_prev == 'f' )
- dberr( S_NOTLOCKED );
- else if ( ld_ptr->fl_prev != 'x' )
- return( keep_locks(ld_ptr) );
- break;
- case 'r':
- if( ld_ptr->fl_prev != 'f' )
- dberr( S_NOTFREE );
- else
- ld_ptr->fl_type = 'r';
- break;
- case 'w':
- if ( !trans_id )
- dberr( S_TRNOTACT );
- else if ( ld_ptr->fl_prev != 'f' && ld_ptr->fl_prev != 'r' )
- dberr( S_NOTFREE );
- else
- ld_ptr->fl_type = 'w';
- break;
- case 'x':
- if ( ld_ptr->fl_prev != 'f' && ld_ptr->fl_prev != 'r' )
- dberr(S_NOTFREE);
- else
- ld_ptr->fl_type = 'x';
- break;
- default:
- dberr( S_BADTYPE );
- }
- if ( db_status == S_OKAY ) {
- /* build lock request packet */
- for (fl_lc = ld_ptr->fl_cnt, fl_ptr = FL_LIST_ACCESS(ld_ptr);
- --fl_lc >= 0; ++fl_ptr) {
- fref = file_refs[fno = *fl_ptr];
- for (i = 0, lockreq_ptr = lock_pkt->locks;
- (i < lock_pkt->nfiles) && (lockreq_ptr->fref != fref);
- ++i, ++lockreq_ptr)
- ; /* null statement */
-
- if (i < lock_pkt->nfiles) {
- /* file already is in lock request packet */
- if ( lockreq_ptr->type == 'r' || ld_ptr->fl_type == 'x' )
- lockreq_ptr->type = ld_ptr->fl_type;
- }
- else if ( !excl_locks[fno] && ( !app_locks[fno] ||
- (ld_ptr->fl_type == 'w' && app_locks[fno] > 0) ||
- (ld_ptr->fl_type == 'x') ) ) {
- /* add to lock request packet */
- ++lock_pkt->nfiles;
- lockreq_ptr->fref = fref;
- lockreq_ptr->type = ld_ptr->fl_type;
- }
- }
- FL_LIST_DEACCESS(ld_ptr);
- }
- return( db_status );
-}
-#endif
-
-
-
-#ifndef SINGLE_USER
-/* Setup table to keep locks after transaction end
-*/
-static keep_locks( ld_ptr )
-struct lock_descr *ld_ptr; /* Lock descriptor */
-{
- int fl_lc; /* loop control */
- FILE_NO *fl_ptr;
- /* Mark lock as kept */
- ld_ptr->fl_kept = TRUE;
- for (fl_lc = ld_ptr->fl_cnt, fl_ptr = FL_LIST_ACCESS(ld_ptr);
- --fl_lc >= 0; ++fl_ptr)
- ++kept_locks[*fl_ptr];
- FL_LIST_DEACCESS(ld_ptr);
- return( db_status = S_OKAY );
-}
-#endif
-#ifndef SINGLE_USER
-/* Free read-locked files associated with record or set
-*/
-static int free_files(ld_ptr)
-struct lock_descr *ld_ptr;
-{
- int fl_lc; /* loop control */
- FILE_NO fno;
- LM_LOCKREQ *lockreq_ptr;
- int *appl_ptr;
- FILE_NO fref;
- FILE_NO *fl_ptr;
-
- /* fill free packet */
- lock_pkt->nfiles = free_pkt->nfiles = 0;
- for (fl_lc = ld_ptr->fl_cnt, fl_ptr = FL_LIST_ACCESS(ld_ptr);
- --fl_lc >= 0; ++fl_ptr) {
- fno = *fl_ptr;
- appl_ptr = &app_locks[fno];
- fref = file_refs[fno];
- if ( ld_ptr->fl_type == 'r' && *appl_ptr > 0 ) {
- /* free read lock */
- if ( --*appl_ptr == 0 && excl_locks[fno] == 0 ) {
- free_pkt->frefs[free_pkt->nfiles++] = fref;
- /* reset key scan position */
- if ( file_table[fno].ft_type == 'k' )
- key_reset(fno);
- }
- }
- else if ( --excl_locks[fno] == 0 ) {
- /* free exclusive access lock */
- if ( *appl_ptr > 0 ) {
- /* downgrade to read-lock */
- lockreq_ptr = &lock_pkt->locks[lock_pkt->nfiles++];
- lockreq_ptr->type = 'r';
- lockreq_ptr->fref = fref;
- }
- else {
- /* free excl-lock */
- free_pkt->frefs[free_pkt->nfiles++] = fref;
- dio_flush();
- /* reset key scan position */
- if ( file_table[fno].ft_type == 'k' )
- key_reset(fno);
- }
- }
- if ( ld_ptr->fl_kept ) {
- /* Remove hold on lock */
- if ( --kept_locks[fno] < 0 ) return( dberr(S_BADLOCKS) );
- ld_ptr->fl_kept = FALSE;
- }
- }
- FL_LIST_DEACCESS(ld_ptr);
- /* send any downgrades */
- if ( send_lock() == S_OKAY ) {
- /* free any files */
- send_free();
- }
- return( db_status );
-}
-#endif
-#ifndef SINGLE_USER
-/* Reset lock descriptor tables
-*/
-static void reset_locks()
-{
- int beg, end;
- int i;
- struct lock_descr *ld_ptr;
-
- /* reset record lock descriptors */
- beg = 0;
- end = size_rt;
- for (i = beg, ld_ptr = &rec_locks[i]; i < end; ++i, ++ld_ptr) {
- if ( ld_ptr->fl_kept ) {
- ld_ptr->fl_type = 'r';
- ld_ptr->fl_kept = FALSE;
- }
- else if ( ld_ptr->fl_type != 'x' )
- ld_ptr->fl_type = 'f';
- }
- /* reset set lock descriptors */
- beg = 0;
- end = size_st;
- for (i = beg, ld_ptr = &set_locks[i]; i < end; ++i, ++ld_ptr) {
- if ( ld_ptr->fl_kept ) {
- ld_ptr->fl_type = 'r';
- ld_ptr->fl_kept = FALSE;
- }
- else if ( ld_ptr->fl_type != 'x' )
- ld_ptr->fl_type = 'f';
- }
- /* reset key lock descriptors */
- beg = 0;
- end = keyl_cnt;
- for (i = beg, ld_ptr = &key_locks[i]; i < end; ++i, ++ld_ptr) {
- if ( ld_ptr->fl_kept ) {
- ld_ptr->fl_type = 'r';
- ld_ptr->fl_kept = FALSE;
- }
- else if ( ld_ptr->fl_type != 'x' )
- ld_ptr->fl_type = 'f';
- }
-}
-#endif
-#ifndef SINGLE_USER
-/* Report a network error
-*/
-neterr()
-{
- switch ( net_status ) {
- case N_OPENREJ:
- db_status = dberr( S_LMBUSY );
- break;
- case N_CALLNAME:
- db_status = dberr( S_NOLOCKMGR );
- break;
- case N_NAMEUSED:
- db_status = dberr( S_DUPUSERID );
- break;
- default:
- db_status = dberr( S_NETERR );
- break;
- }
- return( db_status );
-}
-#endif
int alloc_table(Table, new_size, old_size )
CHAR_P *Table;
HHS = Harris H-series
*/
-#define SINGLE_USER
-#ifdef SINGLE_USER
#define NO_TIMESTAMP
-#endif
#define PGHOLD 1
#define NOPGHOLD 0
typedef struct {FILE_NO *ptr; LOCK_DESC} FILE_NO_P;
typedef struct {int *ptr; LOCK_DESC} INT_P;
typedef struct {struct NODE_PATH_S *ptr; LOCK_DESC} NODE_PATH_P;
-#ifndef SINGLE_USER
-typedef struct {struct lock_descr *ptr; LOCK_DESC} LOCK_DESCR_P;
-typedef struct {struct LM_LOCK_S *ptr; LOCK_DESC} LM_LOCK_P;
-typedef struct {struct LM_FREE_S *ptr; LOCK_DESC} LM_FREE_P;
-typedef struct {struct LM_DBOPEN_S *ptr; LOCK_DESC} LM_DBOPEN_P;
-typedef struct {struct LM_DBCLOSE_S *ptr; LOCK_DESC} LM_DBCLOSE_P;
-typedef struct {struct LR_DBOPEN_S *ptr; LOCK_DESC} LR_DBOPEN_P;
-#endif
typedef struct {struct KEY_INFO_S *ptr; LOCK_DESC} KEY_INFO_P;
typedef struct {struct ren_entry *ptr; LOCK_DESC} REN_ENTRY_P;
typedef struct {struct RN_ENTRY_S *ptr; LOCK_DESC} RN_ENTRY_P;
#endif
#include "proto.h"
-#ifndef SINGLE_USER
-/* record/set lock descriptor */
-struct lock_descr {
- FILE_NO_P fl_list; /* array of files used by record/set */
- int fl_cnt; /* Number of elements in fl_list */
- BOOLEAN fl_kept; /* Is lock kept after transaction? */
- char fl_type; /* lock type: 'r' = read, 'w' = write,
- 'x' = exclusive, 'f' = free */
- char fl_prev; /* previous lock type */
-};
-#endif
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC dbtype.h */
typedef struct TASK_S {
/* The following global variables came from dblfcns.c */
-#ifndef SINGLE_USER
- int Lock_tries; /* lock_tries = 5 */
- int Dbwait_time; /* dbwait_time = 1 */
- int Db_timeout; /* db_timeout = TIMEOUT_DEF */
-#endif
int Dbopen; /* dbopen = 0 */
-#ifndef SINGLE_USER
- int Db_lockmgr; /* db_lockmgr = 1 */
-#endif
char Dbuserid[FILENMLEN]; /* dbuserid = "" */
char Dbdpath[FILENMLEN*2]; /* dbdpath = "" */
char Dbfpath[FILENMLEN*2]; /* dbdpath = "" */
-#ifndef SINGLE_USER
- INT_P App_locks; /* app_locks = NULL */
- INT_P Excl_locks; /* excl_locks = NULL */
- INT_P Kept_locks; /* kept_locks = NULL */
-#endif
const char *Trans_id; /* trans_id = NULL */
char Dblog[FILENMLEN]; /* dblog = "" */
-#ifndef SINGLE_USER
- LOCK_DESCR_P Rec_locks; /* rec_locks = NULL */
- LOCK_DESCR_P Set_locks; /* set_locks = NULL */
- LOCK_DESCR_P Key_locks; /* key_locks = NULL */
- int Keyl_cnt;
- int Lp_size;
- int Fp_size;
- LM_LOCK_P Lock_pkt; /* lock_pkt = NULL */
- LM_FREE_P Free_pkt; /* free_pkt = NULL */
- FILE_NO_P File_refs;
- int Lsn;
- BOOLEAN Session_active; /* session_active = FALSE */
-#endif
/* The following global variables came from dio.c */
BOOLEAN Cache_ovfl; /* cache_ovfl = FALSE */
PGZERO_P Pgzero; /* database file page 0 array */
#endif
-#ifndef SINGLE_USER
-#define EXCL_OPEN() (dbopen >= 2)
-#else
#define EXCL_OPEN() (TRUE)
-#endif
#define DEFDBPAGES 16 /* default number of database cache pages */
#define MINDBPAGES 8 /* minimum number of database cache pages */
PAGE_ENTRY *pg_ptr;
PGZERO *pgzero_ptr;
FILE_ENTRY *file_ptr;
-#ifndef SINGLE_USER
- int *appl_ptr, *excl_ptr;
-#endif
-#ifndef SINGLE_USER
- /*
- We only clear pages which are not from static files and are
- not still locked. The check on app_locks is made to implement
- the ability to hold locks after the end of a transaction
- */
- for (s_file = e_file = fr_file, file_ptr = &file_table[e_file],
- appl_ptr = &app_locks[e_file], excl_ptr = &excl_locks[e_file];
- s_file < to_file;
- ++file_ptr, ++appl_ptr, ++excl_ptr) {
-#else
for (s_file = e_file = fr_file, file_ptr = &file_table[e_file];
s_file < to_file;
++file_ptr) {
-#endif
if ((e_file < to_file) &&
-#ifndef SINGLE_USER
- ((dbopen >= 2) || (!*appl_ptr && !*excl_ptr)) &&
-#endif
!(file_ptr->ft_flags & STATIC))
++e_file;
else {
{
PAGE_ENTRY *pg_ptr;
-#ifndef SINGLE_USER
- if ( dbopen == 1 ) {
- if ( !app_locks[working_file] && !excl_locks[working_file] &&
- !(file_table[working_file].ft_flags & STATIC) )
- return( dberr(S_NOTLOCKED) );
- }
-#endif
if ( pgzero[working_file].pz_next == 0L )
if ( dio_pzread(working_file) != S_OKAY )
RETURN( db_status );
{
PAGE_ENTRY *pg_ptr;
-#ifndef SINGLE_USER
- if ( dbopen == 1 ) {
- /* check shared access privileges */
- if ( !trans_id && !excl_locks[working_file] )
- return( dberr(S_NOTRANS) );
- if ( app_locks[working_file] >= 0 && !excl_locks[working_file] )
- return( dberr( S_NOTLOCKED ) );
- }
-#endif
if (dio_findpg(working_file, page_no, dbpg_table, &pg_ptr, NULL) == S_OKAY ) {
pg_ptr->recently_used = TRUE;
used_files[working_file] = TRUE;
if ( dio_pzread(file) != S_OKAY )
RETURN( db_status );
-#ifndef SINGLE_USER
- if ( dbopen == 1 ) {
- /* check shared access privileges */
- if (!app_locks[file] &&
- !excl_locks[file] &&
- !(file_ptr->ft_flags & STATIC))
- return( dberr(S_NOTLOCKED) );
- }
-#endif
us1 = ADDRMASK & dba;
us2 = (us1 - 1)/file_ptr->ft_slots;
if (dio_findpg(file, us2 + 1, dbpg_table, &pg_ptr, NULL) == S_OKAY ) {
file = NUM2INT((FILE_NO)((dba >> FILESHIFT) & FILEMASK), ft_offset);
-#ifndef SINGLE_USER
- if (dbopen == 1) {
- if (!trans_id && !excl_locks[file])
- return( dberr(S_NOTRANS) );
-
- /* check shared access privileges */
- if ( app_locks[file] >= 0 && !excl_locks[file] )
- return( dberr(S_NOTLOCKED) );
- }
-#endif
file_ptr = &file_table[file];
us1 = ADDRMASK & dba;
us2 = (us1 - 1)/file_ptr->ft_slots;
-#ifndef SINGLE_USER
-/* Read record lock bit
-*/
-dio_rrlb(dba, rid )
-DB_ADDR dba;
-INT *rid;
-{
- FILE_NO file; /* file number */
- F_ADDR page; /* page number */
- F_ADDR sno; /* slot number */
- F_ADDR spp; /* slots per page */
- F_ADDR offset; /* lseek address - offset from start of file */
- FILE_ENTRY *file_ptr;
-
- file = NUM2INT((FILE_NO)((dba >> FILESHIFT) & FILEMASK), ft_offset);
- if ( dio_open(file) == S_OKAY ) {
- file_ptr = &file_table[file];
- sno = ADDRMASK & dba;
- spp = file_ptr->ft_slots;
- page = (sno - 1)/spp + 1;
- offset = PGHDRSIZE + page*file_ptr->ft_pgsize +
- (sno - 1 - (page - 1)*spp)*file_ptr->ft_slsize;
- DB_LSEEK(file_ptr->ft_desc, (off_t)offset, 0);
- if ( DB_READ(file_ptr->ft_desc, (char *)rid, sizeof(INT))
- != sizeof(INT) ) {
- dberr(S_BADREAD);
- }
- NTOHS (*rid);
- }
- return( db_status );
-} /* dio_rrlb() */
-
-
-/* Write record lock bit
-*/
-dio_wrlb(dba, rid )
-DB_ADDR dba;
-INT rid;
-{
- FILE_NO file; /* file number */
- F_ADDR page; /* page number */
- F_ADDR sno; /* slot number */
- F_ADDR spp; /* slots per page */
- F_ADDR offset; /* offset from start of page or file */
- int clr_in_tx; /* true if called from d_rlbclr in trx */
- INT trid; /* [333] working rid */
- FILE_ENTRY *file_ptr;
- PAGE_ENTRY *pg_ptr;
-
- file = NUM2INT((FILE_NO)((dba >> FILESHIFT) & FILEMASK), ft_offset);
- file_ptr = &file_table[file];
- sno = ADDRMASK & dba;
- spp = file_ptr->ft_slots;
- page = ((sno - 1)/spp) + 1;
- offset = PGHDRSIZE + (sno - 1 - (page - 1)*spp)*file_ptr->ft_slsize;
- clr_in_tx = !(rid & RLBMASK) && trans_id;
-
- if ( dbopen > 1 || (app_locks[file] || excl_locks[file]) ) {
- /* file is locked - check if record in cache */
- if (dio_findpg(file, page, dbpg_table, &pg_ptr, NULL) == S_OKAY) {
- MEM_LOCK(&pg_ptr->Buff);
- /* record in cache - update only rlb in rid */
- bytecpy(&trid, &pg_ptr->buff[offset], sizeof(INT));
- MEM_UNLOCK(&pg_ptr->Buff);
- rid = (trid & ~((INT)RLBMASK)) | (rid & RLBMASK);
- bytecpy(&pg_ptr->buff[offset], &rid, sizeof(INT));
- if ( clr_in_tx ) {
- /* clearing within a transaction requires touching page */
- if ( ! pg_ptr->modified ) {
- pg_ptr->modified = TRUE;
- if ( ! pg_ptr->holdcnt )
- ++no_modheld;
- }
- }
- }
- else
- clr_in_tx = FALSE;
- }
- if ( ! clr_in_tx ) {
- /* update only rlb directly to disk */
- if ( dio_open(file) == S_OKAY ) {
- offset += page*file_ptr->ft_pgsize;
-
- /* read rid from disk, and set/clear rlb accordingly */
- DB_LSEEK(file_ptr->ft_desc, (off_t)offset, 0);
- if ( DB_READ(file_ptr->ft_desc, (char *)&trid, sizeof(INT))
- != sizeof(INT) ) {
- dberr(S_BADREAD);
- }
- NTOHS (trid);
- rid = (trid & ~((INT)RLBMASK)) | (rid & RLBMASK);
-
- /* write original rid out with modified rlb */
- trid = htons (rid); /* make a copy in trid for byte swap */
- DB_LSEEK(file_ptr->ft_desc, (off_t)offset, 0); /* reseek */
- if ( DB_WRITE(file_ptr->ft_desc, (char *)&trid, sizeof(INT)) !=
- sizeof(INT) )
- dberr(S_BADWRITE);
- }
- }
- return( db_status );
-} /* dio_wrlb() */
-#endif /* SINGLE_USER */
/****************************************/
char *ptr;
PGZERO *pgzero_ptr;
-#ifndef SINGLE_USER
- /* check shared access privileges */
- if ( dbopen == 1 && !trans_id && !excl_locks[fno] )
- return( dberr(S_NOTRANS) );
-#endif
pgzero_ptr = &pgzero[fno];
if ( pgzero_ptr->pz_next == 0L )
char *ptr;
PGZERO *pgzero_ptr;
-#ifndef SINGLE_USER
- /* check shared access privileges */
- if ( dbopen == 1 && !trans_id && !excl_locks[fno] )
- return( dberr(S_NOTRANS) );
-#endif
pgzero_ptr = &pgzero[fno];
if ( pgzero_ptr->pz_next == 0L )
#include <sys/msg.h>
#include <sys/sem.h>
-#ifndef SINGLE_USER
-# include <X11/Xos.h>
-# include <errno.h>
-# ifdef X_NOT_STDC_ENV
-extern int errno;
-# endif
-
-static char tokfile[80];
-static int inqid;
-static int outqid;
-static int semid;
-static int mypid;
-static char tmpdir[] = "/tmp/";
-
-
-
-/* Check for the existence of NetBIOS on this machine
-*/
-int netbios_chk()
-{
- /* On UNIX, indicate that there is no problem */
- return( 1 );
-}
-
-/* Issue ADD NAME command - wait
-*/
-/*ARGSUSED*/
-int nw_addnm(name, ncb_num)
-char *name;
-int *ncb_num;
-{
- return( net_status = N_OKAY );
-}
-
-
-
-/* Issue DELETE NAME command - wait
-*/
-/*ARGSUSED*/
-int nw_delnm(name)
-char *name;
-{
- return( net_status = N_OKAY );
-}
-
-
-
-
-/* Cleanup any dirty sessions
-*/
-/*ARGSUSED*/
-int nw_cleanup(dbusrid)
- char *dbusrid;
-{
- return( net_status = N_OKAY );
-}
-
-
-/* Issue a session status call
-*/
-int nw_sestat()
-{
- return( net_status = N_OKAY );
-}
-
-
-
-/* Issue CALL command - wait
-*/
-int nw_call(them, me, ncb_lsn)
-char *them;
-char *me;
-int *ncb_lsn;
-{
- key_t key;
- FILE *fp;
- struct sembuf sops[1];
- LM_LOGIN login;
- int tokpos;
-
- if ( ! db_lockmgr )
- RETURN( net_status = N_OKAY );
-
- /* create the token file for the lock manager */
- strcpy(tokfile, tmpdir);
- tokpos = sizeof(tmpdir) - 1;
- strcpy(&tokfile[tokpos], them);
-
- if ( ( key = ftok( tokfile, 1 ) ) == -1 )
- /* /tmp/lockmgr file non-existant */
- RETURN( net_status = N_CALLNAME );
-
- /* obtain the id to the lock manager's input queue and check the
- value of the semaphore
- */
- if (((outqid = msgget(key, PERMISSION | IPC_CREAT)) == -1) ||
- ((semid = semget(key, 1, PERMISSION)) == -1))
- RETURN( net_status = N_TIMEOUT );
-
- if ( semctl( semid, 0, GETVAL, NULL ) != 1 ) {
- /* the lockmgr has terminated, but has not been cleared */
- RETURN( net_status = N_CALLNAME );
- }
-
- /* create the token file for this dbuserid */
- strcpy(&tokfile[tokpos], me);
-
- /* get a key that is unique for the token file */
- if ( ( key = ftok( tokfile, 1 ) ) != -1 ) {
- /* The token file exists. Is it because there is another active
- process which is using the id?
- */
- /* check the value of the semaphore */
- if ( ( semid = semget( key, 1, PERMISSION | IPC_CREAT ) ) == -1 )
- RETURN( net_status = N_TIMEOUT );
- if ( semctl( semid, 0, GETVAL, NULL ) == 1 ) {
- /* this dbuserid is already active */
- RETURN( net_status = N_NAMEUSED );
- }
- /* just in case this process formerly aborted with message remaining
- in its input queue, delete the queue
- */
- if (((inqid = msgget(key, PERMISSION | IPC_CREAT)) == -1) ||
- (msgctl(inqid, IPC_RMID, (struct msqid_ds *)NULL) == -1))
- RETURN( net_status = N_TIMEOUT );
- }
- else {
- /* create the token file */
- if ( ( fp = fopen( tokfile, "w" ) ) == NULL )
- RETURN( net_status = N_TIMEOUT );
- fclose( fp );
-
- /* get the key value for the token file */
- if ( ( key = ftok( tokfile, 1 ) ) == -1 ) {
- RETURN( net_status = N_TIMEOUT );
- }
- }
-
- /* create and set the value of a semaphore */
- if ( ( semid = semget( key, 1, PERMISSION | IPC_CREAT ) ) == -1 )
- RETURN( net_status = N_TIMEOUT );
- sops[0].sem_num = 0;
- sops[0].sem_op = 1;
- sops[0].sem_flg = SEM_UNDO;
- while ( semop( semid, sops, 1 ) == -1 ) {
- if ( errno == EINTR ) continue;
- RETURN( net_status = N_TIMEOUT );
- }
-
- /* create my incoming message queue */
- if ( ( inqid = msgget( key, PERMISSION | IPC_CREAT ) ) == -1 )
- RETURN( net_status = N_TIMEOUT );
-
- /* send the message to the lock manager */
- login.fcn = L_LOGIN;
- strcpy( login.dbusrid, me );
- login.pid = getpid();
- mypid = login.pid;
- while ( msgsnd(outqid, (struct msgbuf *)&login,
- sizeof(LM_LOGIN)-sizeof(LONG), 0) == -1 ) {
- if ( errno == EINTR ) continue;
- RETURN( net_status = N_TIMEOUT );
- }
- *ncb_lsn = 0;
- RETURN( net_status = N_OKAY );
-}
-
-
-/* Issue HANGUP command - wait
-*/
-/*ARGSUSED*/
-int nw_hangup(lsn)
-int lsn;
-{
- if ( ! db_lockmgr )
- RETURN( net_status = N_OKAY );
-
- /* delete the incoming message queue */
- msgctl( inqid, IPC_RMID, (struct msqid_ds *)NULL );
-
- /* delete the semaphore */
- semctl( semid, 0, IPC_RMID, NULL );
-
- /* delete the token file */
- unlink( tokfile );
- RETURN( net_status = N_OKAY );
-}
-
-
-
-/* Issue SEND command - wait
-*/
-/*ARGSUSED*/
-int nw_send(lsn, msgtxt, msglen)
-int lsn;
-MESSAGE *msgtxt;
-int msglen;
-{
-
- if ( ! db_lockmgr ) {
- last_mtype = msgtxt->mtype;
- RETURN( net_status = N_OKAY );
- }
- msgtxt->pid = mypid;
-
- /* everything should be ready, just send it */
- while ( msgsnd(outqid, (struct msgbuf *)msgtxt, msglen-sizeof(LONG),
- 0) == -1 ) {
- if ( errno == EINTR ) continue;
- RETURN( net_status = N_TIMEOUT );
- }
-
- RETURN( net_status = N_OKAY );
-}
-
-
-
-/* Issue RECEIVE command - wait
-*/
-/*ARGSUSED*/
-int nw_rcvmsg(lsn, msgtxt, msglen, ncb_len)
-int lsn;
-MESSAGE *msgtxt;
-int msglen;
-int *ncb_len;
-{
- LR_DBOPEN *dp;
- LR_LOCK *lp;
-
- if ( ! db_lockmgr ) {
- if ( last_mtype == L_LOCK ) {
- lp = (LR_LOCK *)msgtxt;
- lp->fcn = L_LOCK;
- lp->status = L_OKAY;
- }
- else {
- dp = (LR_DBOPEN *)msgtxt;
- dp->fcn = L_DBOPEN;
- dp->status = L_OKAY;
- dp->nusers = 1;
- }
- RETURN( net_status = N_OKAY );
- }
- while ( ( *ncb_len = msgrcv(inqid, (struct msgbuf *)msgtxt,
- msglen-sizeof(LONG), (LONG)0, 0) ) == -1 ) {
- if ( errno == EINTR ) continue;
- RETURN( net_status = N_TIMEOUT );
- }
-
- RETURN( net_status = N_OKAY );
-}
-
-/* The remaining functions are BSD only */
-
-#endif
/* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin netunix.c */
int initdbt(P1(const char *));
int alloc_table(P1(CHAR_P *) Pi(unsigned) Pi(unsigned));
#define ALLOC_TABLE(t, n, o, v) alloc_table((CHAR_P *)(t), n, o)
-#ifndef SINGLE_USER
-int termses(P0);
-#endif
void termfree(P0);
-#ifndef SINGLE_USER
-int neterr(P0);
-#endif
/* From dio.c: */
int dio_open(P1(FILE_NO));
if ( rn < 0 )
return( db_status = S_DELETED );
-#ifndef SINGLE_USER
- if ( rn & RLBMASK ) {
- rn &= ~RLBMASK; /* mask off rlb */
- rlb_status = S_LOCKED;
- }
- else {
- rlb_status = S_UNLOCKED;
- }
-#endif
rn += curr_db_table->rt_offset;
if ( fld_ptr->fd_rec != rn )
FILE_NO ftype;
DB_ADDR dba;
char *recptr;
-#ifndef SINGLE_USER
- int dbopen_sv;
-#endif
F_ADDR rno, last;
RECORD_ENTRY *rec_ptr;
dba = ( (FILEMASK & ftype) << FILESHIFT ) | (ADDRMASK & rno);
/* set up to allow unlocked read */
-#ifndef SINGLE_USER
- dbopen_sv = dbopen;
- dbopen = 2;
-#endif
/* read the record */
dio_read( dba, (char * *)&recptr, NOPGHOLD );
-#ifndef SINGLE_USER
- dbopen = dbopen_sv;
-#endif
if ( db_status != S_OKAY )
RETURN( db_status );
/* get the record type out of the record */
bytecpy( &rectype, recptr, sizeof(INT) );
-#ifndef SINGLE_USER
- rectype &= ~RLBMASK;
-#endif
++rno;
} while ( (int)rectype != rec );
INT rectype; /* record type from record */
F_ADDR rno; /* current slot we're scanning */
-#ifndef SINGLE_USER
- int dbopen_sv; /* saved copy of dbopen */
-#endif
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
/* create the database address, and read this record */
dba = ((FILEMASK & ftype) << FILESHIFT) | (ADDRMASK & rno);
-#ifndef SINGLE_USER
- dbopen_sv = dbopen;
- dbopen = 2; /* setup to allow unlocked read */
-#endif
dio_read(dba, (char * *)&recptr, NOPGHOLD);
-#ifndef SINGLE_USER
- dbopen = dbopen_sv;
-#endif
if ( db_status != S_OKAY )
RETURN( db_status );
/* See if this record is of the type we're looking for */
bytecpy(&rectype, recptr, sizeof(INT));
-#ifndef SINGLE_USER
- rectype &= ~((INT)RLBMASK); /* remove rlb */
-#endif
rno--;
} while ( (int)rectype != rec );
FILE_NO fno;
FILE_NO ft;
DB_ADDR dba;
-#ifndef SINGLE_USER
- int dbopen_sv;
-#endif
int rec_ndx; /* Index into record table */
RECORD_ENTRY *rec_ptr; /* Pointer to record table */
char *recptr;
dba = ( (FILEMASK & fno) << FILESHIFT ) | (ADDRMASK & rno);
/* set up to allow unlocked read */
-#ifndef SINGLE_USER
- dbopen_sv = dbopen;
- dbopen = 2;
-#endif
/* read the record */
dio_read( dba, (char * *)&recptr, NOPGHOLD );
-#ifndef SINGLE_USER
- dbopen = dbopen_sv;
-#endif
if ( db_status != S_OKAY )
RETURN( db_status );
/* get the record type out of the record */
bytecpy( &rectype, recptr, sizeof(INT) );
-#ifndef SINGLE_USER
- rectype &= ~RLBMASK;
-#endif
++rno;
} while ( rectype != RN_REF(rn_type) );
F_ADDR rno; /* current slot we're scanning */
FILE_NO ft; /* normalized file */
-#ifndef SINGLE_USER
- int dbopen_sv; /* saved copy of dbopen */
-#endif
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
do {
if (rno < 1) RETURN( db_status = S_NOTFOUND );
dba = ((fno & FILEMASK) << FILESHIFT) | (rno & ADDRMASK);
-#ifndef SINGLE_USER
- dbopen_sv = dbopen;
- dbopen = 2; /* setup to allow for unlocked read */
-#endif
dio_read(dba, (char * *)&recptr, NOPGHOLD);
-#ifndef SINGLE_USER
- dbopen = dbopen_sv;
-#endif
if (db_status != S_OKAY) RETURN( db_status );
/* see if we've found a match */
bytecpy(&rectype, recptr, sizeof(INT));
-#ifndef SINGLE_USER
- rectype &= ~((INT)RLBMASK);
-#endif
rno--;
} while ( rectype != RN_REF(rn_type) );
{
INT rt; /* record type */
DB_ADDR dba;
-#ifndef SINGLE_USER
- int dbopen_sv;
-#endif
RECORD_ENTRY *rec_ptr;
DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
RETURN( dberr(S_NOCR) );
/* set up to allow unlocked read access */
-#ifndef SINGLE_USER
- dbopen_sv = dbopen;
- dbopen = 2;
-#endif
/* read current record */
dio_read( curr_rec, (char * *)&crloc, NOPGHOLD);
-#ifndef SINGLE_USER
- dbopen = dbopen_sv;
-#endif
if ( db_status != S_OKAY )
RETURN( db_status );
if ( rt < 0 )
RETURN( db_status = S_DELETED );
-#ifndef SINGLE_USER
- if ( rt & RLBMASK ) {
- rt &= ~RLBMASK; /* mask off rlb */
- rlb_status = S_LOCKED;
- }
- else {
- rlb_status = S_UNLOCKED;
- }
-#endif
rec_ptr = &record_table[NUM2INT(rt, rt_offset)];
/* Copy db_addr from record and check with curr_rec */
/* Maximum number of transactions which can commit a time */
-#ifndef SINGLE_USER
-#define TAFLIMIT 5
-#else
#define TAFLIMIT 1
-#endif
#define TRXLOG_H
/* End - trxlog.h */