From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 1 16:35:36 2006 Return-Path: X-Original-To: hackers@freebsd.org 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 32CF616A403; Sun, 1 Oct 2006 16:35:36 +0000 (UTC) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (eva.fit.vutbr.cz [147.229.176.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9A84243D46; Sun, 1 Oct 2006 16:35:34 +0000 (GMT) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (localhost [127.0.0.1]) by eva.fit.vutbr.cz (envelope-from xdivac02@eva.fit.vutbr.cz) (8.13.8/8.13.7) with ESMTP id k91GZWou039896 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 1 Oct 2006 18:35:32 +0200 (CEST) Received: (from xdivac02@localhost) by eva.fit.vutbr.cz (8.13.8/8.13.3/Submit) id k91GZWJH039895; Sun, 1 Oct 2006 18:35:32 +0200 (CEST) Date: Sun, 1 Oct 2006 18:35:32 +0200 From: Divacky Roman To: hackers@freebsd.org Message-ID: <20061001163532.GA39376@stud.fit.vutbr.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i X-Scanned-By: MIMEDefang 2.57 on 147.229.176.14 Cc: emulation@freebsd.org Subject: filedesc copying in fork() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Oct 2006 16:35:36 -0000 hi I am trying to implement CLONE_FS in linuxolator clone(). This flags is used when we want the newly created thread share root/cwd/umask. In FreeBSD we have a flags to fork1() RFFDG/RFCFDG. The first one tells fork1() to copy the filedesc from old proc to the new one. The later says we should create new filedesc struct. If neither of these is given the filedesc struct is shared among the processes. is my analysis correct? currently in the linuxolator we dont set any of this flags passed to fork1() ie. doing CLONE_FS semantics on default. I am a little confused from linux behaviour because it seems to me that they dont share open file descriptors betweeen processes after fork() which is strange. comments? roman ---------------------- www.liberalnistrana.cz