Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 149299 Details for
Bug 226997
udevd read buffer too small.
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch sent to linux-hotplug-devel@lists.sourceforge.net
udev.patch (text/plain), 1.94 KB, created by
George Beshers
on 2007-03-05 22:27:26 UTC
(
hide
)
Description:
Patch sent to linux-hotplug-devel@lists.sourceforge.net
Filename:
MIME Type:
Creator:
George Beshers
Created:
2007-03-05 22:27:26 UTC
Size:
1.94 KB
patch
obsolete
>This came up on a system with 1024cores (well 768cpus and 256 >hyper-threads) where the buffer size for reading /proc/stat was >not large enough causing udev to fail during the boot process. >The read_proc_stat(void) eliminates this problem. > > >--- udev-105/udevd.c 2007-02-02 19:24:48.000000000 -0500 >+++ udev-105.new/udevd.c 2007-02-19 13:47:54.000000000 -0500 >@@ -357,25 +357,58 @@ > return memsize / 1024; > } > >-static int cpu_count(void) >+/* >+ * Use the same buffer for cpu_count() and running_processes() >+ */ >+ >+static char* stat_buf = NULL; >+static int stat_buf_size = 4096; >+ >+static int read_proc_stat(void) > { > int f; >- char buf[32768]; > int len; >- const char *pos; >- int count = 0; > >- f = open("/proc/stat", O_RDONLY); >- if (f == -1) >- return -1; >+ if (stat_buf == NULL) { >+ stat_buf = malloc(stat_buf_size); >+ if (stat_buf == NULL) >+ return -1; >+ } > >- len = read(f, buf, sizeof(buf)-1); >+ do { >+ f = open("/proc/stat", O_RDONLY); >+ if (f == -1) >+ return -1; >+ >+ len = read(f, stat_buf, stat_buf_size-1); >+ if (len < stat_buf_size-1) >+ break; >+ >+ stat_buf_size *= 2; >+ stat_buf = realloc(stat_buf, stat_buf_size); >+ if (stat_buf == NULL) >+ return -1; >+ } while (1); > close(f); >+ > if (len <= 0) > return -1; >- buf[len] = '\0'; >+ stat_buf[len] = '\0'; >+ return len; >+} >+ > >- pos = strstr(buf, "cpu"); >+static int cpu_count(void) >+{ >+ int len; >+ const char *pos; >+ int count = 0; >+ >+ len = read_proc_stat(); >+ if (len <= 0) >+ return -1; >+ >+ pos = strstr(stat_buf, "cpu"); > if (pos == NULL) > return -1; > >@@ -392,23 +425,15 @@ > > static int running_processes(void) > { >- int f; >- char buf[32768]; > int len; > int running; > const char *pos; > >- f = open("/proc/stat", O_RDONLY); >- if (f == -1) >- return -1; >- >- len = read(f, buf, sizeof(buf)-1); >- close(f); >+ len = read_proc_stat(); > if (len <= 0) > return -1; >- buf[len] = '\0'; > >- pos = strstr(buf, "procs_running "); >+ pos = strstr(stat_buf, "procs_running "); > if (pos == NULL) > return -1; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 226997
:
149299
|
153906
|
154301
|
156355