FreeBSD Bugzilla – Attachment 185290 Details for
Bug 221420
[patch] Allow sysctl debug.ncores to be greater than 10
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch made fron svn/head
unlimited-ncores.patch (text/plain), 2.40 KB, created by
Gautier DI FOLCO
on 2017-08-11 14:17:19 UTC
(
hide
)
Description:
Patch made fron svn/head
Filename:
MIME Type:
Creator:
Gautier DI FOLCO
Created:
2017-08-11 14:17:19 UTC
Size:
2.40 KB
patch
obsolete
>Index: sys/kern/kern_sig.c >=================================================================== >--- sys/kern/kern_sig.c (revision 322394) >+++ sys/kern/kern_sig.c (working copy) >@@ -90,6 +90,7 @@ > #include <machine/cpu.h> > > #include <security/audit/audit.h> >+#include <sys/libkern.h> > > #define ONSIG 32 /* NSIG for osig* syscalls. XXX. */ > >@@ -3205,36 +3206,14 @@ > } > > /* >- * We only have 1 character for the core count in the format >- * string, so the range will be 0-9 >+ * We limit the number of core files > */ >-#define MAX_NUM_CORE_FILES 10 > #ifndef NUM_CORE_FILES > #define NUM_CORE_FILES 5 > #endif >-CTASSERT(NUM_CORE_FILES >= 0 && NUM_CORE_FILES <= MAX_NUM_CORE_FILES); >-static int num_cores = NUM_CORE_FILES; >+static unsigned int num_cores = NUM_CORE_FILES; >+SYSCTL_UINT(_debug, OID_AUTO, ncores, CTLFLAG_RW, &num_cores, 0, ""); > >-static int >-sysctl_debug_num_cores_check (SYSCTL_HANDLER_ARGS) >-{ >- int error; >- int new_val; >- >- new_val = num_cores; >- error = sysctl_handle_int(oidp, &new_val, 0, req); >- if (error != 0 || req->newptr == NULL) >- return (error); >- if (new_val > MAX_NUM_CORE_FILES) >- new_val = MAX_NUM_CORE_FILES; >- if (new_val < 0) >- new_val = 0; >- num_cores = new_val; >- return (0); >-} >-SYSCTL_PROC(_debug, OID_AUTO, ncores, CTLTYPE_INT|CTLFLAG_RW, >- 0, sizeof(int), sysctl_debug_num_cores_check, "I", ""); >- > #define GZ_SUFFIX ".gz" > > #ifdef GZIO >@@ -3293,7 +3272,8 @@ > struct sbuf sb; > const char *format; > char *hostname, *name; >- int indexpos, i, error, cmode, flags, oflags; >+ int error, cmode, flags, oflags; >+ unsigned int i, j, indexpos, endnamelen, slotthreshold, remainder; > > hostname = NULL; > format = corefilename; >@@ -3368,9 +3348,26 @@ > * non-existing core file name to use. > */ > if (indexpos != -1) { >+ slotthreshold = 10; >+ endnamelen = strlen(name + indexpos) + 1; > for (i = 0; i < num_cores; i++) { >+ if (i >= slotthreshold) { >+ if (indexpos + 2 + endnamelen > MAXPATHLEN) { >+ error = 1; >+ goto out; >+ } >+ >+ memmove(name + indexpos + 1, name + indexpos, endnamelen); >+ indexpos++; >+ slotthreshold *= 10; >+ } >+ remainder = i; >+ for (j = 0; remainder; ++j) { >+ name[indexpos - j] = '0' + (remainder % 10); >+ remainder /= 10; >+ } >+ > flags = O_CREAT | O_EXCL | FWRITE | O_NOFOLLOW; >- name[indexpos] = '0' + i; > NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, td); > error = vn_open_cred(&nd, &flags, cmode, oflags, > td->td_ucred, NULL);
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 221420
: 185290 |
185291