1139799Simp/*-
211394Sswallace * Copyright (c) 1994 Christos Zoulas
311394Sswallace * Copyright (c) 1995 Frank van der Linden
411394Sswallace * Copyright (c) 1995 Scott Bartram
511394Sswallace * All rights reserved.
611394Sswallace *
711394Sswallace * Redistribution and use in source and binary forms, with or without
811394Sswallace * modification, are permitted provided that the following conditions
911394Sswallace * are met:
1011394Sswallace * 1. Redistributions of source code must retain the above copyright
1111394Sswallace *    notice, this list of conditions and the following disclaimer.
1211394Sswallace * 2. Redistributions in binary form must reproduce the above copyright
1311394Sswallace *    notice, this list of conditions and the following disclaimer in the
1411394Sswallace *    documentation and/or other materials provided with the distribution.
1511394Sswallace * 3. The name of the author may not be used to endorse or promote products
1611394Sswallace *    derived from this software without specific prior written permission
1711394Sswallace *
1811394Sswallace * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1911394Sswallace * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2011394Sswallace * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2111394Sswallace * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2211394Sswallace * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2311394Sswallace * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2411394Sswallace * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2511394Sswallace * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2611394Sswallace * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2711394Sswallace * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2811394Sswallace *
2911394Sswallace *	from: svr4_util.c,v 1.5 1995/01/22 23:44:50 christos Exp
3011394Sswallace */
3111394Sswallace
32115684Sobrien#include <sys/cdefs.h>
33115684Sobrien__FBSDID("$FreeBSD$");
34115684Sobrien
35177785Skib#include <sys/fcntl.h>
3611394Sswallace#include <sys/param.h>
3711394Sswallace#include <sys/systm.h>
38141488Sjhb#include <sys/syscallsubr.h>
3911394Sswallace
4011397Sswallace#include <i386/ibcs2/ibcs2_util.h>
4111394Sswallace
4254655Seivind
4311414Sswallaceconst char      ibcs2_emul_path[] = "/compat/ibcs2";
4411394Sswallace
4511394Sswallace/*
4611394Sswallace * Search an alternate path before passing pathname arguments on
4772091Sasmodai * to system calls. Useful for keeping a separate 'emulation tree'.
4811394Sswallace *
4911394Sswallace * If cflag is set, we check if an attempt can be made to create
5011394Sswallace * the named file, i.e. we check if the directory it should
5111394Sswallace * be in exists.
5211394Sswallace */
5311394Sswallaceint
54141488Sjhbibcs2_emul_find(struct thread *td, char *path, enum uio_seg pathseg,
55141488Sjhb    char **pbuf, int cflag)
5611394Sswallace{
5711394Sswallace
58141488Sjhb	return (kern_alternate_path(td, ibcs2_emul_path, path, pathseg, pbuf,
59177997Skib	    cflag, AT_FDCWD));
6011394Sswallace}
61