ruby-changes:13990
From: nobu <ko1@a...>
Date: Mon, 16 Nov 2009 19:19:21 +0900 (JST)
Subject: [ruby-changes:13990] Ruby:r25798 (mvm): * dir.c (ruby_dirfd): need O_DIRECTORY and O_LARGEFILE.
nobu 2009-11-16 19:18:39 +0900 (Mon, 16 Nov 2009) New Revision: 25798 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25798 Log: * dir.c (ruby_dirfd): need O_DIRECTORY and O_LARGEFILE. * vm.c (ruby_make_bare_vm): initialize thread cwd. Modified files: branches/mvm/ChangeLog branches/mvm/dir.c branches/mvm/vm.c Index: mvm/ChangeLog =================================================================== --- mvm/ChangeLog (revision 25797) +++ mvm/ChangeLog (revision 25798) @@ -1,7 +1,14 @@ -Mon Nov 16 18:55:30 2009 <nobu@r...> +Mon Nov 16 19:18:37 2009 Nobuyoshi Nakada <nobu@r...> + * dir.c (ruby_dirfd): need O_DIRECTORY and O_LARGEFILE. + + * vm.c (ruby_make_bare_vm): initialize thread cwd. + +Mon Nov 16 18:55:30 2009 Nobuyoshi Nakada <nobu@r...> + * thread_pthread.c (get_stack): fixed stack start address on the platforms using pthread_attr_t. + Mon Nov 16 01:36:50 2009 Nobuyoshi Nakada <nobu@r...> * thread.c (rb_queue_shift_wait): added. Index: mvm/dir.c =================================================================== --- mvm/dir.c (revision 25797) +++ mvm/dir.c (revision 25798) @@ -758,20 +758,31 @@ } #endif +enum { + DIR_OPEN_MODE = +#ifdef O_LARGEFILE + O_LARGEFILE| +#endif +#ifdef O_DIRECTORY + O_DIRECTORY| +#endif + O_RDONLY +}; + #ifdef HAVE_FCHDIR int ruby_dirfd(const char *path) { # if USE_OPENAT rb_thread_t *th = GET_THREAD(); - return openat(th->cwd.fd, path, O_RDONLY); + return openat(th->cwd.fd, path, DIR_OPEN_MODE); # elif defined HAVE_DIRFD DIR *cwd = opendir(path); int fd = dup(dirfd(cwd)); closedir(cwd); return fd; # elif defined O_DIRECTORY - return open(path, O_RDONLY|O_DIRECTORY); + return open(path, DIR_OPEN_MODE); # else # error do not know how to open directory. # endif @@ -1117,7 +1128,7 @@ DIR *dirp = NULL; if (dp) { #if USE_OPENAT - int base = openat(dirfd(dp->dir), path, O_RDONLY|O_LARGEFILE|O_DIRECTORY); + int base = openat(dirfd(dp->dir), path, DIR_OPEN_MODE); if (base != -1 && !(dirp = fdopendir(base))) { preserving_errno(close(base)); } Index: mvm/vm.c =================================================================== --- mvm/vm.c (revision 25797) +++ mvm/vm.c (revision 25798) @@ -2268,6 +2268,11 @@ th = vm_make_main_thread(vm); rb_thread_set_current_raw(th); ruby_thread_init_stack(th); +#ifdef HAVE_FCHDIR + th->cwd.fd = ruby_dirfd("."); +#else + rb_str_wrap_cstr(ruby_sys_getcwd()) +#endif return vm; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/