kill-ubik-pthread-env-20080718
[openafs.git] / src / budb / globals.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /*
11  * global configuration information for the database server
12  * ------------------
13  */
14
15 #define DEFAULT_DBPREFIX "bdb"  /* db name prefix */
16
17 /* debug and test flags */
18
19 #define DF_NOAUTH               0x1     /* no authentication */
20 #define DF_RECHECKNOAUTH        0x2     /* recheck no authentication ? */
21 #define DF_SMALLHT              0x4     /* use small hash tables */
22 #define DF_TRUNCATEDB           0x8     /* truncate database on startup */
23
24 extern int debugging;           /* for controlling debug output */
25
26 struct buServerConfS {
27     /* global configuration */
28     char *databaseDirectory;    /* where database is placed */
29     char *databaseName;         /* database file name */
30     char *databaseExtension;    /* extension (depends on ubik) */
31
32     /* error logging */
33     FILE *log;                  /* log file for status/errors */
34
35     /* ubik and comm. related */
36     afs_int32 myHost;
37     afs_int32 serverList[MAXSERVERS];   /* list of ubik servers */
38     char *cellConfigdir;        /* afs cell config. directory */
39     struct ubik_dbase *database;        /* handle for the database */
40
41     /* debug and test */
42     afs_uint32 debugFlags;
43 };
44
45 typedef struct buServerConfS buServerConfT;
46 typedef buServerConfT *buServerConfP;
47
48 extern buServerConfP globalConfPtr;
49
50 /* for synchronizing the threads dumping the database */
51
52 #define DS_WAITING      1       /* reader/writer sleeping */
53 #define DS_DONE         2       /* finished */
54 #define DS_DONE_ERROR   4       /* finished with errors */
55
56 #define DUMP_TTL_INC    300     /* secs. before dump times out */
57
58 #include <time.h>
59
60 struct dumpSyncS {
61     struct Lock ds_lock;        /* for this struct. */
62     afs_int32 statusFlags;      /* 0, or 1 for dump in progress */
63     int pipeFid[2];             /* pipe between threads */
64 #ifdef AFS_PTHREAD_ENV
65     pthread_mutex_t ds_writerStatus_mutex;
66     pthread_mutex_t ds_readerStatus_mutex;
67     pthread_cond_t ds_writerStatus_cond;
68     pthread_cond_t ds_readerStatus_cond;
69     pthread_t dumperPid;
70 #else
71     PROCESS dumperPid;          /* pid of dumper lwp */
72 #endif
73     char ds_writerStatus;
74     char ds_readerStatus;
75
76     struct ubik_trans *ut;      /* dump db transaction */
77     afs_int32 ds_bytes;         /* no. of bytes buffered */
78     time_t timeToLive;          /* time. After this, kill the dump */
79 };
80
81 typedef struct dumpSyncS dumpSyncT;
82 typedef dumpSyncT *dumpSyncP;
83
84 extern dumpSyncP dumpSyncPtr;   /* defined in dbs_dump.c */