Linux-Development-Sys Digest #2, Volume #8        Fri, 7 Jul 00 13:13:18 EDT

Contents:
  Ethertap Devices (Tim Godfrey)
  Re: __KERNEL__ (Josef Moellers)
  Re: What are the proper tools/methods for dealing with core dump  (Josef Moellers)
  how to estimate the memory usage for a program ("Yoon Cheol Jin")
  Re: Good Basic compiler for linux? (Mike Dowling)
  Re: Interrupt handling in Linux ("Dmitriy A. Fedorov")
  Re: Ethertap Devices ([EMAIL PROTECTED])
  A good distribution anybody? (Mike Dowling)
  writing I/O to memory address range (F. Heitkamp)
  LD_LIBRARY_PATH problem ("Gary Knopp")
  Re: LD_LIBRARY_PATH problem (Fabrice Peix)
  Re: writing I/O to memory address range (Frank Haverkamp)
  kmalloc for access in ISR ([EMAIL PROTECTED])
  Re: Interrupt handling in Linux ("Nick Lahtinen")
  Interrupting and resuming the execution of processes. ("Paolo Romano")
  Re: Interrupt handling in Linux (Grant Edwards)
  Re: A good distribution anybody? (Kaz Kylheku)
  Re: Good Basic compiler for linux? (Kaz Kylheku)
  Re: Interrupt handling in Linux (Kaz Kylheku)
  Re: kmalloc for access in ISR (Kaz Kylheku)
  Re: is there a port to windows media player? (Jaime Davila)

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

From: Tim Godfrey <[EMAIL PROTECTED]>
Crossposted-To: 
comp.os.linux.networking,comp.os.linux.development.apps,comp.os.linux.misc
Subject: Ethertap Devices
Date: Fri, 07 Jul 2000 16:11:47 +1000

Does anyone know much about these things?

I have done the following:

(under su -)

mknod /dev/tap0 c 36 16
insmod -x -o tap0 ethertap unit=0
ifconfig tap0 192.168.1.201

All performed without a problem.

I can even ping the damn thing.

The file permissions are as follows

crw-rw-r--   1 root    root    36, 16 July    7 15:39 /dev/tap0

but when I try to open it for writing in my code with this line:

fd = open ("/dev/tap0", O_WRONLY)

if (fd < 0)
{
   fprintf (stderr, "writeEth: could not open /dev/tap0\n%s\n", strerror
(errno));
}

The code outputs the following:

writeEth: could not open /dev/tap0
Device or resource busy.

Busy? I did not think it was doing anything yet

Could someone please sped some light on this problem?

Thanks in advance,

        Tim Godfrey

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

From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: __KERNEL__
Date: Fri, 07 Jul 2000 09:11:17 +0200

rushi wrote:
> =

> Hi all,
> This is a kind of newbie question. I have recently begun to go
> though the code of Linux kernel. At many places I find something
> like this
> =

> #ifdef __KERNEL__
>  :
>  :
>  :
> #endif
> =

> What I could make out is that if a program is compiled with
> -D__KERNEL__ option all the code included in between will be
> available to the program. This could also help in writing
> modules. There could be more to it. Also I find names starting
> with underscores and same names without underscores e.g. u32 and
> __u32. I can't figure out. Could someone please help?

The __KERNEL__ thingy is usually found inside include files which are
used in kernel code as well as user land code. These include files have
portions which are of no interest to user land code (mostly they apply
to kernel data structures or kernel functions) and often require
numerous other include files to properly compile. So bracketing these
protion with "#ifdef __KERNEL__" will save the user land programmer some
hassle.

-- =

Josef M=F6llers
Fujitsu Siemens Computers
SHV Server DS 1

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

From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: What are the proper tools/methods for dealing with core dump 
Date: Fri, 07 Jul 2000 09:13:56 +0200

"Kenneth J. Ingram" wrote:
> =

> ...when you want to "interrogate" them?

gdb, for starters.

> "Great spirits have always encountered violent opposition from
> mediocre minds." - Albert Einstein

I can't beleive Einstein has said that. It's quite arrogant.

-- =

Josef M=F6llers
Fujitsu Siemens Computers
SHV Server DS 1

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

From: "Yoon Cheol Jin" <[EMAIL PROTECTED]>
Subject: how to estimate the memory usage for a program
Date: Fri, 7 Jul 2000 16:18:55 +0900

I want to know how much memory is needed to run a program.

For example, there is a program named "test". test is the network daemon
like "httpd" which forks many childs for each clients.  If "test" forks 9
childs to reply the clients, how much real memory(physical memory) is needed
to run 10 "test"s. ?

