Linux-Development-Sys Digest #954, Volume #7     Thu, 15 Jun 00 16:13:14 EDT

Contents:
  problem with copy_from_user ([EMAIL PROTECTED])
  PCMCIA modem not working ([EMAIL PROTECTED])
  Re: A strange problem using poll() systemcall ([EMAIL PROTECTED])
  Re: I need betatesters for a linux ring0 debugger ("pusillus")
  Re: A strange problem using poll() systemcall ("Roman A. Stepanov")
  Re: PCI utils question... (Stephen Lee - Post replies please)
  Re: dynamic libraries under linux (Markus Pietrek)
  Re: Alan Po Again. How to start to study the KERNEL of Linux (Stephen Lee - Post 
replies please)
  Re: Use of insmod (John Gluck)
  Re: sigaltstack and libpthread (Kaz Kylheku)
  Re: HELP: SIMPLE IRQ Routine Crashes (Tod Daniels)
  Module compilation gone South... (Tim Morneau)
  Re: ansiTime library: mktime() inconsistencies across platforms? (Larry Jones)
  Shared memory, XFree4 and GNOME
  sound skips on hard drive access - YMF724 pci driver (jtnews)
  Problem with compiling glibc... (Neelima Mehta)

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

From: [EMAIL PROTECTED]
Subject: problem with copy_from_user
Date: Thu, 15 Jun 2000 12:10:10 GMT

I'm writing a char-device-driver (Kernel 2.2.5) and
i have a problem with the copy_from_user() in my
write-function. I think it's simple to solve but i
didn't see an error :-(

Here is the samplecode:

ssize_t daad_write(struct file *daad_file, const char *daad_name, size_t
buf_size, loff_t *buf)
{
  int value;
  int result;
  if (buf_size==sizeof(int))
    {
      result=copy_from_user(&value,buf,buf_size);
      printk(KERN_INFO "copied bytes=%i\n",result);
      printk(KERN_INFO "given value=%i\n",value);
    }
  return buf_size;
}

If i write an integer value (for example: 123) in my testprogram,
i get the following output in /var/log/messages:

Jun 15 14:04:06 ws-i-h08 kernel: copied bytes=4
Jun 15 14:04:06 ws-i-h08 kernel: given value=-1072636306



Sent via Deja.com http://www.deja.com/
Before you buy.

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

From: [EMAIL PROTECTED]
Subject: PCMCIA modem not working
Reply-To: [EMAIL PROTECTED]
Date: Thu, 15 Jun 2000 12:17:09 GMT

Hi,

PCMCIA installed as it comes with SuSE-6.4, Xircom and 3com ethernet cards
work as well as Simple Techology 340MB datacard but this MultiTech Multi
Mobile 56K modem doesn't.

Here's a syslog snapshot:

Jun 15 15:18:16 tossu-II cardmgr[3815]: initializing socket 0
Jun 15 15:18:16 tossu-II cardmgr[3815]: socket 0: Serial or Modem
Jun 15 15:18:16 tossu-II cardmgr[3815]: executing: 'insmod 
/lib/modules/2.2.14/pcmcia/serial_cs.o'
Jun 15 15:18:17 tossu-II kernel: tty00 at 0x03f8 (irq = 10) is a 16550A
Jun 15 15:18:17 tossu-II cardmgr[3815]: executing: './serial start ttyS0'

bash-2.03# setserial /dev/modem, UART: 16550A, Port: 0x03f8, IRQ: 10

So it seems to initialize OK but that darn thing just doesn't respond to
anything... For example minicom just hangs when trying to exit before
pulling the card out.

Help?

Roope

-- 
MicroSoft? is that some kind of a toilet paper?
PS: Look for address here, not from headers. And remove NOSPAM's
___________________________________________________________________________
                 [EMAIL PROTECTED]
     +358 9 812 7567  /  +358 9 511 20585  /  +358 40 750 4480
===========================================================================
       Nokia Networks - Radio Access Systems - Site Solutions

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

