patch-1.3.21 linux/include/asm-i386/string.h
Next file: linux/include/asm-i386/unistd.h
Previous file: linux/fs/smbfs/sock.c
Back to the patch index
Back to the overall index
- Lines: 26
- Date:
Fri Aug 18 09:37:40 1995
- Orig file:
v1.3.20/linux/include/asm-i386/string.h
- Orig date:
Tue Aug 8 12:31:41 1995
diff -u --recursive --new-file v1.3.20/linux/include/asm-i386/string.h linux/include/asm-i386/string.h
@@ -496,6 +496,25 @@
return (s);
}
+/* Added by Gertjan van Wingerde to make minix and sysv module work */
+#define __HAVE_ARCH_STRNLEN
+extern inline size_t strnlen(const char * s, size_t count)
+{
+register int __res;
+__asm__ __volatile__(
+ "movl %1,%0\n\t"
+ "jmp 2f\n"
+ "1:\tcmpb $0,(%0)\n\t"
+ "je 3f\n\t"
+ "incl %0\n"
+ "2:\tdecl %2\n\t"
+ "cmpl $-1,%2\n\t"
+ "jne 1b\n"
+ "3:\tsubl %1,%0"
+ :"=a" (__res):"c" (s),"d" (count));
+return __res;
+}
+/* end of additional stuff */
/*
* This looks horribly ugly, but the compiler can optimize it totally,
FUNET's LINUX-ADM group, [email protected]
TCL-scripts by Sam Shen, [email protected]
with Sam's (original) version of this