Linux-Development-Sys Digest #233, Volume #8     Tue, 24 Oct 00 15:13:13 EDT

Contents:
  advice needed on process hierarchies ("Richard Lim")
  Re: advice needed on process hierarchies (Alexander Viro)
  Re: using /linuxrc (Peter Pointner)
  Re: Accessing PCI I/O space (Peter Pointner)
  tcp connection queue size ([EMAIL PROTECTED])
  Re: Device or resource busy ("[EMAIL PROTECTED]")
  Re: using /linuxrc (Josef Moellers)
  Re: Which Gcc version to compile Linux Kernel ? ("O.Petzold")
  Q: Hauppauge TV without sound ("T. J. Domsalla")
  porting from SCO to linux problems? ("Martin Collins")
  Re: porting from SCO to linux problems? (ChromeDome)
  Re: Building a Driver ("Tony Aguilar")
  Re: Microsoft Linux API? ("J.H.Delaney")
  Re: tcp connection queue size (Kaz Kylheku)
  Re: Building a Driver ("Spam Me Not")
  Re: sockets per process ("Spam Me Not")

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

From: "Richard Lim" <[EMAIL PROTECTED]>
Subject: advice needed on process hierarchies
Date: Tue, 24 Oct 2000 12:45:15 +0800

Advice needed on the following:

Eg.
Question:
Write a pseudo C code to create the following process hierarchies using
fork:
       P1
    /   |   \
P2   P3   P4

Solution:
pid = fork()
if (pid > 0)
    pid = fork()
if (pid > 0)
    pid = fork()

Question:
Write a pseudo C code to create the following process hierarchies using
fork:
       P1
    /   |   \
P2   P3   P4
        |          \
        P5       P6
please advice on the solution.
I am not able to derive a solution for this one.
Is there a simple algorithms to follow to generate the C code to create the
process hierarchy of any kind.

regards,
richard lim





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

From: [EMAIL PROTECTED] (Alexander Viro)
Subject: Re: advice needed on process hierarchies
Date: 24 Oct 2000 01:34:28 -0400

In article <8t342a$9v7$[EMAIL PROTECTED]>,
Richard Lim <[EMAIL PROTECTED]> wrote:
>Advice needed on the following:

[snip the homework assignment]

>please advice on the solution.
>I am not able to derive a solution for this one.
>Is there a simple algorithms to follow to generate the C code to create the
>process hierarchy of any kind.

comp.unix.do.my.homework is -> that way. Alternatively, you could try
to read the manpage of fork() and think for a couple of minutes. As soon
as you understand what fork() does this exercise will become completely
obvious. Any textbook/FAQ/whatever on UNIX should be sufficient to
get such understanding.

-- 
"You're one of those condescending Unix computer users!"
"Here's a nickel, kid.  Get yourself a better computer" - Dilbert.

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

From: Peter Pointner <[EMAIL PROTECTED]>
Subject: Re: using /linuxrc
Date: 24 Oct 2000 07:15:27 +0200

Josef Moellers <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
>> 
>> I'm about to make use of the /linuxrc feature.  I'm interested in any
>> experiences people who have tried this for various purposes may have.
>> I don't need any help (yet) on making this happen; I'm just wanting
>> to be wary of any quirks I may encounter.

> AFAIK, despite the fact that the first line looks like a shebang calling
> /bin/bash, linuxrc is NOT a shell script and you won't be able to use
> (full) shell functionality there. You can put a few insmods in there,
> but that's about it.

Fortunately, it _is_ a shell script. From the kernel sources (2.2.13):

static int do_linuxrc(void * shell)
{
        static char *argv[] = { "linuxrc", NULL, };

        close(0);close(1);close(2);
        setsid();
        (void) open("/dev/console",O_RDWR,0);
        (void) dup(0);
        (void) dup(0);
        return execve(shell, argv, envp_init);
}

