1 /* vi: set sw=4 ts=4: */
3 * create_module syscall for uClibc
5 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
7 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
14 #include <sys/syscall.h>
16 #ifdef __NR_create_module
18 unsigned long create_module(const char *name, size_t size);
20 #if defined(__UCLIBC_BROKEN_CREATE_MODULE__)
21 # define __NR___create_module __NR_create_module
22 static __inline__ _syscall2(long, __create_module, const char *, name, size_t, size)
23 /* By checking the value of errno, we know if we have been fooled
24 * by the syscall2 macro making a very high address look like a
25 * negative, so we fix it up here. */
26 unsigned long create_module(const char *name, size_t size)
28 long ret = __create_module(name, size);
30 /* Jump through hoops to fixup error return codes */
31 if (ret == -1 && errno > 125) {
37 #elif defined(__UCLIBC_SLIGHTLY_BROKEN_CREATE_MODULE__)
38 # define __NR___create_module __NR_create_module
39 /* Alpha doesn't have the same problem, exactly, but a bug in older
40 kernels fails to clear the error flag. Clear it here explicitly. */
41 static __inline__ _syscall4(unsigned long, __create_module, const char *, name,
42 size_t, size, size_t, dummy, size_t, err)
43 unsigned long create_module(const char *name, size_t size)
45 return __create_module(name, size, 0, 0);
48 /* Sparc, MIPS, etc don't mistake return values for errors. */
49 _syscall2(unsigned long, create_module, const char *, name, size_t, size)