From:     Digestifier <Linux-Development-Request@senator-bedfellow.mit.edu>
To:       Linux-Development@senator-bedfellow.mit.edu
Reply-To: Linux-Development@senator-bedfellow.mit.edu
Date:     Tue, 23 Nov 93 21:13:11 EST
Subject:  Linux-Development Digest #254

Linux-Development Digest #254, Volume #1         Tue, 23 Nov 93 21:13:11 EST

Contents:
  sys/time.h, timercmp (Peter Dalgaard SFE)
  linux kernel debugger (Fabio Kon)
  Bug report (Joel M. Hoffman)
  Re: Need help on lmscd0.2. (Kai Petzke)
  Re: Don't use Motif for free sw: it now requires runtime royalties! (H. Peter Anvin N9ITP)
  Re: 3 buttons on Microsoftish mice (mouses?). (John Markus Bjoerndalen)
  Re: Don't use Motif for free sw: it now requires runtime royalties! (Jay Schmidgall)
  Pentium & gcc ??? (Markus Krug)
  Synchronous writes under Linux (Nicolas Droux)
  Re: Some ideas and reasons for a more modular kernel. (Rob Janssen)
  Re: 1542B and DSP3160 bad I/O Performance (Rob Janssen)
  HUB6 serial driver & kernel debugging. (Byron A Jeff)

----------------------------------------------------------------------------

From: pd@kubism.ku.dk (Peter Dalgaard SFE)
Subject: sys/time.h, timercmp
Date: Tue, 23 Nov 1993 13:23:47 GMT

While fooling around with the microsecond timer, my eyes
caught this in sys/time.h (slackware 1.0.5):

==================================================
/*
 * Operations on timevals.
 *
 * NB: timercmp does not work for >= or <=.
 * 
 * Note: timercmp may work for for >= or <= now. H.J.
 */
