Re: kernel space getcwd()? (using current() to find out cwd)

From: Christoph Hellwig (hch@ns.caldera.de)
Date: Tue Apr 17 2001 - 07:30:14 EST


In article <15067.30060.436790.458922@bangstate.com> you wrote:
> So, a little ignorance being a dangerous thing, I thought I'd be clever
> and manually reconstruct the full path by walking up
> current->fs->pwd->d_parent and padding d_name to the filename until it
> hits root.
>
> Unfortunatly, this approach causes kernel panics. e.g., the attached
> code snippet will inevitably bring down the machine if I call it
> during in my replacement open, mkdir, rmdir, unlink routines -- and
> tehy all work fine without itq.

Use d_path. NOTE: the buffer in which the pathname is returned is
the return value of the function and _not_ the buffer you gave to it.

        Christoph

-- 
Of course it doesn't work. We've performed a software upgrade.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Apr 23 2001 - 21:00:22 EST