[xmonad] darcs patch: get rid of zombies in a more portable way

Tomas Janousek tomi at nomi.cz
Sun Apr 11 15:03:13 EDT 2010


Sun Apr 11 20:55:10 CEST 2010  Tomas Janousek <tomi at nomi.cz>
  * get rid of zombies in a more portable way
  
  FreeBSD and OpenBSD don't support the signal(SIGCHLD, SIG_IGN) way of dealing
  with them. Wikipedia quote on the issue:
  
  "POSIX.1-2001 allows a parent process to elect for the kernel to automatically
  reap child processes that terminate by setting the disposition of SIGCHLD to
  SIG_IGN or by setting the SA_NOCLDWAIT flag for the SIGCHLD signal; Linux 2.6
  kernels adhere to this behavior while FreeBSD supports only the latter of
  these methods. Because of historical differences between System V and BSD
  behaviors with regard to ignoring SIGCHLD, calling wait remains the most
  portable paradigm for cleaning up after forked child processes."
  

-- 
Tomáš Janoušek, a.k.a. Liskni_si, http://work.lisk.in/
-------------- next part --------------

New patches:

[get rid of zombies in a more portable way
Tomas Janousek <tomi at nomi.cz>**20100411185510
 Ignore-this: 9894157a39dd5f10a01740272b66b41e
 
 FreeBSD and OpenBSD don't support the signal(SIGCHLD, SIG_IGN) way of dealing
 with them. Wikipedia quote on the issue:
 
 "POSIX.1-2001 allows a parent process to elect for the kernel to automatically
 reap child processes that terminate by setting the disposition of SIGCHLD to
 SIG_IGN or by setting the SA_NOCLDWAIT flag for the SIGCHLD signal; Linux 2.6
 kernels adhere to this behavior while FreeBSD supports only the latter of
 these methods. Because of historical differences between System V and BSD
 behaviors with regard to ignoring SIGCHLD, calling wait remains the most
 portable paradigm for cleaning up after forked child processes."
 
] {
hunk ./XMonad/Core.hs 505
 installSignalHandlers :: MonadIO m => m ()
 installSignalHandlers = io $ do
     installHandler openEndedPipe Ignore Nothing
-    installHandler sigCHLD Ignore Nothing
-    (try :: IO a -> IO (Either SomeException a))
-      $ fix $ \more -> do
-        x <- getAnyProcessStatus False False
-        when (isJust x) more
-    return ()
+    installHandler sigCHLD (Catch cleanZombies) Nothing
+    cleanZombies
 
 uninstallSignalHandlers :: MonadIO m => m ()
 uninstallSignalHandlers = io $ do
hunk ./XMonad/Core.hs 513
     installHandler openEndedPipe Default Nothing
     installHandler sigCHLD Default Nothing
     return ()
+
+cleanZombies :: IO ()
+cleanZombies = do
+    (try :: IO a -> IO (Either SomeException a))
+      $ fix $ \more -> do
+        x <- getAnyProcessStatus False False
+        when (isJust x) more
+    return ()
}

Context:

