11#ifndef __PS2SDKAPI_H__
12#define __PS2SDKAPI_H__
19#include <sys/socket.h>
25typedef int (*_libcglue_fdman_getfd_cb_t)(
void *userdata);
26typedef char *(*_libcglue_fdman_getfilename_cb_t)(
void *userdata);
27typedef int (*_libcglue_fdman_close_cb_t)(
void *userdata);
28typedef int (*_libcglue_fdman_read_cb_t)(
void *userdata,
void *buf,
int nbytes);
29typedef int (*_libcglue_fdman_lseek_cb_t)(
void *userdata,
int offset,
int whence);
30typedef int64_t (*_libcglue_fdman_lseek64_cb_t)(
void *userdata, int64_t offset,
int whence);
31typedef int (*_libcglue_fdman_write_cb_t)(
void *userdata,
const void *buf,
int nbytes);
32typedef int (*_libcglue_fdman_ioctl_cb_t)(
void *userdata,
int request,
void *data);
33typedef int (*_libcglue_fdman_ioctl2_cb_t)(
void *userdata,
int request,
void *arg,
unsigned int arglen,
void *buf,
unsigned int buflen);
34typedef int (*_libcglue_fdman_dread_cb_t)(
void *userdata,
struct dirent *dir);
35typedef int (*_libcglue_fdman_fcntl_f_setfl_cb_t)(
void *userdata,
int newfl);
37typedef int (*_libcglue_fdman_bind_cb_t)(
void *userdata,
const struct sockaddr *my_addr, socklen_t addrlen);
38typedef int (*_libcglue_fdman_connect_cb_t)(
void *userdata,
const struct sockaddr *serv_addr, socklen_t addrlen);
39typedef int (*_libcglue_fdman_listen_cb_t)(
void *userdata,
int backlog);
40typedef ssize_t (*_libcglue_fdman_recv_cb_t)(
void *userdata,
void *buf,
size_t len,
int flags);
41typedef ssize_t (*_libcglue_fdman_recvfrom_cb_t)(
void *userdata,
void *buf,
size_t len,
int flags,
struct sockaddr *from, socklen_t *fromlen);
42typedef ssize_t (*_libcglue_fdman_recvmsg_cb_t)(
void *userdata,
struct msghdr *msg,
int flags);
43typedef ssize_t (*_libcglue_fdman_send_cb_t)(
void *userdata,
const void *buf,
size_t len,
int flags);
44typedef ssize_t (*_libcglue_fdman_sendto_cb_t)(
void *userdata,
const void *buf,
size_t len,
int flags,
const struct sockaddr *to, socklen_t tolen);
45typedef ssize_t (*_libcglue_fdman_sendmsg_cb_t)(
void *userdata,
const struct msghdr *msg,
int flags);
46typedef int (*_libcglue_fdman_getsockopt_cb_t)(
void *userdata,
int level,
int optname,
void *optval, socklen_t *optlen);
47typedef int (*_libcglue_fdman_setsockopt_cb_t)(
void *userdata,
int level,
int optname,
const void *optval, socklen_t optlen);
48typedef int (*_libcglue_fdman_shutdown_cb_t)(
void *userdata,
int how);
49typedef int (*_libcglue_fdman_getpeername_cb_t)(
void *userdata,
struct sockaddr *name, socklen_t *namelen);
50typedef int (*_libcglue_fdman_getsockname_cb_t)(
void *userdata,
struct sockaddr *name, socklen_t *namelen);
54 _libcglue_fdman_getfd_cb_t getfd;
55 _libcglue_fdman_getfilename_cb_t getfilename;
56 _libcglue_fdman_close_cb_t close;
57 _libcglue_fdman_read_cb_t read;
58 _libcglue_fdman_lseek_cb_t lseek;
59 _libcglue_fdman_lseek64_cb_t lseek64;
60 _libcglue_fdman_write_cb_t write;
61 _libcglue_fdman_ioctl_cb_t ioctl;
62 _libcglue_fdman_ioctl2_cb_t ioctl2;
63 _libcglue_fdman_dread_cb_t dread;
64 _libcglue_fdman_fcntl_f_setfl_cb_t fcntl_f_setfl;
65 _libcglue_fdman_accept_cb_t accept;
66 _libcglue_fdman_bind_cb_t bind;
67 _libcglue_fdman_connect_cb_t connect;
68 _libcglue_fdman_listen_cb_t listen;
69 _libcglue_fdman_recv_cb_t recv;
70 _libcglue_fdman_recvfrom_cb_t recvfrom;
71 _libcglue_fdman_recvmsg_cb_t recvmsg;
72 _libcglue_fdman_send_cb_t send;
73 _libcglue_fdman_sendto_cb_t sendto;
74 _libcglue_fdman_sendmsg_cb_t sendmsg;
75 _libcglue_fdman_getsockopt_cb_t getsockopt;
76 _libcglue_fdman_setsockopt_cb_t setsockopt;
77 _libcglue_fdman_shutdown_cb_t shutdown;
78 _libcglue_fdman_getpeername_cb_t getpeername;
79 _libcglue_fdman_getsockname_cb_t getsockname;
89typedef int (*_libcglue_fdman_remove_cb_t)(
const char *path);
90typedef int (*_libcglue_fdman_rename_cb_t)(
const char *old,
const char *new_);
91typedef int (*_libcglue_fdman_mkdir_cb_t)(
const char *path,
int mode);
92typedef int (*_libcglue_fdman_rmdir_cb_t)(
const char *path);
93typedef int (*_libcglue_fdman_stat_cb_t)(
const char *path,
struct stat *buf);
94typedef int (*_libcglue_fdman_readlink_cb_t)(
const char *path,
char *buf,
size_t bufsiz);
95typedef int (*_libcglue_fdman_symlink_cb_t)(
const char *target,
const char *linkpath);
99 _libcglue_fdman_open_cb_t open;
100 _libcglue_fdman_remove_cb_t remove;
101 _libcglue_fdman_rename_cb_t rename;
102 _libcglue_fdman_mkdir_cb_t mkdir;
103 _libcglue_fdman_rmdir_cb_t rmdir;
104 _libcglue_fdman_stat_cb_t stat;
105 _libcglue_fdman_readlink_cb_t readlink;
106 _libcglue_fdman_symlink_cb_t symlink;
111typedef int (*_libcglue_fdman_setconfig_cb_t)(
const t_ip_info *ip_info);
112typedef int (*_libcglue_fdman_getconfig_cb_t)(
char *netif_name,
t_ip_info *ip_info);
113typedef void (*_libcglue_fdman_dns_setserver_cb_t)(u8 numdns,
const ip_addr_t *dnsserver);
114typedef const ip_addr_t *(*_libcglue_fdman_dns_getserver_cb_t)(u8 numdns);
116typedef int (*_libcglue_fdman_select_cb_t)(
int n,
fd_set *readfds,
fd_set *writefds,
fd_set *exceptfds,
struct timeval *timeout);
117typedef struct hostent *(*_libcglue_fdman_gethostbyaddr_cb_t)(
const void *addr,
int len,
int type);
118typedef struct hostent *(*_libcglue_fdman_gethostbyname_cb_t)(
const char *name);
119typedef int (*_libcglue_fdman_gethostbyname_r_cb_t)(
const char *name,
struct hostent *ret,
char *buf,
size_t buflen,
struct hostent **result,
int *h_errnop);
120typedef void (*_libcglue_fdman_freeaddrinfo_cb_t)(
struct addrinfo *ai);
121typedef int (*_libcglue_fdman_getaddrinfo_cb_t)(
const char *nodename,
const char *servname,
const struct addrinfo *hints,
struct addrinfo **res);
125 _libcglue_fdman_setconfig_cb_t setconfig;
126 _libcglue_fdman_getconfig_cb_t getconfig;
127 _libcglue_fdman_dns_setserver_cb_t dns_setserver;
128 _libcglue_fdman_dns_getserver_cb_t dns_getserver;
129 _libcglue_fdman_socket_cb_t socket;
130 _libcglue_fdman_select_cb_t select;
131 _libcglue_fdman_gethostbyaddr_cb_t gethostbyaddr;
132 _libcglue_fdman_gethostbyname_cb_t gethostbyname;
133 _libcglue_fdman_gethostbyname_r_cb_t gethostbyname_r;
134 _libcglue_fdman_freeaddrinfo_cb_t freeaddrinfo;
135 _libcglue_fdman_getaddrinfo_cb_t getaddrinfo;
140typedef u32 (*_libcglue_fdman_inet_addr_cb_t)(
const char *cp);
141typedef char *(*_libcglue_fdman_inet_ntoa_cb_t)(
const ip4_addr_t *addr);
142typedef char *(*_libcglue_fdman_inet_ntoa_r_cb_t)(
const ip4_addr_t *addr,
char *buf,
int buflen);
143typedef int (*_libcglue_fdman_inet_aton_cb_t)(
const char *cp,
ip4_addr_t *addr);
147 _libcglue_fdman_inet_addr_cb_t inet_addr;
148 _libcglue_fdman_inet_ntoa_cb_t inet_ntoa;
149 _libcglue_fdman_inet_ntoa_r_cb_t inet_ntoa_r;
150 _libcglue_fdman_inet_aton_cb_t inet_aton;
156extern char __cwd[MAXNAMLEN + 1];
157int __path_absolute(
const char *in,
char *out,
int len);
159#define PS2_CLOCKS_PER_SEC kBUSCLKBY256
160#define PS2_CLOCKS_PER_MSEC (PS2_CLOCKS_PER_SEC / 1000)
163#define PS2_DISABLE_AUTOSTART_PTHREAD() \
164 void __libpthreadglue_init() {} \
165 void __libpthreadglue_deinit() {}
168#define LIBCGLUE_SUPPORT_NAMCO_SYSTEM_2x6() \
169 void _libcglue_rtc_update() {}
171typedef uint64_t ps2_clock_t;
172static inline ps2_clock_t ps2_clock(
void) {
174 return (ps2_clock_t)(GetTimerSystemTime() >> 8);
177extern s64 _ps2sdk_rtc_offset_from_busclk;
178extern void _libcglue_rtc_update();
182typedef int64_t off64_t;
183off64_t lseek64(
int fd, off64_t offset,
int whence);
186extern void _libcglue_timezone_update();
188void ps2sdk_setTimezone(
int timezone);
189void ps2sdk_setDaylightSaving(
int daylightSaving);
197extern int ps2sdk_get_iop_fd(
int fd);
198extern char *ps2sdk_get_iop_filename(
int fd);
199extern int _ps2sdk_close(
int fd);
200extern int _ps2sdk_dclose(
int fd);
201extern int _ps2sdk_read(
int fd,
void *buf,
int nbytes);
202extern int _ps2sdk_lseek(
int fd,
int offset,
int whence);
203extern int64_t _ps2sdk_lseek64(
int fd, int64_t offset,
int whence);
204extern int _ps2sdk_write(
int fd,
const void *buf,
int nbytes);
205extern int _ps2sdk_ioctl(
int fd,
int request,
void *data);
206extern int _ps2sdk_ioctl2(
int fd,
int request,
void *arg,
unsigned int arglen,
void *buf,
unsigned int buflen);
207extern int _ps2sdk_dread(
int fd,
struct dirent *dir);