Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 May 2013 11:39:13 +0100 (BST)
From:      Karl Dreger <k.dreger@yahoo.de>
To:        Mateusz Guzik <mjguzik@gmail.com>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: syscall to userland interface
Message-ID:  <1368268753.73979.YahooMailNeo@web171503.mail.ir2.yahoo.com>
In-Reply-To: <20130511085805.GA23033@dft-labs.eu>
References:  <1368214284.29611.YahooMailNeo@web171503.mail.ir2.yahoo.com> <518D4C4F.90902@mu.org> <1368260611.67320.YahooMailNeo@web171505.mail.ir2.yahoo.com> <20130511085805.GA23033@dft-labs.eu>

index | next in thread | previous in thread | raw e-mail

Yes, that makes it clear. Now, that you are actually speaking
about the syscall table, I have to say that I was aware of there
being one, but I never before saw it that way.

Thanks




________________________________
 Von: Mateusz Guzik <mjguzik@gmail.com>
An: Karl Dreger <k.dreger@yahoo.de> 
CC: "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>; Alfred Perlstein <bright@mu.org> 
Gesendet: 16:58 Samstag, 11.Mai 2013
Betreff: Re: syscall to userland interface
 

On Sat, May 11, 2013 at 09:23:31AM +0100, Karl Dreger wrote:
> What my question boils down to is this: when running fork and friends 
> 
> from userland they are invoked as:
> 
> fork();, open();, read();, close(); ...
> 
> 
> but are defined as:
> 
> sys_fork(), sys_open(), sys_read(), sys_close(), ...
> 
> in their actual c definition.

sys_* are symbols visible only in the kernel, and as such their names
or existence is not visible from userspace.

The kernel has syscall table - each syscall has an entry in the table at
specified offset (syscall number) with a pointer to function
implementing given syscall.

Userspace knows syscall numbers.

So the common thing for both userspace and kernel is syscall number, it
has nothing to do with names.

Here is an example how syscall worked on i386:
- you put syscall numer in eax register
- you call the kernel by issuing int 80h
- handler in the kernel takes number from eax, looks up appropriate
  function from syscall table and calls that function

Here is an example:
http://www.freebsd.org/doc/en/books/developers-handbook/x86-system-calls.html

e.g. fork has number 2.
So, what userspace fork function does is simply telling the kernel to
execute syscall number 2. It is not important how function implementing
this syscall is named, it could be "foobarbecausewhynot".

I hope this clears things up.
-- 
Mateusz Guzik <mjguzik gmail.com>
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
From owner-freebsd-hackers@FreeBSD.ORG  Sat May 11 05:47:06 2013
Return-Path: <owner-freebsd-hackers@FreeBSD.ORG>
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by hub.freebsd.org (Postfix) with ESMTP id AB5A8417;
 Sat, 11 May 2013 05:47:06 +0000 (UTC) (envelope-from sjg@juniper.net)
Received: from exprod7og127.obsmtp.com (exprod7og127.obsmtp.com [64.18.2.210])
 by mx1.freebsd.org (Postfix) with ESMTP id 41AB895C;
 Sat, 11 May 2013 05:47:06 +0000 (UTC)
Received: from P-EMHUB02-HQ.jnpr.net ([66.129.224.36]) (using TLSv1) by
 exprod7ob127.postini.com ([64.18.6.12]) with SMTP
 ID DSNKUY3bWXKIIAJB9Hv1nV0YLkQY0KBsc0D/@postini.com;
 Fri, 10 May 2013 22:47:06 PDT
Received: from magenta.juniper.net (172.17.27.123) by P-EMHUB02-HQ.jnpr.net
 (172.24.192.33) with Microsoft SMTP Server (TLS) id 8.3.213.0; Fri, 10 May
 2013 22:45:36 -0700
Received: from chaos.jnpr.net (chaos.jnpr.net [172.24.29.229])	by
 magenta.juniper.net (8.11.3/8.11.3) with ESMTP id r4B5jaL66346;	Fri, 10 May
 2013 22:45:36 -0700 (PDT)	(envelope-from sjg@juniper.net)
Received: from chaos.jnpr.net (localhost [127.0.0.1])	by chaos.jnpr.net
 (Postfix) with ESMTP id 7707958097;	Fri, 10 May 2013 22:45:36 -0700 (PDT)
To: Baptiste Daroussin <bapt@freebsd.org>
Subject: Making bmake default? (was: Re: ports/173299: [exp-run] test bmake
 conversion)
In-Reply-To: <CAPKC6oKx67biFDcMG2MBzJAE+eRE5SeApfoqfztm+t2gX3BopQ@mail.gmail.com>
References: <CAPKC6oKx67biFDcMG2MBzJAE+eRE5SeApfoqfztm+t2gX3BopQ@mail.gmail.com>
Comments: In-reply-to: Baptiste Daroussin <bapt@freebsd.org>
 message dated "Mon, 06 May 2013 00:11:51 +0200."
From: "Simon J. Gerraty" <sjg@juniper.net>
X-Mailer: MH-E 7.82+cvs; nmh 1.3; GNU Emacs 22.3.1
Date: Fri, 10 May 2013 22:45:36 -0700
Message-ID: <20130511054536.7707958097@chaos.jnpr.net>
MIME-Version: 1.0
Content-Type: text/plain
X-Mailman-Approved-At: Sat, 11 May 2013 12:06:07 +0000
Cc: freebsd-hackers@freebsd.org, freebsd-arch@freebsd.org
X-BeenThere: freebsd-hackers@freebsd.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Technical Discussions relating to FreeBSD
 <freebsd-hackers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-hackers>,
 <mailto:freebsd-hackers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-hackers>;
List-Post: <mailto:freebsd-hackers@freebsd.org>
List-Help: <mailto:freebsd-hackers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-hackers>,
 <mailto:freebsd-hackers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 11 May 2013 05:47:06 -0000


On Mon, 6 May 2013 00:11:51 +0200, Baptiste Daroussin writes:
>The ports tree on current is still in very bad shape but I don't see
>anymore errors due to bmake specifically.
>
>You have my approval as portmgr to switch base make to bmake.

As an interim step, I would propose the change below.

Index: share/mk/bsd.own.mk
==================================================================--- share/mk/bsd.own.mk	(revision 249461)
+++ share/mk/bsd.own.mk	(working copy)
@@ -254,6 +254,7 @@ __DEFAULT_YES_OPTIONS = \
     BIND_UTILS \
     BINUTILS \
     BLUETOOTH \
+    BMAKE \
     BOOT \
     BSD_CPIO \
     BSNMP \
@@ -361,7 +362,6 @@ __DEFAULT_NO_OPTIONS = \
     BIND_LIBS \
     BIND_SIGCHASE \
     BIND_XML \
-    BMAKE \
     BSDCONFIG \
     BSD_GREP \
     CLANG_EXTRAS \


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1368268753.73979.YahooMailNeo>