* stat call in kernel always returns 'bad address'
@ 2002-04-05 17:45 ravra
0 siblings, 0 replies; only message in thread
From: ravra @ 2002-04-05 17:45 UTC (permalink / 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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-04-05 17:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-05 17:45 stat call in kernel always returns 'bad address' ravra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox