Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Feb 2002 13:36:44 +0300 (MSK)
From:      "Eugene L. Vorokov" <vel@bugz.infotecs.ru>
To:        freebsd-hackers@freebsd.org
Subject:   Re: file name
Message-ID:  <200202041036.g14Aai194298@bugz.infotecs.ru>

next in thread | raw e-mail | index | archive | help
> I want to control for example open() syscall:
> static int my_open(register struct proc *p, register struct open_args *ea)
> {
> [...]
> }
> Name of file to open is in ea->path, but this name can be: ./somefile
> and i need a full path to it.
 
I faced that problem once. I used an ugly hack: simulation of __getcwd()
syscall. You need to allocate user memory via mmap() with MAP_ANON flag,
pass it to __getcwd(), then copy string to kernel using copyin() or like
that, and munmap() the memory. This is neither proper nor efficient way
to do that, but it's easy and it works. Note that in case of ./ or
several ../ in the file name you may need to do some extra processing
to get "correct" full path.
 
Regards,
Eugene


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202041036.g14Aai194298>