#define timerisset(tvp)         ((tvp)->tv_sec ||
(tvp)->tv_usec)
#define timercmp(tvp, uvp, cmp) \
        (((tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) \
        || (tvp)->tv_sec cmp (uvp)->tv_sec)
===================================================

No, it won't work! That is why the ?: operator is there. This
works:

#define timercmp(tvp, uvp, cmp) \
        ((tvp)->tv_sec == (uvp)->tv_sec ? (tvp)->tv_usec cmp (uvp)->tv_usec\
        : (tvp)->tv_sec cmp (uvp)->tv_sec) 

Sorry if this is the wrong group, but it is not easy to see
where this kind of bug report should go.

        Peter

--
   O_   ---- Peter Dalgaard
  c/ /'  --- Statistical Research Unit
 ( ) \( ) -- University of Copenhagen
~~~~~~~~~~ - (pd@kubism.ku.dk)

------------------------------

From: kon@ime.usp.br (Fabio Kon)
Subject: linux kernel debugger
Date: 23 Nov 1993 13:02:33 GMT

Hi,

 I would like to change some lines in the linux kernel. How can I debug it?
Is there any software tool for debugging the linux kernel? 

 I have been looking for it in some manual pages and FAQs but I haven't found
it. 

 If this information can be found in any FAQ, please tell me where!

Thanks in advance,

Fabio Kon.

------------------------------

From: joel@rac4.wam.umd.edu (Joel M. Hoffman)
Subject: Bug report
Date: Tue, 23 Nov 1993 15:29:08 GMT

>> I'm terribly sorry, but what should I use instead? I'm rather fond of
>> this "trick":
>>    for i in `yes "" | cat -n | head -100`; do ...
>

Thinking this was a nice trick I'd never thought of before, I tried
it, and it does count to 100.  But then I tried:

        for i in `yes "*" | cat -n | head -100`; do echo $i ; done

just for the hell of it, and bash >crashed.<  It gave me a fatal error
(1), and then core dumped and I got a login prompt again.

Any ideas?
-- 
=============================================================================
|_|~~ Germany, Europe. 1943.    "The diameter of the bomb was 30 centimeters,
__|~| 16 Million DEAD.           and the diameter of its destruction, about 7
                                meters, and in it four killed and 11 wounded. 
 cnc  Bosnia, Europe. 1993.     And around these, in a larger circle of  pain
 cnc  HOW MANY MORE?          and time,  are scattered two  hospitals and one
                          cemetery.   But the young woman who was  buried  in
                    the place from where she came, at a distance of more than
             than 100 kilometers, enlarges the circle considerably.   And the 
      lonely man who is mourning her death in a distant  country incorporates
into the circle the whole world.  And I won't speak of the cry of the orphans
that reaches God's chair and from there makes the circle endless and godless."
=============================================================================
     Tell Clinton to stop the genocide:  president@whitehouse.gov

------------------------------

From: wpp@marie.physik.tu-berlin.de (Kai Petzke)
Subject: Re: Need help on lmscd0.2.
Date: 23 Nov 1993 15:44:56 GMT

In <2cse8k$gmk@nwfocus.wa.com> ten0772@halcyon.com (Timothy E. Neto) writes:

>       I look through the README file for the writer's address, but
>       I couldn't find it, so I'm posting a message here.  I'm trying
>       here in the development group, hoping I'll catch the writer's
>       attention.  I'm appreciative to be able to be an Alpha tester.

You catched the writer of that driver (= me).  The other way of
catching me is to take a look at the lmscd.c file itself - it
should have my e-mail address in the copyright notice.  Sorry,
I forgot it in the README.

>       So here is my error,

>gcc -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer  -m486  -c lmscd.c
>lmscd.c: In function `sec2fsm_bcd':
>lmscd.c:374: `asm' needs too many reloads
>gcc: Internal compiler error: program cc1 got fatal signal 6
>make[2]: *** [lmscd.o] Error 1
>make[1]: *** [kernelsubdirs] Error 1
>make: *** [linuxsubdirs] Error 1
>$

>       I'm running Linux 0.99pl13 with the atdisk2 patch on a Gateway
>       4DX2-66V system.  I have the Gateway internal LMS-CM205 CDROM
>       drive.  My O/S is built up from the SLS1.02 package, JANA
>       May/June CDROM, and some Slackware 1.1.0 libraries.

You forgot the most important information:

        WHICH GCC ARE YOU USING?

As the message goes: "gcc: Internal compiler error: program cc1 got
fatal signal 6" implies: this is a problem specific to the compiler,
not to the syntax.

Ok, let me try to explain, what is going on: The error is caused by
following inline function:

/* binary to bcd: */
static inline uch bin2bcd(uch bin)
{
    unsigned char bcd;
    /* unsigned short b = bin; */

__asm__ ("idivb %b2\n\t"
    "shlb $4,%b0\n\t"
    "orb %%ah,%b0"
    : "=a" (bcd) : "a" ((unsigned short) bin) , "q" ((uch) 10) : "a");
    return bcd;
}

This function does the following:

- load the value of the variable bin into register %a (exactly %ax,
  because 16 bits are used, the size of an short)
- load the value 10 into a register choosen by the compiler

- idivb %b2: divide %a by the compiler choosen register. This
             gives the result in the lower 8 bits of %a (%al),
             and the reminder in the upper 8 bits (%ah).
- shlb $4,%b0: multiply the result with 16, keeps the reminder
               (because shlb addresses the low 8 bits only).
- orb %%ah,%b0: or (or add) the reminder with the result.

- the output, which can be found in register %a is then written
  to the variable bcd.

This converts a binary value in the range 0 ... 99 to a bcd (binary
coded decimal, every 4 bit represent a decimal) value.  CD-ROM drives
like bcd, but OS's generally don't.  The reasons, I used assembler, were:

- gcc would issue a long divide command instead of a byte divide,
  which may be several times slower.
- gcc doesn't know, that it can get the value and remainder with
  one divison, and would issue two division commands.
- I wanted to understand how inline assembler works.

That the compiler complains about reloading means, that this
assembler was included into another, more complicated expression
(the function is inline!), and the compiler is running out of
register (roughly speaking).

Possible bug fixes:

a) Make it a normal function by taking away the "inline" directive.

b) Maybe, gcc is confused that the same register is named twice in
   the input and output part of the assembler directive.  Try the
   default way to reuse a register:

    : "=a" (bcd) : "0" ((unsigned short) bin) , "q" ((uch) 10) : "a");

   instead of:

    : "=a" (bcd) : "a" ((unsigned short) bin) , "q" ((uch) 10) : "a");

c) Replace the function with a C version:
    /* binary to bcd: */
    static inline uch bin2bcd(uch bin)
    {
        return (bin / 10) * 16 + (bin % 10);
    }

Sorry, I do not have a linux box available here - this is all untested!
--
Kai
wpp@marie.physik.tu-berlin.de
Advertisement by Microsoft in a well-known German magazine:
        If you don't like our programmes, than make your own ones.
