140266059SGregory Neil Shapiro /* 25dd76dd0SGregory Neil Shapiro * Copyright (c) 2000-2002 Proofpoint, Inc. and its suppliers. 340266059SGregory Neil Shapiro * All rights reserved. 440266059SGregory Neil Shapiro * 540266059SGregory Neil Shapiro * By using this file, you agree to the terms and conditions set 640266059SGregory Neil Shapiro * forth in the LICENSE file which can be found at the top level of 740266059SGregory Neil Shapiro * the sendmail distribution. 840266059SGregory Neil Shapiro * 94313cc83SGregory Neil Shapiro * $Id: gen.h,v 1.24 2013-11-22 20:51:31 ca Exp $ 1040266059SGregory Neil Shapiro */ 1140266059SGregory Neil Shapiro 1240266059SGregory Neil Shapiro /* 1340266059SGregory Neil Shapiro ** libsm general definitions 1440266059SGregory Neil Shapiro ** See libsm/gen.html for documentation. 1540266059SGregory Neil Shapiro */ 1640266059SGregory Neil Shapiro 1740266059SGregory Neil Shapiro #ifndef SM_GEN_H 1840266059SGregory Neil Shapiro # define SM_GEN_H 1940266059SGregory Neil Shapiro 2040266059SGregory Neil Shapiro # include <sm/config.h> 2140266059SGregory Neil Shapiro # include <sm/cdefs.h> 2240266059SGregory Neil Shapiro # include <sm/types.h> 2340266059SGregory Neil Shapiro 2440266059SGregory Neil Shapiro /* 2540266059SGregory Neil Shapiro ** Define SM_RCSID and SM_IDSTR, 2640266059SGregory Neil Shapiro ** macros used to embed RCS and SCCS identification strings in object files. 2740266059SGregory Neil Shapiro */ 2840266059SGregory Neil Shapiro 2940266059SGregory Neil Shapiro # ifdef lint 3040266059SGregory Neil Shapiro # define SM_RCSID(str) 3140266059SGregory Neil Shapiro # define SM_IDSTR(id,str) 3240266059SGregory Neil Shapiro # else /* lint */ 3340266059SGregory Neil Shapiro # define SM_RCSID(str) SM_UNUSED(static const char RcsId[]) = str; 3440266059SGregory Neil Shapiro # define SM_IDSTR(id,str) SM_UNUSED(static const char id[]) = str; 3540266059SGregory Neil Shapiro # endif /* lint */ 3640266059SGregory Neil Shapiro 3740266059SGregory Neil Shapiro /* 3840266059SGregory Neil Shapiro ** Define NULL and offsetof (from the C89 standard) 3940266059SGregory Neil Shapiro */ 4040266059SGregory Neil Shapiro 4140266059SGregory Neil Shapiro # if SM_CONF_STDDEF_H 4240266059SGregory Neil Shapiro # include <stddef.h> 4340266059SGregory Neil Shapiro # else /* SM_CONF_STDDEF_H */ 4440266059SGregory Neil Shapiro # ifndef NULL 4540266059SGregory Neil Shapiro # define NULL 0 465b0945b5SGregory Neil Shapiro # endif 4740266059SGregory Neil Shapiro # define offsetof(type, member) ((size_t)(&((type *)0)->member)) 4840266059SGregory Neil Shapiro # endif /* SM_CONF_STDDEF_H */ 4940266059SGregory Neil Shapiro 5040266059SGregory Neil Shapiro /* 5140266059SGregory Neil Shapiro ** Define bool, true, false (from the C99 standard) 5240266059SGregory Neil Shapiro */ 5340266059SGregory Neil Shapiro 5440266059SGregory Neil Shapiro # if SM_CONF_STDBOOL_H 5540266059SGregory Neil Shapiro # include <stdbool.h> 5640266059SGregory Neil Shapiro # else /* SM_CONF_STDBOOL_H */ 5740266059SGregory Neil Shapiro # ifndef __cplusplus 5840266059SGregory Neil Shapiro typedef int bool; 5940266059SGregory Neil Shapiro # define false 0 6040266059SGregory Neil Shapiro # define true 1 61e92d3f3fSGregory Neil Shapiro # define __bool_true_false_are_defined 1 62e92d3f3fSGregory Neil Shapiro # endif /* ! __cplusplus */ 6340266059SGregory Neil Shapiro # endif /* SM_CONF_STDBOOL_H */ 6440266059SGregory Neil Shapiro 6540266059SGregory Neil Shapiro /* 6640266059SGregory Neil Shapiro ** Define SM_MAX and SM_MIN 6740266059SGregory Neil Shapiro */ 6840266059SGregory Neil Shapiro 6940266059SGregory Neil Shapiro # define SM_MAX(a, b) ((a) > (b) ? (a) : (b)) 7040266059SGregory Neil Shapiro # define SM_MIN(a, b) ((a) < (b) ? (a) : (b)) 7140266059SGregory Neil Shapiro 7240266059SGregory Neil Shapiro /* Define SM_SUCCESS and SM_FAILURE */ 7340266059SGregory Neil Shapiro # define SM_SUCCESS 0 7440266059SGregory Neil Shapiro # define SM_FAILURE (-1) 7540266059SGregory Neil Shapiro 7640266059SGregory Neil Shapiro /* XXX This needs to be fixed when we start to use threads: */ 7740266059SGregory Neil Shapiro typedef int SM_ATOMIC_INT_T; 7840266059SGregory Neil Shapiro typedef unsigned int SM_ATOMIC_UINT_T; 7940266059SGregory Neil Shapiro 802fb4f839SGregory Neil Shapiro #if _FFR_EAI && !defined(USE_EAI) 812fb4f839SGregory Neil Shapiro # define USE_EAI 1 822fb4f839SGregory Neil Shapiro #endif 832fb4f839SGregory Neil Shapiro 842fb4f839SGregory Neil Shapiro #if USE_EAI && !defined(_FFR_LOGASIS) 852fb4f839SGregory Neil Shapiro # define _FFR_LOGASIS 1 862fb4f839SGregory Neil Shapiro #endif 872fb4f839SGregory Neil Shapiro 882fb4f839SGregory Neil Shapiro #if USE_EAI || _FFR_EIGHT_BIT_ADDR_OK 892fb4f839SGregory Neil Shapiro # define _FFR_8BITENVADDR 1 902fb4f839SGregory Neil Shapiro #endif 912fb4f839SGregory Neil Shapiro 92*d39bd2c1SGregory Neil Shapiro #if _FFR_HAPROXY && !defined(_FFR_XCNCT) 93*d39bd2c1SGregory Neil Shapiro # define _FFR_XCNCT 1 94*d39bd2c1SGregory Neil Shapiro #endif 95*d39bd2c1SGregory Neil Shapiro 9640266059SGregory Neil Shapiro #endif /* SM_GEN_H */ 97