How can I estimate the amount of physical memory needed ?






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

From: [EMAIL PROTECTED] (Mike Dowling)
Subject: Re: Good Basic compiler for linux?
Date: 7 Jul 2000 07:36:13 GMT

On Fri, 07 Jul 2000 02:25:19 GMT, Christopher Browne <[EMAIL PROTECTED]> wrote:
>c) It doesn't support the same language as MSFT Visual BASIC; it
>   rather more resembles "QuickBasic."

Which I think says it all!

Conclusion:
Avoid proprietary languages.  Use standards.

Cheers,
Mike

-- 
My email address [EMAIL PROTECTED] above is a valid email address.
It is, in fact, a sendmail alias; the digit 'N' is incremented regularly.
Spammed aliases will be deleted.  Currently, mike[29,30]
are valid.  If email to mikeN bounces, try mikeN+1.

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

From: "Dmitriy A. Fedorov" <[EMAIL PROTECTED]>
Subject: Re: Interrupt handling in Linux
Date: Fri, 07 Jul 2000 08:26:01 +0000

Nick Lahtinen wrote:
> 
> I am kind of a newcomer to Linux development, at least as far as Interrupt
> handling is concerned, so here is my question:  Is there a Linux equivalent
> to the getvect(...) call?  I had this appear in a program that I was working
> on doing a port with from Windows to Linux, but I couldn't  find any header
> files on my system (even in windows) that contained this call or the similar
> setvect(...) call.

http://metalab.unc.edu/pub/Linux/kernel/irq-1.64.tar.gz
        kernel module to delivery hardware interrupts to user space

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

From: [EMAIL PROTECTED]
Crossposted-To: 
comp.os.linux.networking,comp.os.linux.development.apps,comp.os.linux.misc
Subject: Re: Ethertap Devices
Date: Fri, 07 Jul 2000 09:35:14 GMT

In comp.os.linux.development.system Tim Godfrey <[EMAIL PROTECTED]> wrote:

| The file permissions are as follows
|
| crw-rw-r--   1 root    root    36, 16 July    7 15:39 /dev/tap0
|
| but when I try to open it for writing in my code with this line:
|
| fd = open ("/dev/tap0", O_WRONLY)
|
| if (fd < 0)
| {
|    fprintf (stderr, "writeEth: could not open /dev/tap0\n%s\n", strerror
| (errno));
| }

Do you have this option compiled into your kernel?

Kernel/User netlink socket (CONFIG_NETLINK) [Y/n/?] ?

CONFIG_NETLINK:

  This driver allows for two-way communication between certain parts
  of the kernel or modules and user processes; the user processes are
  able to read from and write to character special files in the /dev
  directory having major mode 36. So far, the kernel uses it to
  publish some network related information if you say Y to "Routing
  messages", below. It is also used by the firewall code to publish
  information about possible attacks if you say Y to "IP: firewall
  packet netlink device" further down. You also need to say Y here if
  you want to use arpd, a daemon that helps keep the internal ARP
  cache (a mapping between IP addresses and hardware addresses on the
  local network) small. The ethertap device, which lets user space
  programs read and write raw Ethernet frames, also needs the network
  link driver. If unsure, say Y.
Kernel/User netlink socket (CONFIG_NETLINK) [Y/n/?]


-- 
| Phil Howard - KA9WGN | My current websites: linuxhomepage.com, ham.org
| phil  (at)  ipal.net +----------------------------------------------------
| Dallas - Texas - USA | [EMAIL PROTECTED]

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

From: [EMAIL PROTECTED] (Mike Dowling)
Subject: A good distribution anybody?
Date: 7 Jul 2000 10:20:11 GMT

I've wanted to ask this question for some time but have been a bit
afraid of flames.  I suspect that the question as to which distribution
is best will be about as sensitive as which OS is best, in which case my
question could easily degenerate into a flame war.

I started with version 0.7? of Linux, and have continued ever since
without using distributions.  I have compiled and configured all the
software myself.  I am about to loose my direct Internet access, but
will continue to have modem access.  It will therefore become
impractical for me to continue as I have.  It would be nice to have a
good distribution, and to take it from there.  But which one?

My thoughts and fears are as follows.

1. I recently played with SuSe.  It seems impossible to use SuSe without
   KDE, and I consider KDE to be designed for Windows converts.  In
   fact, it is my suspicion that distributions can really only make
   money from converts, and so do not cater for those of us who prefer
   the UNIX command line interface to the Windows GUI interface.  Am I
   right?