[Replaced custom forever_ by library function
Daniel Schoepe <asgaroth_ at gmx.de>**20090114215556] 
[reveal: don't insert non-clients into the set of mapped windows
Tomas Janousek <tomi at nomi.cz>**20100327214243
 Ignore-this: 68c0a43d761e626cb9544ca386f4846d
 
 In xmonad-core, this fixes a small bug that caused doIgnored windows to get
 into `mapped' and never being removed from there.
 
 In the context of xmonad-contrib, this fixes a tremendous memory leak that
 could be triggered by using MouseResizableTile and UrgencyHook at the same
 time. MRT would create dummy windows that would get added to `mapped' by the
 reveal call in `windows'. As these were not removed (removal from `mapped' is
 filtered by `isClient'), they'd stay there forever and due to an inefficiency
 in UrgencyHook would eat up all memory sooner or later.
] 
[loc.hs: hlintify
gwern0 at gmail.com**20100213231537
 Ignore-this: c447928ce68d0a968b55af3539c979fa
] 
[Various clean-ups suggested by HLint
Spencer Janssen <spencerjanssen at gmail.com>**20100214025750
 Ignore-this: ccaa6e774f2f8169e6083eddcffe31b6
] 
[Make the --replace docs consistent
Spencer Janssen <spencerjanssen at gmail.com>**20100213002647
 Ignore-this: c99526bce66ae1154fbf5713622f035d
] 
[Add --replace flag with documentation (issue 99).
Adam Vogt <vogt.adam at gmail.com>**20091220183529
 Ignore-this: c56000295b75c66309913e29e1671d88
] 
[Fix compile error when using base-3 (thanks bogner).
Adam Vogt <vogt.adam at gmail.com>**20100211063938
 Ignore-this: 60ba65613bc746e7e88f11a7e30b050f
] 
[Broadcast PropertyChange events (needed for layouts with decoration)
Daniel Schoepe <daniel.schoepe at gmail.com>**20100113204017
 Ignore-this: c8315f438fed66b12282c9bfe70a4d0b
] 
[Rename numlockMask to numberlockMask to help users of the template config.
Adam Vogt <vogt.adam at gmail.com>**20100118162256
 Ignore-this: 4050ed2d1ad373386c2e2b44145f07d9
 
 Without the change, the errors are like:
 
 >     [ unrelated error messages ]
 >     No constructor has all these fields: `numlockMask',
 >       `terminal', [every other field set]
 
 With the change:
 
 >     `numlockMask' is not a record selector
 >     [ context where numlockMask is named ]
] 
[Correct warnings with ghc-6.12
Adam Vogt <vogt.adam at gmail.com>**20100118181532
 Ignore-this: a48ed095b72aedec9eeb88781ace66dc
 
 Changes include:
   - compatibility with base-4 or 3 (base-2 untested) by using
     extensible-exceptions. This adds an additional dependency for users of
     ghc<6.10)
   - list all dependencies again when -ftesting (change in Cabal-1.8.0.2)
   - remove unnecessary imports
   - suppress -fwarn-unused-do-bind, with appropriate Cabal-1.8 workaround,
     described here:
     http://www.haskell.org/pipermail/xmonad/2010-January/009554.html
] 
[Add xfork: a forkProcess that works around process global state
Spencer Janssen <spencerjanssen at gmail.com>**20091223061623
 Ignore-this: 3f968260d8c1b6710c82566520c47c43
] 
[TAG 0.9.1
Spencer Janssen <spencerjanssen at gmail.com>**20091216233643
 Ignore-this: 856abdca8283155bbb8bdf003797ba34
] 
[extra-source-files for the new manpage
Spencer Janssen <spencerjanssen at gmail.com>**20091216232005
 Ignore-this: 919d964238198dd56d96a5052c2419c7
] 
[Bump to 0.9.1
Spencer Janssen <spencerjanssen at gmail.com>**20091216231110
 Ignore-this: 8a03850d758e1e4030d930cd8bf08ba9
] 
[Determine numlockMask automatically, fixes #120
Spencer Janssen <spencerjanssen at gmail.com>**20091216012140
 Ignore-this: d80c82dd0a23dc7a77fdc32fd2792130
] 
[Update for X11 1.5.0.0
Spencer Janssen <spencerjanssen at gmail.com>**20091216011700
 Ignore-this: 669c764c4c0ca516c8bdc1dfa35cd66
] 
[Safer X11 version dependency
Spencer Janssen <spencerjanssen at gmail.com>**20091216010330
 Ignore-this: 8297f7a6a65c5c97f83f860f642fc25
] 
[man/xmonad.hs: remove reference to deprecated 'dynamicLogDzen' function
Brent Yorgey <byorgey at cis.upenn.edu>**20091126053908
 Ignore-this: 7aeeac9791ffd3e6ac22bf158ea86536
] 
[A few tweaks to --verbose-version
Spencer Janssen <spencerjanssen at gmail.com>**20091208040729
 Ignore-this: cf3d6a904d23891829c10f4966974673
] 
[Generalize the type of (<+>). It can be used for keybindings too.
Adam Vogt <vogt.adam at gmail.com>**20091205233611
 Ignore-this: af15248be5e483d1a6e924f786fcc1c4
] 
[Main.hs +--verbose-version flag
gwern0 at gmail.com**20091128144840
 Ignore-this: 61a081f33adb460ea459950a750dd93f
 This resolves http://code.google.com/p/xmonad/issues/detail?id=320 by adding a
 --verbose-version option yielding output like "xmonad 0.9 compiled by ghc 6.10 for linux/i386"
] 
[Swap the order that windows are mapped/unmapped.  Addresses #322
Spencer Janssen <spencerjanssen at gmail.com>**20091119025440
 Ignore-this: 22087204f1b84dae98a3cf2b7f116d3f
] 
[Add GPL warning to GenerateManpage
Spencer Janssen <spencerjanssen at gmail.com>**20091111000106
 Ignore-this: ea24691b8198976a4088a2708e0b4c94
] 
[Add a basic header to the html manpage output
Adam Vogt <vogt.adam at gmail.com>**20091028033042
 Ignore-this: 2641e0fb3179616075fa7549b57740f3
] 
[Use pandoc to convert a markdown manpage tranlation to html and man.
Adam Vogt <vogt.adam at gmail.com>**20091028030639
 Ignore-this: cdf7cdc8e44b21de8fc7725bde299792
] 
[Support for extensible state in contrib modules.
Daniel Schoepe <daniel.schoepe at gmail.com>**20091106115050
 Ignore-this: d04ee1989313ed5710c94f9d7fda3f2a
] 
[Set SIGPIPE to default in forked processes
Spencer Janssen <spencerjanssen at gmail.com>**20091106223743
 Ignore-this: f73943e4fe6c5f08967ddb82afad3eaa
] 
[TAG 0.9
Spencer Janssen <spencerjanssen at gmail.com>**20091026004641
 Ignore-this: 80347d432f3b606c8d722536d0d729aa
] 
Patch bundle hash:
48bebc387c7de073e88f91688e746c03fe37354d



More information about the xmonad mailing list