summaryrefslogtreecommitdiff
path: root/server/unix.h
blob: a7b96f8020b5bfe216c6c5956a63e1d3392d08da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* This file is part of the Project Athena Zephyr Notification System.
 * It contains declarations for many standard UNIX library functions,
 * and macros for aiding in interfacing to them.
 *
 * Created by Ken Raeburn.
 *
 * $Source$
 * $Author$
 * $Zephyr: unix.h,v 1.3 91/01/28 15:12:57 raeburn Exp $
 *
 * Copyright (c) 1990,1991 by the Massachusetts Institute of Technology.
 * For copying and distribution information, see the file
 * "mit-copyright.h".
 */

#include <zephyr/mit-copyright.h>

#ifndef ZSERVER_UNIX_H__

extern "C" {
    /* found in libc.a */
#ifndef __GNUG__
    void *malloc(unsigned), *realloc(void *, unsigned), free (void *);
#endif
    long random(void);
    void srandom (int);
    int getpid (void);

    /*
     * Queue-handling functions.  This structure is basically a dummy;
     * as long as the start of another structure looks like this,
     * we're okay.
     */
    struct qelem {
	struct qelem *q_forw;
	struct qelem *q_back;
	char *q_data;
    };
    void insque (qelem*, qelem*);
    void remque (qelem *);
#ifdef __GNUG__
#if defined (ultrix)
    void openlog (char *, int);
#undef LOG_DEBUG
#define LOG_DEBUG LOG_ERR
#else
    void openlog (char *, int, int); /* ??? */
#endif
#endif /* G++? */
    void syslog (int, const char *, ...);
    int setsockopt (int, int, int, const char *, int);
    extern int strcasecmp (const char*, const char*);
#ifdef __GNUG__
    extern void setservent (int);
    extern void endservent (void);
#endif
    extern void moncontrol (int);

    /* From the Error table library */
    char *error_message(long);

#ifdef KERBEROS
    /* Kerberos */
    extern int krb_get_lrealm (char *, int);
    extern int dest_tkt (void);
    extern int krb_get_svc_in_tkt (char *, char *, char *, char *, char *, int,
				   char *);
#ifdef KRB_DEFS		/* have we actually got krb.h? */
    extern int krb_mk_req (KTEXT, char *, char *, char *, unsigned long);
    extern int krb_get_cred (char *, char *, char *, CREDENTIALS *);
#endif
    extern int krb_rd_req (...);
    extern int des_quad_cksum (...);
#else
    extern int rresvport (...);
#endif

#ifdef HESIOD
    /* Hesiod */
    extern char ** hes_resolve (const char *, const char *);
#endif

    /* hacked acl code */
    extern void acl_cache_reset (void);
}

#ifdef vax
#define HAVE_ALLOCA
#endif

#if defined (__GNUC__) || defined (__GNUG__)

/* GCC/G++ has a built-in function for allocating automatic storage.  */
#define LOCAL_ALLOC(X)	__builtin_alloca(X)
#define LOCAL_FREE(X)

#else /* not gcc or g++ */

#if defined (ibm032)
/*
 * Unfortunately, there's no way to get cfront to access _Alloca.  So
 * we compile with -ma and call alloca.  Sigh.
 */
#define LOCAL_ALLOC(X)	alloca(X)
#define LOCAL_FREE(X)
extern "C" void * alloca (unsigned int);

#else /* none of above */
#ifdef HAVE_ALLOCA
#define LOCAL_ALLOC(X)	alloca(X)
#define LOCAL_FREE(X)
#endif
#endif
#endif

#ifndef LOCAL_ALLOC
#define LOCAL_ALLOC(X)	malloc(X)
#define LOCAL_FREE(X)	free(X)
#endif

/*
 * Miscellaneous casts, so we don't have to insert these all over the
 * source files...
 */

#define	xfree(foo)	free((caddr_t) (foo))
#define	xinsque(a,b)	insque((struct qelem *)(a), (struct qelem *)(b))
#define xremque(a)	remque((struct qelem *)(a))
#define	xmalloc(a)	malloc((unsigned)(a))

#define ZSERVER_UNIX_H__
#endif