I use linuxrc on an embedded system to start inetd and some other
processes. Works fine.

Peter


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

From: Peter Pointner <[EMAIL PROTECTED]>
Subject: Re: Accessing PCI I/O space
Date: 24 Oct 2000 07:18:18 +0200

Peter Huang <[EMAIL PROTECTED]> wrote:
> Hi

> with pci memory space. I can call pci_find_device and then ioremap to access
> a pci memory space.
> How do I access PCI I/O space?

By using I/O instructions (outb and friends). Since there are no virtual
I/O-addresses, you need no special step there.

If you need examples, the kernel sources are full of them.

> Peter
Peter


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

From: [EMAIL PROTECTED]
Subject: tcp connection queue size
Date: Tue, 24 Oct 2000 06:28:57 GMT

Hello,

I have a question about tcp socket connections in qeneral.

I was just wondering what is the default queue size relating to
incoming tcp connection requests that linux can handle right out of the
box.  Is there any way to change it and increase this queue size and
how?

thanks..

-john



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

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

From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
Subject: Re: Device or resource busy
Date: Tue, 24 Oct 2000 09:16:13 +0200

Hi,

int init_module() in your module if returning an error code,
check this out in your driver.

Richard.


Ed Hudson wrote:
> 
> I have successfully compiled a driver written for the 2.2 kernel
> series under 2.0.34.  When I try to insmod it, I get a message
> init_module() Device or resource busy.  The obvious things appear to
> be ok.  The card is plugged in, other simple "Hello world" modules
> work fine.  Any suggestions?
> 
> Thanks
> 
> Ed

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

From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: using /linuxrc
Date: Tue, 24 Oct 2000 10:10:26 +0200

Peter Pointner wrote:

[ About linuxrc not being a shell script ]

> Fortunately, it _is_ a shell script. From the kernel sources (2.2.13):
> =

> static int do_linuxrc(void * shell)
> {
>         static char *argv[] =3D { "linuxrc", NULL, };
> =

>         close(0);close(1);close(2);
>         setsid();
>         (void) open("/dev/console",O_RDWR,0);
>         (void) dup(0);
>         (void) dup(0);
>         return execve(shell, argv, envp_init);
> }
> =

> I use linuxrc on an embedded system to start inetd and some other
> processes. Works fine.

Thanks, I should have checked myself ... shame on me, but I did put a
statically linked executable on an initrd, and it failed to execute for
some reason. Someone once mentioned that all linuxrc could do was to
insmod some drivers. Thanks again, I'll give it another try.

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
        If failure had no penalty success would not be a prize (T. Pratchett)

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

From: "O.Petzold" <[EMAIL PROTECTED]>
Crossposted-To: alt.os.linux,comp.os.linux.misc
Subject: Re: Which Gcc version to compile Linux Kernel ?
Date: Tue, 24 Oct 2000 10:50:27 +0200

>
> >/tmp/ccWv6Hv5.s: Assembler messages:
> >/tmp/ccWv6Hv5.s:47: Warning: Ignoring changed section attributes for .modinfo
>
> Thanks for the info.
> But is there any connection between this
> and the fact that no modules seem to be installed,
> basically because /usr/src/linux/modules does not contain
> the names of the relevant module units as it used to.

I would say no, my module got warning but it was build so I can install this. The
above
is only a warning  The gcc has an option -Werror which means handle warnings as
errors, but this is not the default behavior on the kernel tree makefiles.

Stupid question - you have a clean kernel tree (no prepatched from the
distibutor) and
using make ..config to build modules ( [M] feature ) and "loadable module
support" enabled ?

Regards,
Olaf



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

From: "T. J. Domsalla" <[EMAIL PROTECTED]>
Crossposted-To: 
alt.comp.linux,alt.os.linux,comp.os.linux.hardware,comp.os.linux.misc,comp.os.linux.setup,de.comp.os.unix.linux.hardware,de.comp.os.unix.linux.misc,de.comp.tv+video
Subject: Q: Hauppauge TV without sound
Date: Tue, 24 Oct 2000 13:10:28 +0200

