It seemed like a good idea to allow FreeBSD to recognize ms-windows binaries on the fly and start wine as an interpreter for such binaries, if it is installed on the system. All it takes is adding one more very simple imgact function exec_wine_imgact() to the kernel. This is very much in analogy to how the kernel handles "#!" at the beginning of scripts. The actual benefit is lowering very much the threshold for windows users to start using FreeBSD instead. Fix: The following shar bundle contains my initial version of exec_wine_imgact() and an include file describing the header parts of a windows binary. To make it obvious that this is just an extension I put the header to <compat/windos.h>. You are welcome to choose otherwise. Due to my systems have always had a tendency to quickly become somewhat modified I have no idea how well this will fit in any vanilla FreeBSD system, but the need for changes should be relatively minor. And in any case, it is the idea that counts. How-To-Repeat: No bug or problem, just an extension.
Attached is a better version of the same theme. My original version used a compiled in constant name for the emulator. This of course is not appropriate, because some systems might prefer to use other windows support software than wine. The new version makes the name of the used emulator program a sysctl adjustable kernel MIB variable (kern.w32emu). The new version also fixes some other minor inconveniences which were present in the initial version. This extension requires the HW architecture being defined as a preprocessor macro (i386, etc) while compiling the kernel. It tries to check whether the binary could be run on this HW platform. -- Cheers, // jau .--- ..- -.- -.- .- .- .-.-.- ..- -.- -.- --- -. . -. / Jukka A. Ukkonen, Mawit Ltd, Finland /__ M.Sc. (sw-eng & cs) / Internet: jau(a)iki.fi / (Phone) +358-500-606-671 v + + + + My opinions are mine and mine alone, not my employers. + + + +
Responsible Changed From-To: freebsd-bugs->freebsd-emulation Over to emulation to decide its fate.
Responsible Changed From-To: freebsd-emulation->emulation Use short names for mailing list to make searches using the web query form work with the shown responsible. This also makes open PRs show up in the summery mail.
Given that no-one has looked at this bug in over 14 years I would like to close this bug as "overcome by events". Any objections?
Would binmissctl(8) help? It's already used by poudriere + qemu-user-static to run build tools as a kind of slow cross-compilation. $ chmod +x foo.exe $ ./foo.exe zsh: exec format error: ./foo.exe $ hd -n20 foo.exe 00000000 4d 5a 90 00 03 00 00 00 04 00 00 00 ff ff 00 00 |MZ..............| 00000010 b8 00 00 00 |....| 00000014 $ binmiscctl add wine32 --interpreter /usr/local/bin32/wine \ --magic "\x4d\x5a\x90\x00\x03\x00\x00\x00\x04\x00\x00\x00\xff\xff\x00\x00\xb8\x00\x00\x00" \ --mask "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" \ --size 20 --set-enabled $ ./foo.exe fixme:winediag:start_process Wine Staging 1.9.4 is a testing version containing experimental patches. fixme:winediag:start_process Please mention your exact version when filing bug reports on winehq.org. fixme:ntdll:__syscall_NtCreateNamedPipeFile Message mode not supported, falling back to byte mode. load: 0.16 cmd: wine 3685 [piperd] 7.64r 0.05u 0.10s 0% 11496k
Added description based on comment 5 to: - https://wiki.freebsd.org/i386-Wine - https://wiki.freebsd.org/Wine The functionality as originally intended can be achieved through the binmiscctl(8) utility. @gerald: any benefit of providing this functionality in a port that then runs during launch (i.e. rc.d)? @jbeich: thank you for the explaining binmiscctl(8), I've used it before with Poudriere to create arm packages, but never realized it was more generic than that. :-D