[前][次][番号順一覧][スレッド一覧]

ruby-changes:20066

From: nobu <ko1@a...>
Date: Thu, 16 Jun 2011 09:13:03 +0900 (JST)
Subject: [ruby-changes:20066] nobu:r32113 (trunk): * fix for build on solaris 10.

nobu	2011-06-16 09:12:55 +0900 (Thu, 16 Jun 2011)

  New Revision: 32113

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32113

  Log:
    * fix for build on solaris 10.

  Modified files:
    trunk/ChangeLog
    trunk/cont.c
    trunk/eval_intern.h
    trunk/file.c
    trunk/include/ruby/missing.h
    trunk/thread.c
    trunk/thread_pthread.c

Index: eval_intern.h
===================================================================
--- eval_intern.h	(revision 32112)
+++ eval_intern.h	(revision 32113)
@@ -91,6 +91,7 @@
 */
 #ifdef HAVE_SELECT_LARGE_FDSET
 #define select(n, r, w, e, t) select_large_fdset((n), (r), (w), (e), (t))
+extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval *);
 #endif
 
 #ifdef HAVE_SYS_PARAM_H
Index: include/ruby/missing.h
===================================================================
--- include/ruby/missing.h	(revision 32112)
+++ include/ruby/missing.h	(revision 32113)
@@ -138,6 +138,9 @@
 #ifndef isinf
 # ifndef HAVE_ISINF
 #  if defined(HAVE_FINITE) && defined(HAVE_ISNAN)
+#    ifdef HAVE_IEEEFP_H
+#    include <ieeefp.h>
+#    endif
 #  define isinf(x) (!finite(x) && !isnan(x))
 #  else
 RUBY_EXTERN int isinf(double);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 32112)
+++ ChangeLog	(revision 32113)
@@ -1,3 +1,7 @@
+Thu Jun 16 09:12:38 2011  Nobuyoshi Nakada  <nobu@r...>
+
+	* fix for build on solaris 10.
+
 Thu Jun 16 09:08:39 2011  Nobuyoshi Nakada  <nobu@r...>
 
 	* test/io/console/test_io_console.rb (TestIO_Console#test_sync):
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 32112)
+++ thread_pthread.c	(revision 32113)
@@ -16,6 +16,9 @@
 #ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
 #endif
+#ifdef HAVE_THR_STKSEGMENT
+#include <thread.h>
+#endif
 
 static void native_mutex_lock(pthread_mutex_t *lock);
 static void native_mutex_unlock(pthread_mutex_t *lock);
Index: thread.c
===================================================================
--- thread.c	(revision 32112)
+++ thread.c	(revision 32113)
@@ -330,10 +330,10 @@
     struct rb_thread_struct volatile *th;
     int cond_waiting;
     struct rb_mutex_struct *next_mutex;
-} mutex_t;
+} rb_mutex_t;
 
-static void rb_mutex_unlock_all(mutex_t *mutex, rb_thread_t *th);
-static void rb_mutex_abandon_all(mutex_t *mutexes);
+static void rb_mutex_unlock_all(rb_mutex_t *mutex, rb_thread_t *th);
+static void rb_mutex_abandon_all(rb_mutex_t *mutexes);
 
 void
 rb_thread_terminate_all(void)
@@ -3322,9 +3322,9 @@
  */
 
 #define GetMutexPtr(obj, tobj) \
-    TypedData_Get_Struct((obj), mutex_t, &mutex_data_type, (tobj))
+    TypedData_Get_Struct((obj), rb_mutex_t, &mutex_data_type, (tobj))
 
-static const char *mutex_unlock(mutex_t *mutex, rb_thread_t volatile *th);
+static const char *rb_mutex_unlock_th(rb_mutex_t *mutex, rb_thread_t volatile *th);
 
 #define mutex_mark NULL
 
