ps2ee: PS2 EE support
Initial support for building a library for PS2 EmotionEngine Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>master
parent
f88cca547d
commit
f965ec74cf
1
README
1
README
|
@ -146,6 +146,7 @@ Windows:- tested on Windows 7 64 and Windows XP 32 using Visual Studio 10 (see R
|
||||||
- tested on Windows 7 64 using MingW on Linux to cross-compile (Debian and Ubuntu tested)
|
- tested on Windows 7 64 using MingW on Linux to cross-compile (Debian and Ubuntu tested)
|
||||||
Android:- tested with NDK r10e - running on Android 4.4 (should work starting from 2.3.3)
|
Android:- tested with NDK r10e - running on Android 4.4 (should work starting from 2.3.3)
|
||||||
AROS: - Build with 'make -f aros/Makefile.AROS'
|
AROS: - Build with 'make -f aros/Makefile.AROS'
|
||||||
|
Playstation 2: - Build and install with 'cd ps2ee; make -f Makefile.PS2_EE install'
|
||||||
PlayStation 3: - Build and install the library with 'make -f ps3_ppu/Makefile.PS3_PPU install'
|
PlayStation 3: - Build and install the library with 'make -f ps3_ppu/Makefile.PS3_PPU install'
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WIN32
|
#if !defined(WIN32) && !defined(PS2_EE)
|
||||||
#include <sys/socket.h> /* struct sockaddr_storage */
|
#include <sys/socket.h> /* struct sockaddr_storage */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -39,6 +39,10 @@
|
||||||
#define IFNAMSIZ 16
|
#define IFNAMSIZ 16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PS2_EE) && !defined(IFNAMSIZ)
|
||||||
|
#define IFNAMSIZ 16
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libnfs-zdr.h"
|
#include "libnfs-zdr.h"
|
||||||
#include "../nfs/libnfs-raw-nfs.h"
|
#include "../nfs/libnfs-raw-nfs.h"
|
||||||
#include "../nfs4/libnfs-raw-nfs4.h"
|
#include "../nfs4/libnfs-raw-nfs4.h"
|
||||||
|
@ -54,7 +58,7 @@ extern "C" {
|
||||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_SOCKADDR_STORAGE) && !defined(WIN32)
|
#if !defined(HAVE_SOCKADDR_STORAGE) && !defined(WIN32) && !defined(PS2_EE)
|
||||||
/*
|
/*
|
||||||
* RFC 2553: protocol-independent placeholder for socket addresses
|
* RFC 2553: protocol-independent placeholder for socket addresses
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
#ifndef _LIBNFS_H_
|
#ifndef _LIBNFS_H_
|
||||||
#define _LIBNFS_H_
|
#define _LIBNFS_H_
|
||||||
|
|
||||||
|
#ifdef PS2_EE
|
||||||
|
#include "ps2_compat.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#if defined(__ANDROID__) || defined(AROS) || defined(__PPU__) \
|
#if defined(__ANDROID__) || defined(AROS) || defined(__PPU__) \
|
||||||
|| ( defined(__APPLE__) && defined(__MACH__) )
|
|| ( defined(__APPLE__) && defined(__MACH__) )
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
#include "aros_compat.h"
|
#include "aros_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PS2_EE
|
||||||
|
#include "ps2_compat.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PS3_PPU
|
#ifdef PS3_PPU
|
||||||
#include "ps3_compat.h"
|
#include "ps3_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
#include "aros_compat.h"
|
#include "aros_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PS2_EE
|
||||||
|
#include "ps2_compat.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PS3_PPU
|
#ifdef PS3_PPU
|
||||||
#include "ps3_compat.h"
|
#include "ps3_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -2002,7 +2006,7 @@ mount_free_export_list(struct exportnode *exp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(NO_SRV_AUTOSCAN)
|
||||||
|
|
||||||
void
|
void
|
||||||
free_nfs_srvr_list(struct nfs_server_list *srv)
|
free_nfs_srvr_list(struct nfs_server_list *srv)
|
||||||
|
@ -2369,4 +2373,6 @@ nfs_find_local_servers(void)
|
||||||
}
|
}
|
||||||
return data.srvrs;
|
return data.srvrs;
|
||||||
}
|
}
|
||||||
#endif//WIN32
|
#endif /* WIN32 */
|
||||||
|
|
||||||
|
#endif /* !defined(NO_SRV_AUTOSCAN) */
|
||||||
|
|
|
@ -33,6 +33,10 @@
|
||||||
#include "aros_compat.h"
|
#include "aros_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PS2_EE
|
||||||
|
#include "ps2_compat.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PS3_PPU
|
#ifdef PS3_PPU
|
||||||
#include "ps3_compat.h"
|
#include "ps3_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,6 +30,10 @@
|
||||||
#include "aros_compat.h"
|
#include "aros_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PS2_EE
|
||||||
|
#include "ps2_compat.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PS3_PPU
|
#ifdef PS3_PPU
|
||||||
#include "ps3_compat.h"
|
#include "ps3_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,6 +30,10 @@
|
||||||
#include "aros_compat.h"
|
#include "aros_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PS2_EE
|
||||||
|
#include "ps2_compat.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PS3_PPU
|
#ifdef PS3_PPU
|
||||||
#include "ps3_compat.h"
|
#include "ps3_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,6 +30,10 @@
|
||||||
#include "aros_compat.h"
|
#include "aros_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PS2_EE
|
||||||
|
#include "ps2_compat.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PS3_PPU
|
#ifdef PS3_PPU
|
||||||
#include "ps3_compat.h"
|
#include "ps3_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
#include "aros_compat.h"
|
#include "aros_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PS2_EE
|
||||||
|
#include "ps2_compat.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PS3_PPU
|
#ifdef PS3_PPU
|
||||||
#include "ps3_compat.h"
|
#include "ps3_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
14
lib/socket.c
14
lib/socket.c
|
@ -23,6 +23,10 @@
|
||||||
#include "aros_compat.h"
|
#include "aros_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PS2_EE
|
||||||
|
#include "ps2_compat.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PS3_PPU
|
#ifdef PS3_PPU
|
||||||
#include "ps3_compat.h"
|
#include "ps3_compat.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -91,7 +95,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MSG_NOSIGNAL
|
#ifndef MSG_NOSIGNAL
|
||||||
#if (defined(__APPLE__) && defined(__MACH__))
|
#if (defined(__APPLE__) && defined(__MACH__)) || defined(PS2_EE)
|
||||||
#define MSG_NOSIGNAL 0
|
#define MSG_NOSIGNAL 0
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -133,10 +137,12 @@ set_nonblocking(int fd)
|
||||||
static void
|
static void
|
||||||
set_nolinger(int fd)
|
set_nolinger(int fd)
|
||||||
{
|
{
|
||||||
|
#if !defined(PS2_EE)
|
||||||
struct linger lng;
|
struct linger lng;
|
||||||
lng.l_onoff = 1;
|
lng.l_onoff = 1;
|
||||||
lng.l_linger = 0;
|
lng.l_linger = 0;
|
||||||
setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *)&lng, sizeof(lng));
|
setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *)&lng, sizeof(lng));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -601,7 +607,7 @@ rpc_connect_sockaddr_async(struct rpc_context *rpc)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rpc->old_fd) {
|
if (rpc->old_fd) {
|
||||||
#if !defined(WIN32) && !defined(PS3_PPU)
|
#if !defined(WIN32) && !defined(PS3_PPU) && !defined(PS2_EE)
|
||||||
if (dup2(rpc->fd, rpc->old_fd) == -1) {
|
if (dup2(rpc->fd, rpc->old_fd) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -667,7 +673,7 @@ rpc_connect_sockaddr_async(struct rpc_context *rpc)
|
||||||
sizeof(struct sockaddr_in);
|
sizeof(struct sockaddr_in);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
#ifndef PS3_PPU
|
#if !defined(PS3_PPU) && !defined(PS2_EE)
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
sin6->sin6_port = port;
|
sin6->sin6_port = port;
|
||||||
sin6->sin6_family = AF_INET6;
|
sin6->sin6_family = AF_INET6;
|
||||||
|
@ -725,7 +731,7 @@ rpc_set_sockaddr(struct rpc_context *rpc, const char *server, int port)
|
||||||
sizeof(struct sockaddr_in);
|
sizeof(struct sockaddr_in);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
#ifndef PS3_PPU
|
#if !defined(PS3_PPU) && !defined(PS2_EE)
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
((struct sockaddr_in6 *)&rpc->s)->sin6_family = ai->ai_family;
|
((struct sockaddr_in6 *)&rpc->s)->sin6_family = ai->ai_family;
|
||||||
((struct sockaddr_in6 *)&rpc->s)->sin6_port = htons(port);
|
((struct sockaddr_in6 *)&rpc->s)->sin6_port = htons(port);
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef PS2_EE
|
||||||
|
#include "ps2_compat.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <win32/win32_compat.h>
|
#include <win32/win32_compat.h>
|
||||||
#endif/*WIN32*/
|
#endif/*WIN32*/
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef PS2_EE
|
||||||
|
#include "ps2_compat.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <win32/win32_compat.h>
|
#include <win32/win32_compat.h>
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef PS2_EE
|
||||||
|
#include "ps2_compat.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <win32/win32_compat.h>
|
#include <win32/win32_compat.h>
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
EE_CFLAGS = -DPS2_EE \
|
||||||
|
-D_U_=/**/ -I../include -I../include/nfsc \
|
||||||
|
-I../mount -I../nfs -I../nfs4 -I../portmap
|
||||||
|
|
||||||
|
EE_LIB = libnfs.a
|
||||||
|
EE_INCS =
|
||||||
|
EE_OBJS = ../lib/init.o ../lib/pdu.o ../lib/socket.o \
|
||||||
|
../lib/nfs_v3.o ../lib/nfs_v4.o \
|
||||||
|
../lib/libnfs.o ../lib/libnfs-sync.o ../lib/libnfs-zdr.o \
|
||||||
|
../mount/mount.o ../mount/libnfs-raw-mount.o \
|
||||||
|
../portmap/portmap.o ../portmap/libnfs-raw-portmap.o \
|
||||||
|
../nfs/nfs.o ../nfs/libnfs-raw-nfs.o \
|
||||||
|
../nfs4/nfs4.o ../nfs4/libnfs-raw-nfs4.o
|
||||||
|
|
||||||
|
all: $(EE_LIB) $(EE_OBJS)
|
||||||
|
|
||||||
|
install: all
|
||||||
|
ifeq ($(PS2SDK),)
|
||||||
|
@echo "$PS2SDK is not set. Can not install libnfs."
|
||||||
|
@exit 1
|
||||||
|
endif
|
||||||
|
@echo Copying...
|
||||||
|
@[ -d $(PS2SDK)/ee/include/nfsc ] || mkdir -p $(PS2SDK)/ee/include/nfsc
|
||||||
|
@cp -frv ../include/nfsc/*.h $(PS2SDK)/ee/include/nfsc
|
||||||
|
@cp -frv ../mount/*.h $(PS2SDK)/ee/include/nfsc
|
||||||
|
@cp -frv ../portmap/*.h $(PS2SDK)/ee/include/nfsc
|
||||||
|
@cp -frv ../nfs/*.h $(PS2SDK)/ee/include/nfsc
|
||||||
|
@cp -frv ../nfs4/*.h $(PS2SDK)/ee/include/nfsc
|
||||||
|
@cp -frv *.a $(PS2SDK)/ee/lib
|
||||||
|
@echo Done!
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf *.a $(EE_OBJS)
|
||||||
|
|
||||||
|
reset:
|
||||||
|
ps2client reset
|
||||||
|
|
||||||
|
include $(PS2SDK)/samples/Makefile.pref
|
||||||
|
include $(PS2SDK)/samples/Makefile.eeglobal
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* -*- mode:c; tab-width:8; c-basic-offset:8; indent-tabs-mode:nil; -*- */
|
||||||
|
/*
|
||||||
|
Copyright (C) 2021 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __PS2_CONFIG_H__
|
||||||
|
|
||||||
|
#define HAVE_ARPA_INET_H 1
|
||||||
|
#define HAVE_INTTYPES_H 1
|
||||||
|
#define HAVE_MEMORY_H 1
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
#define HAVE_SOCKADDR_LEN 1
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
#define HAVE_STDLIB_H 1
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
#define HAVE_STRING_H 1
|
||||||
|
/* #define HAVE_SYS_SOCKET_H */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
#define HAVE_UTIME_H 1
|
||||||
|
|
||||||
|
#endif /* __PS2_CONFIG_H__ */
|
|
@ -0,0 +1,86 @@
|
||||||
|
/* -*- mode:c; tab-width:8; c-basic-offset:8; indent-tabs-mode:nil; -*- */
|
||||||
|
/*
|
||||||
|
Copyright (C) 2021 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef PS2_EE
|
||||||
|
|
||||||
|
#define NEED_READV
|
||||||
|
#define NEED_WRITEV
|
||||||
|
#define NEED_POLL
|
||||||
|
#define NEED_BE64TOH
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
int getaddrinfo(const char *node, const char*service,
|
||||||
|
const struct addrinfo *hints,
|
||||||
|
struct addrinfo **res)
|
||||||
|
{
|
||||||
|
struct sockaddr_in *sin;
|
||||||
|
struct hostent *host;
|
||||||
|
int i, ip[4];
|
||||||
|
|
||||||
|
sin = malloc(sizeof(struct sockaddr_in));
|
||||||
|
sin->sin_len = sizeof(struct sockaddr_in);
|
||||||
|
sin->sin_family=AF_INET;
|
||||||
|
|
||||||
|
/* Some error checking would be nice */
|
||||||
|
if (sscanf(node, "%d.%d.%d.%d", ip, ip+1, ip+2, ip+3) == 4) {
|
||||||
|
for (i = 0; i < 4; i++) {
|
||||||
|
((char *)&sin->sin_addr.s_addr)[i] = ip[i];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
host = gethostbyname(node);
|
||||||
|
if (host == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (host->h_addrtype != AF_INET) {
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
memcpy(&sin->sin_addr.s_addr, host->h_addr, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
sin->sin_port=0;
|
||||||
|
if (service) {
|
||||||
|
sin->sin_port=htons(atoi(service));
|
||||||
|
}
|
||||||
|
|
||||||
|
*res = malloc(sizeof(struct addrinfo));
|
||||||
|
|
||||||
|
(*res)->ai_family = AF_INET;
|
||||||
|
(*res)->ai_addrlen = sizeof(struct sockaddr_in);
|
||||||
|
(*res)->ai_addr = (struct sockaddr *)sin;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void freeaddrinfo(struct addrinfo *res)
|
||||||
|
{
|
||||||
|
free(res->ai_addr);
|
||||||
|
free(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
int getnameinfo(const struct sockaddr *addr, socklen_t addrlen,
|
||||||
|
char *host, socklen_t hostlen,
|
||||||
|
char *serv, socklen_t servlen, int flags)
|
||||||
|
{
|
||||||
|
/* not implemented yet */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* PS2_EE */
|
|
@ -0,0 +1,107 @@
|
||||||
|
/* -*- mode:c; tab-width:8; c-basic-offset:8; indent-tabs-mode:nil; -*- */
|
||||||
|
/*
|
||||||
|
Copyright (C) 2021 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PS2_COMPAT_H_
|
||||||
|
#define _PS2_COMPAT_H_
|
||||||
|
|
||||||
|
#ifdef PS2_EE
|
||||||
|
|
||||||
|
#define NO_SRV_AUTOSCAN
|
||||||
|
#define IPPORT_RESERVED 1024
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/utime.h>
|
||||||
|
#include <ps2ip.h>
|
||||||
|
|
||||||
|
typedef unsigned long int fsfilcnt_t;
|
||||||
|
typedef unsigned long int fsblkcnt_t;
|
||||||
|
|
||||||
|
#define getservbyport(a,b) NULL
|
||||||
|
#define major(a) 0
|
||||||
|
#define minor(a) 0
|
||||||
|
#define O_NOFOLLOW 0
|
||||||
|
#define X_OK 1
|
||||||
|
#define W_OK 2
|
||||||
|
#define R_OK 4
|
||||||
|
|
||||||
|
struct statvfs {
|
||||||
|
unsigned long int f_bsize;
|
||||||
|
unsigned long int f_frsize;
|
||||||
|
unsigned long int f_blocks;
|
||||||
|
unsigned long int f_bfree;
|
||||||
|
unsigned long int f_bavail;
|
||||||
|
unsigned long int f_files;
|
||||||
|
unsigned long int f_ffree;
|
||||||
|
unsigned long int f_favail;
|
||||||
|
unsigned long int f_fsid;
|
||||||
|
unsigned long int f_flag;
|
||||||
|
unsigned long int f_namemax;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define getpid() 0
|
||||||
|
#define getuid() 0
|
||||||
|
#define getgid() 0
|
||||||
|
|
||||||
|
#define write(a,b,c) lwip_write(a,b,c)
|
||||||
|
#define read(a,b,c) lwip_read(a,b,c)
|
||||||
|
#define gethostbyname(a) lwip_gethostbyname(a)
|
||||||
|
#define close(a) lwip_close(a)
|
||||||
|
|
||||||
|
#define getlogin_r(a,b) ENXIO
|
||||||
|
#define srandom srand
|
||||||
|
#define random rand
|
||||||
|
|
||||||
|
#define POLLIN 0x0001 /* There is data to read */
|
||||||
|
#define POLLPRI 0x0002 /* There is urgent data to read */
|
||||||
|
#define POLLOUT 0x0004 /* Writing now will not block */
|
||||||
|
#define POLLERR 0x0008 /* Error condition */
|
||||||
|
#define POLLHUP 0x0010 /* Hung up */
|
||||||
|
|
||||||
|
struct pollfd {
|
||||||
|
int fd;
|
||||||
|
short events;
|
||||||
|
short revents;
|
||||||
|
};
|
||||||
|
|
||||||
|
int poll(struct pollfd *fds, unsigned int nfds, int timo);
|
||||||
|
|
||||||
|
struct iovec {
|
||||||
|
void *iov_base;
|
||||||
|
size_t iov_len;
|
||||||
|
};
|
||||||
|
|
||||||
|
ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
|
||||||
|
ssize_t readv(int fd, const struct iovec *iov, int iovcnt);
|
||||||
|
|
||||||
|
int getaddrinfo(const char *node, const char*service,
|
||||||
|
const struct addrinfo *hints,
|
||||||
|
struct addrinfo **res);
|
||||||
|
void freeaddrinfo(struct addrinfo *res);
|
||||||
|
|
||||||
|
long long int be64toh(long long int x);
|
||||||
|
|
||||||
|
#define SOL_TCP IPPROTO_TCP
|
||||||
|
#define EAI_AGAIN EAGAIN
|
||||||
|
|
||||||
|
/* just pretend they are the same so we compile */
|
||||||
|
#define sockaddr_in6 sockaddr_in
|
||||||
|
|
||||||
|
#endif /* PS2_EE */
|
||||||
|
|
||||||
|
#endif /* _PS2_COMPAT_H_ */
|
Loading…
Reference in New Issue