summaryrefslogtreecommitdiffstats
path: root/include/osdep.h
blob: 594259d85fe19313cb825bf75804c8a3515e2511 (plain) (blame)
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
/* $Id */
#ifndef __OSDEP_H__
#define __OSDEP_H__

#ifdef __GNUC__
#define GCC_CHECK_FORMAT(a,b) __attribute__ ((format (printf, a, b)))
#else
#define GCC_CHECK_FORMAT(a,b)
#endif

/* os dependant include file, define */
#ifdef __linux__

#ifndef _GNU_SOURCE
#define _GNU_SOURCE        /* for strcasestr */
#endif

#include <sys/ioctl.h>
#include <sys/file.h>      /* for flock() */
#include <strings.h>       /* for strcasecmp() */

#define NEED_STRLCPY
#define NEED_STRLCAT
#define NEED_SETPROCTITLE

#elif ! defined(__FreeBSD__)
#error "Unknown OSTYPE"
#endif

#define Signal (signal)

#ifdef NEED_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t size);
#endif

#ifdef NEED_STRLCAT
size_t strlcat(char *dst, const char *src, size_t size);
#endif

#ifdef NEED_SETPROCTITLE
#include <stdarg.h>
extern void initsetproctitle(int argc, char **argv, char **envp);
extern void setproctitle(const char* format, ...) GCC_CHECK_FORMAT(1,2);
#else
#define initsetproctitle(...)
#endif

extern int cpuload(char *str);
#endif