From owner-freebsd-arch@FreeBSD.ORG Mon Aug 29 04:24:34 2011 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8503106566C; Mon, 29 Aug 2011 04:24:34 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id 9ABA98FC0C; Mon, 29 Aug 2011 04:24:34 +0000 (UTC) Received: from julian-mac.elischer.org (home-nat.elischer.org [67.100.89.137]) (authenticated bits=0) by vps1.elischer.org (8.14.4/8.14.4) with ESMTP id p7T4BkLX045936 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 28 Aug 2011 21:11:48 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <4E5B1194.2020600@freebsd.org> Date: Sun, 28 Aug 2011 21:12:04 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.20) Gecko/20110804 Thunderbird/3.1.12 MIME-Version: 1.0 To: "K. Macy" References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: arch@freebsd.org Subject: Re: Prefixing system calls to eliminate namespace collisions between kernel and libc 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, 29 Aug 2011 04:24:34 -0000 On 8/28/11 5:05 AM, K. Macy wrote: > This change was motivated by a library that I have written which is, > in effect, a run-time environment for running the freebsd kernel > network stack in userspace. With the exception of a small change to > makesyscalls.sh, this change is entirely mechanical. All > non-compatibility kernel entry points (e.g. not linux_, freebsd32_, > freebsd6_, etc.) are prefixed with sys_ to eliminate collisions > between system call implementations and their libc names. > > NetBSD long ago made this change as well. and for linux this may > always have been the case. Linking POSIX programs against parts of the > kernel can actually be done just by mangling things during dynamic > linking, so doesn't require the above, but it is certainly easier and > more portable with the above. Ultimately I would like my userspace > network stack to be able to run on windows as well. I don't think that > I have the same flexibility there with regards to linker scripts. > > My userspace stack could ease networking code development by allowing > initial work to take place in userspace. > > syscalls.master is unchanged: > 97 AUE_SOCKET STD { int socket(int domain, int type, \ > int protocol); } > > Only the source function changes name: > diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c > index 0e5efe6..3b83e1c 100644 > --- a/sys/kern/uipc_syscalls.c > +++ b/sys/kern/uipc_syscalls.c > @@ -171,7 +171,7 @@ getsock_cap(struct filedesc *fdp, int fd, > cap_rights_t rights, > #endif > > int > -socket(td, uap) > +sys_socket(td, uap) > struct thread *td; > struct socket_args /* { > int domain; > @@ -210,7 +210,7 @@ socket(td, uap) > > > > Please see: > > http://pastebin.com/PpC5uThs > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" > I see no reason to not make this change.. actually I'd be happy making in 9.