From: [EMAIL PROTECTED]
Subject: Re: A strange problem using poll() systemcall
Date: Thu, 15 Jun 2000 12:35:38 GMT



I'm not sure I can help with your original problem, but I have written
a couple of comments on the code which might help you investigate
further.


In article <8iadkf$93c$[EMAIL PROTECTED]>,
  "Roman A. Stepanov" <[EMAIL PROTECTED]> wrote:

> My C++ program working with /dev/ttyS0 has a very strange bug.
> When I try to use poll() to determine if I have a new data in
> port everything works fine for a few minutes. After that poll()
> always returns 0 even if I have a new data in port and my program
> thinks there is no new data. When I try to remove everything
> related to poll() from my code, the program starts to work
> fine but I don't want to wait 10ms if I have no new data.



> my_serial::my_serial(char *devname)
> {
>     devfile = open(devname, O_RDWR | O_NOCTTY);
>     tcgetattr(devfile, &old_tio);

Criminal!  You should check that open() returned successfully. If it
does not, you will most likely want to indicate it to the instantiator
of the my_serial object, and a C++ constructor is not the way to do
that.  Have an open method on your object which returns true on
success. Or throw an exception from your ctor.



> int my_serial::try_read(char *inp_data)
> {
>     int                   lastbyte = 0;
>     struct pollfd    udfs;
>
>     bzero(&udfs, sizeof(struct pollfd));
>     udfs.fd = devfile;
>     udfs.events = POLLIN;
>
>     if (poll(&udfs, 1, 1) <= 0)
>         return false;

You are invoking poll every millisecond, which is very inefficient.
Consider what value of the third argument you really want, bearing in
mind that it's in milliseconds not seconds.

You should be checking the error code of poll(), especially when you
are using signals as you may need to restart the system call.  If poll
returns 0, it means timeout. If it returns negative, you should call
perror() to inform yourself of what's going on. If it's EINTR, you
might want to restart the call.


>     while ((res = read(devfile, &inp_data[lastbyte], 1)) > 0)
>          if (input_data[lastbyte++] == FS)
>              break;

This will cause one user/kernel context switch per byte received: not
at all efficient. Read in a larger chunk and then parse the buffer of
data as required.


HTH




Sent via Deja.com http://www.deja.com/
Before you buy.

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

From: "pusillus" <[EMAIL PROTECTED]>
Subject: Re: I need betatesters for a linux ring0 debugger
Date: Thu, 15 Jun 2000 12:55:21 GMT


>http://ttt.inf.upv.es/~viesllo

i've reposted your request to:

http://www.egroups.com/group/linux-assembly/   (a linux assembly message
board)

http://www.insidetheweb.com/mbs.cgi/mb186284 ( a reversing linux m.b.)



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

From: "Roman A. Stepanov" <[EMAIL PROTECTED]>
Subject: Re: A strange problem using poll() systemcall
Date: Thu, 15 Jun 2000 17:14:04 +0400

Hi, All!

<[EMAIL PROTECTED]> wrote:
>
> Criminal!  You should check that open() returned successfully. If it
> does not, you will most likely want to indicate it to the instantiator
> of the my_serial object, and a C++ constructor is not the way to do
> that.  Have an open method on your object which returns true on
> success. Or throw an exception from your ctor.
>
    Actually I do the check but I'dont show this code here because I wanted
    to show only code I expirienced problem with.

> You are invoking poll every millisecond, which is very inefficient.
> Consider what value of the third argument you really want, bearing in
> mind that it's in milliseconds not seconds.

    Yes, I have to check if there any incoming data _every_ millisecond
because
    it's very important to me to check some particular device connected to
the
    serial port at least 100 times per second. I'd be grateful if anybody
tells me
    how to do it as much faster as possible!

>
> You should be checking the error code of poll(), especially when you
> are using signals as you may need to restart the system call.  If poll
> returns 0, it means timeout. If it returns negative, you should call
> perror() to inform yourself of what's going on. If it's EINTR, you
> might want to restart the call.
>
   As far as I understand if I get EINTR next call to poll() must return
non-negative
   value, isn't it?

>
> >     while ((res = read(devfile, &inp_data[lastbyte], 1)) > 0)
> >          if (inp_data[lastbyte++] == FS)
> >              break;
>
> This will cause one user/kernel context switch per byte received: not
> at all efficient. Read in a larger chunk and then parse the buffer of
> data as required.
>

    Yes, this isn't looking very efficient, I'll try to think how to
re-wrtite this
    part. But I still don't understand why it's not working...

    Greetings,
    Roman A. Stepanov



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

From: Stephen Lee - Post replies please <[EMAIL PROTECTED]>
Subject: Re: PCI utils question...
Date: 15 Jun 2000 13:08:46 GMT

In article <[EMAIL PROTECTED]>,
Adrian Cox  <[EMAIL PROTECTED]> wrote:
>
>PCI cards have four interrupt output lines A-D. The PCI spec describes a
>mechanism to arrange these so that the interrupts of one slot are or-ed
>with the interrupts from the next slot, rotated one place. This leads to
>the system seeing a total of four interrupts from PCI devices. This is
>not compulsory: a motherboard may provide more interrupts, if the
>interrupt controller is up to it.

Corollary: if your motherboard has 5 PCI slots, it most probably is
sharing IRQ between 2 of them.

In addition, most motherboards have 1 PCI slot that shares IRQ with
AGP, and another that shares with the USB controller.

Stephen

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

Date: Thu, 15 Jun 2000 15:52:09 +0200
From: Markus Pietrek <[EMAIL PROTECTED]>
Subject: Re: dynamic libraries under linux

[EMAIL PROTECTED] wrote:
> 
> could some one point me to some place where i can learn how to build a
> dynamic libraries under linux.
> 
> ali al-khalidi
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.

/usr/doc/HOWTO/ELF-HOWTO

--
Markus Pietrek

Tel: +49-761-47094-13
Fax: +49-761-47094-29

Web: http://www.concept.de

Concept Engineering GmbH
Boetzinger Strasse 29
D-79111 Freiburg/Germany

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

From: Stephen Lee - Post replies please <[EMAIL PROTECTED]>
Subject: Re: Alan Po Again. How to start to study the KERNEL of Linux
Date: 15 Jun 2000 13:32:44 GMT

In article <8i1jtp$[EMAIL PROTECTED]>,
Alan Po <[EMAIL PROTECTED]> wrote:
>Yes! I need to write it on my own and then minimize it so that it is small
>enough to fit into any environment.
>
>Alan Po

1) Define 'it'.  Are you writing a completely new OS?  Then it is not
Linux.   Otherwise, you can chop down the size of the Linux kernel a
lot by not including drivers you don't need, etc.

