1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
.\" $OpenBSD: compat_svr4.8,v 1.9 2000/12/22 16:54:38 avsm Exp $
.\" $NetBSD: compat_svr4.8,v 1.1 1996/07/06 17:14:50 christos Exp $
.\"
.\" Copyright (c) 1996 Christos Zoulas
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgment:
.\" This product includes software developed for the NetBSD Project
.\" by Christos Zoulas
.\" 4. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" Stolen from compat_linux.8,v 1.2 1995/10/16 20:17:59 fvdl
.\"
.Dd July 6, 1996
.Dt compat_svr4 8
.Os
.Sh NAME
.Nm compat_svr4
.Nd setup procedure for running SVR4/iBCS2 binaries under emulation
.Sh DESCRIPTION
.Ox
supports running SVR4/iBCS2 binaries. This code has been tested on
i386 and sparc systems. Most programs should work, but not ones that use
or depend on:
.Pp
.Bl -tag -width 123 -compact -offset indent
.It kernel internal data structures
.br
.It the /proc filesystem
.br
.It the ticotsord loopback rpc mechanism (nis uses this)
.br
.It sound and video interfaces
.br
.It threads (ttsession uses threads)
.br
.It the streams administrative driver
.El
.Pp
The SVR4 compatibility feature is active
for kernels compiled with the
.Nm COMPAT_SVR4
option enabled.
.Pp
Most SVR4 programs are dynamically linked. This means that you will
also need the shared libraries that the program depends on and the
runtime linker. Also, you will need to create a "shadow root"
directory for SVR4 binaries on your
.Ox
system. This directory
is named /emul/svr4. Any file operations done by SVR4 programs
run under
.Ox
will look in this directory first. So, if a SVR4
program opens, for example, /etc/passwd,
.Ox
will
first try to open /emul/svr4/etc/passwd, and if that does not exist
open the 'real' /etc/passwd file. It is recommended that you install
SVR4 packages that include configuration files, etc under /emul/svr4,
to avoid naming conflicts with possible
.Ox
counterparts. Shared
libraries should also be installed in the shadow tree.
.Pp
The simplest way to setup your system for SVR4 binaries is:
.Bl -tag -width 123 -compact
.It 1.
Make the necessary directories:
.Pp
.Bl -tag -width 123 -compact -offset indent
.It (me@openbsd) mkdir -p /emul/svr4/{dev,etc}
.br
.It (me@openbsd) mkdir -p /emul/svr4/usr/{bin,lib}
.br
.It (me@openbsd) mkdir -p /emul/svr4/usr/openwin/{bin,lib}
.El
.Pp
.It 2.
Copy files from an SVR4 system:
.Pp
.Bl -tag -width 123 -compact -offset indent
.It (me@svr4) cd /usr/lib
.br
.It (me@svr4) tar -cf -\ . | \e
.in +5
.It rsh openbsd 'cd /emul/svr4/usr/lib; tar -xpf -'
.in -5
.El
.Pp
If you are running OpenWindows:
.Pp
.Bl -tag -width 123 -compact -offset indent
.It (me@svr4) cd /usr/openwin/lib
.br
.It (me@svr4) tar -cf -\ . | \e
.in +5
.It rsh openbsd 'cd /emul/svr4/usr/openwin/lib; tar -xpf -'
.in -5
.El
.Pp
.It 3.
Setup the configuration files and devices:
.Pp
.Bl -tag -width 123 -compact -offset indent
.It (me@openbsd) cd /usr/src/etc/etc.svr4
.br
.It (me@openbsd) cp netconfig nsswitch.conf /emul/svr4/etc
.br
.It (me@openbsd) cp SVR4_MAKEDEV /emul/svr4/dev
.br
.It (me@openbsd) cd /emul/svr4/dev; sh SVR4_MAKEDEV all
.El
.El
.Pp
An alternative method is to mount a whole SVR4 partition in /emul/svr4
and then override with other mounts /emul/svr4/etc and /emul/svr4/dev.
.Pp
Clearly, you cannot use a complete SVR4
.Pa /dev
directory as
.Pa /emul/svr4/dev ,
because other device nodes, such as
.Pa /dev/null ,
need to be
.Ox
device nodes.
.Sh BUGS
Many system calls are still not emulated. The streams emulation is
incomplete (socketpair does not work yet).
.Pp
Most SVR4 executables can not handle directory offset cookies > 32
bits. More recent ones, compiled for large file support (Solaris 2.6
and up) can. With older programs, you will see the message "svr4_getdents:
dir offset too large for emulated program" when this happens. Currently,
this can only happen on NFS mounted filesystems, mounted from servers
that return offsets with information in the upper 32 bits. These errors
should rarely happen, but can be avoided by mounting this filesystem with
the
.Fl 2
option to
.Xr mount_nfs 8 .
|