~ps10gel/ubuntu/xenial/trafficserver/6.2.0

« back to all changes in this revision

Viewing changes to lib/ts/ink_defs.h

  • Committer: Bazaar Package Importer
  • Author(s): Arno Toell
  • Date: 2011-01-13 11:49:18 UTC
  • Revision ID: james.westby@ubuntu.com-20110113114918-vu422h8dknrgkj15
Tags: upstream-2.1.5-unstable
ImportĀ upstreamĀ versionĀ 2.1.5-unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** @file
 
2
 
 
3
  Some small general interest definitions
 
4
 
 
5
  @section license License
 
6
 
 
7
  Licensed to the Apache Software Foundation (ASF) under one
 
8
  or more contributor license agreements.  See the NOTICE file
 
9
  distributed with this work for additional information
 
10
  regarding copyright ownership.  The ASF licenses this file
 
11
  to you under the Apache License, Version 2.0 (the
 
12
  "License"); you may not use this file except in compliance
 
13
  with the License.  You may obtain a copy of the License at
 
14
 
 
15
      http://www.apache.org/licenses/LICENSE-2.0
 
16
 
 
17
  Unless required by applicable law or agreed to in writing, software
 
18
  distributed under the License is distributed on an "AS IS" BASIS,
 
19
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
20
  See the License for the specific language governing permissions and
 
21
  limitations under the License.
 
22
 */
 
23
 
 
24
#ifndef _ink_defs_h
 
25
#define _ink_defs_h
 
26
 
 
27
/* Defines
 
28
*/
 
29
#define SIZE(x) (sizeof(x)/sizeof((x)[0]))
 
30
#define ON ((char*)&on)
 
31
#define OFF ((char*)&off)
 
32
#ifndef ABS
 
33
#define ABS(_x_) (((_x_) < 0) ? ( - (_x_)) : (_x_))
 
34
#endif
 
35
 
 
36
/* Debugging
 
37
*/
 
38
#ifdef NDEBUG
 
39
 
 
40
#define FDBG
 
41
#define DBG(s)
 
42
#define DBG1(s,a)
 
43
#define DBG2(s,a1,a2)
 
44
#define DBG3(s,a1,a2,a3)
 
45
#define DBG4(s,a1,a2,a3,a4)
 
46
 
 
47
#else
 
48
 
 
49
#define FDBG                if (debug_level==1) printf("debug "__FILE__":%d %s : entered\n" ,__LINE__,__FUNCTION__)
 
50
#define DBG(s)              if (debug_level==1) printf("debug "__FILE__":%d %s :" s ,__LINE__,__FUNCTION__)
 
51
#define DBG1(s,a)           if (debug_level==1) printf("debug "__FILE__":%d %s :" s ,__LINE__,__FUNCTION__, a)
 
52
#define DBG2(s,a1,a2)       if (debug_level==1) printf("debug "__FILE__":%d %s :" s ,__LINE__,__FUNCTION__, a1,a2)
 
53
#define DBG3(s,a1,a2,a3)    if (debug_level==1) printf("debug "__FILE__":%d %s :" s ,__LINE__,__FUNCTION__, a1,a2,a3)
 
54
#define DBG4(s,a1,a2,a3,a4) if (debug_level==1) printf("debug "__FILE__":%d %s :" s ,__LINE__,__FUNCTION__, a1,a2,a3,a4)
 
55
 
 
56
#endif
 
57
 
 
58
/* Types
 
59
*/
 
60
typedef void *(*VPVP_PFN) (void *);
 
61
typedef void (*VVP_PFN) (void *);
 
62
typedef void (*VV_PFN) (void);
 
63
typedef void (*VI_PFN) (int);
 
64
 
 
65
/* Compiler Hints
 
66
 */
 
67
#define NOWARN_UNUSED(x)        (void)(x)
 
68
#define NOWARN_UNUSED_RETURN(x) if (x) {}
 
69
#ifdef __GNUC__
 
70
/*  Enable this to get printf() style warnings on the Inktomi functions. */
 
71
/* #define PRINTFLIKE(IDX, FIRST)  __attribute__((format (printf, IDX, FIRST))) */
 
72
#define PRINTFLIKE(IDX, FIRST)
 
73
#else
 
74
#define PRINTFLIKE(IDX, FIRST)
 
75
#endif
 
76
 
 
77
/* Variables
 
78
*/
 
79
extern int debug_level;
 
80
extern int off;
 
81
extern int on;
 
82
 
 
83
/* Functions
 
84
*/
 
85
int ink_sys_name_release(char *name, int namelen, char *release, int releaselen);
 
86
int ink_number_of_processors();
 
87
 
 
88
/** Constants.
 
89
 */
 
90
namespace ts {
 
91
  static const int NO_FD = -1; ///< No or invalid file descriptor.
 
92
}
 
93
 
 
94
#endif /*__ink_defs_h*/