mips64 patches

Atsushi Nemoto anemo at mba.ocn.ne.jp
Wed Sep 13 01:40:42 UTC 2006


On Thu, 06 Jul 2006 14:45:25 +0900 (JST), Atsushi Nemoto <anemo at mba.ocn.ne.jp> wrote:
> > The remained patch is for ioctl, but now I can not remember the reason
> > of this change...  I'll try to figure out this is really required or
> > not.
> 
> This is really needed.  The ioctl number must be sign-extended 32bit
> value for mips64 kernel.  Without this change, libc passes
> 0x0000000080000000 for ioctl request 0x80000000, but kernel expects
> 0xffffffff80000000 for the ioctl.
> 
> Since I do not know about other 64bit system, I think adding mips
> specific ioctl.c would be better than touching the common one.  This
> mips specific ioctl.c can be used for all MIPS ABI.
> 
> Patch attached.

Sorry, the patch was wrong.  I forgot changing Makefile and syscalls.h
path.

Here is a revised patch.

Then again, if the type of second argument of ioctl() was changed to
int, this patch is not needed.
-------------- next part --------------
diff -urNp uClibc-20060811/libc/sysdeps/linux/mips/Makefile.arch uClibc/libc/sysdeps/linux/mips/Makefile.arch
--- uClibc-20060811/libc/sysdeps/linux/mips/Makefile.arch	2006-08-11 16:10:26.000000000 +0900
+++ uClibc/libc/sysdeps/linux/mips/Makefile.arch	2006-09-09 00:56:40.632419688 +0900
@@ -6,7 +6,7 @@
 #
 
 CSRC := \
-	__longjmp.c  brk.c setjmp_aux.c mmap.c __syscall_error.c \
+	__longjmp.c  brk.c setjmp_aux.c mmap.c __syscall_error.c ioctl.c \
 	cacheflush.c pread_write.c sysmips.c _test_and_set.c sigaction.c
 
 SSRC := bsd-_setjmp.S bsd-setjmp.S setjmp.S clone.S syscall.S pipe.S
diff -urNp uClibc-20060811/libc/sysdeps/linux/mips/ioctl.c uClibc/libc/sysdeps/linux/mips/ioctl.c
--- uClibc-20060811/libc/sysdeps/linux/mips/ioctl.c	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/mips/ioctl.c	2006-09-09 01:20:30.696016976 +0900
@@ -0,0 +1,32 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * ioctl() for uClibc
+ *
+ * Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "../common/syscalls.h"
+#include <stdarg.h>
+#include <sys/ioctl.h>
+
+libc_hidden_proto(ioctl)
+
+/* 'request' must be sign-extended 32bit value on n64 */
+#define __NR___syscall_ioctl __NR_ioctl
+static inline
+_syscall3(int, __syscall_ioctl, int, fd, int, request, void *, arg);
+
+int ioctl(int fd, unsigned long int request, ...)
+{
+    void *arg;
+    va_list list;
+
+    va_start(list, request);
+    arg = va_arg(list, void *);
+
+    va_end(list);
+    return __syscall_ioctl(fd, request, arg);
+}
+libc_hidden_def(ioctl)


More information about the uClibc mailing list