2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
14 /* Include afs installation dir retrieval routines */
15 #include <afs/dirpath.h>
17 /* These macros are return values from extractAddr. They do not represent
18 * any valid IP address and so can indicate a failure.
20 #define AFS_IPINVALID 0xffffffff /* invalid IP address */
21 #define AFS_IPINVALIDIGNORE 0xfffffffe /* no input given to extractAddr */
26 #include <sys/types.h>
27 #include <sys/socket.h>
28 #include <netinet/in.h>
29 #include <arpa/inet.h> /* for inet_ntoa() */
37 extern int mrafsStyleLogs;
39 extern int serverLogSyslog;
40 extern int serverLogSyslogFacility;
41 extern char *serverLogSyslogTag;
43 extern void vFSLog(const char *format, va_list args);
44 extern void SetLogThreadNumProgram(int (*func) (void) );
46 /*@printflike@*/ extern void FSLog(const char *format, ...);
47 #define ViceLog(level, str) do { if ((level) <= LogLevel) (FSLog str); } while (0)
48 #define vViceLog(level, str) do { if ((level) <= LogLevel) (vFSLog str); } while (0)
50 extern int OpenLog(const char *filename);
51 extern int ReOpenLog(const char *fileName);
52 extern void SetupLogSignals(void);
55 afs_vsnprintf( /*@out@ */ char *p, size_t avail, const char *fmt,
57 /*@requires maxSet(p) >= (avail-1)@ */
60 extern /*@printflike@ */ int
61 afs_snprintf( /*@out@ */ char *p, size_t avail,
63 /*@requires maxSet(p) >= (avail-1)@ */
67 afs_vasnprintf (char **ret, size_t max_sz, const char *format, va_list args);
70 afs_vasprintf (char **ret, const char *format, va_list args);
73 afs_asprintf (char **ret, const char *format, ...);
76 afs_asnprintf (char **ret, size_t max_sz, const char *format, ...);
78 /* special version of ctime that clobbers a *different static variable, so
79 * that ViceLog can call ctime and not cause buffer confusion.
81 extern char *vctime(const time_t * atime);
83 /* Need a thead safe ctime for pthread builds. Use std ctime for LWP */
84 #if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
85 #if defined(AFS_SUN5_ENV) && !defined(_POSIX_PTHREAD_SEMANTICS) && (_POSIX_C_SOURCE - 0 < 199506L)
86 #define afs_ctime(C, B, L) ctime_r(C, B, L)
88 /* Cast is for platforms which do not prototype ctime_r */
89 #define afs_ctime(C, B, L) (char*)ctime_r(C, B)
90 #endif /* AFS_SUN5_ENV */
91 #else /* AFS_PTHREAD_ENV && !AFS_NT40_ENV */
92 #define afs_ctime(C, B, S) \
93 ((void)strncpy(B, ctime(C), (S-1)), (B)[S-1] = '\0', (B))
94 #endif /* AFS_PTHREAD_ENV && !AFS_NT40_ENV */
97 /* abort the current process. */
99 #define afs_abort() afs_NTAbort()
101 #define afs_abort() abort()
107 #include <winsock2.h>
108 #endif /* _MFC_VER */
110 /* Initialize the windows sockets before calling networking routines. */
111 extern int afs_winsockInit(void);
112 extern void afs_winsockCleanup(void);
115 int tz_minuteswest; /* of Greenwich */
116 int tz_dsttime; /* type of dst correction to apply */
118 #define gettimeofday afs_gettimeofday
119 int afs_gettimeofday(struct timeval *tv, struct timezone *tz);
121 /* Unbuffer output when Un*x would do line buffering. */
122 #define setlinebuf(S) setvbuf(S, NULL, _IONBF, 0)
124 /* regular expression parser for NT */
125 extern char *re_comp(char *sp);
126 extern int rc_exec(char *p);
128 /* Abort on error, possibly trapping to debugger or dumping a trace. */
129 void afs_NTAbort(void);
130 #endif /* AFS_NT40_ENV */
132 typedef char b32_string_t[8];
133 /* b64_string_t is 8 bytes, in stds.h */
134 typedef char lb64_string_t[12];
137 extern size_t strlcat(char *dst, const char *src, size_t siz);
141 extern size_t strlcpy(char *dst, const char *src, size_t siz);
145 #include "afs/ktime.h"
147 #include "afsutil_prototypes.h"
149 #endif /* _AFSUTIL_H_ */