]> git.ipfire.org Git - thirdparty/systemd.git/blame - udev_libc_wrapper.h
[PATCH] Udev doesn't properly build with $CROSS
[thirdparty/systemd.git] / udev_libc_wrapper.h
CommitLineData
57e1a277
KS
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
138068d6 25#undef asmlinkage
63f61c5c 26#ifdef __i386__
138068d6
KS
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)
63f61c5c 40#endif
138068d6
KS
41#ifndef __FD_ZERO
42#define __FD_ZERO(set) ((void) memset ((void*) (set), 0, sizeof (fd_set)))
63f61c5c
KS
43#endif
44
45#include <string.h>
46
b8476286
KS
47#ifdef __KLIBC__
48static inline int clearenv(void)
49{
50 environ[0] = NULL;
51 return 0;
52}
53#endif
54
57e1a277
KS
55extern uid_t lookup_user(const char *user);
56extern gid_t lookup_group(const char *group);
57
63f61c5c 58extern size_t strlcpy(char *dst, const char *src, size_t size);
63f61c5c 59extern size_t strlcat(char *dst, const char *src, size_t size);
63f61c5c 60
57e1a277 61#endif /* _UDEV_LIBC_WRAPPER_H_ */