<?xml version="1.0" ?>
<kc>

<title>Wine Traffic</title>

<author contact="http://www.theshell.com/~vinn">Brian Vincent</author>
<issue num="219" date="16 Apr 2004 00:00:00 -0800" />
<intro> <p>This is the 219th issue of the Wine Weekly News publication.
Its main goal is to get lots of nasty vaccinations. It also serves to inform you of what's going on around Wine. Wine is an open source implementation of the Windows API on top of X and Unix.  Think of it as a Windows compatibility layer.  Wine does not require Microsoft Windows, as it is a completely alternative implementation consisting of 100% Microsoft-free code, but it can optionally use native system DLLs if they are available.   You can find more info at <a href="http://www.winehq.org">www.winehq.org</a></p> </intro>
<stats posts="162" size="716" contrib="58" multiples="30" lastweek="25">

<person posts="15" size="186" who="Mike McCormack" />
<person posts="12" size="28" who="Alexandre Julliard" />
<person posts="11" size="28" who="Dmitry Timoshkov" />
<person posts="11" size="88" who="Dimitrie O. Paun" />
<person posts="8" size="31" who="Peter Riocreux" />
<person posts="8" size="21" who="Mike Hearn" />
<person posts="7" size="22" who="Santosh Siddheshwar" />
<person posts="5" size="27" who="Geoffrey Hausheer" />
<person posts="5" size="12" who="Martin Fuchs" />
<person posts="4" size="21" who="Ivan Leo Murray-Smith" />
<person posts="4" size="13" who="Izak Burger" />
<person posts="4" size="10" who="Christian Costa" />
<person posts="3" size="9" who="Lionel Ulmer" />
<person posts="3" size="8" who="Robert Shearman" />
<person posts="3" size="8" who="Roderick Colenbrander" />
<person posts="3" size="6" who="Hans Leidekker" />
<person posts="3" size="6" who="Juan Lang" />
<person posts="3" size="6" who="Rein Klazes" />
<person posts="2" size="17" who="Paul Davis" />
<person posts="2" size="14" who=" &lt;greensh@knology.net&gt;" />
<person posts="2" size="11" who="Rafael Avila de Espindola" />
<person posts="2" size="9" who="Manjunath Sripadarao" />
<person posts="2" size="7" who="Michael Stefaniuc" />
<person posts="2" size="6" who="Kevin Koltzau" />
<person posts="2" size="6" who="Saulius Krasuckas" />
<person posts="2" size="5" who="Arne Gellhaus" />
<person posts="2" size="5" who="Uwe Bonnes" />
<person posts="2" size="4" who="Shachar Shemesh" />
<person posts="2" size="4" who="Mark Draheim" />
<person posts="1" size="14" who=" (=?utf-8?q?Andr=C3=A9_Johansen?=)" />
<person posts="1" size="7" who=" &lt;ceztko@libero.it&gt;" />
<person posts="1" size="4" who="Francois Gouget" />
<person posts="1" size="3" who="David Lee Lambert" />
<person posts="1" size="3" who="Ulrich Czekalla" />
<person posts="1" size="3" who="Tony Lambregts" />
<person posts="1" size="2" who="Michael Stefaniuc" />
<person posts="1" size="2" who="Ferenc Wagner" />
<person posts="1" size="2" who="(j.cooper1)" />
<person posts="1" size="2" who="Juergen Veith" />
<person posts="1" size="2" who="Andreas Mohr" />
<person posts="1" size="2" who="Gerald Pfeifer" />
<person posts="1" size="2" who="James Perry" />
<person posts="1" size="2" who="Chris Morgan" />
<person posts="1" size="2" who="Flameeyes" />
<person posts="1" size="2" who="Vincent B&#233;ron" />
<person posts="1" size="2" who="Henk Poley" />
<person posts="1" size="2" who="Samium Gromoff" />
<person posts="1" size="2" who="Ge van Geldorp" />
<person posts="1" size="2" who="Dan Kegel" />
<person posts="1" size="2" who="Phil Krylov" />
<person posts="1" size="2" who="Francois Gouget" />
<person posts="1" size="1" who="Filip Navara" />
<person posts="1" size="1" who="antonio serra" />
<person posts="1" size="1" who="David Goodenough" />
<person posts="1" size="1" who="dataphile" />
<person posts="1" size="1" who="Brian Vincent" />

