[uClibc]compilation errors for rlimit syscalls
Miles Bader
miles at lsi.nec.co.jp
Mon Apr 1 04:38:44 UTC 2002
I get the following errors when compiling uclibc today:
v850e-elf-gcc -Wall -Os -fno-builtin -nostdinc -pipe -nostdinc -I../../../../include -I/proj/soft2/uclinux/i386-pc-linux-gnu/lib/gcc-lib/v850e-elf/2.9-v850ice-000414/include -I. -D_LIBC -O2 -g -I/proj/soft2/uclinux/ucdist/build/sim/lib/uClibc/include -I/proj/soft2/uclinux/ucdist/build/sim -Dlinux -D__linux__ -D__uClinux__ -Dunix -DNDEBUG -DL___setrlimit syscalls.c -c -o __setrlimit.o
syscalls.c:577: conflicting types for `setrlimit'
../../../../include/sys/resource.h:72: previous declaration of `setrlimit'
syscalls.c: In function `setrlimit':
syscalls.c:581: warning: implicit declaration of function `MIN'
v850e-elf-gcc -Wall -Os -fno-builtin -nostdinc -pipe -nostdinc -I../../../../include -I/proj/soft2/uclinux/i386-pc-linux-gnu/lib/gcc-lib/v850e-elf/2.9-v850ice-000414/include -I. -D_LIBC -O2 -g -I/proj/soft2/uclinux/ucdist/build/sim/lib/uClibc/include -I/proj/soft2/uclinux/ucdist/build/sim -Dlinux -D__linux__ -D__uClinux__ -Dunix -DNDEBUG -DL___getrlimit syscalls.c -c -o __getrlimit.o
syscalls.c:605: conflicting types for `getrlimit'
../../../../include/sys/resource.h:52: previous declaration of `getrlimit'
syscalls.c: In function `getrlimit':
syscalls.c:614: `rlimits' undeclared (first use in this function)
v850e-elf-gcc -Wall -Os -fno-builtin -nostdinc -pipe -nostdinc -I../../../../include -I/proj/soft2/uclinux/i386-pc-linux-gnu/lib/gcc-lib/v850e-elf/2.9-v850ice-000414/include -I. -D_LIBC -O2 -g -I/proj/soft2/uclinux/ucdist/build/sim/lib/uClibc/include -I/proj/soft2/uclinux/ucdist/build/sim -Dlinux -D__linux__ -D__uClinux__ -Dunix -DNDEBUG -DL___ugetrlimit syscalls.c -c -o __ugetrlimit.o
syscalls.c: In function `__ugetrlimit':
syscalls.c:1454: `__NR_ugetrlimit' undeclared (first use in this function)
syscalls.c:1454: warning: `__ret' might be used uninitialized in this function
Here's how I fixed them:
Index: libc/sysdeps/linux/common/syscalls.c
===================================================================
RCS file: /var/cvs/uClibc/libc/sysdeps/linux/common/syscalls.c,v
retrieving revision 1.68
diff -u -r1.68 syscalls.c
--- libc/sysdeps/linux/common/syscalls.c 31 Mar 2002 01:56:09 -0000 1.68
+++ libc/sysdeps/linux/common/syscalls.c 1 Apr 2002 04:37:50 -0000
@@ -3,7 +3,7 @@
* Syscalls for uClibc
*
* Copyright (C) 2000 by Lineo, inc
- * Copyright (C) 2001 by Erik Andersen
+ * Copyright (C) 2001, 2002 by Erik Andersen
* Written by Erik Andersen <andersen at codpoet.org>
*
* This program is free software; you can redistribute it and/or modify it
@@ -572,18 +572,20 @@
#define __NR___setrlimit __NR_setrlimit
#include <unistd.h>
#include <sys/resource.h>
+#define RMIN(x, y) ((x) < (y) ? (x) : (y))
_syscall2(int, __setrlimit, int, resource, const struct rlimit *, rlim);
-int setrlimit (enum __rlimit_resource resource, const struct rlimit *rlimits)
+int setrlimit (__rlimit_resource_t resource, const struct rlimit *rlimits)
{
struct rlimit rlimits_small;
/* We might have to correct the limits values. Since the old values
* were signed the new values might be too large. */
- rlimits_small.rlim_cur = MIN ((unsigned long int) rlimits->rlim_cur,
- RLIM_INFINITY >> 1);
- rlimits_small.rlim_max = MIN ((unsigned long int) rlimits->rlim_max,
- RLIM_INFINITY >> 1);
+ rlimits_small.rlim_cur = RMIN ((unsigned long int) rlimits->rlim_cur,
+ RLIM_INFINITY >> 1);
+ rlimits_small.rlim_max = RMIN ((unsigned long int) rlimits->rlim_max,
+ RLIM_INFINITY >> 1);
return(__setrlimit(resource, &rlimits_small));
}
+#undef RMIN
#endif
#else /* We don't need to wrap setrlimit */
#ifdef L_setrlimit
@@ -601,10 +603,10 @@
#include <unistd.h>
#include <sys/resource.h>
_syscall2(int, __getrlimit, int, resource, struct rlimit *, rlim);
-int getrlimit (enum __rlimit_resource resource, struct rlimit *rlim)
+int getrlimit (__rlimit_resource_t resource, struct rlimit *rlimits)
{
int result;
- result = __getrlimit(resource, rlim);
+ result = __getrlimit(resource, rlimits);
if (result == -1)
return result;
@@ -1446,6 +1448,7 @@
//#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
#ifdef L___ugetrlimit
+#ifdef __NR_ugetrlimit
#define __NR___ugetrlimit __NR_ugetrlimit
#include <unistd.h>
#include <sys/resource.h>
@@ -1454,7 +1457,9 @@
{
return(__ugetrlimit(resource, rlimits));
}
+#endif /* __NR_ugetrlimit */
#endif
+
//#define __NR_mmap2 192
-Miles
--
o The existentialist, not having a pillow, goes everywhere with the book by
Sullivan, _I am going to spit on your graves_.
More information about the uClibc
mailing list