From owner-freebsd-arch@FreeBSD.ORG Mon Jun 4 16:41:16 2007 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6224316A400 for ; Mon, 4 Jun 2007 16:41:16 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (vlk.vlakno.cz [62.168.28.247]) by mx1.freebsd.org (Postfix) with ESMTP id 2026513C4B0 for ; Mon, 4 Jun 2007 16:41:16 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 7B4468BDAC9 for ; Mon, 4 Jun 2007 18:24:31 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (vlk.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id raO7-wUP1wVa for ; Mon, 4 Jun 2007 18:24:30 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 873BB8BDA8F for ; Mon, 4 Jun 2007 18:24:30 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.13.8/8.13.8/Submit) id l54GOUkZ077224 for arch@freebsd.org; Mon, 4 Jun 2007 18:24:30 +0200 (CEST) (envelope-from rdivacky) Date: Mon, 4 Jun 2007 18:24:30 +0200 From: Roman Divacky To: arch@freebsd.org Message-ID: <20070604162430.GA76813@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Cc: Subject: *at family of syscalls in FreeBSD X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2007 16:41:16 -0000 Hi, Starting from Linux 2.6.16, there is available so called *at syscalls. For example openat(), linkat() etc. Those syscalls are used to avoid races in threaded programs and to implement per-thread CWD. in other words they are usefull. Thats why Linux implemented them. I am currently implementing those in our Linuxulator. As suggested by Robert Watson I implemented general kern_fooat() functions and wrapped them around those kern_fooat() functions. It works ok and everything. But I want to introduce native *at syscalls for FreeBSD binaries. Hence I am here to discuss the API. My suggestion: use Linux API with some slight naming changes: syscalls: openat(), mkdirat(), mknodat(), chownat(), utimesat(), statat(), unlinkat(), renameat(), linkat(), symlinkat(), readlinkat(), chmodat(), accessat(). example of a syscall: int openat(int dirfd, char *path, int flags, int mode); ie. exactly the same API as Linux have with the exception of naming them sanely, ie. instead for example fchownat() we have chownat() because it does not operate on a fd but on a path. I am not sure about compatibility but we can always introduce a weak reference like fchownat() -> chownat(). I want to have special AT_FDCWD -100 define for "cwd" argument, just like linux. I am currently finishing my linuxulator-side work and I'd like to see this in 7.0R so please comment on the API and the idea of introducing those syscalls in FreeBSD. thank you Roman Divacky