]> arthur.barton.de Git - netatalk.git/blob - include/atalk/util.h
try to fix OpenBSD build
[netatalk.git] / include / atalk / util.h
1 /*
2  * $Id: util.h,v 1.7.10.5 2004-04-21 18:45:54 bfernhomberg Exp $
3  */
4
5 #ifndef _ATALK_UTIL_H
6 #define _ATALK_UTIL_H 1
7
8 #include <sys/cdefs.h>
9 #include <sys/types.h>
10 #ifdef HAVE_UNISTD_H
11 #include <unistd.h>
12 #endif /* HAVE_UNISTD_H */
13 #include <netatalk/at.h>
14
15 extern int     sys_ftruncate __P((int fd, off_t length));
16
17 #ifdef WITH_SENDFILE
18 extern ssize_t sys_sendfile __P((int __out_fd, int __in_fd, off_t *__offset,size_t __count));
19 #endif
20
21 extern const int _diacasemap[], _dialowermap[];
22
23 extern char **getifacelist(void);
24 extern void freeifacelist(char **);
25
26 #define diatolower(x)     _dialowermap[(unsigned char) (x)]
27 #define diatoupper(x)     _diacasemap[(unsigned char) (x)]
28 extern int atalk_aton     __P((char *, struct at_addr *));
29 extern void bprint        __P((char *, int));
30 extern int strdiacasecmp  __P((const char *, const char *));
31 extern int strndiacasecmp __P((const char *, const char *, size_t));
32 extern pid_t server_lock  __P((char * /*program*/, char * /*file*/, 
33                                int /*debug*/));
34 extern void fault_setup   __P((void (*fn)(void *)));
35 #define server_unlock(x)  (unlink(x))
36
37 #ifndef HAVE_STRLCPY
38 size_t strlcpy __P((char *, const char *, size_t));
39 #endif
40  
41 #ifndef HAVE_STRLCAT
42 size_t strlcat __P((char *, const char *, size_t));
43 #endif
44
45 #ifndef HAVE_DLFCN_H
46 extern void *mod_open    __P((const char *));
47 extern void *mod_symbol  __P((void *, const char *));
48 extern void mod_close    __P((void *));
49 #define mod_error()      ""
50 #else /* ! HAVE_DLFCN_H */
51 #include <dlfcn.h>
52
53 #ifndef RTLD_NOW
54 #define RTLD_NOW 1
55 #endif /* ! RTLD_NOW */
56
57 /* NetBSD doesn't like RTLD_NOW for dlopen (it fails). Use RTLD_LAZY.
58  * OpenBSD currently does not use the second arg for dlopen(). For
59  * future compatibility we define DL_LAZY */
60 #ifdef __NetBSD__
61 #define mod_open(a)      dlopen(a, RTLD_LAZY)
62 #elif defined(__OpenBSD__)
63 #define mod_open(a)      dlopen(a, DL_LAZY)
64 #else /* ! __NetBSD__ && ! __OpenBSD__ */
65 #define mod_open(a)      dlopen(a, RTLD_NOW)
66 #endif /* __NetBSD__ */
67
68 #ifndef DLSYM_PREPEND_UNDERSCORE
69 #define mod_symbol(a, b) dlsym(a, b)
70 #else /* ! DLSYM_PREPEND_UNDERSCORE */
71 extern void *mod_symbol  __P((void *, const char *));
72 #endif /* ! DLSYM_PREPEND_UNDERSCORE */
73 #define mod_error()      dlerror()
74 #define mod_close(a)     dlclose(a)
75 #endif /* ! HAVE_DLFCN_H */
76
77 #endif