]> git.saurik.com Git - apple/libc.git/blob - pthreads/mk_pthread_impl.c
adc56705935dec0bd02caea56bd9ed449b2f4605
[apple/libc.git] / pthreads / mk_pthread_impl.c
1 /*
2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * Copyright 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991
27 * All Rights Reserved
28 *
29 * Permission to use, copy, modify, and distribute this software and
30 * its documentation for any purpose and without fee is hereby granted,
31 * provided that the above copyright notice appears in all copies and
32 * that both the copyright notice and this permission notice appear in
33 * supporting documentation.
34 *
35 * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
36 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
37 * FOR A PARTICULAR PURPOSE.
38 *
39 * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
40 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
41 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
42 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
43 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
44 *
45 */
46 /*
47 * MkLinux
48 */
49
50 /*
51 * This program will generate the stuff necessary to "publish" the POSIX
52 * header <pthread.h> in a machine dependent fashion.
53 */
54
55 #include <pthread_internals.h>
56 #include <stdio.h>
57
58 int
59 main(void)
60 {
61 printf("#ifndef _PTHREAD_IMPL_H_\n");
62 printf("#define _PTHREAD_IMPL_H_\n");
63 printf("/*\n");
64 printf(" * Internal implementation details\n");
65 printf(" */\n");
66 printf("\n");
67 printf("#define __PTHREAD_SIZE__ %ld\n", (long) sizeof(struct _pthread)-sizeof(long));
68 printf("#define __PTHREAD_ATTR_SIZE__ %ld\n", (long) sizeof(pthread_attr_t)-sizeof(long));
69 printf("#define __PTHREAD_MUTEXATTR_SIZE__ %ld\n", (long) sizeof(pthread_mutexattr_t)-sizeof(long));
70 printf("#define __PTHREAD_MUTEX_SIZE__ %ld\n", (long) sizeof(pthread_mutex_t)-sizeof(long));
71 printf("#define __PTHREAD_CONDATTR_SIZE__ %ld\n", (long) sizeof(pthread_condattr_t)-sizeof(long));
72 printf("#define __PTHREAD_COND_SIZE__ %ld\n", (long) sizeof(pthread_cond_t)-sizeof(long));
73 printf("#define __PTHREAD_ONCE_SIZE__ %ld\n", (long) sizeof(pthread_once_t)-sizeof(long));
74 printf("/*\n");
75 printf(" * [Internal] data structure signatures\n");
76 printf(" */\n");
77 printf("#define _PTHREAD_MUTEX_SIG_init 0x%08X\n", _PTHREAD_MUTEX_SIG_init);
78 printf("#define _PTHREAD_COND_SIG_init 0x%08X\n", _PTHREAD_COND_SIG_init);
79 printf("#define _PTHREAD_ONCE_SIG_init 0x%08X\n", _PTHREAD_ONCE_SIG_init);
80 printf("/*\n");
81 printf(" * POSIX scheduling policies \n");
82 printf(" */\n");
83 printf("#define SCHED_OTHER %d\n", SCHED_OTHER);
84 printf("#define SCHED_FIFO %d\n", SCHED_FIFO);
85 printf("#define SCHED_RR %d\n", SCHED_RR);
86 printf("\n");
87 printf("#define __SCHED_PARAM_SIZE__ %ld\n", (long) sizeof(struct sched_param)-sizeof(int));
88 printf("\n");
89 printf("#endif _PTHREAD_IMPL_H_\n");
90
91 exit(0);
92 }