Hi,

since upgrading from kernel 2.2.xx to 2.4.0-test9=20
I don't get sound working while looking TV. It worked
fine before. Do anyone have an idea?

It doesn't work neither if I link all modules statically=20
into the kernel nor if loaded dynamically by modutils.

My system: Hauppauge WinTV/Radio /w BTTV878, Philips
PAL, Philips Tuner, MSP3400; Athlon 800; SB Live! Value;
Geforce 2 GTS; 512 MB; Kernel 2.4.0-Test9; OSS 3.9.3r
or emu10k1 module.

TJ


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

From: "Martin Collins" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: porting from SCO to linux problems?
Date: Tue, 24 Oct 2000 14:37:25 +0200

Hi,

I've gotten the job of porting a set of programs and
a daemon from SCO Opendesktop to Caldera linux.
Some of the software is in ansi C and the rest in C++.
There is no X interface. Sockets are used however.

Does anybody have any experience in this line and can
point out possible sources of difficulty. I'm supposed to
estimate the effort invloved.

Thanks for any help,

Martin.





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

From: ChromeDome <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Crossposted-To: comp.os.linux.development.apps
Subject: Re: porting from SCO to linux problems?
Date: Tue, 24 Oct 2000 15:25:10 GMT

Martin Collins wrote:
> 
> Hi,
> 
> I've gotten the job of porting a set of programs and
> a daemon from SCO Opendesktop to Caldera linux.
> Some of the software is in ansi C and the rest in C++.
> There is no X interface. Sockets are used however.
> 
> Does anybody have any experience in this line and can
> point out possible sources of difficulty. I'm supposed to
> estimate the effort invloved.
> 
> Thanks for any help,
> 
> Martin.

I had a customer who ran SCO.  I did all my C development at home on a
Linux box with GCC.  IIRC, the only problem was a slight difference in
what functions were prototyped in what include file.

As in your case, no graphics was involved, but I did have extensive
IPC.  Unless your application is really strange, I don't think you'll
have any problems.  Of course, I didn't have any C++ to contend with.

Gene

-- 
ChromeDome
"Anyone who wants to be elected shouldn't be" - Will Rogers

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

From: "Tony Aguilar" <[EMAIL PROTECTED]>
Subject: Re: Building a Driver
Date: Tue, 24 Oct 2000 17:29:20 +0100

Hi Philip,

I read your answer in the newsgroup. Can you help me about the following:

How can a user-space program link to a device driver routine, and how
can/has it to call a device driver routine?

For example:
I have a character driver and my module mymodule.o is exporting functions
foo() and foo2() to the kernel symbol table.
How does test.c(API) have to use these functions and link to generate the
test executable.

Thank you very much in advance.

Tony

