From owner-freebsd-current Thu Dec 3 10:39:56 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA06128 for freebsd-current-outgoing; Thu, 3 Dec 1998 10:39:56 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from highwind.com (hurricane.highwind.com [209.61.45.50]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA06101 for ; Thu, 3 Dec 1998 10:39:52 -0800 (PST) (envelope-from info@highwind.com) Received: (from info@localhost) by highwind.com (8.8.6/8.8.6) id NAA01466; Thu, 3 Dec 1998 13:39:27 -0500 (EST) Date: Thu, 3 Dec 1998 13:39:27 -0500 (EST) Message-Id: <199812031839.NAA01466@highwind.com> From: HighWind Software Information To: current@FreeBSD.ORG Subject: Re: Thread fd locking and fork() Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Again.. having a conversation with myself: Wouldn't inserting this code in uthread_fork.c at line 122 fix this problem? /* * Enter a loop to remove all locks on all locked fd's */ for (i = 0; i < _thread_dtablesize; i++) { if (_thread_fd_table[i] != NULL) { memset(&_thread_fd_table[i]->lock, 0, sizeof(_thread_fd_table[i]->lock)); _thread_fd_table[i]->r_owner = NULL; _thread_fd_table[i]->w_owner = NULL; _thread_fd_table[i]->r_fname = NULL; _thread_fd_table[i]->w_fname = NULL; _thread_fd_table[i]->r_lineno = 0;; _thread_fd_table[i]->w_lineno = 0;; _thread_fd_table[i]->r_lockcount = 0; _thread_fd_table[i]->w_lockcount = 0; /* Initialise the read/write queues: */ _thread_queue_init(&_thread_fd_table[i]->r_queue); _thread_queue_init(&_thread_fd_table[i]->w_queue); } } We know we are in the child, we know we are the only active thread, we know we don't have any fd's locked and we just nuked all the other threads. So, just go to the fd table and nuke any and all locks. I'm going to give this a try, but, would appreciate if someone gave me some comments. -Rob To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message