Module Name:    src
Committed By:   christos
Date:           Sat Apr  5 18:42:32 UTC 2014

Modified Files:
        src/sys/miscfs/procfs: procfs.h procfs_linux.c

Log Message:
On my 24 proc box I got ENOSPC, so make the routine return the size it wants
and try again.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/miscfs/procfs/procfs.h
cvs rdiff -u -r1.66 -r1.67 src/sys/miscfs/procfs/procfs_linux.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/miscfs/procfs/procfs.h
diff -u src/sys/miscfs/procfs/procfs.h:1.68 src/sys/miscfs/procfs/procfs.h:1.69
--- src/sys/miscfs/procfs/procfs.h:1.68	Mon May 28 09:16:10 2012
+++ src/sys/miscfs/procfs/procfs.h	Sat Apr  5 14:42:32 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs.h,v 1.68 2012/05/28 13:16:10 christos Exp $	*/
+/*	$NetBSD: procfs.h,v 1.69 2014/04/05 18:42:32 christos Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -245,7 +245,7 @@ int procfs_validmap(struct lwp *, struct
 
 int procfs_rw(void *);
 
-int procfs_getcpuinfstr(char *, int *);
+int procfs_getcpuinfstr(char *, size_t *);
 
 #define PROCFS_LOCKED	0x01
 #define PROCFS_WANT	0x02

Index: src/sys/miscfs/procfs/procfs_linux.c
diff -u src/sys/miscfs/procfs/procfs_linux.c:1.66 src/sys/miscfs/procfs/procfs_linux.c:1.67
--- src/sys/miscfs/procfs/procfs_linux.c:1.66	Wed Nov 27 12:24:44 2013
+++ src/sys/miscfs/procfs/procfs_linux.c	Sat Apr  5 14:42:32 2014
@@ -1,4 +1,4 @@
-/*      $NetBSD: procfs_linux.c,v 1.66 2013/11/27 17:24:44 christos Exp $      */
+/*      $NetBSD: procfs_linux.c,v 1.67 2014/04/05 18:42:32 christos Exp $      */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.66 2013/11/27 17:24:44 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.67 2014/04/05 18:42:32 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -510,14 +510,15 @@ int
 procfs_docpuinfo(struct lwp *curl, struct proc *p,
     struct pfsnode *pfs, struct uio *uio)
 {
-	int len = LBFSZ;
-	char *bf = malloc(len, M_TEMP, M_WAITOK);
+	size_t len = LBFSZ;
+	char *bf = NULL;
 	int error;
 
-	if (procfs_getcpuinfstr(bf, &len) < 0) {
-		error = ENOSPC;
-		goto done;
-	}
+	do {
+		if (bf)
+			free(bf, M_TEMP);
+		bf = malloc(len, M_TEMP, M_WAITOK);
+	} while (procfs_getcpuinfstr(bf, &len) < 0);
 
 	if (len == 0) {
 		error = 0;

Reply via email to