remove unused functions from netdb-compat

This commit is contained in:
Dima Pulkinen 2024-02-27 13:44:51 +02:00
parent cc86141206
commit bde776704a
2 changed files with 14 additions and 136 deletions

View File

@ -4,50 +4,13 @@
* Copyright (c) Nokia 2004-2005. All rights reserved. * Copyright (c) Nokia 2004-2005. All rights reserved.
* This code is licensed under the same terms as Perl itself. * This code is licensed under the same terms as Perl itself.
* *
* netdb-compat.c
* Copyright (c) Dima Pulkinen 2024
*
*/ */
#include "EXTERN.h" #include "netdb-compat.h"
#include "perl.h" #include <string.h>
#include "symbian_stubs.h"
static int setENOSYS(void) { errno = ENOSYS; return -1; }
uid_t getuid(void) { return setENOSYS(); }
gid_t getgid(void) { return setENOSYS(); }
uid_t geteuid(void) { return setENOSYS(); }
gid_t getegid(void) { return setENOSYS(); }
int setuid(uid_t uid) { return setENOSYS(); }
int setgid(gid_t gid) { return setENOSYS(); }
int seteuid(uid_t uid) { return setENOSYS(); }
int setegid(gid_t gid) { return setENOSYS(); }
int execv(const char* path, char* const argv []) { return setENOSYS(); }
int execvp(const char* path, char* const argv []) { return setENOSYS(); }
#ifndef USE_PERLIO
FILE *popen(const char *command, const char *mode) { return 0; }
int pclose(FILE *stream) { return setENOSYS(); }
#endif
int pipe(int fd[2]) { return setENOSYS(); }
int setmode(int fd, long flags) { return -1; }
_sig_func_ptr signal(int signum, _sig_func_ptr handler) { return (_sig_func_ptr)setENOSYS(); }
int kill(pid_t pid, int signum) { return setENOSYS(); }
pid_t wait(int *status) { return setENOSYS(); }
#if PERL_VERSION <= 8
void Perl_my_setenv(pTHX_ char *var, char *val) { }
#else
void Perl_my_setenv(pTHX_ const char *var, const char *val) { }
#endif
bool Perl_do_exec(pTHX_ const char *cmd) { return FALSE; }
bool Perl_do_exec3(pTHX_ const char *cmd, int fd, int flag) { return FALSE; }
int Perl_do_spawn(pTHX_ char *cmd) { return symbian_do_spawn(cmd); }
int Perl_do_aspawn(pTHX_ SV *really, SV** mark, SV **sp) { return symbian_do_aspawn(really, mark, sp); }
static const struct protoent protocols[] = { static const struct protoent protocols[] = {
{ "tcp", 0, 6 }, { "tcp", 0, 6 },

View File

@ -11,85 +11,19 @@
* This file is part of Phoenix-RTOS. * This file is part of Phoenix-RTOS.
* *
* %LICENSE% * %LICENSE%
*
* netdb-compat.h
* Copyright (c) Dima Pulkinen 2024
*
*/ */
#ifndef _LIBPHOENIX_NETDB_H_ #ifndef _NETDB_COMPAT_H_
#define _LIBPHOENIX_NETDB_H_ #define _NETDB_COMPAT_H_
#include <sys/socktypes.h>
#include <netinet/intypes.h>
#include <stdint.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#define AI_PASSIVE (1 << 0)
#define AI_CANONNAME (1 << 1)
#define AI_NUMERICHOST (1 << 2)
#define AI_NUMERICSERV (1 << 3)
#define AI_V4MAPPED (1 << 4)
#define AI_ALL (1 << 5)
#define AI_ADDRCONFIG (1 << 6)
#define NI_NOFQDN (1 << 0)
#define NI_NUMERICHOST (1 << 1)
#define NI_NAMEREQD (1 << 2)
#define NI_NUMERICSERV (1 << 3)
#define NI_NUMERICSCOPE (1 << 4)
#define NI_DGRAM (1 << 5)
#define NI_MAXHOST 1025
#define NI_MAXSERV 32
#define EAI_BADFLAGS -1
#define EAI_NONAME -2
#define EAI_AGAIN -3
#define EAI_FAIL -4
#define EAI_FAMILY -6
#define EAI_SOCKTYPE -7
#define EAI_SERVICE -8
#define EAI_MEMORY -10
#define EAI_SYSTEM -11
#define EAI_OVERFLOW -12
/* non-POSIX */
#define EAI_NODATA -5
struct hostent {
char *h_name;
char **h_aliases;
int h_addrtype;
int h_length;
char **h_addr_list;
};
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
socklen_t ai_addrlen;
struct sockaddr *ai_addr;
char *ai_canonname;
struct addrinfo *ai_next;
};
enum {
RESOLVED_OK,
HOST_NOT_FOUND,
TRY_AGAIN,
NO_RECOVERY,
NO_DATA,
};
struct servent { struct servent {
char *s_name; char *s_name;
char **s_aliases; char **s_aliases;
@ -104,32 +38,13 @@ struct protoent {
int p_proto; int p_proto;
}; };
const char *hstrerror(int err);
/* FIXME: not thread-safe */
extern int h_errno;
extern const char *hstrerror(int err);
struct servent *getservbyname(const char *name, const char *proto); struct servent *getservbyname(const char *name, const char *proto);
struct servent *getservbyport(int port, const char *proto); struct servent *getservbyport(int port, const char *proto);
struct hostent *gethostbyname(const char *name); struct protoent *getprotobyname(const char *name);
struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type); struct protoent *getprotobynumber(int proto);
int getnameinfo(const struct sockaddr *addr, socklen_t addrlen,
char *host, socklen_t hostlen,
char *serv, socklen_t servlen, int flags);
int getaddrinfo(const char *node, const char *service,
const struct addrinfo *hints,
struct addrinfo **res);
void freeaddrinfo(struct addrinfo *res);
const char *gai_strerror(int errcode);
extern struct protoent *getprotobyname(const char *name);
extern struct protoent *getprotobynumber(int proto);
#ifdef __cplusplus #ifdef __cplusplus