From owner-freebsd-hackers Sat Aug 11 14: 7:43 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from elvis.mu.org (elvis.mu.org [216.33.66.196]) by hub.freebsd.org (Postfix) with ESMTP id E829E37B409; Sat, 11 Aug 2001 14:07:38 -0700 (PDT) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id B255E81D06; Sat, 11 Aug 2001 16:07:28 -0500 (CDT) Date: Sat, 11 Aug 2001 16:07:28 -0500 From: Alfred Perlstein To: Terry Lambert Cc: Michael Robinson , current@FreeBSD.ORG, hackers@FreeBSD.ORG Subject: Re: _sigprocmask in malloc.c causes full file table? Message-ID: <20010811160728.U85642@elvis.mu.org> References: <200108110115.f7B1F4100321@netrinsics.com> <3B75822F.E84799BD@mindspring.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3B75822F.E84799BD@mindspring.com>; from tlambert2@mindspring.com on Sat, Aug 11, 2001 at 12:06:23PM -0700 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Terry Lambert [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