Skip to content

Commit

Permalink
Support the non-Darwin track flag for processes.
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Feb 8, 2010
1 parent 2ad9b16 commit 2410986
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/rb-kqueue/native/flags.rb
Expand Up @@ -54,6 +54,9 @@ module Flags
NOTE_PROC_EXEC = 0x20000000 # Process exec'd
NOTE_PROC_REAP = 0x10000000 # Process reaped
NOTE_PROC_SIGNAL = 0x08000000 # Received signal
NOTE_TRACK = 0x00000001 # follow across forks
NOTE_TRACKERR = 0x00000002 # could not track child
NOTE_CHILD = 0x00000004 # am a child process


# Converts a list of flags to the bitmask that the C API expects.
Expand Down
8 changes: 8 additions & 0 deletions lib/rb-kqueue/queue.rb
Expand Up @@ -246,6 +246,14 @@ def watch_file(path, *flags, &callback)
# : The process was reaped by the parent via `wait(2)` or similar.
# This is only supported under Darwin/OS X.
#
# `:track`
# : Follow the process across `fork(2)` calls.
# {Event#flags} for the parent process will contain `:fork`,
# while {Event#flags} for the child process will contain `:child`.
# If the system was unable to attach an event to the child process,
# {Event#flags} will contain `:trackerr`.
# This is not supported under Darwin/OS X.
#
# @param pid [Fixnum] The id of the process.
# @param flags [Array<Symbol>] Which events to watch for.
# @yield [event] A block that will be run when the process changes.
Expand Down

0 comments on commit 2410986

Please sign in to comment.