1 #pragma ident	"%Z%%M%	%I%	%E% SMI"
2 
3 /*
4  * Copyright (C) 2004 by the Massachusetts Institute of Technology,
5  * Cambridge, MA, USA.  All Rights Reserved.
6  *
7  * This software is being provided to you, the LICENSEE, by the
8  * Massachusetts Institute of Technology (M.I.T.) under the following
9  * license.  By obtaining, using and/or copying this software, you agree
10  * that you have read, understood, and will comply with these terms and
11  * conditions:
12  *
13  * Export of this software from the United States of America may
14  * require a specific license from the United States Government.
15  * It is the responsibility of any person or organization contemplating
16  * export to obtain such a license before exporting.
17  *
18  * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute
19  * this software and its documentation for any purpose and without fee or
20  * royalty is hereby granted, provided that you agree to comply with the
21  * following copyright notice and statements, including the disclaimer, and
22  * that the same appear on ALL copies of the software and documentation,
23  * including modifications that you make for internal use or for
24  * distribution:
25  *
26  * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS
27  * OR WARRANTIES, EXPRESS OR IMPLIED.  By way of example, but not
28  * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF
29  * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
30  * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
31  * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
32  *
33  * The name of the Massachusetts Institute of Technology or M.I.T. may NOT
34  * be used in advertising or publicity pertaining to distribution of the
35  * software.  Title to copyright in this software and any associated
36  * documentation shall at all times remain with M.I.T., and USER agrees to
37  * preserve same.
38  *
39  * Furthermore if you modify this software you must label
40  * your software as modified software and not distribute it in such a
41  * fashion that it might be confused with the original M.I.T. software.
42  */
43 
44 #include <fake-addrinfo.h>
45 #include <k5-thread.h>
46 
47 /* Allocate the storage here.  */
48 struct fac krb5int_fac = { K5_MUTEX_PARTIAL_INITIALIZER, 0 };
49 
50 int krb5int_init_fac (void)
51 {
52     return k5_mutex_finish_init(&krb5int_fac.lock);
53 }
54 
55 void krb5int_fini_fac (void)
56 {
57     k5_mutex_destroy(&krb5int_fac.lock);
58 }
59 
60 extern int krb5int_call_thread_support_init(void);
61 int krb5int_lock_fac (void)
62 {
63     int err;
64     err = krb5int_call_thread_support_init();
65     if (err)
66 	return err;
67     return k5_mutex_lock(&krb5int_fac.lock);
68 }
69 
70 int krb5int_unlock_fac (void)
71 {
72     return k5_mutex_unlock(&krb5int_fac.lock);
73 }
74