2 * Copyright (C) 1995-1997, 1999 Jeffrey A. Uphoff
3 * Modified by Olaf Kirch, Dec. 1996.
17 * Paths and filenames.
19 #if defined(NFS_STATEDIR)
20 # define DEFAULT_DIR_BASE NFS_STATEDIR "/"
22 # define DEFAULT_DIR_BASE "/var/lib/nfs/"
25 #define DEFAULT_SM_DIR DEFAULT_DIR_BASE "sm"
26 #define DEFAULT_SM_BAK_DIR DEFAULT_DIR_BASE "sm.bak"
27 #define DEFAULT_SM_STAT_PATH DEFAULT_DIR_BASE "state"
29 /* Added to support run-time specification of state directory path.
30 * j_carlos_gomez@yahoo.com
33 extern char * DIR_BASE
;
35 extern char * SM_BAK_DIR
;
36 extern char * SM_STAT_PATH
;
41 #define STAT_FAIL stat_fail
42 #define STAT_SUCC stat_succ
45 * Function prototypes.
47 extern void change_state(void);
48 extern void my_svc_run(void);
49 extern void notify_hosts(void);
50 extern void shuffle_dirs(void);
51 extern int statd_get_socket(void);
52 extern int process_notify_list(void);
53 extern int process_reply(FD_SET_TYPE
*);
54 extern char * xstrdup(const char *);
55 extern void * xmalloc(size_t);
56 extern void xunlink (char *, char *);
57 extern void load_state(void);
60 * Host status structure and macros.
62 stat_chge SM_stat_chge
;
63 #define MY_NAME SM_stat_chge.mon_name
64 #define MY_STATE SM_stat_chge.state
67 * Some timeout values. (Timeout values are in whole seconds.)
69 #define CALLBACK_TIMEOUT 3 /* For client call-backs. */
70 #define NOTIFY_TIMEOUT 5 /* For status-change notifications. */
71 #define SELECT_TIMEOUT 10 /* Max select() timeout when work to do. */
72 #define MAX_TRIES 5 /* Max number of tries for any host. */
75 * Modes of operation - Lon
78 #define MODE_NODAEMON 1 /* No-daemon/foreground mode. */
79 #define MODE_LOG_STDERR 2 /* in foreground mode, log to stderr */
80 #define MODE_NOTIFY_ONLY 4 /* Send SM_NOTIFY to everyone monitored on
81 a single interface/alias */
82 /* LH - notify_only mode would be for notifying hosts on an IP alias
83 * that just came back up, for ex, when failing over a HA service to
85 #define STATIC_HOSTNAME 8 /* Always use the hostname set by -n */
86 #define MODE_NO_NOTIFY 16 /* Don't notify peers of a reboot */
88 * Program name and version pointers -- See statd.c for the reasoning
89 * as to why they're global.
91 extern char *name_p
; /* program basename */
92 extern const char *version_p
; /* program version */