/usr/include/syslog-ng/misc.h is in syslog-ng-dev 3.5.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | /*
* Copyright (c) 2002-2012 BalaBit IT Ltd, Budapest, Hungary
* Copyright (c) 1998-2012 Balázs Scheidler
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* As an additional exemption you are allowed to compile & link against the
* OpenSSL libraries as published by the OpenSSL project. See the file
* COPYING for details.
*
*/
#ifndef MISC_H_INCLUDED
#define MISC_H_INCLUDED
#include "syslog-ng.h"
#include "gsockaddr.h"
#include <sys/types.h>
#include <sys/socket.h>
/* functions that should be implemented by GLib but they aren't */
GString *g_string_assign_len(GString *s, const gchar *val, gint len);
void g_string_steal(GString *s);
gboolean g_fd_set_nonblock(int fd, gboolean enable);
gboolean g_fd_set_cloexec(int fd, gboolean enable);
/* deliberately using gint here as the extremal values may not fit into uid_t/gid_t */
gboolean resolve_user(const char *user, gint *uid);
gboolean resolve_group(const char *group, gint *gid);
gboolean resolve_user_group(char *arg, gint *uid, gint *gid);
/* name resolution */
void reset_cached_hostname(void);
const gchar *get_local_hostname(gsize *len);
void resolve_sockaddr(gchar *result, gsize *result_len, GSockAddr *saddr, gboolean usedns, gboolean usefqdn, gboolean use_dns_cache, gboolean normalize_hostnames);
gboolean resolve_hostname(GSockAddr **addr, gchar *name);
gchar *format_hex_string(gpointer str, gsize str_len, gchar *result, gsize result_len);
gchar *find_cr_or_lf(gchar *s, gsize n);
gchar *find_file_in_path(const gchar *path, const gchar *filename, GFileTest test);
GThread *create_worker_thread(GThreadFunc func, gpointer data, gboolean joinable, GError **error);
static inline void
init_sequence_number(gint32 *seqnum)
{
*seqnum = 1;
}
static inline void
step_sequence_number(gint32 *seqnum)
{
(*seqnum)++;
if (*seqnum < 0)
*seqnum = 1;
}
GList *string_array_to_list(const gchar *strlist[]);
void string_list_free(GList *l);
#define APPEND_ZERO(dest, value, value_len) \
do { \
gchar *__buf; \
if (G_UNLIKELY(value[value_len] != 0)) \
{ \
/* value is NOT zero terminated */ \
\
__buf = g_alloca(value_len + 1); \
memcpy(__buf, value, value_len); \
__buf[value_len] = 0; \
} \
else \
{ \
/* value is zero terminated */ \
__buf = (gchar *) value; \
} \
dest = __buf; \
} while (0)
gchar *utf8_escape_string(const gchar *str, gssize len);
#endif
|