</stats>
<section 
	title="News: WineX 3.3.1, Press Coverage" 
	subject="News"
	archive="http://www.winehq.com/hypermail/wine-devel/2004/01/0.html" 
	posts="3"
	startdate="10 Apr 2004 00:00:00 -0800"
	enddate="16 Apr 2004 00:00:00 -0800"
>
<topic>News</topic>
<mention></mention>
<mention>News</mention>
<mention>TransGaming</mention>

<p>TransGaming <a href="http://www.transgaming.com/showthread.php?news=113">
released WineX 3.3.1</a> this week.  The 
<a href="http://downloads.transgaming.com/files/winex-3.3.1_releasenotes.txt">
release notes</a> discuss new additions:</p>
<quote who="Transgaming"><p>
WineX 3.3.1 is primarily a bug fix release. However, it also includes
a number of DirectX 9 related changes to make the present patch level of 
EverQuest work, and a major reduction in sound latency.</p>
</quote>

<p>Looks like we got a little PR last week from internetnews.com,
<i><a href="http://www.internetnews.com/dev-news/article.php/3338641">"Vintage
Year For New WINE?"</a></i>.  For anyone not familiar with the project
it provides a nice introduction.  Despite the title, the author wisely
avoids speculating on when a release might be ready.  </p>
<p>
Tom's Hardware began a series of Linux tutorials.  The second one
came out this week and 
<a href="http://www.tomshardware.com/howto/20040412/wintolinux-05.html">briefly
mentions Wine</a>, 
<quote who="TomsHardwareGuide">
If you simply must run your Windows programs, chances are you can make them 
work with WINE. WINE is a free Linux program that will trick Windows programs 
into thinking they are running inside of Windows and not Linux. </quote></p>

</section>
<section 
	title="Execshield (con't)" 
	subject="exec-shield workaround take 2"
	archive="http://www.winehq.org/hypermail/wine-devel/2004/04/0193.html" 
	posts="18"
	startdate="10 Apr 2004 00:00:00 -0800"
	enddate="15 Apr 2004 00:00:00 -0800"
>
<topic>Architecture</topic>
<mention></mention>