2) Define 'any environment'.  I doubt you can chop the regular
Linux kernel down enough to fit on an 8-bit microcontroller.

Please think about what you actually want to accomplish so people can
give you better suggestions.

Stephen

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

From: John Gluck <[EMAIL PROTECTED]>
Subject: Re: Use of insmod
Date: Thu, 15 Jun 2000 09:55:20 -0400

Ed Hudson wrote:

> I am trying to write a modular device driver that crashes on
> initialization.  If I type lsmod I see that the driver is initilizing.  However, I 
>cannot rmmod it or try to reload
>  it. If I try to rmmod I get a "device or resource busy" message and if I try 
>reloading the module I am told
> that  it is already loaded.  Is there a way of forcing the module out other than 
>rebooting the machine?
> Also is there a How-to or other bit of documentation on kernel level debugging using 
>gdb or some other
> debugger?
>
> Thanks for your help
>
> Ed Hudson
> [EMAIL PROTECTED]
>
> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----==  Over 80,000 Newsgroups - 16 Different Servers! =-----

There's the Linux Kernel Hacker's Guide at the linux documentation project. It's a bit 
old but will provide some hints

http://metalab.unc.edu/mdw/index.html

--
John Gluck  (Passport Kernel Design Group)

(613) 765-8392  ESN 395-8392

