sm_statd.h revision bbaa8b60dd95d714741fc474adad3cf710ef4efd
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
#ifndef _SM_STATD_H
#define _SM_STATD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Limit defines */
#define SM_DIRECTORY_MODE 00755
#define MAX_HASHSIZE 50
#define SM_RPC_TIMEOUT 15
#define PERCENT_MINJOIN 10
#define MAX_FDS 256
#define MAX_THR 25
#define INC_DELAYTIME 30
#define MAX_DELAYTIME 300
#define SM_CLTS_TIMEOUT 15
#define SM_MAXPATHLEN 17
/* Increment size for realloc of array host_name */
#define HOST_NAME_INCR 5
#define SM_ADDR_IPV4 "ipv4"
#define SM_ADDR_IPV6 "ipv6"
/* Supported for readdir_r() */
/* Structure entry for monitor table (mon_table) */
struct mon_entry {
};
/* Structure entry for record (rec_table) and recovery (recov_q) tables */
struct name_entry {
char *name; /* name of host */
int count; /* count of entries */
};
typedef struct name_entry name_entry;
/* Structure for passing arguments into thread send_notice */
typedef struct moninfo {
int state; /* Current state */
} moninfo_t;
/* Structure entry for hash tables */
typedef struct sm_hash {
union {
} smhd_t;
} sm_hash_t;
/* Structure entry for address list in name-to-address entry */
typedef struct addr_entry {
struct addr_entry *next;
} addr_entry_t;
/* Structure entry for name-to-address translation table */
typedef struct name_addr_entry {
struct name_addr_entry *next;
char *name;
struct addr_entry *addresses;
/* Hash tables for each of the in-cache information */
/* Global variables */
extern int die; /* Flag to indicate that an SM_CRASH */
/* request came in & to stop threads cleanly */
extern int in_crash; /* Flag to single thread sm_crash requests. */
extern int regfiles_only; /* Flag to indicate symlink use in statmon */
/*
* The only established lock precedence here is:
*
* thr_rwlock > name_addrlock
*/
extern char BACKUP[MAXPATHLEN];
extern int LOCAL_STATE;
/*
* Hash functions for monitor and record hash tables.
* Functions are hashed based on first 2 letters and last 2 letters of name.
* If only 1 letter in name, then, hash only on 1 letter.
*/
int l; \
}
extern int debug; /* Prints out debug information if set. */
extern char hostname[MAXHOSTNAMELEN];
/*
* These variables will be used to store all the
* alias names for the host, as well as the -a
* command line hostnames.
*/
extern char **host_name; /* store -a opts */
extern int host_name_count;
extern int addrix; /* # of -a entries */
/*
* The following 2 variables are meaningful
* only under a HA configuration.
*/
extern char **path_name; /* store -p opts */
extern int pathix; /* # of -p entries */
/* Function prototypes used in program */
extern int create_file(char *name);
extern void delete_file(char *name);
extern void sm_crash(void);
extern void statd_init();
extern void merge_hosts(void);
extern void merge_ips(void);
extern char *xmalloc(unsigned);
/*
* RPC service functions, slightly different here than the
* generated ones in sm_inter.h
*/
extern void sm_simu_crash_svc(void *myidp);
extern void sm_inithash();
extern int str_cmp_unqual_hostname(char *, char *);
extern int is_symlink(char *file);
#ifdef __cplusplus
}
#endif
#endif /* _SM_STATD_H */