Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest PS2SDK. #341

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions lib/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,21 +464,11 @@ int poll(struct pollfd *fds, unsigned int nfds, int timo)
if(timo < 0) {
toptr = NULL;
} else {
#if defined(PS2_EE_PLATFORM) && defined(PS2IPS)
/*
* select() is broken on the ps2ips stack so we basically have
* to busy-wait.
*/
(void)timeout;
timeout.tv_sec = 0;
timeout.tv_usec = 10000;
#else
toptr = &timeout;
timeout.tv_sec = timo / 1000;
timeout.tv_usec = (timo - timeout.tv_sec * 1000) * 1000;
#endif
#endif
timeout.tv_usec = (timo - timeout.tv_sec * 1000) * 1000;
}
#endif

rc = select(maxfd + 1, ip, op, &efds, toptr);

Expand Down
5 changes: 5 additions & 0 deletions lib/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,13 @@ int iop_connect(int sockfd, struct sockaddr *addr, socklen_t addrlen);
ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
ssize_t readv(int fd, const struct iovec *iov, int iovcnt);

#ifndef SOL_TCP
#define SOL_TCP IPPROTO_TCP
#endif

#ifndef EAI_AGAIN
#define EAI_AGAIN EAGAIN
#endif

#ifdef PS2_IOP_PLATFORM
#define strerror(x) "Unknown"
Expand Down
12 changes: 1 addition & 11 deletions lib/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ smb2_close_connecting_fds(struct smb2_context *smb2)
smb2->connecting_fds_count = 0;

if (smb2->addrinfos != NULL) {
#ifndef PS2IPS
freeaddrinfo(smb2->addrinfos);
#endif
smb2->addrinfos = NULL;
}
smb2->next_addrinfo = NULL;
Expand Down Expand Up @@ -857,7 +855,7 @@ smb2_service(struct smb2_context *smb2, int revents)
static void
set_nonblocking(t_socket fd)
{
#if defined(WIN32) || defined(_XBOX) || defined(PS2_EE_PLATFORM)
#if defined(WIN32) || defined(_XBOX)
unsigned long opt = 1;
ioctlsocket(fd, FIONBIO, &opt);
#elif (defined(__AMIGA__) || defined(__AROS__)) && !defined(__amigaos4__)
Expand Down Expand Up @@ -1086,13 +1084,9 @@ smb2_connect_async(struct smb2_context *smb2, const char *server,
port = "445";
}

#ifdef PS2IPS
{
#else
/* is it a hostname ? */
err = getaddrinfo(host, port, NULL, &smb2->addrinfos);
if (err != 0) {
#endif
free(addr);
#if defined(_WINDOWS) || defined(_XBOX)
if (err == WSANOTINITIALISED)
Expand Down Expand Up @@ -1141,9 +1135,7 @@ smb2_connect_async(struct smb2_context *smb2, const char *server,
addr_count++;
smb2->connecting_fds = malloc(sizeof(t_socket) * addr_count);
if (smb2->connecting_fds == NULL) {
#ifndef PS2IPS
freeaddrinfo(smb2->addrinfos);
#endif
smb2->addrinfos = NULL;
return -ENOMEM;
}
Expand All @@ -1156,9 +1148,7 @@ smb2_connect_async(struct smb2_context *smb2, const char *server,
} else {
free(smb2->connecting_fds);
smb2->connecting_fds = NULL;
#ifndef PS2IPS
freeaddrinfo(smb2->addrinfos);
#endif
smb2->addrinfos = NULL;
smb2->next_addrinfo = NULL;
}
Expand Down
9 changes: 1 addition & 8 deletions lib/sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,7 @@ static int wait_for_reply(struct smb2_context *smb2,
{
smb2_set_error(smb2, "Timeout expired and no connection exists\n");
return -1;
}
#if defined (PS2_EE_PLATFORM) && defined(PS2IPS)
/* select() is broken on ps2ips :-( */
pfd.revents |= POLLOUT;
if (SMB2_VALID_SOCKET(smb2->fd)) {
pfd.revents |= POLLIN;
}
#endif
}
if (pfd.revents == 0) {
continue;
}
Expand Down
Loading