From owner-freebsd-stable@FreeBSD.ORG Sun Aug 10 12:58:53 2003 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9C38C37B401 for ; Sun, 10 Aug 2003 12:58:53 -0700 (PDT) Received: from david.siemens.de (david.siemens.de [192.35.17.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 13DCA43FBD for ; Sun, 10 Aug 2003 12:58:52 -0700 (PDT) (envelope-from andre.albsmeier@siemens.com) Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by david.siemens.de (8.11.7/8.11.7) with ESMTP id h7AJwmX08815; Sun, 10 Aug 2003 21:58:48 +0200 (MEST) Received: from mars.cert.siemens.de (ust.mchp.siemens.de [139.23.201.17]) by mail3.siemens.de (8.11.7/8.11.7) with ESMTP id h7AJwlG19379; Sun, 10 Aug 2003 21:58:47 +0200 (MEST) Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.42.7]) 1.46 2003/05/28 09:28:32 ust Exp $) with ESMTP id h7AJwltQ016854; Sun, 10 Aug 2003 21:58:47 +0200 (CEST) Received: (from localhost) by curry.mchp.siemens.de (8.12.9/8.12.9) id h7AJwl9F014246; Date: Sun, 10 Aug 2003 21:58:46 +0200 From: Andre Albsmeier To: othermark Message-ID: <20030810195846.GA65889@curry.mchp.siemens.de> References: <20030808133657.GA42855@curry.mchp.siemens.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Echelon: strike, USSS, Telex, Blowfish, codes X-Advice: Drop that crappy M$-Outlook, I'm tired of your viruses! User-Agent: Mutt/1.5.4i cc: freebsd-stable@freebsd.org Subject: Re: stable libmilter leaks kqueue descriptors? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Aug 2003 19:58:53 -0000 On Fri, 08-Aug-2003 at 18:08:31 +0000, othermark wrote: > I'm glad I'm not 'seeing' things. If you have a good enough idea > of where the leakage is occuring, could you file a PR against -STABLE? > I'd like to see this fixed soon. I'm not even sure that the pr I > referenced is the exact problem, but seems likely. The PR seems to be the right one for our problem. I have simply stolen the patch from -current and did the HIDDEN_SYSCALLS additionally (see below). This might be complete nonsense but it fixed my problem here. I hope someone commits the real fix to -STABLE r.s.n. This is what I did: --- lib/libc_r/Makefile.ORI Wed Oct 23 08:23:54 2002 +++ lib/libc_r/Makefile Fri Aug 8 15:38:08 2003 @@ -30,7 +30,7 @@ execve.o fchflags.o fchmod.o fchown.o fcntl.o \ flock.o fpathconf.o fstat.o fstatfs.o fsync.o getdirentries.o \ getlogin.o getpeername.o getsockname.o getsockopt.o ioctl.o \ - kevent.o listen.o \ + kevent.o kqueue.o listen.o \ msync.o nanosleep.o open.o poll.o read.o readv.o recvfrom.o \ recvmsg.o sched_yield.o select.o sendfile.o sendmsg.o sendto.o \ setsockopt.o shutdown.o sigaction.o \ --- lib/libc_r/uthread/Makefile.inc.ORI Wed May 28 10:35:18 2003 +++ lib/libc_r/uthread/Makefile.inc Fri Aug 8 14:23:16 2003 @@ -71,6 +71,7 @@ uthread_join.c \ uthread_kern.c \ uthread_kevent.c \ + uthread_kqueue.c \ uthread_kill.c \ uthread_listen.c \ uthread_main_np.c \ --- lib/libc_r/uthread/uthread_kqueue.c.ORI Fri Aug 8 14:23:31 2003 +++ lib/libc_r/uthread/uthread_kqueue.c Fri Aug 8 15:39:07 2003 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2003 Mark Peek + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include "pthread_private.h" + +__weak_reference(_kqueue, kqueue); + +int +_kqueue(void) +{ + int fd; + + /* Create a kqueue: */ + if ((fd = __sys_kqueue()) < 0) { + /* Error creating socket. */ + + /* Initialise the entry in the file descriptor table: */ + } else if (_thread_fd_table_init(fd) != 0) { + __sys_close(fd); + fd = -1; + } + return (fd); +} -Andre > > In article <20030808133657.GA42855@curry.mchp.siemens.de>, > Andre Albsmeier wrote: > > > I have a self-written milter app. Today I upgraded to the recent > > -STABLE and now it eats KQUEUE filedscriptors like crazy. I tried > > to MFC the fix in lib/libc_r/uthread/uthread_kqueue.c but I always > > get complaints about multiple definition of `_kqueue': > > > > building shared library libc_r.so.4 > > kqueue.So: In function `_kqueue': > > kqueue.So(.text+0x14): multiple definition of `_kqueue' > > uthread_kqueue.So(.text+0x0): first defined here > > *** Error code 1 > > > > Seems it conflicts with /usr/obj/lib/libc_r/kqueue.S > > which is generated everytime from scratch during the build. > > > > I assume that I have to add kqueue.o to HIDDEN_SYSCALLS > > but I am not sure if this is correct and what it will break :-) > > --- > Mark > atkin901 at NOSPAM yahoo dot com > (!wired)?(coffee++):(wired); > > _______________________________________________ > freebsd-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org" -- Win98: useless extension to a minor patch release for 32-bit extensions and a graphical shell for a 16-bit patch to an 8-bit operating system originally coded for a 4-bit microprocessor, written by a 2-bit company that can't stand for 1 bit of competition.