"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "stress-open.c" between
stress-ng-0.12.09.tar.xz and stress-ng-0.12.10.tar.xz

About: stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces.

stress-open.c  (stress-ng-0.12.09.tar.xz):stress-open.c  (stress-ng-0.12.10.tar.xz)
skipping to change at line 484 skipping to change at line 484
struct stat statbuf; struct stat statbuf;
bool open_fd = false; bool open_fd = false;
/* /*
* 32 bit systems may OOM if we have too many open fds, so * 32 bit systems may OOM if we have too many open fds, so
* try to constrain the max limit as a workaround. * try to constrain the max limit as a workaround.
*/ */
if (sizeof(void *) == 4) if (sizeof(void *) == 4)
max_fds = STRESS_MINIMUM(max_fds, 65536); max_fds = STRESS_MINIMUM(max_fds, 65536);
sz = max_fds * sizeof(int); sz = max_fds * sizeof(*fds);
fds = (int *)mmap(NULL, sz, PROT_READ | PROT_WRITE, fds = (int *)mmap(NULL, sz, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (fds == MAP_FAILED) { if (fds == MAP_FAILED) {
max_fds = STRESS_FD_MAX; max_fds = STRESS_FD_MAX;
sz = max_fds * sizeof(int); sz = max_fds * sizeof(*fds);
fds = (int *)mmap(NULL, sz, PROT_READ | PROT_WRITE, fds = (int *)mmap(NULL, sz, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (fds == MAP_FAILED) { if (fds == MAP_FAILED) {
pr_inf("%s: cannot allocate file descriptors\n", args->na me); pr_inf("%s: cannot allocate file descriptors\n", args->na me);
return EXIT_NO_RESOURCE; return EXIT_NO_RESOURCE;
} }
} }
(void)stress_get_setting("open-fd", &open_fd); (void)stress_get_setting("open-fd", &open_fd);
if (open_fd) { if (open_fd) {
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)