Quiney, Philip [HAL02:HH00:EXCH] <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Programmer wrote:
> >
> > Howdy,
> >     This is my first time developing in Linux; I used to develop for
Windows
> > (so I've made an improvment :-).  Does anyone know where to find
> > documentation to help me develop drivers in Linux?  I've already visted
> > linuxdoc.org and I didn't find very useful information.  I'd appreciate
any
> > help.  Thanks.
> Hi,
>
> A good starting point would be to get hold of a copy of "Linux Device
> Drivers" by Allessandro Rubini (ISBN 1-56592-292-1) at a bookshop near
> you.
>
> Failing that have a look at the source code for say one of Don Becker's
> ethernet drivers in /usr/src/linux/drivers/net.
>
> Another useful repository of information is the Linux cross-reference
> site (http://lxr.linux.no/). With this you can piece together what calls
> what and find macro/function definitions etc.
>
> Here is a simple 'hello world' for a module...
>
> #define MODULE
> #include <linux/module.h>
>
> int init_module(void)
> {
>     printk("Hello World from modulespace\n");
>     return(0);
> }
>
> void cleanup_module(void)
> {
>     printk("<1>Goodbye....\n");
> }
>
> Compile with:
>  gcc -c -o hello_mod.o hello_mod.c
>
> Then (as root) install it with:
>
> insmod hello_mod.o
>
> Check it is there with
>
> lsmod
>
> & remove it with
> rmmod hello_mod
>
> Note: the printk statements will appear on the root console so if
> running from an X term (or other such terminal from X) you won't see any
> output but you should see them in the system log file
> (/var/log/messages).
>
> HTH
>
> Regards
>
> Phil Q
>
> --
>
> Phil Quiney                             CSIP Demonstrator
> [EMAIL PROTECTED]              Nortel Networks,
> Telephone: +44 (0)1279 402363           London Rd, Harlow,
> Fax:       +44 (0)1279 402885           Essex CM17 9NA,
>                                         United Kingdom.
>
> "This message may contain information proprietary to Northern
> Telecom so any unauthorised disclosure, copying or distribution
> of its contents is strictly prohibited."



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

From: "J.H.Delaney" <[EMAIL PROTECTED]>
Subject: Re: Microsoft Linux API?
Date: Tue, 24 Oct 2000 19:21:06 +0200

>
> Pretty soon, Microsoft can use this dependency to
> leverage control over the Linux marketplace.
>

Will never happen. Sure, Microsoft 'ports' some apps to linux, but... Its
**BINARYS** they deliver, not source code. People that love linux, love it
because they can modify anything they want. Cant do that with binarys.

> multiple operating systems, not just Linux.  If apps start
> coming to Linux so that it is of very high value and runs
> specifially for Linux, THAT is the day when Windows will see
> serious competition.  However, if Microsoft was to become the

There already are application on linux that are of very high value. And most
of the people that use linux dont really care about windows, so they will
not 'switch' to linux just cause windows has a cool new feauture.

>
> Linux must play to the human psychie.
>

They already do. People who use linux, use linux because they like *nix in
general, and because they like open source. THAT is the power of linux.
These people will never leave linux for another OS, they will ADD any cool
feature seen in another OS to linux themselves.



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

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: tcp connection queue size
Reply-To: [EMAIL PROTECTED]
Date: Tue, 24 Oct 2000 18:13:51 GMT

On Tue, 24 Oct 2000 06:28:57 GMT, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>Hello,
>
>I have a question about tcp socket connections in qeneral.
>
>I was just wondering what is the default queue size relating to
>incoming tcp connection requests that linux can handle right out of the
>box.  Is there any way to change it and increase this queue size and
>how?

The connect request backlog queue size is influenced by the second argument of
the listen() system call.  Since that argument is mandatory, there is no
default. Here is an interesting paragraph from the listen() man page:

    The  behaviour  of  the  backlog  parameter on TCP sockets
    changed with Linux 2.2.  Now it specifies the queue length
    for completely established sockets waiting to be accepted,
    instead of the number of incomplete  connection  requests.
    The maximum length of the queue for incomplete sockets can
    be set using the tcp_max_syn_backlog sysctl;  see  tcp(4).
    When  syncookies  are  enabled there is no logical maximum
    length and this sysctl setting is ignored.

So now only completely established sockets that have gone through the
appropriate TCP handshake are backlogged to the queue that is controllable by
listen(). There is an earlier queue for incomplete connections which just has a
global maximum, to guard against some types of SYN floods. If you have SYN
cookies compiled in, then there is no logical maximum, because incomplete
connections do not then have any server-side state; the state is encapsulated
in the cookies themselves, so no queuing is required.

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

From: "Spam Me Not" <[EMAIL PROTECTED]>
Subject: Re: Building a Driver
Date: Tue, 24 Oct 2000 11:58:20 -0700

Your character device driver must first make itself known to the rest of
the system: see register_chrdev().  You must choose a major number which is
unique for your device (one of the arguments to register_chrdev()).
The user program establishes contact with your driver by opening a
device file with the same major number as your driver
(e.g., "/dev/mydevice").  The user program can then issue ioctl() calls
to your driver, and your driver can then perform functions for the user
app and provide return results (you must implement the ioctl calls in
your driver).   You may also need to make a device
file with the corresponding major number if you don't have one
already, there's no need for this file to be in "/dev" if you're
just testing.  Or, for 2.4 kernels, you can use "devfs", which
removes most of the silliness of the "choose the device via
fixed number" scheme.

"Tony Aguilar" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Hi Philip,
>
> I read your answer in the newsgroup. Can you help me about the following:
>
> How can a user-space program link to a device driver routine, and how
> can/has it to call a device driver routine?
>
> For example:
> I have a character driver and my module mymodule.o is exporting functions
> foo() and foo2() to the kernel symbol table.
> How does test.c(API) have to use these functions and link to generate the
> test executable.
>
> Thank you very much in advance.
>
> Tony
>
> Quiney, Philip [HAL02:HH00:EXCH] <[EMAIL PROTECTED]> wrote in
message
> news:[EMAIL PROTECTED]...
> > Programmer wrote:
> > >
> > > Howdy,
> > >     This is my first time developing in Linux; I used to develop for
> Windows
> > > (so I've made an improvment :-).  Does anyone know where to find
> > > documentation to help me develop drivers in Linux?  I've already
visted
> > > linuxdoc.org and I didn't find very useful information.  I'd
appreciate
> any
> > > help.  Thanks.
> > Hi,
> >
> > A good starting point would be to get hold of a copy of "Linux Device
> > Drivers" by Allessandro Rubini (ISBN 1-56592-292-1) at a bookshop near
> > you.
> >
> > Failing that have a look at the source code for say one of Don Becker's
> > ethernet drivers in /usr/src/linux/drivers/net.
> >
> > Another useful repository of information is the Linux cross-reference
> > site (http://lxr.linux.no/). With this you can piece together what calls
> > what and find macro/function definitions etc.
> >
> > Here is a simple 'hello world' for a module...
> >
> > #define MODULE
> > #include <linux/module.h>
> >
> > int init_module(void)
> > {
> >     printk("Hello World from modulespace\n");
> >     return(0);
> > }
> >
> > void cleanup_module(void)
> > {
> >     printk("<1>Goodbye....\n");
> > }
> >
> > Compile with:
> >  gcc -c -o hello_mod.o hello_mod.c
> >
> > Then (as root) install it with:
> >
> > insmod hello_mod.o
> >
> > Check it is there with
> >
> > lsmod
> >
> > & remove it with
> > rmmod hello_mod
> >
> > Note: the printk statements will appear on the root console so if
> > running from an X term (or other such terminal from X) you won't see any
> > output but you should see them in the system log file
> > (/var/log/messages).
> >
> > HTH
> >
> > Regards
> >
> > Phil Q
> >
> > --
> >
> > Phil Quiney                             CSIP Demonstrator
> > [EMAIL PROTECTED]              Nortel Networks,
> > Telephone: +44 (0)1279 402363           London Rd, Harlow,
> > Fax:       +44 (0)1279 402885           Essex CM17 9NA,
> >                                         United Kingdom.
> >
> > "This message may contain information proprietary to Northern
> > Telecom so any unauthorised disclosure, copying or distribution
> > of its contents is strictly prohibited."
>
>



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

From: "Spam Me Not" <[EMAIL PROTECTED]>
Subject: Re: sockets per process
Date: Tue, 24 Oct 2000 12:00:57 -0700


> FYI, I have gotten well over 10,000 open TCP connections per process.
>
> Ali
>
>

But can you select() on them?   I'd imagine this is an
implementation-specific question.   Does it work for you?
What system are you using?




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


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