chiark / gitweb /
add SUSE rules
[elogind.git] / udev_libc_wrapper.h
1 /*
2  * udev_libc_wrapper - wrapping of functions missing in a specific libc
3  *                     or not working in a statically compiled binary
4  *
5  * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
6  *
7  *      This program is free software; you can redistribute it and/or modify it
8  *      under the terms of the GNU General Public License as published by the
9  *      Free Software Foundation version 2 of the License.
10  * 
11  *      This program is distributed in the hope that it will be useful, but
12  *      WITHOUT ANY WARRANTY; without even the implied warranty of
13  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  *      General Public License for more details.
15  * 
16  *      You should have received a copy of the GNU General Public License along
17  *      with this program; if not, write to the Free Software Foundation, Inc.,
18  *      675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  */
21
22 #ifndef _UDEV_LIBC_WRAPPER_H_
23 #define _UDEV_LIBC_WRAPPER_H_
24
25 #undef asmlinkage
26 #ifdef __i386__
27 #define asmlinkage      __attribute__((regparm(0)))
28 #else
29 #define asmlinkage
30 #endif
31
32 #ifndef __FD_SET
33 #define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
34 #endif
35 #ifndef __FD_CLR
36 #define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
37 #endif
38 #ifndef __FD_ISSET
39 #define __FD_ISSET(d, set) (((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0)
40 #endif
41 #ifndef __FD_ZERO
42 #define __FD_ZERO(set) ((void) memset ((void*) (set), 0, sizeof (fd_set)))
43 #endif
44
45 #ifndef NETLINK_KOBJECT_UEVENT
46 #define NETLINK_KOBJECT_UEVENT 15
47 #endif
48
49 #include <string.h>
50
51 #ifdef __KLIBC__
52 static inline int clearenv(void)
53 {
54         environ[0] = NULL;
55         return 0;
56 }
57 #endif
58
59 extern uid_t lookup_user(const char *user);
60 extern gid_t lookup_group(const char *group);
61
62 extern size_t strlcpy(char *dst, const char *src, size_t size);
63 extern size_t strlcat(char *dst, const char *src, size_t size);
64
65 #endif /* _UDEV_LIBC_WRAPPER_H_ */