syslog-ng source
compat.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2013 Balabit
3  * Copyright (c) 1998-2012 Balázs Scheidler
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * As an additional exemption you are allowed to compile & link against the
20  * OpenSSL libraries as published by the OpenSSL project. See the file
21  * COPYING for details.
22  *
23  */
24 
25 /*
26  * The compat subdirectory is a placeholder for missing functionality on
27  * various platforms. Here are the rules to follow when a specific platform
28  * lacks a given functionality.
29  *
30  * NOTE: compat is the place for simple functions and fixups that should
31  * have been defined by the system but isn't for some reason (old version,
32  * weird platform etc). It is not the place for extensive logic, complex
33  * implementations and so on. It is a strong indicator that we are doing
34  * something wrong if a .c file in compat is more than a 100 lines. For
35  * those, a proper syslog-ng style API with several implementations is the
36  * way to go.
37  *
38  * NOTE/2: please don't implement dummy, empty functions for things that
39  * make no sense on a specific platforms. In that case, please modify the
40  * call-site instead. Whenever you read a call-site of code that resides in
41  * compat it shouldn't misguide you that it doesn't do anything. For these
42  * changing the call-site is better.
43  *
44  * File organization, call sites:
45  *
46  * 1) Add a header for that subsystem under lib/compat, this should in turn
47  * include "compat/compat.h" first, and then add all headers required by
48  * the interface itself.
49  *
50  * 2) compat.h will take care about including <config.h> no code under
51  * compat should do the same.
52  *
53  * 3) Add the implementation to one or more .c files. If the functions are
54  * unrelated, it's preferred to have a separate .c file for each, with a
55  * single header. In other cases you can simply use the same name for
56  * the .c as you did for the .h
57  *
58  * 4) call sites should include compat/XXXX.h, preferably _instead_ of the
59  * system header that defines the given functionality. The compat header
60  * will include the required system headers anyway, no need to do that
61  * multiple times.
62  *
63  * 5) compat.h shouldn't be included by call-sites directly.
64  *
65  * If a function is missing on a set of platforms, they should be named as
66  * POSIX named them (if they are standard), or if not, they should be named
67  * as on Linux.
68  */
69 
70 #ifndef COMPAT_COMPAT_H_INCLUDED
71 #define COMPAT_COMPAT_H_INCLUDED
72 
73 #include <syslog-ng-config.h>
74 
75 #endif