summaryrefslogtreecommitdiffstats
path: root/src/util/support/init-addrinfo.c
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2004-11-15 22:16:02 +0000
committerKen Raeburn <raeburn@mit.edu>2004-11-15 22:16:02 +0000
commit21b23db6f1226e9cbcc89703369f8a48de5eabd5 (patch)
treeb71ac821f5aec51d4522b5508138e0219d461716 /src/util/support/init-addrinfo.c
parent7e47f7162cb6fe83e269e9ddc3602b2869a46c90 (diff)
downloadkrb5-21b23db6f1226e9cbcc89703369f8a48de5eabd5.tar.gz
krb5-21b23db6f1226e9cbcc89703369f8a48de5eabd5.tar.xz
krb5-21b23db6f1226e9cbcc89703369f8a48de5eabd5.zip
Make static linking not require -lsocket, -lnsl, etc.
Don't duplicate macro definitions. Header files and comments still need some cleanup. * cache-addrinfo.h, init-addrinfo.c: New files, split out from fake-addrinfo.c. * fake-addrinfo.c: Include cache-addrinfo.h. (FAI_CACHE, struct face, struct fac): Moved to cache-addrinfo.h. (krb5int_fac, krb5int_init_fac, krb5int_fini_fac): Moved to init-addrinfo.c. (addrinfo, struct addrinfo): Don't define. (AI_* and NI_* and EAI_* macros): Don't define. * threads.c: Include cache-addrinfo.h. (krb5int_init_fac, krb5int_fini_fac): Don't declare. * Makefile.in (SRCS, STLIBOBJS, LIBOBJS): Updated. ticket: 2761 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16867 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/support/init-addrinfo.c')
-rw-r--r--src/util/support/init-addrinfo.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/util/support/init-addrinfo.c b/src/util/support/init-addrinfo.c
new file mode 100644
index 000000000..4c94dc743
--- /dev/null
+++ b/src/util/support/init-addrinfo.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2004 by the Massachusetts Institute of Technology,
+ * Cambridge, MA, USA. All Rights Reserved.
+ *
+ * This software is being provided to you, the LICENSEE, by the
+ * Massachusetts Institute of Technology (M.I.T.) under the following
+ * license. By obtaining, using and/or copying this software, you agree
+ * that you have read, understood, and will comply with these terms and
+ * conditions:
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute
+ * this software and its documentation for any purpose and without fee or
+ * royalty is hereby granted, provided that you agree to comply with the
+ * following copyright notice and statements, including the disclaimer, and
+ * that the same appear on ALL copies of the software and documentation,
+ * including modifications that you make for internal use or for
+ * distribution:
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS
+ * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not
+ * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF
+ * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
+ * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
+ * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+ *
+ * The name of the Massachusetts Institute of Technology or M.I.T. may NOT
+ * be used in advertising or publicity pertaining to distribution of the
+ * software. Title to copyright in this software and any associated
+ * documentation shall at all times remain with M.I.T., and USER agrees to
+ * preserve same.
+ *
+ * Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ */
+
+/* Stuff that needs initialization for fake-addrinfo.c.
+
+ Separated out, so that static linking against this library doesn't
+ require pulling in socket/nsl/whatever libraries for code not using
+ getaddrinfo. */
+
+#include "port-sockets.h"
+#include "socket-utils.h"
+#include "k5-platform.h"
+#include "k5-thread.h"
+
+#include <stdio.h> /* for sprintf */
+#include <errno.h>
+
+#define IMPLEMENT_FAKE_GETADDRINFO
+#include "fake-addrinfo.h"
+#include "cache-addrinfo.h"
+
+struct fac krb5int_fac = { K5_MUTEX_PARTIAL_INITIALIZER, 0 };
+
+int krb5int_init_fac (void)
+{
+ return k5_mutex_finish_init(&krb5int_fac.lock);
+}
+
+void krb5int_fini_fac (void)
+{
+ k5_mutex_destroy(&krb5int_fac.lock);
+}