2. No distribution is likely to be _exactly_ right for me, or probably
   anybody else.  I will therefore have to modify the configuration, and
   include some of my favourite software.  My first fear is that
   modified configuration files in /etc will get clobbered by OS
   updates.  HP did this to my sendmail.cf, turning our mail server into
   a promiscuous relay!  This is Hewlett-Packard, what about Linux
   distributions?

3. I would have thought that the distribution software belongs in /usr,
   while local modifications belong in /usr/local.  (For networked
   pools, shared additional software belongs in /opt.)  But I note that
   SuSe writes to both /usr/local and /opt.  So my second fear is that
   some distributions will clobber my own software.

4. One thing that rather shocked me with SuSe was that there were
   directories like /usr/X386 together with /usr/X11R6.  I presume that
   the reason is that SuSe still uses old binaries that must link to old
   X11 libraries.  (Unfortunately, I no longer have that machine
   available to check that this is true.)  Surely the one thing we can
   expect from a distribution is that it has up to date binaries all
   linking to the latest shared libraries.  What distributions do this?

Thoughts and comments are much appreciated.

Cheers,
Mike

-- 
My email address [EMAIL PROTECTED] above is a valid email address.
It is, in fact, a sendmail alias; the digit 'N' is incremented regularly.
Spammed aliases will be deleted.  Currently, mike[29,30]
are valid.  If email to mikeN bounces, try mikeN+1.

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

From: [EMAIL PROTECTED] (F. Heitkamp)
Date: Fri, 7 Jul 2000 08:03:24
Subject: writing I/O to memory address range
Reply-To: [EMAIL PROTECTED]

I would like to know how to read and write to a specific
hardware (physical) address range.  For example I know
that the hardware is at 0x00f40000 and occupies 128K of
memory.  (The actual values are not that important though
for this example.)  The hardware needs to be able to access
that same memory. i.e. there is a processor on the hardware.
How to I setup that memory block inside the kernel so the 
I/O processor and kernel can freely access the memory range
preferrabley without things getting stuck transitioning 
in the CPU cache.  And to answer two obvious questions.
Yes I am a newbie at this. No this is not PC hardware 
(if that makes any difference for the sake of this question.).
What I am interested in is which kernel API calls to use and
any other advise or insight really.

Thanks!

Fred





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

From: "Gary Knopp" <[EMAIL PROTECTED]>
Subject: LD_LIBRARY_PATH problem
Date: Fri, 7 Jul 2000 08:40:59 -0400


I just installed RedHat Linux 6.2 (2.2.14-12).  When I try to
compile a C++ program, I get an error that it can't find any of the
X libraries.   The library path '/usr/X11R6/lib' is in the /etc/ld.so.conf.
If I set the LD_LIBRARY_PATH=/usr/X11R6/lib,  I still get an error.
If I issue the env command I can see that LD_LIBRARY_PATH has
been set, however the only way to get my program to compile is to hard
code the lib path in my makefile.

What am I doing wrong?





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

From: Fabrice Peix <[EMAIL PROTECTED]>
Subject: Re: LD_LIBRARY_PATH problem
Date: Fri, 07 Jul 2000 15:23:55 +0200

Gary Knopp wrote:
> 
> I just installed RedHat Linux 6.2 (2.2.14-12).  When I try to
> compile a C++ program, I get an error that it can't find any of the
> X libraries.   The library path '/usr/X11R6/lib' is in the /etc/ld.so.conf.
> If I set the LD_LIBRARY_PATH=/usr/X11R6/lib,  I still get an error.
> If I issue the env command I can see that LD_LIBRARY_PATH has
> been set, however the only way to get my program to compile is to hard
> code the lib path in my makefile.
> 
> What am I doing wrong?

        Yops,

/etc/ld.so.conf and LD_LIBRARY_PATH is for dynamic load of library at
runtime 
for compilation gcc/g++ use -L add directory dir to the list of
directories to be searched 
library.

for exemple you must write 
        g++ -L/usr/X11R6/lib ....

        Bye.

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

From: Frank Haverkamp <[EMAIL PROTECTED]>
Subject: Re: writing I/O to memory address range
Date: Fri, 07 Jul 2000 16:58:44 +0200

Hi,

I suggest that you try to write your own driver for that 
purpose. The linux kernel provides the function ioremap
for that purpose. Look inside the sources how to use it.
A good starting point is /usr/src/linux/drivers/char
directory.

void * ioremap (unsigned long offset, unsigned long size)

If your hardware is a pci card, you have to make yourself
confident in setting it up properly. You can read out the
cards configuration to get the ioaddress which you have to
put in the ioremap function.

