⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 amanda.h

📁 开源备份软件源码 AMANDA, the Advanced Maryland Automatic Network Disk Archiver, is a backup system that a
💻 H
📖 第 1 页 / 共 3 页
字号:
/* * Amanda, The Advanced Maryland Automatic Network Disk Archiver * Copyright (c) 1991-1999 University of Maryland at College Park * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of U.M. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission.  U.M. makes no representations about the * suitability of this software for any purpose.  It is provided "as is" * without express or implied warranty. * * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Authors: the Amanda Development Team.  Its members are listed in a * file named AUTHORS, in the root directory of this distribution. *//* * $Id: amanda.h,v 1.131 2006/07/25 18:27:56 martinea Exp $ * * the central header file included by all amanda sources */#ifndef AMANDA_H#define AMANDA_H#include <glib.h>#include <glib/gprintf.h>#include "amflock.h"#ifdef HAVE_CONFIG_H/* use a relative path here to avoid conflicting with Perl's config.h. */#include "../config/config.h"#endif/* * Force large file source even if configure guesses wrong. */#ifndef _LARGE_FILE_SOURCE#define _LARGE_FILES 1#endif#ifndef _LARGEFILE64_SOURCE#define _LARGEFILE64_SOURCE 1#endif#ifndef  _FILE_OFFSET_BITS#define	_FILE_OFFSET_BITS 64#endif#ifdef HAVE_SYS_TYPES_H#  include <sys/types.h>#endif/* gnulib creates this header locally if the system doesn't provide it */#include <stdint.h>/* * I would prefer that each Amanda module include only those system headers * that are locally needed, but on most Unixes the system header files are not * protected against multiple inclusion, so this can lead to problems. * * Also, some systems put key files in different places, so by including  * everything here the rest of the system is isolated from such things. */#ifdef HAVE_ALLOCA_H#  include <alloca.h>#endif/* from the autoconf documentation */#ifdef HAVE_DIRENT_H#  include <dirent.h>#  define NAMLEN(dirent) strlen((dirent)->d_name)#else#  define dirent direct#  define NAMLEN(dirent) (dirent)->d_namlen#  if HAVE_SYS_NDIR_H#    include <sys/ndir.h>#  endif#  if HAVE_SYS_DIR_H#    include <sys/dir.h>#  endif#  if HAVE_NDIR_H#    include <ndir.h>#  endif#endif#ifdef ENABLE_NLS#  include <libintl.h>#  include <locale.h>#  define  plural(String1, String2, Count)				\		(((Count) == 1) ? (String1) : (String2))#else#  define plural(String1, String2, Count)				\		(((Count) == 1) ? (String1) : (String2))#  define setlocale(Which, Locale)#  define textdomain(Domain)#  define bindtextdomain(Package, Directory)#  define gettext(String)			String#  define dgettext(Domain, String)		String#  define dcgettext(Domain, String, Catagory)	String#  define ngettext(String1, String2, Count)				\		plural((String1), (String2), (Count))#  define dngettext(Domain, String1, String2, Count)			\		plural((String1), (String2), (Count))#  define dcngettext(Domain, String1, String2, Count, Catagory)		\		plural((String1), (String2), (Count))#endif#define T_(String)			String#ifndef SWIG /* TODO: make this go away */#define _(String)			dgettext("amanda", (String))#endif#ifdef HAVE_FCNTL_H#  include <fcntl.h>#endif#ifdef HAVE_GRP_H#  include <grp.h>#endif#if defined(USE_DB_H)#  include <db.h>#else#if defined(USE_DBM_H)#  include <dbm.h>#else#if defined(USE_GDBM_H)#  include <gdbm.h>#else#if defined(USE_NDBM_H)#  include <ndbm.h>#endif#endif#endif#endif#ifdef HAVE_NETDB_H#  include <netdb.h>#endif#ifdef TIME_WITH_SYS_TIME#  include <sys/time.h>#  include <time.h>#else#  ifdef HAVE_SYS_TIME_H#    include <sys/time.h>#  else#    include <time.h>#  endif#endif#ifdef HAVE_LIBC_H#  include <libc.h>#endif#ifdef HAVE_STDLIB_H#  include <stdlib.h>#endif#ifdef HAVE_LIBGEN_H#  include <libgen.h>#endif#ifdef HAVE_STRING_H#  include <string.h>#endif#ifdef HAVE_STRINGS_H#  include <strings.h>#endif#ifdef HAVE_SYSLOG_H#  include <syslog.h>#endif#ifdef HAVE_MATH_H#  include <math.h>#endif#ifdef HAVE_SYS_FILE_H#  include <sys/file.h>#endif#ifdef HAVE_SYS_IOCTL_H#  include <sys/ioctl.h>#endif#ifdef HAVE_LIMITS_H#include <limits.h>#endif#ifdef HAVE_SYS_PARAM_H#  include <sys/param.h>#endif#if defined(HAVE_SYS_IPC_H) && defined(HAVE_SYS_SHM_H)#  include <sys/ipc.h>#  include <sys/shm.h>#else#  ifdef HAVE_SYS_MMAN_H#    include <sys/mman.h>#  endif#endif#ifdef HAVE_SYS_SELECT_H#  include <sys/select.h>#endif#ifdef HAVE_SYS_STAT_H#  include <sys/stat.h>#endif#ifdef HAVE_SYS_UIO_H#  include <sys/uio.h>#elsestruct iovec {    void *iov_base;    int iov_len;};#endif#ifdef HAVE_WAIT_H#  include <wait.h>#endif#ifdef HAVE_SYS_WAIT_H#  include <sys/wait.h>#endif#ifdef HAVE_STDARG_H#include <stdarg.h>#endif#ifdef WAIT_USES_INT  typedef int amwait_t;# ifndef WEXITSTATUS#  define WEXITSTATUS(stat_val) (*(unsigned*)&(stat_val) >> 8)# endif# ifndef WTERMSIG#  define WTERMSIG(stat_val) (*(unsigned*)&(stat_val) & 0x7F)# endif# ifndef WIFEXITED#  define WIFEXITED(stat_val) ((*(unsigned*)&(stat_val) & 255) == 0)# endif#else# ifdef WAIT_USES_UNION   typedef union wait amwait_t;#  ifndef WEXITSTATUS#  define WEXITSTATUS(stat_val) (((amwait_t*)&(stat_val))->w_retcode)#  endif#  ifndef WTERMSIG#   define WTERMSIG(stat_val) (((amwait_t*)&(stat_val))->w_termsig)#  endif#  ifndef WIFEXITED#   define WIFEXITED(stat_val) (WTERMSIG(stat_val) == 0)#  endif# else   typedef int amwait_t;#  ifndef WEXITSTATUS#   define WEXITSTATUS(stat_val) (*(unsigned*)&(stat_val) >> 8)#  endif#  ifndef WTERMSIG#   define WTERMSIG(stat_val) (*(unsigned*)&(stat_val) & 0x7F)#  endif#  ifndef WIFEXITED#   define WIFEXITED(stat_val) ((*(unsigned*)&(stat_val) & 255) == 0)#  endif# endif#endif#ifndef WIFSIGNALED# define WIFSIGNALED(stat_val)	(WTERMSIG(stat_val) != 0)#endif#ifdef HAVE_UNISTD_H#  include <unistd.h>#endif#ifdef HAVE_NETINET_IN_H#  include <netinet/in.h>#endif#include <ctype.h>#include <errno.h>#include <pwd.h>#include <signal.h>#include <setjmp.h>#include <stdio.h>#include <sys/resource.h>#include <sys/socket.h>#ifdef HAVE_ARPA_INET_H#include <arpa/inet.h>#endif/* Support for missing IPv6 components */#ifndef HAVE_SOCKADDR_STORAGE#  define sockaddr_storage sockaddr_in#  define ss_family sin_family#endif#ifdef WORKING_IPV6#define INET6#endif#ifndef INET_ADDRSTRLEN#define INET_ADDRSTRLEN 16#endif#if !defined(HAVE_SIGACTION) && defined(HAVE_SIGVEC)/* quick'n'dirty hack for NextStep31 */#  define sa_flags sv_flags#  define sa_handler sv_handler#  define sa_mask sv_mask#  define sigaction sigvec#  define sigemptyset(mask) /* no way to clear pending signals */#endif/* * Most Unixen declare errno in <errno.h>, some don't.  Some multithreaded * systems have errno as a per-thread macro.  So, we have to be careful. */#ifndef errnoextern int errno;#endif/* * Some compilers have int for type of sizeof() some use size_t. * size_t is the one we want... */#define	SIZEOF(x)	(size_t)sizeof(x)/* * Some older BSD systems don't have these FD_ macros, so if not, provide them. */#if !defined(FD_SET) || defined(LINT) || defined(__lint)#  undef FD_SETSIZE#  define FD_SETSIZE      (int)(SIZEOF(fd_set) * CHAR_BIT)#  undef FD_SET#  define FD_SET(n, p)    (((fd_set *)(p))->fds_bits[(n)/WORD_BIT] |= (int)((1 << ((n) % WORD_BIT))))#  undef FD_CLR#  define FD_CLR(n, p)    (((fd_set *)(p))->fds_bits[(n)/WORD_BIT] &= (int)(~(1 << ((n) % WORD_BIT))))#  undef FD_ISSET#  define FD_ISSET(n, p)  (((fd_set *)(p))->fds_bits[(n)/WORD_BIT] & (1 << ((n) % WORD_BIT)))#  undef FD_ZERO#  define FD_ZERO(p)      memset((p), 0, SIZEOF(*(p)))#endif#ifndef FD_COPY#  define FD_COPY(p, q)   memcpy((q), (p), SIZEOF(*(p)))#endif/* * Define MAX_HOSTNAME_LENGTH as the size of arrays to hold hostname's. */#undef  MAX_HOSTNAME_LENGTH#define MAX_HOSTNAME_LENGTH 1025/* * If void is broken, substitute char. */#ifdef BROKEN_VOID#  define void char#endif#define stringize(x) #x#define stringconcat(x, y) x ## y/* amanda #days calculation, with roundoff */#define SECS_PER_DAY	(24*60*60)#define days_diff(a, b)	(int)(((b) - (a) + SECS_PER_DAY/2) / SECS_PER_DAY)/* Global constants.  */#ifndef AMANDA_SERVICE_NAME#define AMANDA_SERVICE_NAME "amanda"#endif#ifndef KAMANDA_SERVICE_NAME#define KAMANDA_SERVICE_NAME "kamanda"#endif#ifndef SERVICE_SUFFIX#define SERVICE_SUFFIX ""#endif#ifndef AMANDA_SERVICE_DEFAULT#define AMANDA_SERVICE_DEFAULT	((in_port_t)10080)#endif#ifndef KAMANDA_SERVICE_DEFAULT#define KAMANDA_SERVICE_DEFAULT	((in_port_t)10081)#endif#define am_round(v,u)	((((v) + (u) - 1) / (u)) * (u))#define am_floor(v,u)	(((v) / (u)) * (u))/* Holding disk block size.  Do not even think about changint this!  :-) */#define DISK_BLOCK_KB		32#define DISK_BLOCK_BYTES	(DISK_BLOCK_KB * 1024)/* Maximum size of a tape block *//* MAX_TAPE_BLOCK_KB is defined in config.h *//* by configure --with-maxtapeblocksize     */#define MAX_TAPE_BLOCK_BYTES (MAX_TAPE_BLOCK_KB*1024)/* Maximum length of tape label, plus one for null-terminator. */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -