tst-align.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* Copyright (C) 2003 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #include <pthread.h>
  16. #include <stdbool.h>
  17. #include <stdint.h>
  18. #include <stdio.h>
  19. #include "tst-stack-align.h"
  20. static void *
  21. tf (void *arg)
  22. {
  23. bool ok = true;
  24. puts ("in thread");
  25. if (TEST_STACK_ALIGN ())
  26. ok = false;
  27. return ok ? NULL : (void *) -1l;
  28. }
  29. static int
  30. do_test (void)
  31. {
  32. bool ok = true;
  33. puts ("in main");
  34. if (TEST_STACK_ALIGN ())
  35. ok = false;
  36. pthread_t th;
  37. if (pthread_create (&th, NULL, tf, NULL) != 0)
  38. {
  39. puts ("create failed");
  40. return 1;
  41. }
  42. void *res;
  43. if (pthread_join (th, &res) != 0)
  44. {
  45. puts ("join failed");
  46. return 1;
  47. }
  48. if (res != NULL)
  49. ok = false;
  50. return ok ? 0 : 1;
  51. }
  52. #define TEST_FUNCTION do_test ()
  53. #include "../test-skeleton.c"