However, they expect you to use Microsoft products for this -:)

------------------------------

Crossposted-To: comp.windows.x,comp.windows.x.i386unix,comp.windows.x.motif,gnu.misc.discuss,comp.sources.d
From: hpa@ahab.eecs.nwu.edu (H. Peter Anvin N9ITP)
Subject: Re: Don't use Motif for free sw: it now requires runtime royalties!
Reply-To: hpa@nwu.edu (H. Peter Anvin)
Date: Tue, 23 Nov 1993 17:45:47 GMT

In article <mjr.754007665@texas> of comp.windows.x.i386unix,
  mjr@syl.dl.nec.com (Matt Ranney) writes:
> mkl@rob.cs.tu-bs.de (Mario Klebsch DG1AM) writes:
> 
> >But please don't forget that these staticaly linked executables do
> >not only need more space on disk, but also need more virtual memory
> >when executiing. And this means a lot more swapping, if the user does
> 
> Do they really?  How much more?  I thought that the only difference in
> memory usage between using shared and static libs was roughly the size
> of the .sa file.  Is this incorrect?
> 

Yes, because -- read my MIPS:

a) All instances of a statically linked application running at once
share the same copy of the binary (and hence the library routines) in
memory. 

b) All instances of *all* dynamically linked applications running at
the same time share the same copy of the library in memory.

However, remember that static and dynamic linking can be done on a
library by library basis (the -static switch to ln means link *all*
libraries statically; but if you speficy the .a file explicitly you
can link a single library statically); hence for example Mosaic can
still use (and share) libc.so while having its own copy of the Motif
library.  If Mosaic is your only Motif application, it doesn't matter
that it is statically linked with the Motif libes.

Linux, incidentally, initially didn't have dynamic libraries, but had
*shared* libraries.  This was great, except for the fact that each
version of the C compiler (HLU distributed gcc and libc as a unit back
then) came with a different shared image which did not replace earlier
ones unless you recompiled (or at least relinked) your application.
Ah, those days of yore...       :-)

        /hpa
         (who just barely missed the 0.1x era since I didn't have
          enough money to buy a 386+ computer until after 0.95 was out)

-- 
INTERNET: hpa@nwu.edu               FINGER/TALK: hpa@ahab.eecs.nwu.edu
IBM MAIL: I0036073 at IBMMAIL       NeXTMAIL:    hpa@speedy.acns.nwu.edu
FIDONET:  1:115/511 or 1:115/989.4  HAM RADIO:   N9ITP or SM4TKN
This article might have been generated by a buggy newsreader.

------------------------------

From: johnm@stud.cs.uit.no (John Markus Bjoerndalen)
Subject: Re: 3 buttons on Microsoftish mice (mouses?).
Date: Tue, 23 Nov 1993 16:04:09 GMT

In article <1993Nov16.130931.83@nehlsen.toppoint.de>, stefan@nehlsen.toppoint.de (Stefan Nehlsen) writes:
|> freed@europa.orion.adobe.com (Alex Freed) writes:
|> >Hi,
|> 
[Description of problem with logitech/microsoft compatible mouse]

|> The microsoft mouse protocol only supports 2 buttons, it's not a
|> software problem. I don't know about a special logitech protocol.
|> I think to use all 3 buttons the mouse has to run in mouse systems mode.
|> 

Nope. 

