unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* BLOCK_INPUT on Mac OS X
@ 2004-09-03 12:41 YAMAMOTO Mitsuharu
  2004-09-03 13:51 ` Kim F. Storm
  2004-09-03 16:48 ` Stefan Monnier
  0 siblings, 2 replies; 14+ messages in thread
From: YAMAMOTO Mitsuharu @ 2004-09-03 12:41 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1710 bytes --]

I'm now trying to fill missing BLOCK_INPUTs for Mac OS X.  I suspect
occasional hang of Carbon Emacs is due to the heap corruption caused
by interrupted malloc/free mentioned in blockinput.h.

Two patches are attached.  The first one is for adding missing
BLOCK_INPUTs that I tracked down (mainly for window operations).  The
second one is for a helper that assists us to detect
malloc/calloc/valloc/realloc/free that is not protected by
BLOCK_INPUT.  It hooks a check function to each internal memory
allocation routine.  To use this, compile with "CFLAGS=-g
-DDEBUG_BLOCK_INPUT" after applying both patches, and set a break
point to `debug_block_input'.  It works only on Carbon build.

I have some questions about this issue.

1. The check function that is executed in every malloc call is as
   follows:

    int
    check_block_input ()
    {
      sigset_t mask;

      if (poll_suppress_count == 0 && interrupt_input_blocked == 0)
	{
	  sigprocmask (0, NULL, &mask);
	  if (!sigismember (&mask, SIGALRM))
	   {
	     debug_block_input ();
	     return -1;
	   }
	}
      return 0;
    }

   Is this correct?  Or does it produce a false alarm?
   (Carbon Emacs uses polling by SIGALRM, because window events don't
    come from sockets and we can't use SIGIO.)

2. The following library functions are detected as those that may call
   malloc and so on without BLOCK_INPUT.

   localtime, gmtime, ctime, opendir, getc, getaddrinfo, fwrite, mkstemp
   fclose, closedir, freeaddrinfo

   If the check function in the previous item is correct, should we
   make a wrapper function for each of them?  Or add BLOCK_INPUTs to
   caller functions?

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

[-- Attachment #2: diff-blockinput.gz --]
[-- Type: application/octet-stream, Size: 2367 bytes --]

[-- Attachment #3: diff-blockinput-debug.gz --]
[-- Type: application/octet-stream, Size: 1782 bytes --]

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-11-29 10:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-03 12:41 BLOCK_INPUT on Mac OS X YAMAMOTO Mitsuharu
2004-09-03 13:51 ` Kim F. Storm
2004-09-03 16:48 ` Stefan Monnier
2004-09-04  9:07   ` YAMAMOTO Mitsuharu
2004-09-06 16:17     ` Stefan
2004-09-07  8:21       ` YAMAMOTO Mitsuharu
2004-09-07 12:27         ` Stefan
2004-09-08 11:38           ` YAMAMOTO Mitsuharu
2004-09-08 12:56             ` Stefan Monnier
2004-11-25 19:13               ` Dr. Carsten Bormann
2004-11-25 19:58                 ` Stefan Monnier
2004-11-26 10:09                   ` YAMAMOTO Mitsuharu
2004-11-26 14:24                     ` POSIX_SIGNALS (was: BLOCK_INPUT on Mac OS X) Stefan Monnier
2004-11-29 10:12                       ` YAMAMOTO Mitsuharu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).