summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-15 01:53:08 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-15 01:53:08 +0000
commitc6af6b1b947f8b367c22904bd5b31079784059f6 (patch)
tree079fc0c321ed4bd793f10b9113a5a6ee96d95c48
parente24346d6c6b4bdf91e1e32bfd53a328086b8d772 (diff)
* symbian/README.SYMBIAN: symbian support added. great appreciate
to <alexandre.zavorine at symbian.com>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--dln.c14
-rw-r--r--file.c2
-rw-r--r--io.c13
-rw-r--r--process.c2
-rw-r--r--ruby.c4
-rw-r--r--signal.c6
7 files changed, 37 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 0c99fcf071..1b01b50b03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jan 15 10:45:52 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * symbian/README.SYMBIAN: symbian support added. great appreciate
+ to <alexandre.zavorine at symbian.com>.
+
Thu Jan 15 00:06:12 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* enc/trans/gb18030.trans: get rid of a 1.9 feature for cross
diff --git a/dln.c b/dln.c
index d3408fb0f6..d27d79e8e5 100644
--- a/dln.c
+++ b/dln.c
@@ -1268,6 +1268,16 @@ dln_load(const char *file)
# define RTLD_GLOBAL 0
#endif
+#if defined __SYMBIAN32__
+ { /* Need backslash in the path again */
+ char *p;
+ for (p = (char *)file; *p; p++) {
+ if (*p == '/') {
+ *p = '\\';
+ }
+ }
+ }
+#endif
/* Load file */
if ((handle = (void*)dlopen(file, RTLD_LAZY|RTLD_GLOBAL)) == NULL) {
error = dln_strerror();
@@ -1275,6 +1285,10 @@ dln_load(const char *file)
}
init_fct = (void(*)())dlsym(handle, buf);
+#if defined __SYMBIAN32__
+ if (init_fct == NULL)
+ init_fct = (void(*)())dlsym(handle, "1"); /* Some Symbian versions do not support symbol table in DLL, ordinal numbers only */
+#endif
if (init_fct == NULL) {
error = DLN_ERROR();
dlclose(handle);
diff --git a/file.c b/file.c
index 918ac112d5..8debc150ee 100644
--- a/file.c
+++ b/file.c
@@ -1998,7 +1998,7 @@ rb_file_chown(VALUE obj, VALUE owner, VALUE group)
o = NIL_P(owner) ? -1 : NUM2INT(owner);
g = NIL_P(group) ? -1 : NUM2INT(group);
GetOpenFile(obj, fptr);
-#if defined(__CYGWIN32__) || defined(_WIN32) || defined(__EMX__)
+#if defined(__CYGWIN32__) || defined(_WIN32) || defined(__EMX__) || defined(__SYMBIAN32__)
if (NIL_P(fptr->pathv)) return Qnil;
if (chown(RSTRING_PTR(fptr->pathv), o, g) == -1)
rb_sys_fail_path(fptr->pathv);
diff --git a/io.c b/io.c
index 5b04dda579..a70baf8edf 100644
--- a/io.c
+++ b/io.c
@@ -4479,9 +4479,12 @@ pipe_open(struct rb_exec_arg *eargp, VALUE prog, const char *modestr, int fmode,
int status;
struct popen_arg arg;
char errmsg[80] = { '\0' };
-#elif defined(_WIN32)
- volatile VALUE argbuf;
- char **args = NULL;
+#else
+#if defined(_WIN32)
+ int openmode = rb_io_modestr_oflags(modestr);
+ const char *exename = NULL;
+ volatile VALUE cmdbuf;
+#endif
struct rb_exec_arg sarg;
int pair[2], write_pair[2];
#endif
@@ -6245,7 +6248,11 @@ argf_next_argv(VALUE argf)
chmod(fn, st.st_mode);
#endif
if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) {
+#ifdef __SYMBIAN32__
+ chown(fn, st.st_uid, st.st_gid);
+#else
fchown(fw, st.st_uid, st.st_gid);
+#endif
}
#endif
rb_stdout = prep_io(fw, FMODE_WRITABLE, rb_cFile, fn);
diff --git a/process.c b/process.c
index 0f2b55f8c7..ba5b298ef1 100644
--- a/process.c
+++ b/process.c
@@ -1097,7 +1097,9 @@ rb_proc_exec(const char *str)
exit(status);
#else
before_exec();
+#ifndef __SYMBIAN32__
execl("/bin/sh", "sh", "-c", str, (char *)NULL);
+#endif
preserving_errno(after_exec());
#endif
return -1;
diff --git a/ruby.c b/ruby.c
index 68d9fc739c..461a4f2dbb 100644
--- a/ruby.c
+++ b/ruby.c
@@ -182,7 +182,7 @@ translate_char(char *p, int from, int to)
}
#endif
-#if defined _WIN32 || defined __CYGWIN__
+#if defined _WIN32 || defined __CYGWIN__ || defined __SYMBIAN32__
static VALUE
rubylib_mangled_path(const char *s, unsigned int l)
{
@@ -331,7 +331,7 @@ ruby_incpush_expand(const char *path)
ruby_push_include(path, expand_include_path);
}
-#if defined DOSISH || defined __CYGWIN__
+#if (defined DOSISH || defined __CYGWIN__) && !defined __SYMBIAN32__
#define LOAD_RELATIVE 1
#endif
diff --git a/signal.c b/signal.c
index 8d75c3bc5c..85f4c90b70 100644
--- a/signal.c
+++ b/signal.c
@@ -409,7 +409,7 @@ static struct {
#endif
typedef RETSIGTYPE (*sighandler_t)(int);
-#ifdef SA_SIGINFO
+#if defined SA_SIGINFO && !defined __SYMBIAN32__
typedef void ruby_sigaction_t(int, siginfo_t*, void*);
#define SIGINFO_ARG , siginfo_t *info, void *ctx
#else
@@ -535,7 +535,7 @@ static int trap_last_mask;
void
rb_disable_interrupt(void)
{
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__SYMBIAN32__)
sigset_t mask;
sigfillset(&mask);
sigdelset(&mask, SIGVTALRM);
@@ -547,7 +547,7 @@ rb_disable_interrupt(void)
void
rb_enable_interrupt(void)
{
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__SYMBIAN32__)
sigset_t mask;
sigemptyset(&mask);
pthread_sigmask(SIG_SETMASK, &mask, NULL);