Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stress-pthread.c fails to compile with recent glibc versions #136

Closed
jbastian opened this issue Jul 19, 2021 · 4 comments
Closed

stress-pthread.c fails to compile with recent glibc versions #136

jbastian opened this issue Jul 19, 2021 · 4 comments

Comments

@jbastian
Copy link

jbastian commented Jul 19, 2021

A recent glibc commit changed the definition of PTHREAD_STACK_MIN:

http://sourceware.org/git/?p=glibc.git;a=commit;h=aaacde11f2e814814fdd19dfb683e76f1dede4d5

And now stress-pthread.c fails to compile on Fedora Rawhide with glibc-2.33.9000-43.fc35. gcc gives an error message:

CC stress-pthread.c
In file included from /usr/include/bits/local_lim.h:81,
                from /usr/include/bits/posix1_lim.h:161,
                from /usr/include/dirent.h:233,
                from stress-ng.h:50,
                from stress-pthread.c:25:
stress-pthread.c: In function ‘stress_pthread’:
stress-pthread.c:403:26: error: missing binary operator before token "("
403 | #if DEFAULT_STACK_MIN == PTHREAD_STACK_MIN
    |                          ^~~~~~~~~~~~~~~~~

stress-ng will need to be updated for the new definition of PTHREAD_STACK_MIN.

More info:

https://gitlab.com/cki-project/kernel-tests/-/issues/613

@codonell
Copy link

Using STRESS_MAXIMUM in all cases seems like the right way forward e.g.

 #if defined(HAVE_PTHREAD_ATTR_SETSTACK)
-#if DEFAULT_STACK_MIN == PTHREAD_STACK_MIN
-       const size_t stack_size = PTHREAD_STACK_MIN;
-#else
        const size_t stack_size = STRESS_MAXIMUM(DEFAULT_STACK_MIN, PTHREAD_STACK_MIN);
-#endif
 #endif

This allows the value to be non-constant and determined dynamically by the kernel at runtime depending on the hardware.

@ColinIanKing
Copy link
Owner

I've pushed a change that adds a pthread stack size helper. Please pull this change and see if it helps.

@jbastian
Copy link
Author

jbastian commented Jul 19, 2021

Commit f839de2 allowed stress-pthread.c to compile cleanly with glibc-2.33.9000-43.fc35. Thanks for the quick fix!

Side note: I ran into a new issue with stress-prctl.c so I had to disable it temporarily.

CC stress-prctl.c
stress-prctl.c: In function ‘stress_prctl_child’:
stress-prctl.c:791:66: error: ‘PIDTYPE_PID’ undeclared (first use in this function)
  791 |            ret = prctl(PR_SCHED_CORE, PR_SCHED_CORE_GET, 0, PIDTYPE_PID, &cookie);
      |                                                             ^~~~~~~~~~~

stress-prctl.c:791:66: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [Makefile:391: stress-prctl.o] Error 1
make[1]: Leaving directory '/root/stress-ng'
make: *** [Makefile:375: all] Error 2

@jbastian
Copy link
Author

jbastian commented Jul 19, 2021

Side note: I ran into a new issue with stress-prctl.c so I had to disable it temporarily.

See issue #137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants