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.h,v 1.5 1994/11/18 02:54:31 christos Exp 3011394Sswallace * from: linux_util.h,v 1.2 1995/03/05 23:23:50 fvdl Exp 3183366Sjulian * 3283366Sjulian * $FreeBSD: releng/10.2/sys/i386/ibcs2/ibcs2_util.h 160241 2006-07-10 17:59:26Z jhb $ 3311394Sswallace */ 3411394Sswallace 3511394Sswallace/* 3611394Sswallace * This file is pretty much the same as Christos' svr4_util.h 3711394Sswallace * (for now). 3811394Sswallace */ 3911394Sswallace 4011394Sswallace#ifndef _IBCS2_UTIL_H_ 4111394Sswallace#define _IBCS2_UTIL_H_ 4211394Sswallace 4314331Speter#include <sys/proc.h> 44141488Sjhb#include <sys/uio.h> 4511394Sswallace 4611394Sswallace#ifdef DEBUG_IBCS2 4711394Sswallace#define DPRINTF(a) printf a; 4811394Sswallace#else 4911394Sswallace#define DPRINTF(a) 5011394Sswallace#endif 5111394Sswallace 5211394Sswallaceextern const char ibcs2_emul_path[]; 5311394Sswallace 54141488Sjhbint ibcs2_emul_find(struct thread *, char *, enum uio_seg, char **, int); 5511394Sswallace 56141488Sjhb#define CHECKALT(td, upath, pathp, i) \ 57141488Sjhb do { \ 58141488Sjhb int _error; \ 59141488Sjhb \ 60141488Sjhb _error = ibcs2_emul_find(td, upath, UIO_USERSPACE, pathp, i); \ 61141488Sjhb if (*(pathp) == NULL) \ 62141488Sjhb return (_error); \ 63141488Sjhb } while (0) 6411394Sswallace 65141488Sjhb#define CHECKALTEXIST(td, upath, pathp) CHECKALT(td, upath, pathp, 0) 66141488Sjhb#define CHECKALTCREAT(td, upath, pathp) CHECKALT(td, upath, pathp, 1) 6711394Sswallace 6820652Sbde#ifdef SPX_HACK 69141488Sjhbint spx_open(struct thread *td); 7020652Sbde#endif 7120652Sbde 7211394Sswallace#endif /* !_IBCS2_UTIL_H_ */ 73