I have a "100% Microsoft compatible" Logitech Mouseman. The default
mode for this mouse is Microsoft mode, which generates a "button 1&3
pressed" whenever you press the middle button. (That is, the middle
button is not a seperate button, but looks like you pressed the left
and right button at the same time.) (This only goes for the newer
LM's, the older ones use the "Mouseman" protocol directly).

So, a quick and dirty way to get it working is to just use it as a
Microsoft mouse and use the "Emulate3Button" feature in X.

But. Logitech have an "extended microsoft protocol" too. In my
"technical documentation" is tells you how to use a switch for some
tool or driver (Don't remember which, and I don't have any docs here)
to get it to use this protocol.

As far as I can guess the driver is dumping some garbage to the 
mouse, and upon seeing this garbage the mouse decides it was a 
Logitech Mouseman after all. 

I might try and write a utility that does this myself after my 
exams, but if you're in a hurry you could try and call Logitech or 
your supplier and ask for some documentation on how to write this 
piece of software. (If you're lucky it doesn't need to be more 
complex than a line echoing something to the mouse in your 
/etc/rc.local). 

Good luck, 

-- 
        / John Markus Bjørndalen
        / johnm@stud.cs.uit.no  (at uit)
        / johnm@autosim.no      (at work)

------------------------------

Crossposted-To: comp.infosystems.www,comp.windows.x,comp.windows.x.i386unix,comp.windows.x.motif,gnu.misc.discuss,comp.sources.d
From: shmdgljd@rchland.vnet.ibm.com (Jay Schmidgall)
Subject: Re: Don't use Motif for free sw: it now requires runtime royalties!
Date: Tue, 23 Nov 1993 15:20:12 GMT
Reply-To: jay@vnet.ibm.com

In article <SHANE.93Nov22232045@nugget.spr.com>, shane@nugget.spr.com (Shane Hartman) writes:
|> Like it or not, you are in the minority.  Now that Motif is going to
|> be bundled with all COSE platforms in the near future, it makes NCSA's
|> job easier to target a standard platform (which tcl/tk is certainly
|> not). 

Too bad the X Consortium just doesn't bundle tcl/tk with the X distribution
like it does with the Athena widgets.  Then it could just be up to the
vendor as to whether or not they are supplied on that platform, just like
it is now with the Athena widgets.

Of course, this is slightly problematic, since tcl/tk are currently changing
more rapidly than the Athena widgets do, but it would at least get them out
to more places...

-- 
: jay          jay@vnet.ibm.com    My opinions and ideas, not my employer's.
: shmdgljd@rchland.vnet.ibm.com    (c) Copyright 1993.  All rights reserved.

------------------------------

From: 613918@rhds11.rz.fht-esslingen.de (Markus Krug)
Subject: Pentium & gcc ???
Date: 23 Nov 1993 16:25:44 GMT

Hello folks,

Does anybody knows, if there will become a Pentium support for the
GCC compiler ???
What I mean is, if someone is working on compiler flag for special
support and using of the Pentium architecture ??? (like it exists for 486)

Thanx in advance

markus

------------------------------

From: droux@isbiel.ch (Nicolas Droux)
Subject: Synchronous writes under Linux
Date: 23 Nov 1993 16:20:49 GMT


I'm porting some software that works actually fine under NEXTSTEP and  
SunOS 4 to Linux (SLS 0.99.pl9-12). 

I need to do synchronous writes on pipes. Under NEXTSTEP and SunOS, I can  
use fcntl() to turn on the FSYNC bit of the pipe flag. I didn't find FSYNC  
under Linux however and I would know if this feature is not implemented,  
or if it's implemented but with other functions, or if it's implemented  
under an other version of Linux. 

Any idea ?

Thanks,

Nicolas Droux

------------------------------

From: rob@pe1chl.ampr.org (Rob Janssen)
Subject: Re: Some ideas and reasons for a more modular kernel.
Date: Tue, 23 Nov 1993 15:38:46 GMT

In <2csajl$7vn@news.u.washington.edu> tzs@stein3.u.washington.edu (Tim Smith) writes:

>Ed H. Chi <ehhchi@maroon.tc.umn.edu> wrote:
>>>kernels. What it needs is an automated way of generating a kernel symbol
>>>map. I was hoping Linus will get around to incorporating into the kernel
>...
>>This loadable driver thing has been talked about before, and people just
>>said, "there is this module thing on the QIC-80 directory."  There has
>>been no move of it into the standard kernel distribution.

>Is there something about Linux that makes loadable drivers hard?
>(I don't have Linux, so can't look for myself).  I added them to
>ISC Unix when I worked at ISC, and it was easy.

>If I recall correctly, here's how we did it.  This should be adaptable
>to any Unix-like system.

[ list of changes deleted ]

>--Tim Smith

Actually, the problem is not to load the driver, but to let it interface
with the kernel.  Remember, the datstructures referenced by the device driver
may be modified between kernel revisions, and the concept of a loadable
device driver introduces the problem of having a device driver that has
been compiled with a different set of kernel include files than the
currently running kernel...

Also, functions in the kernel called by the device driver (and vice-versa)
may have changes in their interface while keeping the same name.

Therefore, a foolproof 'loadable device driver' feature would have to check
for such incompatibilities in some automatic way, and this is less trivial
to implement than the actual loading of the driver.

When using the feature with relatively stable kernels the above problems
are minor, but in the rapidly developing Linux system they would lead to
numerous questions about 'why does the driver for my xxx not work with
my new 0.99 pl543 kernel???'

Rob

=========================================================================
| Rob Janssen                | AMPRnet:   rob@pe1chl.ampr.org           |
|                            | AX.25 BBS: PE1CHL@PI8UTR.#UTR.NLD.EU     |
| e-mail: pe1chl@rabo.nl     | Tel. BBS:  +31-30715610 (23:00-07:30 LT) |
=========================================================================
-- 
=========================================================================
| Rob Janssen                | AMPRnet:   rob@pe1chl.ampr.org           |
|                            | AX.25 BBS: PE1CHL@PI8UTR.#UTR.NLD.EU     |
| e-mail: pe1chl@rabo.nl     | Tel. BBS:  +31-30715610 (23:00-07:30 LT) |

------------------------------

From: rob@pe1chl.ampr.org (Rob Janssen)
Subject: Re: 1542B and DSP3160 bad I/O Performance
Date: Tue, 23 Nov 1993 15:45:20 GMT

In <2crer0$ug@adv.win.tue.nl> devet@adv.win.tue.nl (Arjan de Vet) writes:

>I use a 2.0 Gb DEC SCSI-2 harddisk with an Adaptec 1542C on a 486DX33 and I
>get only 600-700 kB/sec (using iozone). I don't know whether this is
>`normal' and what kind of settings could improve this performance. The
>performance as it is now is not faster than my IDE disks.

>I remember some discussions on the SCSI/KERNEL channel about improving
>SCSI performance in Linux. I don't know what the current status is.

Look in the .../BETA/scsi directory on most mirrors to find recent things.
Eric Youngdale has, after I started the discussion for what was probably
the 25th time, done some real research on this and has constructed some
patches to improve the transfer block size by clustering.

He has also written a program to read and set the parameters of the drive,
which often are set to sub-optimal values for Linux's use of the drive.

Rob

=========================================================================
| Rob Janssen                | AMPRnet:   rob@pe1chl.ampr.org           |
|                            | AX.25 BBS: PE1CHL@PI8UTR.#UTR.NLD.EU     |
| e-mail: pe1chl@rabo.nl     | Tel. BBS:  +31-30715610 (23:00-07:30 LT) |
=========================================================================
-- 
=========================================================================
| Rob Janssen                | AMPRnet:   rob@pe1chl.ampr.org           |
|                            | AX.25 BBS: PE1CHL@PI8UTR.#UTR.NLD.EU     |
| e-mail: pe1chl@rabo.nl     | Tel. BBS:  +31-30715610 (23:00-07:30 LT) |

------------------------------

From: byron@cc.gatech.edu (Byron A Jeff)
Subject: HUB6 serial driver & kernel debugging.
Date: Tue, 23 Nov 1993 17:25:15 GMT

Has anyone gotten the HUB6 part of the serial driver to work? I enabled mine
in the pl12 kernel (Slackware 1.02 distribution) but only the 1st port works.

So I took a mind to debugging it. I enabled the SERIAL_OPEN_DEBUG define that
gives a few printk's to show what's going on. After recompiling and rebooting
however nothing showed up.

So I took a look around in printk.c and saw that the log to console variable
had so be set. I did that but still didn't get any messages on any of the
consoles.

Lastly does anyone have any idea of how bad a performance hit the HUB6 has
because it has to do an outb to set the card,port, and register before 
accessing? Since the HUB6 can address a whole bunch of serial ports (24)
using only two IO address, I think it might be cool to release an updated
version with 16550's or something. Getting 24 to 32 serial ports in one machine
is an intriguing idea.

Thanks for any help you can offer.

BAJ

---
Another random extraction from the mental bit stream of...
Byron A. Jeff - PhD student operating in parallel!
Georgia Tech, Atlanta GA 30332   Internet: byron@cc.gatech.edu

------------------------------


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: Linux-Development-Request@NEWS-DIGESTS.MIT.EDU

You can send mail to the entire list (and comp.os.linux.development) via:

    Internet: Linux-Development@NEWS-DIGESTS.MIT.EDU

Linux may be obtained via one of these FTP sites:
    nic.funet.fi				pub/OS/Linux
    tsx-11.mit.edu				pub/linux
    sunsite.unc.edu				pub/Linux

End of Linux-Development Digest
******************************