Unless otherwise stated, any opinions expressed here are strictly my own
and do not reflect any official position of Nortel Networks.




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

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: sigaltstack and libpthread
Reply-To: [EMAIL PROTECTED]
Date: Thu, 15 Jun 2000 14:18:08 GMT

On Thu, 15 Jun 2000 12:15:54 +0200, Henning <[EMAIL PROTECTED]> wrote:
>Hy folks,
>
>does anyone have an idea what to do if I want to catch
>stack exceptions (limited stack size) with pthread library bound?
>
>If an exception occures the pthread_sighandler wants to determine
>thread_self but this is found on the program stack NOT on the alternate
>exception stack. What should I call or set to make this possible?

This is a problem.

As a workaround, try reserving an area at the top of the thread's stack as the
alternate stack. E.g.

    void *thread_function_wrapper(void *arg)
    {
        /* Reserved stack area with conservative 32 byte alignment. */

        char reserved[4096] __attribute__ (( aligned (32) )); 

        /* set up alt stack */

        return thread_function(arg);
    }

A pointer to ``reserved'' can be associated with a thread-specific data
key for later retrieval, so that the setting up of the alternate stack
can be done later.

-- 
#exclude <windows.h>

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

From: [EMAIL PROTECTED] (Tod Daniels)
Subject: Re: HELP: SIMPLE IRQ Routine Crashes
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.hardware
Date: 15 Jun 2000 10:24:35 -0400

Arnaud,

Thanks for the advice.  It always amazes me how a coder (like me, for example)
can look at a line a hundred times and never see an obvious error.  

Of course, now that the oops is gone, the system just hangs.  You wouldn't 
happen to have any troubleshooting tips for resolving complete system hangs 
in a device driver.

I believe I have ruled out a hardware IRQ conflict (the only things in the 
system are a floppy, a NIC, and a single IDE interface).  The device 
drivers loads and runs normally, but when I send data to the new interface, 
the system hangs -- no console, no network response, no ctl-alt-del, 
nothing.  I have tried the interrupt as both a fast and a slow handler 
-- no difference.

I appreciate any help you (or anyone else) can give.

thanks again...



Arnaud Westenberg ([EMAIL PROTECTED]) wrote:
> Tod Daniels wrote:

> > Here is the output from the KERN_DEBUG message:

> See rubini's book about making (a little) more sense of oopses

> > The code I wrote to service the interrupt is as follows:

> [snip]