After using it, e.g. if you unload your driver you should
call iounmap to free the memory. 

If you want to access the memory in userspace you may
implement a mmap function for you driver, that will makes
it possible for you to mmap your devices memory in user
space. Afterwards you can put a library in top of that
and you are done :-)

Depending on the Kernelversion you are using this can look
differently.

The book of Allessandro Rubini: Linux Device Drivers
is a good starting point for writing your first drivers,
although it is based on an old kernel version.

Maybe you are lucky and you find a simpler solution :->

Frank

Here is something I did some day, you may look if it changed
for the new kernel versions.

    dev->pci_device = pci_device;
    dev->irq = dev->pci_device->irq;
    dev->membase = dev->pci_device->base_address[0];
    dev->membase &= PCI_BASE_ADDRESS_IO_MASK;

    if ((dev->vmembase =
         ioremap(dev->membase, PROMAXX_MAP_SIZE)) == NULL) {
        PERRORK("Cannot map in board memory!\n");
        return -ENXIO;
    }

    /* register irq */
    if (request_irq(dev->irq,
                    (void *) promaxx_interrupt, SA_SHIRQ,
                    "promaxx", (void *) devid)) {
        PERRORK("Cannot install interrupt handler for irq %d\n",
                dev->irq);
        iounmap(dev->vmembase);  /* release memory */
        return -EBUSY;
    }              


"F. Heitkamp" wrote:
> 
> I would like to know how to read and write to a specific
> hardware (physical) address range.  For example I know
> that the hardware is at 0x00f40000 and occupies 128K of
> memory.  (The actual values are not that important though
> for this example.)  The hardware needs to be able to access
> that same memory. i.e. there is a processor on the hardware.
> How to I setup that memory block inside the kernel so the
> I/O processor and kernel can freely access the memory range
> preferrabley without things getting stuck transitioning
> in the CPU cache.  And to answer two obvious questions.
> Yes I am a newbie at this. No this is not PC hardware
> (if that makes any difference for the sake of this question.).
> What I am interested in is which kernel API calls to use and
> any other advise or insight really.
> 
> Thanks!
> 
> Fred

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

From: [EMAIL PROTECTED]
Subject: kmalloc for access in ISR
Date: Fri, 07 Jul 2000 14:21:48 GMT

Hi,
 I am a bit confused with the use of flag GFP_KERNEL and GFP_ATOMIC in
kmalloc.

If I allocate a memory in init_module using malloc(xxx , GFP_KERNEL)
will the memory be accessible in an ISR.

regards
jeseem
mailto:[EMAIL PROTECTED]


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

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

From: "Nick Lahtinen" <[EMAIL PROTECTED]>
Subject: Re: Interrupt handling in Linux
Date: Fri, 7 Jul 2000 08:25:01 -0600


Fabrice Peix wrote in message <[EMAIL PROTECTED]>...
> Interrupt handling is part of kernel, so if you to manage
> interupt you must write kernel module.
> But if you explain a bit more what you mean to do we can help you >more

A little bit more explanation:

The application I am writing needs to be able to handle an interrupt if it
comes in on either COM1 or COM2, and recieve or transmit data while this
program is running.  I am completely  new to kernel programming, so a
barebones example or small sample would be most helpful.  Thanks for your
help.

Nick



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

From: "Paolo Romano" <[EMAIL PROTECTED]>
Subject: Interrupting and resuming the execution of processes.
Date: Fri, 7 Jul 2000 17:13:56 +0200

I've never used a clone() and i need some help.
If i use it passing to it the name of a function then a new process is
created, but how can i execute it?
Actually I need to stop the execution of the parent process, start and
finish the execution of the child, then continue the parent.
Do you know how to do it?



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

From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: Interrupt handling in Linux
Date: Fri, 07 Jul 2000 16:21:08 GMT

In article <[EMAIL PROTECTED]>, Nick Lahtinen wrote:

>A little bit more explanation:
>
>The application I am writing needs to be able to handle an
>interrupt if it comes in on either COM1 or COM2, and recieve or
>transmit data while this program is running.  I am completely
>new to kernel programming, so a barebones example or small
>sample would be most helpful.  Thanks for your help.

The serial port driver already handle the interrupts for both
receiving and transmitting data.  You don't have to worry about
it.

-- 
Grant Edwards                   grante             Yow!  We are now enjoying
                                  at               total mutual interaction in
                               visi.com            an imaginary hot tub...

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

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: A good distribution anybody?
Reply-To: [EMAIL PROTECTED]
Date: Fri, 07 Jul 2000 16:22:35 GMT

