[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r8298 - in /fsf/trunk/libc: ./ sysdeps/unix/sysv/linux/ sysdeps/unix/sysv/linux/wordsize-64/
- To: commits@xxxxxxxxxx
- Subject: [commits] r8298 - in /fsf/trunk/libc: ./ sysdeps/unix/sysv/linux/ sysdeps/unix/sysv/linux/wordsize-64/
- From: eglibc@xxxxxxxxxx
- Date: Thu, 16 Apr 2009 07:04:02 -0000
Author: eglibc
Date: Thu Apr 16 00:04:01 2009
New Revision: 8298
Log:
Import glibc-mainline for 2009-04-16
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/sysdeps/unix/sysv/linux/fallocate.c
fsf/trunk/libc/sysdeps/unix/sysv/linux/fallocate64.c
fsf/trunk/libc/sysdeps/unix/sysv/linux/getsysstats.c
fsf/trunk/libc/sysdeps/unix/sysv/linux/wordsize-64/fallocate.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Apr 16 00:04:01 2009
@@ -1,3 +1,18 @@
+2009-04-15 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/getsysstats.c (next_line): Make sure there
+ are always at least 4 bytes in the returned line.
+
+2009-04-15 Jakub Jelinek <jakub@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Check
+ __libc_use_alloca (8192), if the stack is too small use 512 bytes
+ instead of 8K. Stop searching in /proc/stat after hitting first
+ line not starting with cpu.
+ (next_line): Truncate too long
+ lines at buffer size * 3/4 instead of pretending there were line
+ breaks inside of large lines.
+
2009-04-14 Ulrich Drepper <drepper@xxxxxxxxxx>
* sysdeps/x86_64/mp_clz_tab.c: New file.
@@ -7,6 +22,7 @@
* sysdeps/unix/sysv/linux/fallocate.c: Handle old kernel headers.
* sysdeps/unix/sysv/linux/fallocate64.c: Likewise.
+ * sysdeps/unix/sysv/linux/wordsize-64/fallocate.c: Likewise.
2009-03-25 Andrew Stubbs <ams@xxxxxxxxxxxxxxxx>
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/fallocate.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/fallocate.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/fallocate.c Thu Apr 16 00:04:01 2009
@@ -25,7 +25,7 @@
int
fallocate (int fd, int mode, __off_t offset, __off_t len)
{
-#ifndef __NR_fallocate
+#ifdef __NR_fallocate
return INLINE_SYSCALL (fallocate, 6, fd, mode,
__LONG_LONG_PAIR (offset >> 31, offset),
__LONG_LONG_PAIR (len >> 31, len));
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/fallocate64.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/fallocate64.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/fallocate64.c Thu Apr 16 00:04:01 2009
@@ -25,7 +25,7 @@
int
__fallocate64_l64 (int fd, int mode, __off64_t offset, __off64_t len)
{
-#ifndef __NR_fallocate
+#ifdef __NR_fallocate
return INLINE_SYSCALL (fallocate, 6, fd, mode,
__LONG_LONG_PAIR ((long int) (offset >> 32),
(long int) offset),
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/getsysstats.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/getsysstats.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/getsysstats.c Thu Apr 16 00:04:01 2009
@@ -93,15 +93,42 @@
return NULL;
*re += n;
+
+ nl = memchr (*cp, '\n', *re - *cp);
+ while (nl == NULL && *re == buffer_end)
+ {
+ /* Truncate too long lines. */
+ *re = buffer + 3 * (buffer_end - buffer) / 4;
+ n = read_not_cancel (fd, *re, buffer_end - *re);
+ if (n < 0)
+ return NULL;
+
+ nl = memchr (*re, '\n', n);
+ **re = '\n';
+ *re += n;
+ }
}
+ else
+ nl = memchr (*cp, '\n', *re - *cp);
res = *cp;
- nl = memchr (*cp, '\n', *re - *cp);
}
if (nl == NULL)
nl = *re - 1;
}
+ else if (nl + 5 >= *re)
+ {
+ memmove (buffer, nl, *re - nl);
+ *re = buffer + (*re - nl);
+ nl = *cp = buffer;
+
+ ssize_t n = read_not_cancel (fd, *re, buffer_end - *re);
+ if (n < 0)
+ return NULL;
+
+ *re += n;
+ }
*cp = nl + 1;
assert (*cp <= *re);
@@ -115,8 +142,9 @@
{
/* XXX Here will come a test for the new system call. */
- char buffer[8192];
- char *const buffer_end = buffer + sizeof (buffer);
+ const size_t buffer_size = __libc_use_alloca (8192) ? 8192 : 512;
+ char *buffer = alloca (buffer_size);
+ char *buffer_end = buffer + buffer_size;
char *cp = buffer_end;
char *re = buffer_end;
int result = 1;
@@ -134,7 +162,11 @@
char *l;
while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL)
- if (strncmp (l, "cpu", 3) == 0 && isdigit (l[3]))
+ /* The current format of /proc/stat has all the cpu* entries
+ at the front. We assume here that stays this way. */
+ if (strncmp (l, "cpu", 3) != 0)
+ break;
+ else if (isdigit (l[3]))
++result;
close_not_cancel_no_status (fd);
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/wordsize-64/fallocate.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/wordsize-64/fallocate.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/wordsize-64/fallocate.c Thu Apr 16 00:04:01 2009
@@ -25,6 +25,11 @@
int
fallocate (int fd, int mode, __off_t offset, __off_t len)
{
+#ifdef __NR_fallocate
return INLINE_SYSCALL (fallocate, 4, fd, mode, offset, len);
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
}
strong_alias (fallocate, fallocate64)