mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-12-17 09:27:26 +00:00
Adding options to disable some other newlib support
- Option to disable pipe support - Option to disable socker support - Option to disable timezone support - Option to disable cwd support
This commit is contained in:
@@ -178,6 +178,7 @@ int __path_absolute(const char *in, char *out, int len)
|
|||||||
|
|
||||||
#ifdef F___init_cwd
|
#ifdef F___init_cwd
|
||||||
/* Set the current working directory (CWD) to the path where the module was launched. */
|
/* Set the current working directory (CWD) to the path where the module was launched. */
|
||||||
|
__attribute__((weak))
|
||||||
void __init_cwd(char *argv_0)
|
void __init_cwd(char *argv_0)
|
||||||
{
|
{
|
||||||
if (argv_0 != NULL) {
|
if (argv_0 != NULL) {
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ int pipe(int fildes[2])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef F___pipe_close
|
#ifdef F___pipe_close
|
||||||
|
__attribute__((weak))
|
||||||
int __pipe_close(int fd)
|
int __pipe_close(int fd)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -124,6 +125,7 @@ int __pipe_close(int fd)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef F___pipe_nonblocking_read
|
#ifdef F___pipe_nonblocking_read
|
||||||
|
__attribute__((weak))
|
||||||
int __pipe_nonblocking_read(int fd, void *buf, size_t len)
|
int __pipe_nonblocking_read(int fd, void *buf, size_t len)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@@ -180,6 +182,7 @@ int __pipe_nonblocking_read(int fd, void *buf, size_t len)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef F___pipe_read
|
#ifdef F___pipe_read
|
||||||
|
__attribute__((weak))
|
||||||
int __pipe_read(int fd, void *buf, size_t len)
|
int __pipe_read(int fd, void *buf, size_t len)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@@ -241,6 +244,7 @@ int __pipe_read(int fd, void *buf, size_t len)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef F___pipe_write
|
#ifdef F___pipe_write
|
||||||
|
__attribute__((weak))
|
||||||
int __pipe_write(int fd, const void *buf, size_t len)
|
int __pipe_write(int fd, const void *buf, size_t len)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@@ -286,6 +290,7 @@ int __pipe_write(int fd, const void *buf, size_t len)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef F___pipe_nonblocking_write
|
#ifdef F___pipe_nonblocking_write
|
||||||
|
__attribute__((weak))
|
||||||
int __pipe_nonblocking_write(int fd, const void *buf, size_t len)
|
int __pipe_nonblocking_write(int fd, const void *buf, size_t len)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ int socket(int domain, int type, int protocol)
|
|||||||
them in and have expanded socket capability. */
|
them in and have expanded socket capability. */
|
||||||
|
|
||||||
#ifdef F___socket_close
|
#ifdef F___socket_close
|
||||||
|
__attribute__((weak))
|
||||||
int __socket_close(int sock)
|
int __socket_close(int sock)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -170,6 +171,7 @@ int listen(int s, int backlog)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef F_recv
|
#ifdef F_recv
|
||||||
|
__attribute__((weak))
|
||||||
ssize_t recv(int s, void *buf, size_t len, int flags)
|
ssize_t recv(int s, void *buf, size_t len, int flags)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@@ -212,6 +214,7 @@ ssize_t recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef F_send
|
#ifdef F_send
|
||||||
|
__attribute__((weak))
|
||||||
ssize_t send(int s, const void *buf, size_t len, int flags)
|
ssize_t send(int s, const void *buf, size_t len, int flags)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@@ -275,6 +278,7 @@ int getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef F_setsockopt
|
#ifdef F_setsockopt
|
||||||
|
__attribute__((weak))
|
||||||
int setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen)
|
int setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|||||||
@@ -107,6 +107,37 @@ enum PspModuleInfoAttr
|
|||||||
void __libcglue_init(int argc, char *argv[]) {} \
|
void __libcglue_init(int argc, char *argv[]) {} \
|
||||||
void __libcglue_deinit() {}
|
void __libcglue_deinit() {}
|
||||||
|
|
||||||
|
/* Disable using pipe suuport from POSIX functions. */
|
||||||
|
#define PSP_DISABLE_NEWLIB_PIPE_SUPPORT() \
|
||||||
|
static int __pipe_not_supported() { \
|
||||||
|
errno = ENOSYS; \
|
||||||
|
return -1; \
|
||||||
|
} \
|
||||||
|
int __pipe_close(int fd) { return __pipe_not_supported(); } \
|
||||||
|
int __pipe_nonblocking_read(int fd, void *buf, size_t len) { return __pipe_not_supported(); } \
|
||||||
|
int __pipe_read(int fd, void *buf, size_t len) { return __pipe_not_supported(); } \
|
||||||
|
int __pipe_write(int fd, const void *buf, size_t len) { return __pipe_not_supported(); } \
|
||||||
|
int __pipe_nonblocking_write(int fd, const void *buf, size_t len) { return __pipe_not_supported(); }
|
||||||
|
|
||||||
|
/* Disable using socket suuport from POSIX functions. */
|
||||||
|
#define PSP_DISABLE_NEWLIB_SOCKET_SUPPORT() \
|
||||||
|
static int __socket_not_supported() { \
|
||||||
|
errno = ENOSYS; \
|
||||||
|
return -1; \
|
||||||
|
} \
|
||||||
|
int __socket_close(int sock) { return __socket_not_supported(); } \
|
||||||
|
ssize_t recv(int s, void *buf, size_t len, int flags) { return __socket_not_supported(); } \
|
||||||
|
ssize_t send(int s, const void *buf, size_t len, int flags) { return __socket_not_supported(); } \
|
||||||
|
int setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen) { return __socket_not_supported(); }
|
||||||
|
|
||||||
|
/* Disable the timezone support from newlib. */
|
||||||
|
#define PSP_DISABLE_NEWLIB_TIMEZONE_SUPPORT() \
|
||||||
|
void __timezone_update() { }
|
||||||
|
|
||||||
|
/* Disable the CWD support from newlib. */
|
||||||
|
#define PSP_DISABLE_NEWLIB_CWD_SUPPORT() \
|
||||||
|
void __init_cwd(char *argv_0) {}
|
||||||
|
|
||||||
/* Disable the auto start of pthread on init for reducing binary size if not used. */
|
/* Disable the auto start of pthread on init for reducing binary size if not used. */
|
||||||
#define PSP_DISABLE_AUTOSTART_PTHREAD() \
|
#define PSP_DISABLE_AUTOSTART_PTHREAD() \
|
||||||
void __libpthreadglue_init() {}
|
void __libpthreadglue_init() {}
|
||||||
|
|||||||
Reference in New Issue
Block a user