Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Aug 2001 16:07:28 -0500
From:      Alfred Perlstein <bright@mu.org>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        Michael Robinson <robinson@netrinsics.com>, current@FreeBSD.ORG, hackers@FreeBSD.ORG
Subject:   Re: _sigprocmask in malloc.c causes full file table?
Message-ID:  <20010811160728.U85642@elvis.mu.org>
In-Reply-To: <3B75822F.E84799BD@mindspring.com>; from tlambert2@mindspring.com on Sat, Aug 11, 2001 at 12:06:23PM -0700
References:  <200108110115.f7B1F4100321@netrinsics.com> <3B75822F.E84799BD@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
* Terry Lambert <tlambert2@mindspring.com> [010811 14:06] wrote:
> Michael Robinson wrote:
> > 
> > I'm currently trying to deal with the problem where malloc/free in a
> > signal handler will crash (in my case, the X window server) if a signal
> > arrives during malloc or free.
> 
> The manual pages suck, since this should be under signal(3), not
> as a reference to sigaction(2), but...
> 
> 	man 2 sigaction
> 
> You can not allocate or free in signal handlers because malloc(3)
> and free(3) use brk(2) and sbrk(2), which are system calls that
> can't be used in a signal handler, since they are missing from
> the list of permitted function.

It's really the fact that malloc/free are not re-entrant that causes
the problem.  brk/sbrk by itself should be safe to call from a
signal handler as they are syscalls and don't really share state
with the process context in userland.

-- 
-Alfred Perlstein [alfred@freebsd.org]
Ok, who wrote this damn function called '??'?
And why do my programs keep crashing in it?

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010811160728.U85642>