From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 24 10:14:14 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DCF5137B401 for ; Tue, 24 Jun 2003 10:14:14 -0700 (PDT) Received: from hannibal.servitor.co.uk (hannibal.servitor.co.uk [195.188.15.48]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3F0AA43FBF for ; Tue, 24 Jun 2003 10:14:14 -0700 (PDT) (envelope-from paul@hannibal.servitor.co.uk) Received: from paul by hannibal.servitor.co.uk with local (Exim 4.14) id 19UrNC-000BG7-7k; Tue, 24 Jun 2003 18:14:26 +0100 Date: Tue, 24 Jun 2003 18:14:26 +0100 From: Paul Robinson To: Varshavchick Alexander Message-ID: <20030624171426.GU34365@iconoplex.co.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Paul Robinson cc: freebsd-hackers@FreeBSD.ORG Subject: Re: How to delete unix socket entries X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jun 2003 17:14:15 -0000 On Tue, Jun 24, 2003 at 08:59:49PM +0400, Varshavchick Alexander wrote: > I had a wrong-behaved server application which opened a unix socket to > respond to incoming connections, so that after the socket was opened, the > application core dumped each time it was launched. As a result, 'netstat > -f unix' now shows a lot of not-needed active entries. Is there any way to > delete them, or will they eventually die by themselves? A "better" way to do this is to use sockstat: paul@hannibal:~> sockstat -u USER COMMAND PID FD PROTO ADDRESS root screen 30084 4 stream /tmp/screens/S-paul/30084.ttyp0.hannibal root pure-ftp 22112 3 dgram syslogd[67]:3 root named 56824 3 dgram syslogd[67]:3 root ntpd 11575 3 dgram syslogd[67]:3 mysql mysqld 53779 6 stream /tmp/mysql.sock root syslogd 67 3 dgram /var/run/log paul@hannibal:~> you then *know* which are the safe sockets to destroy. If it's a stream socket, you've got a file that you can rm - they're not going anywhere of their own accord.* The short answer then is "rm them, but make sure you rm the right ones". -- Paul Robinson * If you reboot the machine, depending on how things are setup on your machine, /tmp and /var/tmp may or may not get rm'ed anyway, so the system has "cleared" the sockets on your behalf.