<p>Last week (issue 
<a href="http://www.winehq.com/?issue=218#Execshield/Prelinking%20(con't)">#218</a>)
we mentioned Mike McCormack had begun working on problems caused by execshield
enabled kernels.  Basically the problem Wine runs into is it requires certain
memory locations to be available and with execshield there's no way to 
guarantee that.  A few people have taken stabs at finding a solution, the
latest was announced by Mike on Saturday:</p>
<quote who="Mike McCormack"><p>
This patch works around the exec-shield problems with Fedora Core.  I'd 
be greatful if any people using Fedora core could test it out and see 
how it works.
</p><p>
It should be enough to apply it to the latest CVS tip and recompile.
</p><p>
All comments and flames accepted... /me wears his asbestos suit.
</p></quote>

<p>Digging into 
<a href="http://www.winehq.com/hypermail/wine-devel/2004/04/0193.html">Mike's
patch</a> you'll find a "mini loader" at the heart of it.  Before any
application can begin execution it's necessary for the environment to
get set up properly and that process is typically handled by what's
known as a loader.  Normally what happens is you clear out all the
memory you want to use, get a dynamic linker mapped into memory and
start it's bootstrap procedure, and then initialize the stack.  From
there the linker finds the entry point into the executable and transfers
execution over to it.  Mike explains how his approach fits into this
whole scheme:</p>

<quote who="Mike McCormack"><p>

 Design notes
</p><p>
 The goal of this program is to be a workaround for exec-shield, as used
 by the Linux kernel distributed with Fedora Core and other distros.
</p><p>
 To do this, we implement our own shared object loader that reserves memory
  that is important to Wine, and then loads the the standard shared object
  loader (ELF interpreter), usually ld-linux.so.2
</p><p>
 As Wine is i386 specific, we are not too worried about portability issues,
 but will do our best to keep the system dependencies (syscalls) seperate to 
 the rest (ELF loader and printf) part of the program.
</p><p>
 This program will be invoked as follows:
 <ul><code>
 wld &lt;full path to ELF executable to be loaded&gt; &lt;args...&gt;
 </code></ul></p><p>
 We will try to set up the stack an memory area so that the program that
 loads after us (eg. the wine binary) never knows we were here, except that
 areas of memory it needs are already magically reserved.
</p><p>
 The following memory areas are important to Wine:
 <ul>
  <li>0x00000000 - the DOS area</li>
  <li>0x00400000 - the standard Win32 load address</li>
  <li>0x65430000 - the shared heap at</li></ul>
</p><p>
 There are a few things that will be different after this program passes
 control of execution to the loaded binary:
 <ol>
  <li>The _ variable in the environment (will be the name of this exe)</li>
  <li>The brk area returned by brk(2) </li>
  <li>This program will still be mapped into memory.</li>
  <li>The command line kept by the kernel in kernel memory (/proc/self/cmdline)</li>
 </ol>
</p><p>
 References (things I consulted to understand how ELF loading works):
<dl>
 <dt>glibc 2.3.2   elf/dl-load.c</dt>
  <dd><a href="http://www.gnu.org/directory/glibc.html">
  http://www.gnu.org/directory/glibc.html</a></dd>

 <dt>Linux 2.6.4   fs/binfmt_elf.c</dt>
  <dd><a href="ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.4.tar.bz2">
  ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.4.tar.bz2</a></dd>

 <dt>Userland exec, by &lt;grugq_at_hcunix.net&gt;</dt>
  <dd><a href="http://cert.uni-stuttgart.de/archive/bugtraq/2004/01/msg00002.html">
  http://cert.uni-stuttgart.de/archive/bugtraq/2004/01/msg00002.html</a></dd>

 <dt>The ELF specification:</dt>
  <dd><a href="http://www.linuxbase.org/spec/booksets/LSB-Embedded/LSB-Embedded/book387.html">
  http://www.linuxbase.org/spec/booksets/LSB-Embedded/LSB-Embedded/book387.html</a></dd></dl>
</p></quote>

<p>Mike Hearn commented on the approach,
<quote who="Mike Hearn">
It seems it's turned from being an normal (albiet static) app which
reserves the areas needed then boots wine, into a reimplementation of
ld-linux.so? I'm not sure it's a good plan to alter the .interp field -
that has to be absolute and this technique would break binary
relocatability.</quote></p>

<p>The .interp section Mike refers to is an ASCII string in an
ELF binary that explicitly says what dynamic loader to invoke.
Mike M. didn't think he was doing anything bad:</p>
<quote who="Mike McCormack"><p>
 At least in the Linux kernel, the ELF interpreter is loaded from the 
 current directory if it is not an absolute path.  In this 
 implementation, I have forced the current directory to be the same as 
 the binary's directory, and saved the working directory in an 
 environment variable WINEWORKDIR.
</p><p>
 The reason for doing this was to save the hastle of passing yet another 
 round of extra argv[0]'s to the execv.  If it's determined that this 
 method is not portable,  it's easy enough to go back to the other method 
 of using an executable instead of replacing the ELF interpreter.
</p><p>
 In any case, this patch seems to work, and is not limited by binary 
 relocatability.
</p></quote>

<p>Mike M. then followed up with more revisions later in the week
that added some more features:</p>
<quote who="Mike McCormack"><p>
Changes in version 5:<ul>
<li> reserve the shared heap area as well as the PE load area</li>
<li> allow multiple reserve areas in libwine</li>
</ul></p><p>
Changes in version 4:<ul>
<li> set the WINEPEEXEPATH environment variable correctly</li>
</ul></p><p>
Changes in version 3:<ul>
<li> reserve only the area required by the PE EXE if launched from
     CreateProcess (else just a default slab)</li>
<li> pass the reserved area to wine, so wine knows about it</li>
<li> unmap the preloader after it is no longer used</li></ul></p>
</quote>
<p>So far Alexandre hasn't committed the patch.</p>
</section>
<section 
	title="AbiWord Ported to Winelib" 
	subject="Abi Word ported to Winelib!"
	archive="http://www.winehq.org/hypermail/wine-devel/2004/04/0192.html" 
	posts="3"
	startdate="09 Apr 2004 00:00:00 -0800"
	enddate="10 Apr 2004 00:00:00 -0800"
>
<topic>Winelib</topic>
<mention></mention>
<mention>ReactOS</mention>
<mention>Dimi Paun</mention>

<p>Last week Dimi Paun ported AbiWord to Linux using Winelib.
Of course, your first reaction is probably right - AbiWord already
runs on Linux so there's no real need to port the application
back to Linux.  However, as a way to test Winelib it's extremely
helpful.  Dimi took the source and MinGW build system and basically
used it to generate a Winelib app:</p>
<quote who="Dimitrie Paun"><p>
 In the past couple days I've entertained myself with porting
 AbiWord to Winelib. This was possible because now AbiWord
 has a nice MinGW build system. A total of 5 trivial patches 
 were indeed needed for Wine:
<ul><li><a href="http://www.winehq.org/hypermail/wine-patches/2004/04/0122.html">
    http://www.winehq.org/hypermail/wine-patches/2004/04/0122.html</a></li>
    <li><a href="http://www.winehq.org/hypermail/wine-patches/2004/04/0123.html">
    http://www.winehq.org/hypermail/wine-patches/2004/04/0123.html</a></li>
    <li><a href="http://www.winehq.org/hypermail/wine-patches/2004/04/0124.html">
    http://www.winehq.org/hypermail/wine-patches/2004/04/0124.html</a></li>
    <li><a href="http://www.winehq.org/hypermail/wine-patches/2004/04/0147.html">
    http://www.winehq.org/hypermail/wine-patches/2004/04/0147.html</a></li>
    <li><a href="http://www.winehq.org/hypermail/wine-patches/2004/04/0155.html">
    http://www.winehq.org/hypermail/wine-patches/2004/04/0155.html</a></li>
</ul></p><p>
 Notice how little we had to fix! To encourage others to port
 stuff to Winelib, I'll inline the hacks I did to port AbiWord.
 These we'll need to be cleaned up for integration into the
 AbiWord tree, but again, please note how little we had to change.
 (I've also attached a screenshot of the resulting Abi Word in action).
</p></quote>

<p>This is a fairly large application and the changes required
to port it were minimal.  If you put all those patches together
you'd end up with roughly 24 changed lines, almost all of which
were in headers.  Ge van Geldorp of ReactOS mentioned there were
some user interface issues uncovered by the port and he planned on
tackling them, namely, 
<quote who="Ge van Geldorp">
 the font family combo box is slightly higher than the other combo boxes, the 
 two rightmost images on the toolbar are not shown</quote></p>

<p>Dimi said he had no further plans to work on AbiWord other than
getting some patches integrated into AbiWord that allowed it to
build with Winelib.</p>
</section>




<section 
	title="Wine As a Shared Library" 
	subject="current version of wine_adopt_thread"
	archive="http://www.winehq.org/hypermail/wine-devel/2004/04/0228.html" 
	posts="1"
	startdate="12 Apr 2004 00:00:00 -0800"
>
<topic>Winelib</topic>
<mention></mention>
<mention>Mono</mention>

<p>Last month there was quite a bit of discussion about
using Wine as a regular shared library.  We covered that
topic pretty well in issues
<a href="http://www.winehq.org/?issue=213#Wine%20As%20A%20Shared%20Library%20&amp;%20Mono">#213</a>
and
<a href="http://www.winehq.org/?issue=214#Wine%20As%20A%20Shared%20Library%20&amp;%20Mono%20(con't)">#214</a>.
The problem is, Windows libraries and executables require a 
a different environment to run in than Linux ones.  Things
like threading are done differently enough that the recommended
solution has always been to just create a Winelib app if you
need to access a Windows library.  This week Paul Davis
came up with Winelib code that will convert a Linux thread
to a Win32 one on the fly.  Potentially a lot of other projects
could benefit from this.  Paul had a short announcement:
</p>
<quote who="Paul Davis"><p>
I offer this for Alexandre and other's consideration and
comments. This is already in use in libfst, which is in turn used by
Ardour, a native linux digital audio workstation, and gAlan, a native
linux modular synthesis system.
</p><p>
There is still no proper cleanup on failure, and nothing is done if
the adopted thread calls pthread_exit(). Both are simple to fix.</p>
</quote>

</section>


<section 
	title="Converting Wininet to Windows Sockets" 
	subject="Re: WININET: move to Windows sockets"
	archive="http://www.winehq.org/hypermail/wine-devel/2004/04/0071.html" 
	posts="13"
	startdate="04 Apr 2004 00:00:00 -0800"
	enddate="06 Apr 2004 00:00:00 -0800"
>
<topic>IO</topic>
<mention></mention>
<mention>Jonathon Wilson</mention>

<p>Han Leidekker posted a patch to make wininet build on MinGW
and in the process announced, 
<quote who="Hans Leidekker">Move to Windows sockets.</quote>
</p>

<p>Steven Edwards had been down that road before and 
questioned whether that was the right solution,
<quote who="Steven Edwards">
 I asked Alexandre about a patch to move Wininet to Winsock and he said
 it took to much of a performance hit to merge. Is there a way we can
 bench mark it to show how much of a hit Winsock vs Unix sockets is
 going to give us? He suggested that we find a way to make Wininet use
 Unix sockets on Unix and Winsock on Windows.
</quote></p>

<p>Jonathon Wilson thought a few #ifdefs to differentiate between
platforms would make that work.  Dimi cautioned against sprinkling
#ifdefs around and wondered how much of a performance hit was being
incurred.  Hans did some benchmarking and reported:</p>

<quote who="Hans Leidekker"><p>
Here are some timings for a loop of 100 synchronous HTTP GETs from
localhost on a 777 bytes file:
</p><p>
Unix sockets
<ul><table>
<tr><td>real  </td><td>0m4.099s</td></tr>
<tr><td>user  </td><td>0m0.480s</td></tr> 
<tr><td>sys   </td><td>0m0.312s </td></tr>
<tr><td> </td><td> </td></tr>
<tr><td>real  </td><td>0m4.137s</td></tr>
<tr><td>user  </td><td>0m0.503s</td></tr>
<tr><td>sys   </td><td>0m0.283s</td></tr> 
<tr><td> </td><td> </td></tr>
<tr><td>real  </td><td>0m4.092s</td></tr>
<tr><td>user  </td><td>0m0.514s </td></tr>
<tr><td>sys   </td><td>0m0.280s </td></tr>
<tr><td> </td><td> </td></tr>
<tr><td>real  </td><td>0m4.104s</td></tr>
<tr><td>user  </td><td>0m0.533s </td></tr>
<tr><td>sys   </td><td>0m0.303s </td></tr></table></ul></p>

<p>
Windows sockets
<ul><table>
<tr><td>real  </td><td>0m4.172s</td></tr>
<tr><td>user  </td><td>0m0.888s</td></tr>
<tr><td>sys   </td><td>0m0.910s</td></tr>
<tr><td> </td><td> </td></tr>
<tr><td>real  </td><td>0m4.255s</td></tr>
<tr><td>user  </td><td>0m0.858s</td></tr>
<tr><td>sys   </td><td>0m0.820s</td></tr>
<tr><td> </td><td> </td></tr>
<tr><td>real  </td><td>0m4.219s</td></tr>
<tr><td>user  </td><td>0m0.807s</td></tr>
<tr><td>sys   </td><td>0m0.839s</td></tr>
<tr><td> </td><td> </td></tr>
<tr><td>real  </td><td>0m4.867s</td></tr>
<tr><td>user  </td><td>0m0.936s</td></tr>
<tr><td>sys   </td><td>0m0.988s</td></tr></table></ul></p>
<p>
So yes, there is a performance hit. Especially the 'user' and 'sys'
measurements are respectively nearly 2 and 3 times higher than with
Unix sockets.
</p><p>
So, is this a problem? Depends on what's important to you, but I'd
argue that it's more important for Wine to open up wininet (and
consequently winsock) to more users and developers. That may eventually
attract more developers to fix bugs or even the performance issues
with our implementation.
</p><p>
I would also argue that performance in a typical scenario is probably
not bounded by wininet's implementation but by the user's bandwidth or,
for example, by his browser's rendering speed.
</p><p>
By the way, 100 *asynchronous* HTTP GETs in a tight loop will reliably
crash Wine, both with Unix sockets and Windows sockets.
</p></quote>

<p>Mike McCormack voted in favor of the patch:</p>
<quote who="Mike McCormack"><p>
 I hope that we use Han's patch. It's going to make it easier to 
 implement thread safety (as we can use WaitForMultipleObjects on the 
 handles) and will make porting easier for Reactos.
</p><p>
 IMO, wininet is not really performance critical, and we can probably 
 improve things in the winsock layer a bit too.
</p></quote>

<p>Alexandre went back to Steven's original comment and
outlined his preference,
<quote who="Alexandre Julliard">
 There's no real reason that we cannot use Unix sockets on Unix and
 Windows socket on Reactos with the same code, it just needs a bit of
 header magic; and this will be useful for Winelib apps too.
</quote></p>

<p>He also noted the problem with Wine crashing was a direct result
of wininet not being thread-safe.  Hans' original patch remains
uncommitted and no patch has appeared implementing the aforementioned
magic.</p>
</section>
<section 
	title="Problems With Automounted Filesystems" 
	subject="AutoFS-ed drives"
	archive="http://www.winehq.org/hypermail/wine-devel/2004/04/0279.html" 
	posts="3"
	startdate="14 Apr 2004 00:00:00 -0800"
>
<topic>Filesystems</topic>
<mention></mention>
<mention>Mark</mention>

<p>Mark Draheim couldn't get automounted drives to play nicely with Wine:
</p><quote who="Mark Draheim"><p>
Anybody using autofs and wine? Does it work? I don't follow wine development 
lists, so maybe autofs is no longer a problem. Once in a while I build a CVS 
snapshot and test whether the odd app I still have works. And wine on autofs 
doesn't work here. I think Guido already sent a mail about this last month.
</p><p>
Guido patched wine way back in Feb 2003, submitted a bug
<ul><a href="http://bugs.winehq.com/show_bug.cgi?id=1283">
http://bugs.winehq.com/show_bug.cgi?id=1283</a></ul>
</p><p>
and even set up a page to describe the problem
<ul><a href="http://freespace.sourceforge.net/guidod/wine-vol-a/">
http://freespace.sourceforge.net/guidod/wine-vol-a/
</a></ul></p><p>
Since then he has completely rewritten the patch in order to search 
the /etc/auto.* files for drives. This obsoleted the additional options in 
wine's config with the old patch. This last patch worked perfectly until 
recently.
</p><p>
However, Guido is busy right now and cannot work on the patch. And my C is 
pretty bad. If anybody is interested I can provide the last patch known to 
work. If for some reason the patch does not meet wine's standards, would it 
be possible that the autofs problem is recognized and put on a TODO list for 
later? Or even close the bug as WONTFIX?
</p></quote>

<p>Alexandre mentioned that as part of the filesystem rewrite this
should start working.  </p>

</section>

</kc>
