#include "config.h" #if defined(HAVE_LOCKF) #include #include /* Emulate flock() with lockf() or fcntl(). This is just to increase portability of scripts. The calls might not be completely interchangeable. What's really needed is a good file locking module. */ # ifndef F_ULOCK # define F_ULOCK 0 /* Unlock a previously locked region */ # endif # ifndef F_LOCK # define F_LOCK 1 /* Lock a region for exclusive use */ # endif # ifndef F_TLOCK # define F_TLOCK 2 /* Test and lock a region for exclusive use */ # endif # ifndef F_TEST # define F_TEST 3 /* Test a region for other processes locks */ # endif /* These are the flock() constants. Since this sytems doesn't have flock(), the values of the constants are probably not available. */ # ifndef LOCK_SH # define LOCK_SH 1 # endif # ifndef LOCK_EX # define LOCK_EX 2 # endif # ifndef LOCK_NB # define LOCK_NB 4 # endif # ifndef LOCK_UN # define LOCK_UN 8 # endif int flock(fd, operation) int fd; int operation; { int i; switch (operation) { /* LOCK_SH - get a shared lock */ case LOCK_SH: /* LOCK_EX - get an exclusive lock */ case LOCK_EX: i = lockf (fd, F_LOCK, 0); break; /* LOCK_SH|LOCK_NB - get a non-blocking shared lock */ case LOCK_SH|LOCK_NB: /* LOCK_EX|LOCK_NB - get a non-blocking exclusive lock */ case LOCK_EX|LOCK_NB: i = lockf (fd, F_TLOCK, 0); if (i == -1) if ((errno == EAGAIN) || (errno == EACCES)) errno = EWOULDBLOCK; break; /* LOCK_UN - unlock */ case LOCK_UN: i = lockf (fd, F_ULOCK, 0); break; /* Default - can't decipher operation */ default: i = -1; errno = EINVAL; break; } return i; } #else int flock(fd, operation) int fd; int operation; { rb_notimplement(); return -1; } #endif v1_1dev The Ruby Programming Language
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-02-18vcs.rb: refactornobu
* tool/vcs.rb (VCS::GIT.get_revisions): refactor git -C option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-27vcs.rb: include svn property commitsnobu
* tool/vcs.rb (VCS::GIT.get_revisions): omit "." to include svn property only commits. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-23vcs.rb: fix after_exportnobu
* tool/vcs.rb (VCS#after_export): fix nesting. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-20make-snapshot: make revision.h by makenobu
* tool/make-snapshot (package): keep VCS management files until prerequisites build, so that revision.h can be made by make. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-20vcs.rb: fix for local svnnobu
* tool/vcs.rb (VCS.local_path?): predicate that the argument is a local path. * tool/vcs.rb (VCS::SVN.search_root): extract a method to search working root directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-20* tool/vcs.rb: fix the exception given remote-url of svn.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-18vcs.rb: search svn directorynobu
* tool/vcs.rb (VCS::SVN#wcroot): search svn directory by traversing parent directories for old svn. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-18vcs.rb: debugnobu
* tool/vcs.rb (VCS::SVN#wcroot): debug info. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-18vcs.rb: workaroundnobu
* tool/vcs.rb (VCS::SVN#export): workaround for the case wcroot-abspath is not present. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-18vcs.rb: export without remote svnnobu
* tool/vcs.rb (VCS::SVN#export): export without access to the remote server. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-17vcs.rb: no empty namesnobu
* tool/vcs.rb (get_revisions): branch names must not be empty. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-17version.h: include branch namenobu
* tool/file2lastrev.rb, tool/vcs.rb (get_revisions): define RUBY_BRANCH_NAME from the current branch name. * version.h (RUBY_REVISION_STR): include the current branch name not "trunk" always. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-17vcs.rb: fake string for branch namesnobu
* tool/vcs.rb (VCS::GIT#branch): make fake string for branch names to suppress expanding as a path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-23make-snapshot: fix stable snapshotnobu
* tool/make-snapshot (package): VCS#branch_list expects glob a pattern string but not a regexp. based on the patch by Vit Ondruch. in [ruby-core:67064]. [Bug #10636] * tool/vcs.rb (VCS::SVN#branch_list): strip newlines. * tool/vcs.rb (VCS::GIT.get_revisions): retrieve modified time from toplevel log too. * tool/vcs.rb (VCS::GIT#branch_list): yield for each lines. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-16tool/vcs.rb: fix Ruby 1.8 compatibility hardernormal
Arguments after splat do not work under 1.8, either. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-15tool/vcs.rb: fix Ruby 1.8 compatibilitynormal
Symbol#to_proc is not standard in Ruby 1.8 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-15VCS::SVN#url was buggy and recent commits exposed itnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-15vcs.rb: abstractnobu
* tool/vcs.rb: abstract VCS interfaces from make-snapshot. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-15vcs.rb: non-string pathnobu
* tool/vcs.rb (VCS#get_revisions, VCS::SVN.get_revisions): allow path to be other than a string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-15vcs.rb: IO.preadnobu
* tool/vcs.rb (IO.pread): method to read command output without shell. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-13vcs.rb: srcdir parameternobu
* tool/vcs.rb (VCS#get_revisions): add srcdir optional parameter to SVN.get_revisions and GIT.get_revisions, instead of change working directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-25vcs.rb: make Time with proper offsetnobu
* tool/vcs.rb (get_revisions): use Time.new instead of Time.mktime which does not accept UTC offset, and offset manually for older versions than 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-22tool/vcs.rb: no time.rbnobu
* common.mk (Doxyfile): revert r43888, not to require preinstalled ruby. [ruby-core:64488] [Bug #10161] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-28tool/vcs.rb: discard error messagesnobu
* tool/vcs.rb (VCS#get_revisions): discard error messages for all VCS not only SVN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09rbinstall.rb: fix for non-working directorynobu
* tool/rbinstall.rb (Gem::Specification.last_date): skip if failed to get info from VCS, for example, in the case circumstance sharing working directory with another machine and run vcs tools cannot work. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09rbinstall.rb: spec date from VCSnobu
* tool/rbinstall.rb (Gem::Specification.load): obtain spec date from VCS for the case using git, RUBY_RELEASE_DATE is the last resort. probably fixes [Bug #9085]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09vcs.rb: splitnobu
* tool/vcs.rb: split from file2lastrev.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e