From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Newsgroups: gmane.linux.redhat.axp.kernel Subject: stat call in kernel always returns 'bad address' Date: Fri, 5 Apr 2002 09:45:02 -0800 Sender: axp-kernel-list-admin@redhat.com Message-ID: <200204051745.DEU02808@vmms5.verisignmail.com> Reply-To: axp-kernel-list@redhat.com NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1018029657 7905 127.0.0.1 (5 Apr 2002 18:00:57 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 5 Apr 2002 18:00:57 +0000 (UTC) Original-Received: from listman.redhat.com ([66.187.233.211]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16tY1B-00023N-00 for ; Fri, 05 Apr 2002 20:00:57 +0200 Original-Received: from listman.redhat.com (localhost.localdomain [127.0.0.1]) by listman.redhat.com (Postfix) with ESMTP id AB9B33FCE6; Fri, 5 Apr 2002 12:59:27 -0500 (EST) Original-Received: from localhost.localdomain (int-mx1.corp.redhat.com [172.16.52.254]) by listman.redhat.com (Postfix) with ESMTP id 83B243FC09 for ; Fri, 5 Apr 2002 12:45:08 -0500 (EST) Original-Received: from lacrosse.corp.redhat.com (lacrosse.corp.redhat.com [172.16.52.154]) by localhost.localdomain (8.11.6/8.11.6) with ESMTP id g35HjAm09703 for ; Fri, 5 Apr 2002 12:45:10 -0500 Original-Received: (from mail@localhost) by lacrosse.corp.redhat.com (8.11.6/8.9.3) id g35HjA529557 for axp-kernel-list@listman.redhat.com; Fri, 5 Apr 2002 12:45:10 -0500 Original-Received: from localhost.localdomain (int-mx1.corp.redhat.com [172.16.52.254]) by lacrosse.corp.redhat.com (8.11.6/8.9.3) with ESMTP id g35Hj9q29548 for ; Fri, 5 Apr 2002 12:45:09 -0500 Original-Received: from mx1.redhat.com (mx1.redhat.com [172.16.48.31]) by localhost.localdomain (8.11.6/8.11.6) with SMTP id g35Hj9m09697 for ; Fri, 5 Apr 2002 12:45:09 -0500 Original-Received: from vmmr5.verisignmail.com (vmmr5.verisignmail.com [216.168.230.145]) by mx1.redhat.com (8.11.6/8.11.6) with SMTP id g35Hg5Y31449 for ; Fri, 5 Apr 2002 12:42:05 -0500 Original-Received: from vmms5.verisignmail.com (vmms5.verisignmail.com [10.166.0.146]) by vmmr5.verisignmail.com (Mirapoint Messaging Server MOS 2.9.3.2) with ESMTP id DBN01052; Fri, 5 Apr 2002 12:45:04 -0500 (EST) Original-Received: from vmms5.verisignmail.com (localhost.verisignmail.com [127.0.0.1]) by vmms5.verisignmail.com (Mirapoint Messaging Server MOS 2.9.3.2) with SMTP id DEU02808 (AUTH ravra@avras.com); Fri, 5 Apr 2002 12:45:03 -0500 (EST) Original-Received: from 158.140.2.102 by vmms5.verisignmail.com (Mirapoint Messaging Server MOS 2.9.3.2) with HTTP/1.1; Fri, 5 Apr 2002 09:45:02 -0800 Original-To: axp-kernel-list@redhat.com X-Mailer: Mirapoint Webmail Direct 2.9.3.2 X-Loop: axp-kernel-list@redhat.com Errors-To: axp-kernel-list-admin@redhat.com X-BeenThere: axp-kernel-list@redhat.com X-Mailman-Version: 2.0.1 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Alpha Kernel issues List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.linux.redhat.axp.kernel:2 X-Report-Spam: http://spam.gmane.org/gmane.linux.redhat.axp.kernel:2 Hello all, I compiled some code into the 7.2 kernel which has a 'stat' function call for checking on a particular file in /tmp. Unfortunately, this stat call always returns with an errno of 14 (EFAULT: bad address). When I compile and run the same code outside the kernel everything works just fine. Can anyone give me a pointer? A couple extra notes: stat requires libc which I believe is not compatible with the libraries the kernel uses (errno conflicts I found) so I had to remove errno from the kernel lib for the kernel to link cleanly. I confirmed in the code (with print statements-see below) that the stat struct was intact as well as the pointer to it. The print statements work fine in the kernel. And, as I said, the user version of the code works fine. #include #include #include struct stat statbuf1; struct stat *statbufptr = &statbuf1; int foo () { statbufptr->st_blocks = 44; printk("foo.c :: Just confirming we can access statbufptr st_blocks: %d\n", statbufptr->st_blocks); if ( stat("/tmp/myfile", statbufptr) != 0 ) ... Thanks, Rick Please let me know if I should be posting this somewhere else.