From owner-freebsd-hackers Mon Feb 4 2:40: 3 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from bugz.infotecs.ru (bugz.infotecs.ru [195.210.139.22]) by hub.freebsd.org (Postfix) with ESMTP id 54B4737B425 for ; Mon, 4 Feb 2002 02:38:13 -0800 (PST) Received: (from root@localhost) by bugz.infotecs.ru (8.11.6/8.11.4) id g14Aai194298 for freebsd-hackers@freebsd.org; Mon, 4 Feb 2002 13:36:44 +0300 (MSK) (envelope-from vel) From: "Eugene L. Vorokov" Message-Id: <200202041036.g14Aai194298@bugz.infotecs.ru> Subject: Re: file name To: freebsd-hackers@freebsd.org Date: Mon, 4 Feb 2002 13:36:44 +0300 (MSK) X-Mailer: ELM [version 2.5 PL5] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > 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