Added better missing function emulation.
diff --git a/configure b/configure
index 139ff44..4228461 100755
--- a/configure
+++ b/configure
@@ -4555,11 +4555,21 @@
for ac_func in \
_lwp_create \
clone \
+ getnetbyaddr \
+ getnetbyname \
getpagesize \
+ getprotobyname \
+ getprotobynumber \
+ getservbyport \
+ getsockopt \
+ inet_network \
memmove \
rfork \
+ select \
sendmsg \
+ settimeofday \
sigaltstack \
+ statfs \
strcasecmp \
strerror \
strncasecmp \
@@ -4572,12 +4582,12 @@
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4576: checking for $ac_func" >&5
+echo "configure:4586: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4581 "configure"
+#line 4591 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4600,7 +4610,7 @@
; return 0; }
EOF
-if { (eval echo configure:4604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4677,17 +4687,17 @@
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4681: checking for $ac_hdr" >&5
+echo "configure:4691: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4686 "configure"
+#line 4696 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4691: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4701: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4714,12 +4724,12 @@
done
echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:4718: checking whether stat file-mode macros are broken" >&5
+echo "configure:4728: checking whether stat file-mode macros are broken" >&5
if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4723 "configure"
+#line 4733 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -4772,12 +4782,12 @@
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:4776: checking for working const" >&5
+echo "configure:4786: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4781 "configure"
+#line 4791 "configure"
#include "confdefs.h"
int main() {
@@ -4826,7 +4836,7 @@
; return 0; }
EOF
-if { (eval echo configure:4830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -4847,21 +4857,21 @@
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:4851: checking for inline" >&5
+echo "configure:4861: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
-#line 4858 "configure"
+#line 4868 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:4865: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4875: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -4887,12 +4897,12 @@
esac
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:4891: checking for ANSI C header files" >&5
+echo "configure:4901: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4896 "configure"
+#line 4906 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -4900,7 +4910,7 @@
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4904: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4914: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4917,7 +4927,7 @@
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 4921 "configure"
+#line 4931 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -4935,7 +4945,7 @@
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 4939 "configure"
+#line 4949 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -4956,7 +4966,7 @@
:
else
cat > conftest.$ac_ext <<EOF
-#line 4960 "configure"
+#line 4970 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -4967,7 +4977,7 @@
exit (0); }
EOF
-if { (eval echo configure:4971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
:
else
@@ -4991,12 +5001,12 @@
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:4995: checking for size_t" >&5
+echo "configure:5005: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5000 "configure"
+#line 5010 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -5024,7 +5034,7 @@
fi
echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:5028: checking size of long long" >&5
+echo "configure:5038: checking size of long long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5032,7 +5042,7 @@
ac_cv_sizeof_long_long=0
else
cat > conftest.$ac_ext <<EOF
-#line 5036 "configure"
+#line 5046 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -5043,7 +5053,7 @@
exit(0);
}
EOF
-if { (eval echo configure:5047: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long_long=`cat conftestval`
else
@@ -5066,12 +5076,12 @@
if test "$ac_cv_header_linux_joystick_h" = "yes"
then
echo $ac_n "checking "whether linux/joystick.h uses the Linux 2.2+ API"""... $ac_c" 1>&6
-echo "configure:5070: checking "whether linux/joystick.h uses the Linux 2.2+ API"" >&5
+echo "configure:5080: checking "whether linux/joystick.h uses the Linux 2.2+ API"" >&5
if eval "test \"`echo '$''{'wine_cv_linux_joystick_22_api'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5075 "configure"
+#line 5085 "configure"
#include "confdefs.h"
#include <sys/ioctl.h>
@@ -5086,7 +5096,7 @@
/*empty*/
; return 0; }
EOF
-if { (eval echo configure:5090: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5100: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_linux_joystick_22_api=yes
else
@@ -5113,12 +5123,12 @@
if test "$ac_cv_header_sys_vfs_h" = "yes"
then
echo $ac_n "checking "whether sys/vfs.h defines statfs"""... $ac_c" 1>&6
-echo "configure:5117: checking "whether sys/vfs.h defines statfs"" >&5
+echo "configure:5127: checking "whether sys/vfs.h defines statfs"" >&5
if eval "test \"`echo '$''{'wine_cv_sys_vfs_has_statfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5122 "configure"
+#line 5132 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -5135,7 +5145,7 @@
; return 0; }
EOF
-if { (eval echo configure:5139: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5149: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_sys_vfs_has_statfs=yes
else
@@ -5162,12 +5172,12 @@
if test "$ac_cv_header_sys_statfs_h" = "yes"
then
echo $ac_n "checking "whether sys/statfs.h defines statfs"""... $ac_c" 1>&6
-echo "configure:5166: checking "whether sys/statfs.h defines statfs"" >&5
+echo "configure:5176: checking "whether sys/statfs.h defines statfs"" >&5
if eval "test \"`echo '$''{'wine_cv_sys_statfs_has_statfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5171 "configure"
+#line 5181 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -5182,7 +5192,7 @@
; return 0; }
EOF
-if { (eval echo configure:5186: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5196: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_sys_statfs_has_statfs=yes
else
@@ -5209,12 +5219,12 @@
if test "$ac_cv_header_sys_mount_h" = "yes"
then
echo $ac_n "checking "whether sys/mount.h defines statfs"""... $ac_c" 1>&6
-echo "configure:5213: checking "whether sys/mount.h defines statfs"" >&5
+echo "configure:5223: checking "whether sys/mount.h defines statfs"" >&5
if eval "test \"`echo '$''{'wine_cv_sys_mount_has_statfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5218 "configure"
+#line 5228 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -5229,7 +5239,7 @@
; return 0; }
EOF
-if { (eval echo configure:5233: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5243: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_sys_mount_has_statfs=yes
else
@@ -5255,7 +5265,7 @@
echo $ac_n "checking "for statfs.f_bfree"""... $ac_c" 1>&6
-echo "configure:5259: checking "for statfs.f_bfree"" >&5
+echo "configure:5269: checking "for statfs.f_bfree"" >&5
if eval "test \"`echo '$''{'wine_cv_statfs_bfree'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5264,7 +5274,7 @@
wine_cv_statfs_bfree=no
else
cat > conftest.$ac_ext <<EOF
-#line 5268 "configure"
+#line 5278 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -5291,7 +5301,7 @@
; return 0; }
EOF
-if { (eval echo configure:5295: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5305: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_statfs_bfree=yes
else
@@ -5315,7 +5325,7 @@
fi
echo $ac_n "checking "for statfs.f_bavail"""... $ac_c" 1>&6
-echo "configure:5319: checking "for statfs.f_bavail"" >&5
+echo "configure:5329: checking "for statfs.f_bavail"" >&5
if eval "test \"`echo '$''{'wine_cv_statfs_bavail'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5324,7 +5334,7 @@
wine_cv_statfs_bavail=no
else
cat > conftest.$ac_ext <<EOF
-#line 5328 "configure"
+#line 5338 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -5351,7 +5361,7 @@
; return 0; }
EOF
-if { (eval echo configure:5355: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5365: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_statfs_bavail=yes
else
@@ -5376,7 +5386,7 @@
echo $ac_n "checking "for working sigaltstack"""... $ac_c" 1>&6
-echo "configure:5380: checking "for working sigaltstack"" >&5
+echo "configure:5390: checking "for working sigaltstack"" >&5
if eval "test \"`echo '$''{'ac_cv_c_working_sigaltstack'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5385,7 +5395,7 @@
else
cat > conftest.$ac_ext <<EOF
-#line 5389 "configure"
+#line 5399 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -5423,7 +5433,7 @@
}
EOF
-if { (eval echo configure:5427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_c_working_sigaltstack="yes"
else
@@ -5450,12 +5460,12 @@
echo $ac_n "checking "for msg_accrights in struct msghdr"""... $ac_c" 1>&6
-echo "configure:5454: checking "for msg_accrights in struct msghdr"" >&5
+echo "configure:5464: checking "for msg_accrights in struct msghdr"" >&5
if eval "test \"`echo '$''{'ac_cv_c_msg_accrights'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5459 "configure"
+#line 5469 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
@@ -5463,7 +5473,7 @@
struct msghdr hdr; hdr.msg_accrights=0
; return 0; }
EOF
-if { (eval echo configure:5467: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5477: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_msg_accrights="yes"
else
@@ -5486,12 +5496,12 @@
echo $ac_n "checking "whether we need to define __i386__"""... $ac_c" 1>&6
-echo "configure:5490: checking "whether we need to define __i386__"" >&5
+echo "configure:5500: checking "whether we need to define __i386__"" >&5
if eval "test \"`echo '$''{'ac_cv_cpp_def_i386'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5495 "configure"
+#line 5505 "configure"
#include "confdefs.h"
#if (defined(i386) || defined(__i386)) && !defined(__i386__)
yes
diff --git a/configure.in b/configure.in
index 3f05ff1..95ed29f 100644
--- a/configure.in
+++ b/configure.in
@@ -513,11 +513,21 @@
AC_CHECK_FUNCS(\
_lwp_create \
clone \
+ getnetbyaddr \
+ getnetbyname \
getpagesize \
+ getprotobyname \
+ getprotobynumber \
+ getservbyport \
+ getsockopt \
+ inet_network \
memmove \
rfork \
+ select \
sendmsg \
+ settimeofday \
sigaltstack \
+ statfs \
strcasecmp \
strerror \
strncasecmp \
diff --git a/files/drive.c b/files/drive.c
index ef12bb9..26f3b50 100644
--- a/files/drive.c
+++ b/files/drive.c
@@ -41,6 +41,7 @@
#include "heap.h"
#include "msdos.h"
#include "options.h"
+#include "wine/port.h"
#include "task.h"
#include "debugtools.h"
diff --git a/include/config.h.in b/include/config.h.in
index d88778d..b4118f2 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -151,21 +151,51 @@
/* Define if you have the gethostbyname function. */
#undef HAVE_GETHOSTBYNAME
+/* Define if you have the getnetbyaddr function. */
+#undef HAVE_GETNETBYADDR
+
+/* Define if you have the getnetbyname function. */
+#undef HAVE_GETNETBYNAME
+
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
+/* Define if you have the getprotobyname function. */
+#undef HAVE_GETPROTOBYNAME
+
+/* Define if you have the getprotobynumber function. */
+#undef HAVE_GETPROTOBYNUMBER
+
+/* Define if you have the getservbyport function. */
+#undef HAVE_GETSERVBYPORT
+
+/* Define if you have the getsockopt function. */
+#undef HAVE_GETSOCKOPT
+
+/* Define if you have the inet_network function. */
+#undef HAVE_INET_NETWORK
+
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
/* Define if you have the rfork function. */
#undef HAVE_RFORK
+/* Define if you have the select function. */
+#undef HAVE_SELECT
+
/* Define if you have the sendmsg function. */
#undef HAVE_SENDMSG
+/* Define if you have the settimeofday function. */
+#undef HAVE_SETTIMEOFDAY
+
/* Define if you have the sigaltstack function. */
#undef HAVE_SIGALTSTACK
+/* Define if you have the statfs function. */
+#undef HAVE_STATFS
+
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
diff --git a/include/wine/port.h b/include/wine/port.h
new file mode 100644
index 0000000..27de191
--- /dev/null
+++ b/include/wine/port.h
@@ -0,0 +1,108 @@
+/*
+ * Wine porting definitions
+ *
+ */
+
+#ifndef __WINE_WINE_PORT_H
+#define __WINE_WINE_PORT_H
+
+#include "config.h"
+
+#include <sys/types.h>
+#include <sys/time.h>
+
+/* Types */
+
+#if !defined(HAVE_GETNETBYADDR) && !defined(HAVE_GETNETBYNAME)
+struct netent {
+ char *n_name;
+ char **n_aliases;
+ int n_addrtype;
+ unsigned long n_net;
+};
+#endif /* !defined(HAVE_GETNETBYADDR) && !defined(HAVE_GETNETBYNAME) */
+
+#if !defined(HAVE_GETPROTOBYNAME) && !defined(HAVE_GETPROTOBYNUMBER)
+struct protoent {
+ char *p_name;
+ char **p_aliases;
+ int p_proto;
+};
+#endif /* !defined(HAVE_GETPROTOBYNAME) && !defined(HAVE_GETPROTOBYNUMBER) */
+
+#ifndef HAVE_STATFS
+# ifdef __BEOS__
+# define STATFS_HAS_BFREE
+struct statfs {
+ long f_bsize; /* block_size */
+ long f_blocks; /* total_blocks */
+ long f_bfree; /* free_blocks */
+};
+# else /* defined(__BEOS__) */
+struct statfs;
+# endif /* defined(__BEOS__) */
+#endif /* !defined(HAVE_STATFS) */
+
+/* Functions */
+
+#if !defined(HAVE_CLONE) && defined(linux)
+int clone(int (*fn)(void *arg), void *stack, int flags, void *arg);
+#endif /* !defined(HAVE_CLONE) && defined(linux) */
+
+#ifndef HAVE_GETNETBYADDR
+struct netent *getnetbyaddr(unsigned long net, int type);
+#endif /* defined(HAVE_GETNETBYNAME) */
+
+#ifndef HAVE_GETNETBYNAME
+struct netent *getnetbyname(const char *name);
+#endif /* defined(HAVE_GETNETBYNAME) */
+
+#ifndef HAVE_GETPROTOBYNAME
+struct protoent *getprotobyname(const char *name);
+#endif /* !defined(HAVE_GETPROTOBYNAME) */
+
+#ifndef HAVE_GETPROTOBYNUMBER
+struct protoent *getprotobynumber(int proto);
+#endif /* !defined(HAVE_GETPROTOBYNUMBER) */
+
+#ifndef HAVE_GETSERVBYPORT
+struct servent *getservbyport(int port, const char *proto);
+#endif /* !defined(HAVE_GETSERVBYPORT) */
+
+#ifndef HAVE_GETSOCKOPT
+int getsockopt(int socket, int level, int option_name, void *option_value, size_t *option_len);
+#endif /* !defined(HAVE_GETSOCKOPT) */
+
+#ifndef HAVE_MEMMOVE
+void *memmove(void *dest, const void *src, unsigned int len);
+#endif /* !defined(HAVE_MEMMOVE) */
+
+#ifndef HAVE_INET_NETWORK
+unsigned long inet_network(const char *cp);
+#endif /* !defined(HAVE_INET_NETWORK) */
+
+#ifndef HAVE_SETTIMEOFDAY
+int settimeofday(struct timeval *tp, void *reserved);
+#endif /* !defined(HAVE_SETTIMEOFDAY) */
+
+#ifndef HAVE_STATFS
+int statfs(const char *name, struct statfs *info);
+#endif /* !defined(HAVE_STATFS) */
+
+#ifndef HAVE_STRNCASECMP
+int strncasecmp(const char *str1, const char *str2, size_t n);
+#endif /* !defined(HAVE_STRNCASECMP) */
+
+#ifndef HAVE_STRERROR
+const char *strerror(int err);
+#endif /* !defined(HAVE_STRERROR) */
+
+#ifndef HAVE_STRCASECMP
+int strcasecmp(const char *str1, const char *str2);
+#endif /* !defined(HAVE_STRCASECMP) */
+
+#ifndef HAVE_USLEEP
+int usleep (unsigned int useconds);
+#endif /* !defined(HAVE_USLEEP) */
+
+#endif /* !defined(__WINE_WINE_PORT_H) */
diff --git a/misc/port.c b/misc/port.c
index 934d0f8..c03819b 100644
--- a/misc/port.c
+++ b/misc/port.c
@@ -4,8 +4,14 @@
* Copyright 1996 Alexandre Julliard
*/
-#include "config.h"
+#include "wine/port.h"
+#ifdef __BEOS__
+#include <be/kernel/fs_info.h>
+#include <be/kernel/OS.h>
+#endif
+
+#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
@@ -20,13 +26,22 @@
#ifdef HAVE_LIBIO_H
# include <libio.h>
#endif
+#ifdef HAVE_SYSCALL_H
+# include <syscall.h>
+#endif
+/***********************************************************************
+ * usleep
+ */
#ifndef HAVE_USLEEP
-#ifdef __EMX__
-unsigned int usleep (unsigned int useconds) { DosSleep(useconds); }
-#else
unsigned int usleep (unsigned int useconds)
{
+#if defined(__EMX__)
+ DosSleep(useconds);
+ return 0;
+#elif defined(__BEOS__)
+ return snooze(useconds);
+#elif defined(HAVE_SELECT)
struct timeval delay;
delay.tv_sec = 0;
@@ -34,10 +49,16 @@
select( 0, 0, 0, 0, &delay );
return 0;
+#else /* defined(__EMX__) || defined(__BEOS__) || defined(HAVE_SELECT) */
+ errno = ENOSYS;
+ return -1;
+#endif /* defined(__EMX__) || defined(__BEOS__) || defined(HAVE_SELECT) */
}
-#endif
#endif /* HAVE_USLEEP */
+/***********************************************************************
+ * memmove
+ */
#ifndef HAVE_MEMMOVE
void *memmove( void *dest, const void *src, unsigned int len )
{
@@ -63,6 +84,9 @@
}
#endif /* HAVE_MEMMOVE */
+/***********************************************************************
+ * strerror
+ */
#ifndef HAVE_STRERROR
const char *strerror( int err )
{
@@ -71,12 +95,10 @@
}
#endif /* HAVE_STRERROR */
+/***********************************************************************
+ * clone
+ */
#if !defined(HAVE_CLONE) && defined(__linux__)
-#include <assert.h>
-#include <errno.h>
-#ifdef HAVE_SYSCALL_H
-# include <syscall.h>
-#endif
int clone( int (*fn)(void *), void *stack, int flags, void *arg )
{
#ifdef __i386__
@@ -106,7 +128,9 @@
}
#endif /* !HAVE_CLONE && __linux__ */
-
+/***********************************************************************
+ * strcasecmp
+ */
#ifndef HAVE_STRCASECMP
int strcasecmp( const char *str1, const char *str2 )
{
@@ -115,6 +139,9 @@
}
#endif /* HAVE_STRCASECMP */
+/***********************************************************************
+ * strncasecmp
+ */
#ifndef HAVE_STRNCASECMP
int strncasecmp( const char *str1, const char *str2, size_t n )
{
@@ -126,13 +153,16 @@
}
#endif /* HAVE_STRNCASECMP */
-/**
- * It looks like the openpty that comes with glibc in RedHat 5.0
- * is buggy (second call returns what looks like a dup of 0 and 1
- * instead of a new pty), this is a generic replacement.
+/***********************************************************************
+ * wine_openpty
+ * NOTE
+ * It looks like the openpty that comes with glibc in RedHat 5.0
+ * is buggy (second call returns what looks like a dup of 0 and 1
+ * instead of a new pty), this is a generic replacement.
+ *
+ * FIXME
+ * We should have a autoconf check for this.
*/
-/** We will have an autoconf check for this soon... */
-
int wine_openpty(int *master, int *slave, char *name,
struct termios *term, struct winsize *winsize)
{
@@ -170,3 +200,131 @@
return -1;
}
+/***********************************************************************
+ * getnetbyaddr
+ */
+#ifndef HAVE_GETNETBYADDR
+struct netent *getnetbyaddr(unsigned long net, int type)
+{
+ errno = ENOSYS;
+ return NULL;
+}
+#endif /* defined(HAVE_GETNETBYNAME) */
+
+/***********************************************************************
+ * getnetbyname
+ */
+#ifndef HAVE_GETNETBYNAME
+struct netent *getnetbyname(const char *name)
+{
+ errno = ENOSYS;
+ return NULL;
+}
+#endif /* defined(HAVE_GETNETBYNAME) */
+
+/***********************************************************************
+ * getprotobyname
+ */
+#ifndef HAVE_GETPROTOBYNAME
+struct protoent *getprotobyname(const char *name)
+{
+ errno = ENOSYS;
+ return NULL;
+}
+#endif /* !defined(HAVE_GETPROTOBYNAME) */
+
+/***********************************************************************
+ * getprotobynumber
+ */
+#ifndef HAVE_GETPROTOBYNUMBER
+struct protoent *getprotobynumber(int proto)
+{
+ errno = ENOSYS;
+ return NULL;
+}
+#endif /* !defined(HAVE_GETPROTOBYNUMBER) */
+
+/***********************************************************************
+ * getservbyport
+ */
+#ifndef HAVE_GETSERVBYPORT
+struct servent *getservbyport(int port, const char *proto)
+{
+ errno = ENOSYS;
+ return NULL;
+}
+#endif /* !defined(HAVE_GETSERVBYPORT) */
+
+/***********************************************************************
+ * getsockopt
+ */
+#ifndef HAVE_GETSOCKOPT
+int getsockopt(int socket, int level, int option_name,
+ void *option_value, size_t *option_len)
+{
+ errno = ENOSYS;
+ return -1;
+}
+#endif /* !defined(HAVE_GETSOCKOPT) */
+
+/***********************************************************************
+ * inet_network
+ */
+#ifndef HAVE_INET_NETWORK
+unsigned long inet_network(const char *cp)
+{
+ errno = ENOSYS;
+ return 0;
+}
+#endif /* defined(HAVE_INET_NETWORK) */
+
+/***********************************************************************
+ * settimeofday
+ */
+#ifndef HAVE_SETTIMEOFDAY
+int settimeofday(struct timeval *tp, void *reserved)
+{
+ tp->tv_sec = 0;
+ tp->tv_usec = 0;
+
+ errno = ENOSYS;
+ return -1;
+}
+#endif /* HAVE_SETTIMEOFDAY */
+
+/***********************************************************************
+ * statfs
+ */
+#ifndef HAVE_STATFS
+int statfs(const char *name, struct statfs *info)
+{
+#ifdef __BEOS__
+ dev_t mydev;
+ fs_info fsinfo;
+
+ if(!info) {
+ errno = ENOSYS;
+ return -1;
+ }
+
+ if ((mydev = dev_for_path(name)) < 0) {
+ errno = ENOSYS;
+ return -1;
+ }
+
+ if (fs_stat_dev(mydev,&fsinfo) < 0) {
+ errno = ENOSYS;
+ return -1;
+ }
+
+ info->f_bsize = fsinfo.block_size;
+ info->f_blocks = fsinfo.total_blocks;
+ info->f_bfree = fsinfo.free_blocks;
+
+ return 0;
+#else /* defined(__BEOS__) */
+ errno = ENOSYS;
+ return -1;
+#endif /* defined(__BEOS__) */
+}
+#endif /* !defined(HAVE_STATFS) */
diff --git a/misc/winsock.c b/misc/winsock.c
index 8d7d881..b234906 100644
--- a/misc/winsock.c
+++ b/misc/winsock.c
@@ -77,6 +77,7 @@
#include "task.h"
#include "message.h"
#include "miscemu.h"
+#include "wine/port.h"
#include "services.h"
#include "server.h"
#include "debugtools.h"
diff --git a/misc/winsock_async.c b/misc/winsock_async.c
index 17852ae..df88bd7 100644
--- a/misc/winsock_async.c
+++ b/misc/winsock_async.c
@@ -83,6 +83,7 @@
#include "task.h"
#include "message.h"
#include "miscemu.h"
+#include "wine/port.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(winsock)
diff --git a/scheduler/sysdeps.c b/scheduler/sysdeps.c
index c9ea1b0..ab3f6d9 100644
--- a/scheduler/sysdeps.c
+++ b/scheduler/sysdeps.c
@@ -25,6 +25,7 @@
#ifdef HAVE_UCONTEXT_H
# include <ucontext.h>
#endif
+#include "wine/port.h"
#include "thread.h"
#include "server.h"
#include "winbase.h"
@@ -33,14 +34,10 @@
DEFAULT_DEBUG_CHANNEL(thread)
-#ifdef linux
-#define HAVE_CLONE_SYSCALL
-#endif
-
/* Xlib critical section (FIXME: does not belong here) */
CRITICAL_SECTION X11DRV_CritSection = { 0, };
-#ifdef HAVE_CLONE_SYSCALL
+#ifdef linux
# ifdef HAVE_SCHED_H
# include <sched.h>
# endif
@@ -50,10 +47,8 @@
# define CLONE_FILES 0x00000400
# define CLONE_SIGHAND 0x00000800
# define CLONE_PID 0x00001000
-/* If we didn't get the flags, we probably didn't get the prototype either */
-extern int clone( int (*fn)(void *arg), void *stack, int flags, void *arg );
# endif /* CLONE_VM */
-#endif /* HAVE_CLONE_SYSCALL */
+#endif /* linux */
static int init_done;
@@ -155,7 +150,7 @@
{
#ifndef NO_REENTRANT_LIBC
-#ifdef HAVE_CLONE_SYSCALL
+#ifdef linux
if (clone( (int (*)(void *))SYSDEPS_StartThread, teb->stack_top,
CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, teb ) < 0)
return -1;