#define __AFS_SYSINCLUDESH__ 1
#include <stdio.h>
+#if !defined(AFS_USR_DARWIN_ENV) && !defined(AFS_USR_FBSD_ENV) /* must be included after KERNEL undef'd */
#include <errno.h>
+#endif
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define FREAD 0x0001
#endif /* AFS_USR_LINUX22_ENV */
-/* this is necessary for client programs as well as the library itself */
-#if defined(AFS_LINUX22_ENV) || defined(AFS_USR_LINUX22_ENV)
+#if defined(AFS_USR_DARWIN_ENV) || defined(AFS_USR_FBSD_ENV)
+#ifdef KERNEL
+#undef KERNEL
+#define AFS_USR_UNDEF_KERNEL_ENV 1
+#endif
+#include <errno.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/fcntl.h>
+#include <sys/uio.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <arpa/inet.h>
+#ifndef O_SYNC
+#define O_SYNC O_FSYNC
+#endif
+#endif /* AFS_USR_DARWIN_ENV || AFS_USR_FBSD_ENV */
+
+#ifdef AFS_AFSDB_ENV
+#include <arpa/nameser.h>
+#include <resolv.h>
+#endif /* AFS_AFSDB_ENV */
+
+/* glibc 2.2 has pthread_attr_setstacksize */
+#if defined(AFS_LINUX22_ENV) || defined(AFS_USR_LINUX22_ENV) && (__GLIBC_MINOR__ < 2)
#define pthread_attr_setstacksize(a,b) 0
#endif
#undef socket
#endif /* AFS_USR_SGI_ENV */
+#if defined(AFS_USR_DARWIN_ENV) || defined(AFS_USR_FBSD_ENV)
+#undef if_mtu
+#undef if_metric
+#endif
+
#define mount usr_mount
#define fs usr_fs
#define uio usr_uio
#define EXCL usr_EXCL
#define NONEXCL usr_NONEXCL
#define uio_rw usr_uio_rw
+#ifdef ino_t
+#undef ino_t
+#endif
#define ino_t usr_ino_t
#define offset_t usr_offset_t
#define getpid() usr_getpid()
#define setpag(A,B,C,D) usr_setpag((A),(B),(C),(D))
+#ifdef pid_t
+#undef pid_t
+#endif
#define pid_t int
enum usr_vcexcl { usr_NONEXCL, usr_EXCL };
#define usr_cond_signal(A) assert(pthread_cond_signal(A) == 0)
#define usr_cond_broadcast(A) assert(pthread_cond_broadcast(A) == 0)
#define usr_cond_wait(A,B) pthread_cond_wait(A,B)
+#define usr_cond_timedwait(A,B,C) pthread_cond_timedwait(A,B,C)
+
#define usr_thread_create(A,B,C) \
do { \
pthread_attr_t attr; \
struct usr_ucred {
unsigned long cr_ref;
long cr_uid;
+#if !defined(AFS_USR_FBSD_ENV) && !defined(AFS_USR_DARWIN60_ENV)
long cr_gid;
+#endif
long cr_ruid;
long cr_rgid;
long cr_suid;
#define u_rval1 u_r.r_val1
#define u (*(get_user_struct()))
-extern struct usr_user *get_user_struct();
+extern struct usr_user *get_user_struct(void);
#define USR_DIRSIZE 2048
extern unsigned short usr_rx_port;
+#define AFS_LOOKUP_NOEVAL 1
+
#endif /* __AFS_SYSINCLUDESH__ so idempotent */