From f34618e64b254f7792b476acf2e7eb426aa551a2 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 13 Apr 2009 11:46:14 -0700 Subject: Expose worker to {before,after}_fork hooks Instead of just worker.nr. This is a configuration file/API change and will break existing configurations. This allows worker.tempfile to be exposed to the hooks so ownership changes can still happen on it. On the other hand, I don't know of many people actually using this feature (or Unicorn). --- lib/unicorn.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/unicorn.rb') diff --git a/lib/unicorn.rb b/lib/unicorn.rb index c1e8fcd..4465109 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -389,7 +389,7 @@ module Unicorn tempfile = Tempfile.new('') # as short as possible to save dir space tempfile.unlink # don't allow other processes to find or see it worker = Worker.new(worker_nr, tempfile) - @before_fork.call(self, worker.nr) + @before_fork.call(self, worker) pid = fork { worker_loop(worker) } @workers[pid] = worker end @@ -438,7 +438,7 @@ module Unicorn @start_ctx = @workers = @rd_sig = @wr_sig = nil @listeners.each { |sock| sock.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) } worker.tempfile.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) - @after_fork.call(self, worker.nr) if @after_fork # can drop perms + @after_fork.call(self, worker) if @after_fork # can drop perms @request = HttpRequest.new(logger) build_app! unless @preload_app end -- cgit v1.2.3-24-ge0c7