2 * Copyright 2000, International Business Machines Corporation and others.
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
10 #define BOP_TIMEOUT(bnode) ((*(bnode)->ops->timeout)((bnode)))
11 #define BOP_GETSTAT(bnode, a) ((*(bnode)->ops->getstat)((bnode),(a)))
12 #define BOP_SETSTAT(bnode, a) ((*(bnode)->ops->setstat)((bnode),(a)))
13 #define BOP_DELETE(bnode) ((*(bnode)->ops->delete)((bnode)))
14 #define BOP_PROCEXIT(bnode, a) ((*(bnode)->ops->procexit)((bnode),(a)))
15 #define BOP_GETSTRING(bnode, a, b) ((*(bnode)->ops->getstring)((bnode),(a), (b)))
16 #define BOP_GETPARM(bnode, n, b, l) ((*(bnode)->ops->getparm)((bnode),(n),(b),(l)))
17 #define BOP_RESTARTP(bnode) ((*(bnode)->ops->restartp)((bnode)))
18 #define BOP_HASCORE(bnode) ((*(bnode)->ops->hascore)((bnode)))
21 struct bnode *(*create) ( /* variable args */ );
22 int (*timeout) ( /* bnode */ );
23 int (*getstat) ( /* bnode, status */ );
24 int (*setstat) ( /* bnode, status */ );
25 int (*delete) ( /* bnode */ );
26 int (*procexit) ( /* bnode, proc */ );
27 int (*getstring) ( /* bnode, buffer, bufLen */ );
28 int (*getparm) ( /* bnode, parmIndex, buffer, bufLen */ );
29 int (*restartp) ( /* bnode */ );
30 int (*hascore) ( /* bnode */ );
34 struct bnode_type *next;
36 struct bnode_ops *ops;
40 struct bnode_token *next;
45 struct bnode *next; /* next pointer in top-level's list */
46 char *name; /* instance name */
47 afs_int32 nextTimeout; /* next time this guy should be woken */
48 afs_int32 period; /* period between calls */
49 afs_int32 rsTime; /* time we started counting restarts */
50 afs_int32 rsCount; /* count of restarts since rsTime */
51 struct bnode_type *type; /* type object */
52 struct bnode_ops *ops; /* functions implementing bnode class */
53 afs_int32 procStartTime; /* last time a process was started */
54 afs_int32 procStarts; /* number of process starts */
55 afs_int32 lastAnyExit; /* last time a process exited, for any reason */
56 afs_int32 lastErrorExit; /* last time a process exited unexpectedly */
57 afs_int32 errorCode; /* last exit return code */
58 afs_int32 errorSignal; /* last proc terminating signal */
59 char *lastErrorName; /* name of proc that failed last */
60 char *notifier; /* notifier program to be executed on exits */
61 short refCount; /* reference count */
62 short flags; /* random flags */
63 char goal; /* 1=running or 0=not running */
64 char fileGoal; /* same, but to be stored in file */
68 struct bnode_proc *next; /* next guy in top-level's list */
69 struct bnode *bnode; /* bnode creating this process */
70 char *comLine; /* command line used to start this process */
71 char *coreName; /* optional core file component name */
72 afs_int32 pid; /* pid if created */
73 afs_int32 lastExit; /* last termination code */
74 afs_int32 lastSignal; /* last signal that killed this guy */
75 afs_int32 flags; /* flags giving process state */
80 afs_int32 zapTime; /* time we sent a sigterm */
82 struct bnode_proc *proc;
83 afs_int32 lastStart; /* time last started process */
84 char waitingForShutdown; /* have we started any shutdown procedure? */
85 char running; /* is process running? */
86 char killSent; /* have we tried sigkill signal? */
89 /* this struct is used to construct a list of dirpaths, along with
90 * their recommended permissions
92 struct bozo_bosEntryStats {
93 const char *path; /* pathname to check */
94 int dir; /* 1=>dir or 0=>file */
95 int rootOwner; /* 1=>root must own */
96 int reqPerm; /* required permissions */
97 int proPerm; /* prohibited permissions */
100 #define BNODE_NEEDTIMEOUT 1 /* timeouts are active */
101 #define BNODE_ACTIVE 2 /* in generic lists */
102 #define BNODE_WAIT 4 /* someone waiting for status change */
103 #define BNODE_DELETE 8 /* delete this bnode asap */
104 #define BNODE_ERRORSTOP 0x10 /* stopped due to errors */
106 /* flags for bnode_proc */
107 #define BPROC_STARTED 1 /* ever started */
108 #define BPROC_EXITED 2 /* exited */
110 #define NONOTIFIER "__NONOTIFIER__"
112 /* status values for bnodes, and goals */
113 #define BSTAT_SHUTDOWN 0 /* shutdown normally */
114 #define BSTAT_NORMAL 1 /* running normally */
115 #define BSTAT_SHUTTINGDOWN 2 /* normal --> shutdown */
116 #define BSTAT_STARTINGUP 3 /* shutdown --> normal */
118 /* exit values indicating that NT SCM integrator should restart bosserver */
120 #define BOSEXIT_RESTART 0xA0
121 #define BOSEXIT_DORESTART(code) (((code) & ~(0xF)) == BOSEXIT_RESTART)
122 #define BOSEXIT_NOAUTH_FLAG 0x01
123 #define BOSEXIT_LOGGING_FLAG 0x02
126 /* max time to wait for fileserver shutdown */
127 #define FSSDTIME (30 * 60) /* seconds */
129 /* calls back up to the generic bnode layer */
130 extern int bnode_SetTimeout(register struct bnode *abnode, afs_int32 atimeout);
131 extern int bnode_Init(void);
132 extern int bnode_NewProc(struct bnode *abnode, char *aexecString, char *coreName, struct bnode_proc **aproc);
133 extern int bnode_InitBnode(register struct bnode *abnode, struct bnode_ops *abnodeops, char *aname);
134 extern afs_int32 bnode_Create(char *atype, char *ainstance, struct bnode ** abp, char *ap1, char *ap2, char *ap3, char *ap4, char *ap5, char *notifier, int fileGoal, int rewritefile);
135 extern struct bnode *bnode_FindInstance(register char *aname);
136 extern int bnode_WaitStatus(register struct bnode *abnode, int astatus);
137 extern int bnode_SetStat(register struct bnode *abnode, register int agoal);