From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 8 14:04:09 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E59D1065696 for ; Wed, 8 Apr 2009 14:04:09 +0000 (UTC) (envelope-from mehulc87@gmail.com) Received: from mail-qy0-f134.google.com (mail-qy0-f134.google.com [209.85.221.134]) by mx1.freebsd.org (Postfix) with ESMTP id 20ED38FC1D for ; Wed, 8 Apr 2009 14:04:09 +0000 (UTC) (envelope-from mehulc87@gmail.com) Received: by qyk40 with SMTP id 40so168432qyk.3 for ; Wed, 08 Apr 2009 07:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=PlOcBCy6E43pkWP5UWJlw921PUC//OV5/Xbg5+4KY1s=; b=LOwsPK9KwzNPxQdY9Rj8qTXkk9T998L/yvHg8Ln1aPdsPA1Efp0ozo4n9hySGzcyI0 CGV7ae1UD9qAX3i/3LdtBDguF+nmrGDuIQ/KjbC0DPsINymgmW5w+8Q9UQ15Cy/3grPq 6ILqAhv4WALl/HDd30tyJAno8DIjzMIsc2huQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=soKiO98o2B+Wf5V28gNMyKVTIm7B2U2CZakn8YECV5urkLqffnvZX8uZGq5fZB6th3 Rb26heSzmtfCIesDv/CbiyJ2d7xL+9QShRTYYJiXtt/MBK2f6MkRSEDmzghlVjJGZTOM Y+LbIaUOYAEE+kQwdEmWWjgrQ65qL1Eq2iarY= MIME-Version: 1.0 Received: by 10.229.97.19 with SMTP id j19mr565518qcn.54.1239198190917; Wed, 08 Apr 2009 06:43:10 -0700 (PDT) Date: Wed, 8 Apr 2009 19:13:10 +0530 Message-ID: <251d650c0904080643o8789860w87c8cca070a16489@mail.gmail.com> From: Mehul Chadha To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: working of syscall handling 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: Wed, 08 Apr 2009 14:04:10 -0000 Hello all, I have a doubt in understanding the working of the freebsd OS. In the program given below the function readlink gets called up when printf is executed and the program ends without any output. readlink is a system call (syscall number = 58) which is being made by the printf function, but according to my understanding of system call, it is made by putting the handler number in eax register and then interrupting the processor, so that it can enter the kernel mode and execute the required function, but in this case(dont know why) my readlink function gets called up which should not have happened. I will be very thankful if you can help me with it. #include int readlink(void *a, void *b) { exit(0); } int main(int argc, char **argv) { printf("Hello World"); }