From: <ravra@avras.com>
Subject: stat call in kernel always returns 'bad address'
Date: Fri, 5 Apr 2002 09:45:02 -0800 [thread overview]
Message-ID: <200204051745.DEU02808@vmms5.verisignmail.com> (raw)
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 <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
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.
reply other threads:[~2002-04-05 17:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox