Commit | Line | Data |
---|---|---|
27da23d5 JH |
1 | /* |
2 | * symbian_stubs.c | |
3 | * | |
4 | * Copyright (c) Nokia 2004-2005. All rights reserved. | |
5 | * This code is licensed under the same terms as Perl itself. | |
6 | * | |
7 | */ | |
8 | ||
9 | #include "EXTERN.h" | |
10 | #include "perl.h" | |
11 | #include "symbian_stubs.h" | |
12 | ||
13 | static int setENOSYS(void) { errno = ENOSYS; return -1; } | |
14 | ||
15 | uid_t getuid(void) { return setENOSYS(); } | |
16 | gid_t getgid(void) { return setENOSYS(); } | |
17 | uid_t geteuid(void) { return setENOSYS(); } | |
18 | gid_t getegid(void) { return setENOSYS(); } | |
19 | ||
20 | int setuid(uid_t uid) { return setENOSYS(); } | |
21 | int setgid(gid_t gid) { return setENOSYS(); } | |
22 | int seteuid(uid_t uid) { return setENOSYS(); } | |
23 | int setegid(gid_t gid) { return setENOSYS(); } | |
24 | ||
25 | int execv(const char* path, char* const argv []) { return setENOSYS(); } | |
26 | int execvp(const char* path, char* const argv []) { return setENOSYS(); } | |
27 | ||
28 | #ifndef USE_PERLIO | |
29 | FILE *popen(const char *command, const char *mode) { return 0; } | |
30 | int pclose(FILE *stream) { return setENOSYS(); } | |
31 | #endif | |
32 | int pipe(int fd[2]) { return setENOSYS(); } | |
33 | ||
34 | int setmode(int fd, long flags) { return -1; } | |
35 | ||
36 | _sig_func_ptr signal(int signum, _sig_func_ptr handler) { return (_sig_func_ptr)setENOSYS(); } | |
37 | int kill(pid_t pid, int signum) { return setENOSYS(); } | |
38 | pid_t wait(int *status) { return setENOSYS(); } | |
39 | ||
40 | #if PERL_VERSION <= 8 | |
41 | void Perl_my_setenv(pTHX_ char *var, char *val) { } | |
42 | #else | |
43 | void Perl_my_setenv(pTHX_ const char *var, const char *val) { } | |
44 | #endif | |
45 | ||
c042ae3a JH |
46 | bool Perl_do_exec(pTHX_ const char *cmd) { return FALSE; } |
47 | bool Perl_do_exec3(pTHX_ const char *cmd, int fd, int flag) { return FALSE; } | |
27da23d5 JH |
48 | |
49 | int Perl_do_spawn(pTHX_ char *cmd) { return symbian_do_spawn(cmd); } | |
50 | int Perl_do_aspawn(pTHX_ SV *really, SV** mark, SV **sp) { return symbian_do_aspawn(really, mark, sp); } | |
51 | ||
52 | static const struct protoent protocols[] = { | |
53 | { "tcp", 0, 6 }, | |
54 | { "udp", 0, 17 } | |
55 | }; | |
56 | ||
57 | /* The protocol field (the last) is left empty to save both space | |
58 | * and time because practically all services have both tcp and udp | |
59 | * allocations in IANA. */ | |
60 | static const struct servent services[] = { | |
61 | { "http", 0, 80, 0 }, /* Optimization. */ | |
62 | { "https", 0, 443, 0 }, | |
63 | { "imap", 0, 143, 0 }, | |
64 | { "imaps", 0, 993, 0 }, | |
65 | { "smtp", 0, 25, 0 }, | |
66 | { "irc", 0, 194, 0 }, | |
67 | ||
68 | { "ftp", 0, 21, 0 }, | |
69 | { "ssh", 0, 22, 0 }, | |
70 | { "tftp", 0, 69, 0 }, | |
71 | { "pop3", 0, 110, 0 }, | |
72 | { "sftp", 0, 115, 0 }, | |
73 | { "nntp", 0, 119, 0 }, | |
74 | { "ntp", 0, 123, 0 }, | |
75 | { "snmp", 0, 161, 0 }, | |
76 | { "ldap", 0, 389, 0 }, | |
77 | { "rsync", 0, 873, 0 }, | |
78 | { "socks", 0, 1080, 0 } | |
79 | }; | |
80 | ||
81 | struct protoent* getprotobynumber(int number) { | |
82 | int i; | |
83 | for (i = 0; i < sizeof(protocols)/sizeof(struct protoent); i++) | |
84 | if (protocols[i].p_proto == number) | |
85 | return (struct protoent*)(&(protocols[i])); | |
86 | return 0; | |
87 | } | |
88 | ||
89 | struct protoent* getprotobyname(const char* name) { | |
90 | int i; | |
91 | for (i = 0; i < sizeof(protocols)/sizeof(struct protoent); i++) | |
083b2a61 | 92 | if (strEQ(name, protocols[i].p_name)) |
27da23d5 JH |
93 | return (struct protoent*)(&(protocols[i])); |
94 | return 0; | |
95 | } | |
96 | ||
97 | struct servent* getservbyname(const char* name, const char* proto) { | |
98 | int i; | |
99 | for (i = 0; i < sizeof(services)/sizeof(struct servent); i++) | |
083b2a61 | 100 | if (strEQ(name, services[i].s_name)) |
27da23d5 JH |
101 | return (struct servent*)(&(services[i])); |
102 | return 0; | |
103 | } | |
104 | ||
105 | struct servent* getservbyport(int port, const char* proto) { | |
106 | int i; | |
107 | for (i = 0; i < sizeof(services)/sizeof(struct servent); i++) | |
108 | if (services[i].s_port == port) | |
109 | return (struct servent*)(&(services[i])); | |
110 | return 0; | |
111 | } | |
112 |