Remove unused localedata/th_TH.in
[glibc.git] / sysdeps / pthread / tst-mutex11.c
blobfdaf17884fb24e628557421c2668aed62c72186b
1 /* Test unsupported/bad clocks passed to pthread_mutex_clocklock.
3 Copyright (C) 2019-2023 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
20 #include <errno.h>
21 #include <pthread.h>
22 #include <stdio.h>
23 #include <time.h>
24 #include <unistd.h>
25 #include <support/check.h>
27 static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
29 static void test_bad_clockid (clockid_t clockid)
31 const struct timespec ts = {0,0};
32 TEST_COMPARE (pthread_mutex_clocklock (&mut, clockid, &ts), EINVAL);
35 #define NOT_A_VALID_CLOCK 123456
37 static int
38 do_test (void)
40 /* These clocks are meaningless to pthread_mutex_clocklock. */
41 #if defined(CLOCK_PROCESS_CPUTIME_ID)
42 test_bad_clockid (CLOCK_PROCESS_CPUTIME_ID);
43 #endif
44 #if defined(CLOCK_THREAD_CPUTIME_ID)
45 test_bad_clockid (CLOCK_PROCESS_CPUTIME_ID);
46 #endif
48 /* These clocks might be meaningful, but are currently unsupported by
49 pthread_mutex_clocklock. */
50 #if defined(CLOCK_REALTIME_COARSE)
51 test_bad_clockid (CLOCK_REALTIME_COARSE);
52 #endif
53 #if defined(CLOCK_MONOTONIC_RAW)
54 test_bad_clockid (CLOCK_MONOTONIC_RAW);
55 #endif
56 #if defined(CLOCK_MONOTONIC_COARSE)
57 test_bad_clockid (CLOCK_MONOTONIC_COARSE);
58 #endif
59 #if defined(CLOCK_BOOTTIME)
60 test_bad_clockid (CLOCK_BOOTTIME);
61 #endif
63 /* This is a completely invalid clock. */
64 test_bad_clockid (NOT_A_VALID_CLOCK);
66 return 0;
69 #include <support/test-driver.c>