@@ -3332,10 +3332,10 @@
 mutex_free(void *ptr)
 {
     if (ptr) {
-	mutex_t *mutex = ptr;
+	rb_mutex_t *mutex = ptr;
 	if (mutex->th) {
 	    /* rb_warn("free locked mutex"); */
-	    const char *err = mutex_unlock(mutex, mutex->th);
+	    const char *err = rb_mutex_unlock_th(mutex, mutex->th);
 	    if (err) rb_bug("%s", err);
 	}
 	native_mutex_destroy(&mutex->lock);
@@ -3347,7 +3347,7 @@
 static size_t
 mutex_memsize(const void *ptr)
 {
-    return ptr ? sizeof(mutex_t) : 0;
+    return ptr ? sizeof(rb_mutex_t) : 0;
 }
 
 static const rb_data_type_t mutex_data_type = {
@@ -3370,9 +3370,9 @@
 mutex_alloc(VALUE klass)
 {
     VALUE volatile obj;
-    mutex_t *mutex;
+    rb_mutex_t *mutex;
 
-    obj = TypedData_Make_Struct(klass, mutex_t, &mutex_data_type, mutex);
+    obj = TypedData_Make_Struct(klass, rb_mutex_t, &mutex_data_type, mutex);
     native_mutex_initialize(&mutex->lock);
     native_cond_initialize(&mutex->cond, RB_CONDATTR_CLOCK_MONOTONIC);
     return obj;
@@ -3405,7 +3405,7 @@
 VALUE
 rb_mutex_locked_p(VALUE self)
 {
-    mutex_t *mutex;
+    rb_mutex_t *mutex;
     GetMutexPtr(self, mutex);
     return mutex->th ? Qtrue : Qfalse;
 }
@@ -3413,7 +3413,7 @@
 static void
 mutex_locked(rb_thread_t *th, VALUE self)
 {
-    mutex_t *mutex;
+    rb_mutex_t *mutex;
     GetMutexPtr(self, mutex);
 
     if (th->keeping_mutexes) {
@@ -3432,7 +3432,7 @@
 VALUE
 rb_mutex_trylock(VALUE self)
 {
-    mutex_t *mutex;
+    rb_mutex_t *mutex;
     VALUE locked = Qfalse;
     GetMutexPtr(self, mutex);
 
@@ -3449,7 +3449,7 @@
 }
 
 static int
-lock_func(rb_thread_t *th, mutex_t *mutex, int timeout_ms)
+lock_func(rb_thread_t *th, rb_mutex_t *mutex, int timeout_ms)
 {
     int interrupted = 0;
     int err = 0;
@@ -3491,7 +3491,7 @@
 static void
 lock_interrupt(void *ptr)
 {
-    mutex_t *mutex = (mutex_t *)ptr;
+    rb_mutex_t *mutex = (rb_mutex_t *)ptr;
     native_mutex_lock(&mutex->lock);
     if (mutex->cond_waiting > 0)
 	native_cond_broadcast(&mutex->cond);
@@ -3510,7 +3510,7 @@
 {
 
     if (rb_mutex_trylock(self) == Qfalse) {
-	mutex_t *mutex;
+	rb_mutex_t *mutex;
 	rb_thread_t *th = GET_THREAD();
 	GetMutexPtr(self, mutex);
 
@@ -3565,10 +3565,10 @@
 }
 
 static const char *
-mutex_unlock(mutex_t *mutex, rb_thread_t volatile *th)
+rb_mutex_unlock_th(rb_mutex_t *mutex, rb_thread_t volatile *th)
 {
     const char *err = NULL;
-    mutex_t *th_mutex;
+    rb_mutex_t *th_mutex;
 
     native_mutex_lock(&mutex->lock);
 
@@ -3593,7 +3593,7 @@
 	}
 	else {
 	    while (1) {
-		mutex_t *tmp_mutex;
+		rb_mutex_t *tmp_mutex;
 		tmp_mutex = th_mutex->next_mutex;
 		if (tmp_mutex == mutex) {
 		    th_mutex->next_mutex = tmp_mutex->next_mutex;
@@ -3619,35 +3619,35 @@
 rb_mutex_unlock(VALUE self)
 {
     const char *err;
-    mutex_t *mutex;
+    rb_mutex_t *mutex;
     GetMutexPtr(self, mutex);
 
-    err = mutex_unlock(mutex, GET_THREAD());
+    err = rb_mutex_unlock_th(mutex, GET_THREAD());
     if (err) rb_raise(rb_eThreadError, "%s", err);
 
     return self;
 }
 
 static void
-rb_mutex_unlock_all(mutex_t *mutexes, rb_thread_t *th)
+rb_mutex_unlock_all(rb_mutex_t *mutexes, rb_thread_t *th)
 {
     const char *err;
-    mutex_t *mutex;
+    rb_mutex_t *mutex;
 
     while (mutexes) {
 	mutex = mutexes;
 	/* rb_warn("mutex #<%p> remains to be locked by terminated thread",
 		mutexes); */
 	mutexes = mutex->next_mutex;
-	err = mutex_unlock(mutex, th);
+	err = rb_mutex_unlock_th(mutex, th);
 	if (err) rb_bug("invalid keeping_mutexes: %s", err);
     }
 }
 
 static void
-rb_mutex_abandon_all(mutex_t *mutexes)
+rb_mutex_abandon_all(rb_mutex_t *mutexes)
 {
-    mutex_t *mutex;
+    rb_mutex_t *mutex;
 
     while (mutexes) {
 	mutex = mutexes;
@@ -3759,7 +3759,7 @@
 rb_barrier_wait(VALUE self)
 {
     VALUE mutex = GetBarrierPtr(self);
-    mutex_t *m;
+    rb_mutex_t *m;
 
     if (!mutex) return Qfalse;
     GetMutexPtr(mutex, m);
@@ -4721,7 +4721,7 @@
 	*found = 1;
     }
     else if (th->locking_mutex) {
-	mutex_t *mutex;
+	rb_mutex_t *mutex;
 	GetMutexPtr(th->locking_mutex, mutex);
 
 	native_mutex_lock(&mutex->lock);
@@ -4744,7 +4744,7 @@
 
     printf("th:%p %d %d", th, th->status, th->interrupt_flag);
     if (th->locking_mutex) {
-	mutex_t *mutex;
+	rb_mutex_t *mutex;
 	GetMutexPtr(th->locking_mutex, mutex);
 
 	native_mutex_lock(&mutex->lock);
Index: cont.c
===================================================================
--- cont.c	(revision 32112)
+++ cont.c	(revision 32113)
@@ -537,13 +537,14 @@
 	}
     }
     else {
+	void *page;
 	STACK_GROW_DIR_DETECTION;
 	ptr = (VALUE*)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
 	if (ptr == (VALUE*)(SIGNED_VALUE)-1) {
 	    rb_raise(rb_eFiberError, "can't alloc machine stack to fiber");
 	}
-	if (mprotect(ptr + STACK_DIR_UPPER((size - RB_PAGE_SIZE) / sizeof(VALUE), 0),
-		     RB_PAGE_SIZE, PROT_READ | PROT_WRITE) < 0) {
+	page = ptr + STACK_DIR_UPPER((size - RB_PAGE_SIZE) / sizeof(VALUE), 0);
+	if (mprotect(page, RB_PAGE_SIZE, PROT_READ | PROT_WRITE) < 0) {
 	    rb_raise(rb_eFiberError, "mprotect failed");
 	}
     }
Index: file.c
===================================================================
--- file.c	(revision 32112)
+++ file.c	(revision 32113)
@@ -5007,7 +5007,8 @@
 	    && !(p && execpath && (st.st_mode & S_ISVTX))
 #endif
 	    && !access(p0, W_OK)) {
-	    rb_warn("Insecure world writable dir %s in %sPATH, mode 0%o",
+	    rb_warn("Insecure world writable dir %s in %sPATH, mode 0%"
+		    PRI_MODET_PREFIX"o",
 		    p0, (execpath ? "" : "LOAD_"), st.st_mode);
 	    if (p) *p = '/';
 	    RB_GC_GUARD(path);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]