From: Ronnie Sahlberg Date: Fri, 12 Apr 2013 13:12:58 +0000 (-0700) Subject: AROS: it is called IoctlSocket/CloseSocket and WaitSelect on AROS. X-Git-Tag: upstream/1.9.6^2~230 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2cdf4fcb07a2d4ec0fbeb66096afd9e8f9cd03a1;p=deb_libnfs.git AROS: it is called IoctlSocket/CloseSocket and WaitSelect on AROS. Additionally add a aros_init_socket() function to open the bsd socket library and set up networking --- diff --git a/aros/aros_compat.c b/aros/aros_compat.c index 7f46a46..202f614 100644 --- a/aros/aros_compat.c +++ b/aros/aros_compat.c @@ -17,6 +17,9 @@ #ifdef AROS +#include +#include +#include #include #include #include "aros_compat.h" @@ -33,6 +36,16 @@ int minor(int i) return 2; } +struct Library * SocketBase = NULL; + +void aros_init_socket(void) +{ + if (!(SocketBase = OpenLibrary("bsdsocket.library", 4))) { + printf("No TCP/IP stack available.\n"); + exit(10); + } +} + int aros_poll(struct pollfd *fds, unsigned int nfds, int timo) { struct timeval timeout, *toptr; @@ -72,7 +85,7 @@ int aros_poll(struct pollfd *fds, unsigned int nfds, int timo) timeout.tv_usec = (timo - timeout.tv_sec * 1000) * 1000; } - rc = select(0, ip, op, &efds, toptr); + rc = WaitSelect(0, ip, op, &efds, toptr, NULL); if(rc <= 0) return rc; diff --git a/aros/aros_compat.h b/aros/aros_compat.h index 9568299..d5b2d73 100644 --- a/aros/aros_compat.h +++ b/aros/aros_compat.h @@ -4,8 +4,15 @@ #include #include #include +#include #define statvfs statfs +#define ioctl IoctlSocket +#define close CloseSocket + +extern struct Library * SocketBase; + +void aros_init_socket(void); #define f_flag f_flags #define f_favail f_ffree diff --git a/examples/nfsclient-listservers.c b/examples/nfsclient-listservers.c index c4fc41e..9bec6a7 100644 --- a/examples/nfsclient-listservers.c +++ b/examples/nfsclient-listservers.c @@ -23,12 +23,19 @@ #include "libnfs-zdr.h" #include "libnfs.h" +#ifdef AROS +#include "aros_compat.h" +#endif int main(int argc _U_, char *argv[] _U_) { struct nfs_server_list *srvrs; struct nfs_server_list *srv; +#ifdef AROS + aros_init_socket(); +#endif + srvrs = nfs_find_local_servers(); for (srv=srvrs; srv; srv = srv->next) { printf("NFS SERVER @ %s\n", srv->addr); diff --git a/lib/init.c b/lib/init.c index 06f6e4b..80368c2 100644 --- a/lib/init.c +++ b/lib/init.c @@ -32,6 +32,10 @@ #include "libnfs-raw.h" #include "libnfs-private.h" +#ifdef AROS +#include "aros_compat.h" +#endif + struct rpc_context *rpc_init_context(void) { struct rpc_context *rpc;