> >   if (request_irq(Card->Irq, &dcpInterruptService, 0,

> [/snip]

> Don't use the address of operator (&) in front of your handler name, the
> name alone is already a handler.

> Regards Arnaud

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

From: Tim Morneau <[EMAIL PROTECTED]>
Subject: Module compilation gone South...
Date: Thu, 15 Jun 2000 10:14:49 -0600

I wrote a driver/module that compiled perfectly under RedHat 6.2 and now
attempting to build it under Mandrake 7.0.  It appears as though the
system include files like linux/fs.h and most of the others are broken
by something I've done.  The primary error message that I see over the
hundreds that are displayed is "/usr/include/linux/{fs.h for example but
not limited to}:lineno: parse error before '{example:ino_t}'.  Kernel
source and headers are installed.  I noted that another posting
described the "dereferencing pointer to incomplete type" error message
but I believe that is just another side effect of a simpler problem
since I assume that the kernel headers are somewhat bug free and all of
the errors I'm seeing are located in kernel headers and I've not made
any alterations to the headers whatsoever.  

As for the reason I'm using Mandrake instead of RedHat; well the
Mandrake installation does a better job with my target machine and its
video setup for X.

tim

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

From: [EMAIL PROTECTED] (Larry Jones)
Crossposted-To: comp.lang.c,comp.os.linux.misc,comp.os.linux.portable
Subject: Re: ansiTime library: mktime() inconsistencies across platforms?
Date: 15 Jun 2000 15:52:59 GMT
Reply-To: [EMAIL PROTECTED]

Mark Law ([EMAIL PROTECTED]) wrote:
>
> There are other test result diffs that follow the same pattern, where
> the pattern is for times given on the boundary of transitioning from
> daylight savings to standard time, SunOS treats tm_isdst = -1 as if its
> a "1" and the resulting time is a daylight savings time and Win NT
> treats tm_isdst = -1 as if its a "0" and the resulting time is NOT a
> daylight savings time.
>
> Which behavior is correct?

Both.  Times in the overlap period occur twice -- once in Daylight
Saving Time and once in Standard Time -- so mktime() has no way to know
which one you mean; it is allowed to return either one, or to return an
error.  The same is true for times in the gap period that don't occur at
all.

-Larry Jones

In short, open revolt and exile is the only hope for change? -- Calvin

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

From: <[EMAIL PROTECTED]>
Subject: Shared memory, XFree4 and GNOME
Date: Thu, 15 Jun 2000 18:30:45 GMT

I'm running kernel 2.2.16, Xfree86 4.0 and GNOME 1.2. I've noticed that X
and GNOME use a hell of a lot of shared memory segments. In fact, they max
out at 128 which is the maximum allowed under my kernel. I then get shmget:
failed messages everywhere. First of all, are these guys supposed to use
this many shared memory segments? Each GNOME process uses 5 or 6 of them
and X uses about 20 - 25. Second of all, how do I increase the maximum
without totally screwing up my kernel.

Thanks

Curtis Stanford

--
Posted via CNET Help.com
http://www.help.com/

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

From: jtnews <[EMAIL PROTECTED]>
Subject: sound skips on hard drive access - YMF724 pci driver
Date: Thu, 15 Jun 2000 18:38:33 GMT

I just switched over to the alsa sound driver from opensound.
One thing I noticed is that my sound now tends to skip more
on hard drive access.  Is there anything I can do to minimize
this?

Thanks.




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

From: Neelima Mehta <[EMAIL PROTECTED]>
Subject: Problem with compiling glibc...
Date: Thu, 15 Jun 2000 14:37:26 -0500


Hi,

I am new at working with glibc - I want to compile glibc-2.0.6 as a test
library. I've been following the instructions on :

http://www.linuxdoc.org/HOWTO/Glibc2-HOWTO.html

I managed to do 'make' and 'make check', but it gets stuck at 'make
install', and I get the following error message:

/home/suha/wtcp/libc/glibc-2.0.6/compile/../../libroot/bin/make  -C time
subdir_install
make[2]: Entering directory `/home/suha/wtcp/libc/glibc-2.0.6/time'
LD_LIBRARY_PATH=/home/suha/wtcp/libc/glibc-2.0.6/compile:/home/suha/wtcp/libc/glibc-2.0.6/compile/elf:/home/suha/wtcp/libc/glibc-2.0.6/compile/nss
/home/suha/wtcp/libc/glibc-2.0.6/compile/elf/ld-linux.so.2
/home/suha/wtcp/libc/glibc-2.0.6/compile/time/zic -d
/home/suha/wtcp/libc/libroot//share/zoneinfo -L /dev/null -y ./yearistype
australasia
"australasia", line 83: Wild result from command execution (rule from
"australasia", line 75)
/home/suha/wtcp/libc/glibc-2.0.6/compile/time/zic: command was
'./yearistype 1990 even', result was 139
make[2]: ***
[/home/suha/wtcp/libc/libroot//share/zoneinfo/Australia/Adelaide] Error 1
make[2]: Leaving directory `/home/suha/wtcp/libc/glibc-2.0.6/time'
make[1]: *** [time/subdir_install] Error 2
make[1]: Leaving directory `/home/suha/wtcp/libc/glibc-2.0.6'
make: *** [install] Error 2

I then checked:

http://www.imaxx.net/~thrytis/glibc/glibc-FAQ.html

where they have recommended using make-3.75. I had used make-3.76.1, so I
downgraded it. Yet, I ran into the same problem.

Can anyone help me out with this?

Thanks!!

Neelima



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


** 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: [EMAIL PROTECTED]

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

    Internet: [EMAIL PROTECTED]

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

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

Reply via email to