xref: /netbsd/sys/compat/sunos32/sunos32.h (revision c4a72b64)
1 /*	$NetBSD: sunos32.h,v 1.2 2002/07/04 23:32:12 thorpej Exp $	 */
2 
3 /*
4  * Copyright (c) 2001 Matthew R. Green
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. The name of the author may not be used to endorse or promote products
16  *    derived from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  */
30 
31 #ifndef _COMPAT_SUNOS32_SUNOS32_H_
32 #define _COMPAT_SUNOS32_SUNOS32_H_
33 
34 /*
35  * 32-bit SunOS 4.x compatibility module.
36  */
37 
38 #include <compat/sunos/sunos.h>
39 
40 /*
41  * Typedefs for pointer-types.
42  */
43 /* stime() */
44 typedef u_int32_t sunos32_time_tp;
45 
46 /* statfs(), fstatfs() */
47 typedef u_int32_t sunos32_statfsp_t;
48 
49 /* ustat() */
50 typedef u_int32_t sunos32_ustatp_t;
51 
52 /* uname() */
53 typedef u_int32_t sunos32_utsnamep_t;
54 
55 /*
56  * general prototypes
57  */
58 __BEGIN_DECLS
59 /* Defined in arch/<arch>/sunos_machdep.c */
60 void	sunos32_sendsig __P((int, sigset_t *, u_long));
61 __END_DECLS
62 
63 /*
64  * here are some macros to convert between sunos32 and sparc64 types.
65  * note that they do *NOT* act like good macros and put ()'s around all
66  * arguments cuz this _breaks_ SCARG().
67  */
68 #define SUNOS32TO64(s32uap, uap, name) \
69 	    SCARG(uap, name) = SCARG(s32uap, name)
70 #define SUNOS32TOP(s32uap, uap, name, type) \
71 	    SCARG(uap, name) = (type *)(u_long)(u_int)SCARG(s32uap, name)
72 #define SUNOS32TOX(s32uap, uap, name, type) \
73 	    SCARG(uap, name) = (type)SCARG(s32uap, name)
74 #define SUNOS32TOX64(s32uap, uap, name, type) \
75 	    SCARG(uap, name) = (type)(u_long)SCARG(s32uap, name)
76 
77 /* and some standard versions */
78 #define	SUNOS32TO64_UAP(name)		SUNOS32TO64(uap, &ua, name);
79 #define	SUNOS32TOP_UAP(name, type)	SUNOS32TOP(uap, &ua, name, type);
80 #define	SUNOS32TOX_UAP(name, type)	SUNOS32TOX(uap, &ua, name, type);
81 #define	SUNOS32TOX64_UAP(name, type)	SUNOS32TOX64(uap, &ua, name, type);
82 
83 #define SUNOS32_CHECK_ALT_EXIST(p, sgp, path) \
84     emul_find(p, sgp, p->p_emul->e_path, (char *)(u_long)path, (const char **)&(path), CHECK_ALT_FL_EXISTS)
85 
86 #define SUNOS32_CHECK_ALT_CREAT(p, sgp, path) \
87     emul_find(p, sgp, p->p_emul->e_path, (char *)(u_long)path, (const char **)&(path), CHECK_ALT_FL_CREAT)
88 
89 #endif /* _COMPAT_SUNOS32_SUNOS32_H_ */
90