On 7 Jul 2000 10:20:11 GMT, Mike Dowling <[EMAIL PROTECTED]>
wrote:
>I've wanted to ask this question for some time but have been a bit
>afraid of flames.  I suspect that the question as to which distribution
>is best will be about as sensitive as which OS is best, in which case my
>question could easily degenerate into a flame war.

Just search the web for ``rules-o-sucks-o-meter''. You should be able
to find one that compares Linux distributions. Then use the one
with the largest score on the ``rules'' side.

This is how all effective corporate professionals conduct technology research.

-- 
#exclude <windows.h>

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

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Good Basic compiler for linux?
Reply-To: [EMAIL PROTECTED]
Date: Fri, 07 Jul 2000 16:24:47 GMT

On 7 Jul 2000 07:36:13 GMT, Mike Dowling <[EMAIL PROTECTED]>
wrote:
>On Fri, 07 Jul 2000 02:25:19 GMT, Christopher Browne <[EMAIL PROTECTED]> wrote:
>>c) It doesn't support the same language as MSFT Visual BASIC; it
>>   rather more resembles "QuickBasic."
>
>Which I think says it all!
>
>Conclusion:
>Avoid proprietary languages.  Use standards.

The problem is tyhat most programmers take standardized languages and then,
sometimes unknowingly, use their proprietary extensions.  E.g. much so called
C++ code written for Windows might as well be written in Visual BASIC.

-- 
#exclude <windows.h>

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

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Interrupt handling in Linux
Reply-To: [EMAIL PROTECTED]
Date: Fri, 07 Jul 2000 16:27:31 GMT

On Fri, 7 Jul 2000 08:25:01 -0600, Nick Lahtinen <[EMAIL PROTECTED]> wrote:
>
>Fabrice Peix wrote in message <[EMAIL PROTECTED]>...
>> Interrupt handling is part of kernel, so if you to manage
>> interupt you must write kernel module.
>> But if you explain a bit more what you mean to do we can help you >more
>
>A little bit more explanation:
>
>The application I am writing needs to be able to handle an interrupt if it
     ^^^^^^^^^^^
>comes in on either COM1 or COM2, and recieve or transmit data while this
>program is running.  I am completely  new to kernel programming, so a
                                              ^^^^^^^^^^^^^^^^^^
>barebones example or small sample would be most helpful.  Thanks for your
>help.

So what are you making, kernel extensions or an application?

The serial system in Linux already handles interrupts, and performs buffering
and flow control and all that. All you have to do in user space is open
up the serial device like /dev/ttyS0, use the POSIX termios interfaces to
configure its settings and just perform your data transfers.

Multiplexing a whole lot of serial ports can be done with poll(), select()
or multiple threads. The unblocking of reads, writes or polls is keyed to the
reception of interrupts.

-- 
#exclude <windows.h>

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

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: kmalloc for access in ISR
Reply-To: [EMAIL PROTECTED]
Date: Fri, 07 Jul 2000 16:30:15 GMT

On Fri, 07 Jul 2000 14:21:48 GMT, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>Hi,
> I am a bit confused with the use of flag GFP_KERNEL and GFP_ATOMIC in
>kmalloc.
>
>If I allocate a memory in init_module using malloc(xxx , GFP_KERNEL)
>will the memory be accessible in an ISR.

Yes it will be. The difference is that kmalloc must be called using
GFP_ATOMIC when you call it from out of an ISR. This causes it to get
the memory in a non-blocking manner (but is more likely to fail
in low memory conditions).

-- 
#exclude <windows.h>

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

From: Jaime Davila <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Crossposted-To: 
comp.os.linux.development.apps,comp.os.linux.misc,comp.os.linux.setup,comp.os.linux.x
Subject: Re: is there a port to windows media player?
Date: Fri, 07 Jul 2000 17:02:10 GMT

Lew Pitcher wrote:

> 
> Short answer: No, there is no port of "Windows Media Player".
> Microsoft has not (and probably will not) port this commercial product
> to the Linux environment.
> 
> However, there are Linux packages that provide similar or identical
> functionality. You have been referred to some of them.
> 
> 

??
That part of the thread I must have missed. By identical functionality,
do you mean "can handle streaming audio?" Certainly xmms can do it with
mp3, and real can do it with .ram's. But, do you mean 'can handle .asp
files? THAT would be news! :-)




-- 

******************************************************
Jaime J. Davila
Assistant Professor of Computer Science
School of Cognitive Science
Hampshire College
[EMAIL PROTECTED]
http://helios.hampshire.edu/jdavila
*******************************************************

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


** 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