Linux-Development-Sys Digest #782, Volume #8     Mon, 11 Jun 01 12:13:15 EDT

Contents:
  Re: Parsing error ("Greg K")
  Re: Stack size of kernel_thread (Hanspeter Halle)
  Re: accept freezes (Christophe Dore)
  Re: close or shutdown the tcp socket when it is in SYN_SEND 
([EMAIL PROTECTED])
  udelay in newer kernels ("Gerhard Uttenthaler")
  where to download "AT&T System V/386 assembler syntax manual" (Zhu Liming)
  Re: Parsing error ("Peter T. Breuer")
  Re: Parsing error ("Peter T. Breuer")
  Re: udelay in newer kernels ([EMAIL PROTECTED])
  Re: System.map(or similiar file) in Solaris? (Josef Moellers)
  Re: System.map(or similiar file) in Solaris? (Kasper Dupont)
  Re: "Locked Directory" for floppy & CDROM (Kasper Dupont)
  Re: a question about MBR (Kasper Dupont)
  Re: Stack size of kernel_thread (Kasper Dupont)
  Re: where to download "AT&T System V/386 assembler syntax manual" (Eric Taylor)
  Re: Parsing error (Pankajkumar Chauhan)
  RH 7.1 (2.4.2) kernel build question - no network (Mark Morrissey)
  Re: Request for comment - notion for cpuset option in umask. (John Reiser)
  Newbie on drivers (Rutger Luitzen van Dijk)

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

From: "Greg K" <[EMAIL PROTECTED]>
Subject: Re: Parsing error
Date: Sun, 10 Jun 2001 23:39:55 -0700

Okay, it's fixed...

    I pasted over the section of code with the problem with the code I
downloaded from the publishers website.  No more parsing error.  I have no
idea why.  So be it.  I guess I screwed up, but I sure couldn't find it.

   Anyway, after compiling I got another error:

   "undefined reference to 'DieWithError'"

I thought I had messed up again, so I just gave up on the code I typed out,
and just compiled the code I downloaded, and STILL got the error.

    Here's a bit of the offending relevant code:

void DieWithError(char *errorMessage);  /* Error handling function */

    /* Create a reliable, stream socket using TCP */
    if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
        DieWithError("socket() failed");



The instance of "DieWithError" above was the first of the other four
instances it had a problem with.  I located another socket program on the
net that had similar code:

/* create socket */
  sd = socket(AF_INET, SOCK_STREAM, 0);
  if(sd<0) {
    perror("cannot open socket ");
    exit(1);


It didn't have a "void perror" line at the beginning so I looked up "perror"
and found that it's defined in "stdio.h" and it looks like this...

void perror(const char *s);

I replaced the "void DieWithError(char *errorMessage);" with "void
perror(const char *errorMessage);" compiled with no problems, and ran it
with no problems.

  Bada bing, bada boom, I'm done...

Maybe in a year or so I'LL be skilled enough to write a book with buggy code
that nobody bothers to validate.  I hope not all books are like the one I
bought.

     Thanks



<[EMAIL PROTECTED]> wrote in message
news:d5VU6.10904$[EMAIL PROTECTED]...
> Dear Greg:
>     Well, my guess would be that either sock is not declared properly in
> your program or you are giving the wrong arguments to send. I believe the
> compiler is correctly identifying your problem as just before the "!" in
the
> "!=" [not equal to] statement. I suspect that there is some header file in
> your book, or some other piece of the program that is missing and the
parser
> in the c compiler is having trouble right after the closing parentheses
> after the 0. This means that what is enclosed by the parentheses is the
> problem.
>
> "Greg K" <[EMAIL PROTECTED]> wrote in message
> news:4eUU6.3357$[EMAIL PROTECTED]...
> > Hi,
> >
> >      I'm just a newbie at C and along with my ongoing study I'm also
> > browsing through a couple of books here and there amd compiling the
> programs
> > on Linux just to develop my typing skills and learn GCC.
> >
> >     This code is from a book, "The Pocket Guide to TCP/IP Sockets":
> >
> >
> >
> > echoStringLen = strlen(echoString);          /* Determine input length
*/
> >
> >     /* Send the string to the server */
> >     if (send(sock, echoString, echoStringLen, 0) != echoStringLen)
> >         DieWithError("send() sent a different number of bytes than
> > expected");
> >
> > When I compile it I get the error "tcpechoclient.c:54:parse error before
> > '!'"
> >
> > Since I am still fairly new to C programming, and the publishers errata
> page
> > for the book appears to be buggy (I guess that's why it's called an
errata
> > page), can anyone here see a problem with the above syntax?  Is there an
> > application I can use that will run through the code and point out the
the
> > parsing error in a little more detail?  I have stared at the whole
program
> > code for an hour and I don't see any difference from the book.
> >
> >     Thanks,
> >
> >             Greg
> >
> >
> >
> >
> >
> >
>
>



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

From: Hanspeter Halle <[EMAIL PROTECTED]>
Subject: Re: Stack size of kernel_thread
Date: Mon, 11 Jun 2001 09:10:35 +0200

Thanks Kasper,
but I hoped to get a solution for a dynamic stack size change. I need a 
larger stack size only for one thread started with the kernel_thread 
function.

Hanspeter

Kasper Dupont wrote:

> Hanspeter Halle wrote:
> > 
> > Hi,
> > does anybody know how to increase the memory avaliable for the stack of
> > a kernel_thread (kerbnel 2.2 and 2.4)?
> > 
> > Thanks, Hanspeter
> 
> On i386 you have to change two files in the
> directory include/asm-i386.
> 
> In processor.h you must change the line
> #define THREAD_SIZE (2*PAGE_SIZE)
> 
> In current.h you must change the line
> __asm__("andl %%esp,%0; ":"=r" (current)
>         : "0" (~8191UL));
> 
> Notice that the size must be a power of 2,
> and that it may not be smaller than 4096.
> (But making it smaller than the default of
> 8192 is asking for trouble.)
> 
> After changing these files recompile your
> kernel and _ALL_ kernel modules.
> 
> There might be other files to change that
> I don't know about.
> 



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

From: [EMAIL PROTECTED] (Christophe Dore)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: accept freezes
Date: 11 Jun 2001 00:16:51 -0700

"Nils O. Sel?dal" <[EMAIL PROTECTED]> wrote in message 
news:<[EMAIL PROTECTED]>...
(...)
> > Any idea, hint, ... is welcome !! :-)
> You do remember to close the socket when the client is done ?
> you can check the /proc/<pid of progam> filesystem to see iif you have
> filedescriptor leaks.

That's a good assumption, but....

Yes, I have controlled this. Furthermore, when you try to telnet a
server that cannot open any more file descriptor (at least on redhat
6.2), accept notifies nothing, but the telnet session is closed
immediatly.

In the current case, telnet session lasts. I can even write some text.

On the other hand, it is true that I have several sockets known in
/proc/<pid>/fd, but these are sockets in TIME_WAIT and CLOSE states
(see netstat) that stay in such a state for too long (IMHO, this is
another problem...)

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

From: [EMAIL PROTECTED]
Subject: Re: close or shutdown the tcp socket when it is in SYN_SEND
Date: 11 Jun 2001 09:02:53 GMT

On Mon, 11 Jun 2001 04:58:04 GMT HuYp <[EMAIL PROTECTED]> wrote:

| I'm confused that I can't close the socket when it is in SYN_SEND state,
| for examples after using "connect" primitive to the remote host, I
| decide to close it but it is impossible, I tried close(id) and
| shutdown(id, SHUT_RDWR), it didn't work. Who can help me? OS is redhat
| linux 6.0, kernel version is 2.2.9.

Why do you say it is impossible?  After doing close() what is the
connection state according to netstat?


| I has another question, there are two hosts A and B in the same subnet,
| and there is the route to each other in both host. I powered off B, and
| tried to telnet it in A, according to TCP specification it should return
| "unable to connect" error after 75 seconds, in fact it return the error
| "no route to B" after several seconds, why?

In this case, and actual ICMP packet came back.  While telnet might
wait 75 seconds, the network layer ARP query to find the MAC address
for the given IP address times out faster.  Because the next host
is on the same LAN, it knows it must respond faster or else it is
unavailable rather quickly.  There are other cases which can do this
as well.  So you can't assume telnet will wait 75 seconds.  That
only happens if nothing comes back at all (not always the case).

-- 
=================================================================
| Phil Howard - KA9WGN |   Dallas   | http://linuxhomepage.com/ |
| [EMAIL PROTECTED] | Texas, USA | http://phil.ipal.org/     |
=================================================================

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

From: "Gerhard Uttenthaler" <[EMAIL PROTECTED]>
Subject: udelay in newer kernels
Date: Mon, 11 Jun 2001 12:17:02 +0200

Hello everybody,

it seems that udelay() is not available on kernel 2.4.x ( maybe also 2.2.x
?)

Is there some replacement?

Thanks
Gerhard



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

From: [EMAIL PROTECTED] (Zhu Liming)
Subject: where to download "AT&T System V/386 assembler syntax manual"
Date: 11 Jun 2001 04:31:49 -0700

Now I read some programs for linux which using AT&T System V/386
assembler syntax (not gcc inline assemble).

I want to know where can I download something like "AT&T System V/386
assembler syntax manual"

thanks

Zhu Liming

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

From: "Peter T. Breuer" <[EMAIL PROTECTED]>
Subject: Re: Parsing error
Date: Mon, 11 Jun 2001 13:39:12 +0200

Greg K <[EMAIL PROTECTED]> wrote:
>    "undefined reference to 'DieWithError'"

> I thought I had messed up again, so I just gave up on the code I typed out,
> and just compiled the code I downloaded, and STILL got the error.

>     Here's a bit of the offending relevant code:

> void DieWithError(char *errorMessage);  /* Error handling function */

This is the declaration of an external function that you should write.

>     /* Create a reliable, stream socket using TCP */
>     if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
>         DieWithError("socket() failed");

and this is an instance of its use. Write the code.

Peter

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

From: "Peter T. Breuer" <[EMAIL PROTECTED]>
Subject: Re: Parsing error
Date: Mon, 11 Jun 2001 13:37:51 +0200

Greg K <[EMAIL PROTECTED]> wrote:
> Maybe in a year or so I'LL be skilled enough to write a book with buggy code
> that nobody bothers to validate.  I hope not all books are like the one I

It's not buggy. You can't get a clearer  specification than
"DieWithError"! And they even gave you a sample implementation.

Peter

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

From: [EMAIL PROTECTED]
Subject: Re: udelay in newer kernels
Date: 11 Jun 2001 12:51:08 GMT

Gerhard Uttenthaler <[EMAIL PROTECTED]> wrote:
> it seems that udelay() is not available on kernel 2.4.x ( maybe also 2.2.x
> ?)
> Is there some replacement?

Why do you think it's not in the 2.4.x kernels? On my system (2.4.1) it's
a macro defined in /usr/include/asm/delay.h (which in turn is included by
/usr/include/linux/delay.h). Or are you trying to use it for a userland
program? In this case you probably better use usleep() anyway.

                                         Regards, Jens
-- 
      _  _____  _____
     | ||_   _||_   _|        [EMAIL PROTECTED]
  _  | |  | |    | |          AG Moebius, Institut fuer Molekuelphysik
 | |_| |  | |    | |          Fachbereich Physik, Freie Universitaet Berlin
  \___/ens|_|homs|_|oerring   Tel: ++49 (0)30 838 - 53394 / FAX: - 56046

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

From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: System.map(or similiar file) in Solaris?
Date: Mon, 11 Jun 2001 14:59:04 +0200

weining gu wrote:
> =

> Hi friends,
> =

> Does solaris have similiar file like System.map(in Linux)?
> My research work needs to know all the symbol's address
> in Solaris.

Although I'm not familiar with Solaris, I'll try and explain:

Linux might need the System.map file since the kernel itself is stripped
and compressed.
Solaris probably has its kernel image in a standard executable which you
can inspect using nlist(3).

Josef
-- =

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

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

From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: System.map(or similiar file) in Solaris?
Date: Mon, 11 Jun 2001 13:18:38 +0000

Josef Moellers wrote:
> 
> weining gu wrote:
> >
> > Hi friends,
> >
> > Does solaris have similiar file like System.map(in Linux)?
> > My research work needs to know all the symbol's address
> > in Solaris.
> 
> Although I'm not familiar with Solaris, I'll try and explain:
> 
> Linux might need the System.map file since the kernel itself is stripped
> and compressed.
> Solaris probably has its kernel image in a standard executable which you
> can inspect using nlist(3).
> 
[...]

Linux can run without a System.map file.
It is used by the syslog to lookup EIP
values in the case of kernel errors. And
it is used by ps and top to lookup the
wchan field of a process. I think it was
used in earlier kernels when loading
modules, but not anymore.

The ps command on Solaris prints wchan
fields in hexadecimal and doesn't look
up the symbols.

On one Solaris system I was able to find
some information using the command:
   nm /kernel/genunix 
I don't know if this works in general,
neither do I know how usefull the
information is.

-- 
Kasper Dupont

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

From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: "Locked Directory" for floppy & CDROM
Date: Mon, 11 Jun 2001 13:28:54 +0000

Jose W. Shermanson wrote:
> 
> I'm not sure this is a kernal question or a file system one but I cannot
> access my CDROM nor my floppy.  I recently loaded Mandrake Linux v8.0.  All
> went well for about 2 weeks and then, for some reason unknown to me, when I
> attempt to access my CDROM or floppy, I get an error message "You do not
> have enough permissions to read file:/mnt/floppy."  The "file type" column
> displayed by konqueror says "locked directory."  I suspect I somehow shut
> down LINUX while these devices were busy and the condition hasn't been
> cleared.  Any suggestions short of re-installing would be appreciated.  I
> am a total novice to LINUX but have 30+ years experience with mainframe
> OSs.  Thanks.  Jose
> 
> --
> Posted via CNET Help.com
> http://www.help.com/

What do you get when you type the
following commands in a shell?
   cat /etc/fstab
   ls -l /mnt
   mount /mnt/floppy
   mount /mnt/cdrom
   ls -l /mnt

Have you tried with different
floppies and CDROMs?

-- 
Kasper Dupont

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

From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: a question about MBR
Date: Mon, 11 Jun 2001 13:34:27 +0000

Zhu Liming wrote:
> 
> thanks for your reply, but can you explain more about what you say.
> 
> r@cLIeNUX. (cLIeNUX user) wrote in message 
>news:<[EMAIL PROTECTED]>...
> > [EMAIL PROTECTED]
> > >I read the MBR these days, and found it seems that the begin of MBR is
> > >cli and relocate the sector from 0:0x7c00 to 0:0x600, then sti.
> > >
> > >can anyone tell me why "cli", thanks!
> >
> > I think because there's a pending interrupt from the floppy controller
>                           ~~~~~~~~~~~~~~~~~~~~
> what is the "pending interrupt"?
> 
> > that you have to ignore.
> >

I don't think there usually is a pending interrupt.
But the code does some manipulation with the stack
pointer, and if an interrupt arrives at just the
wrong time during this manipulation when the stack
pointer is not valid the system might crash.

The most likely sources of this interrupt I think
would be the timer and the keyboard.

Even if the CLI was removed the system would
probably boot without problems 99.99% of the time.

-- 
Kasper Dupont

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

From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Stack size of kernel_thread
Date: Mon, 11 Jun 2001 13:51:17 +0000

Hanspeter Halle wrote:
> 
> Thanks Kasper,
> but I hoped to get a solution for a dynamic stack size change. I need a
> larger stack size only for one thread started with the kernel_thread
> function.
> 
> Hanspeter

The current macro in current.h relies on the
task_struct and stack being located in a fixed
size aligned memory block.

In earlier kernels current was a variable
defined in sched.c. But that wouldn't work on
SMP systems.

If you need to have one process with a
different stacksize, you must change the
current macro to something else. If you only
need to do this on UP systems you might get
away with using some of the code from the
earlier Linux versions. If you need this to
run also on SMP systems you need to implement
an array of current variables and a current
macro to pick the correct entry.

When the current macro has been changed it
shouldn't be to difficult to create one
process with a different stacksize. Allocate
an appropriate memory range with pagealloc(),
kmalloc() or whatever suitable function is
available. With a litle piece of asm code you
can switch stacks and call a function on this
new stack.

Make sure that the process does not terminate
while the new stack is in use, you must
return to the function that allocated the new
stack which will then free the allocated
memory again.

Notice that you will still have to recompile
your kernel and all modules, but you don't
have to vaste a lot of memory to create a
large stack for each process.

> 
> Kasper Dupont wrote:
> 
> > Hanspeter Halle wrote:
> > >
> > > Hi,
> > > does anybody know how to increase the memory avaliable for the stack of
> > > a kernel_thread (kerbnel 2.2 and 2.4)?
> > >
> > > Thanks, Hanspeter
> >
> > On i386 you have to change two files in the
> > directory include/asm-i386.
> >
> > In processor.h you must change the line
> > #define THREAD_SIZE (2*PAGE_SIZE)
> >
> > In current.h you must change the line
> > __asm__("andl %%esp,%0; ":"=r" (current)
> >         : "0" (~8191UL));
> >
> > Notice that the size must be a power of 2,
> > and that it may not be smaller than 4096.
> > (But making it smaller than the default of
> > 8192 is asking for trouble.)
> >
> > After changing these files recompile your
> > kernel and _ALL_ kernel modules.
> >
> > There might be other files to change that
> > I don't know about.
> >

-- 
Kasper Dupont

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

From: Eric Taylor <[EMAIL PROTECTED]>
Subject: Re: where to download "AT&T System V/386 assembler syntax manual"
Date: Mon, 11 Jun 2001 15:30:48 GMT



Zhu Liming wrote:

> Now I read some programs for linux which using AT&T System V/386
> assembler syntax (not gcc inline assemble).
>
> I want to know where can I download something like "AT&T System V/386
> assembler syntax manual"
>
> thanks
>
> Zhu Liming

I second this motion, but I would also like to see a manual that
describes the assembly language that the GDB debugger users
with the disassemble command. In particular, I am looking for a
description of the intel operands, some seem quite complex. I have
the intel pdf's but they only describe the machine language, not
how an assembler, like gdb would represent them.

eric



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

From: Pankajkumar Chauhan <[EMAIL PROTECTED]>
Subject: Re: Parsing error
Date: 11 Jun 2001 11:39:37 -0400

I wonder if this has anything to do with comp.os.linux.development.system?

-- 
- Pankaj

======================================================================
             "Great ideas are like internet domain names, the ones
              I get are already taken up by Knuth, Neumann, Turing 
              and the likes....."
======================================================================

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

From: Mark Morrissey <[EMAIL PROTECTED]>
Subject: RH 7.1 (2.4.2) kernel build question - no network
Date: Mon, 11 Jun 2001 08:56:09 -0700


I'm working through some exercises in the book _Kernel Project for Linux_
by Gary Nutt and am having some troubles rebuilding the kernel that I
could use a pointer or two regarding.

(I'm actually doing exercise #5, adding a kernel call, which works and
isn't really related to this problem, so I'll quit talking about that now)

It is entirely possible that my problem is the result of not knowing which
rpms are required to build a kernel.

I've built two machines, one an i686 desktop (eepro100 enet card) and one
a Sony Vaio (i586) (megahertz pcmcia enet card). For both machines, the
only sources I have installed are from the kernel-2.4.2-2.src.rpm rpm.
After I make my changes for my simple system call, I rebuild the kernel
this way:

0. change the top level Makefile so that the EXTRAVERSION variable has a
discriminator (I use '-markm')

1. make mrproper
2. make xconfig (I include all the intel cards for the desktop and all the
3COM cards for the laptop)
3. make dep
4. make modules
5. make bzImage
6. make modules (just for luck - I'm a superstitious kernel developer)
7. make modules_install (as root)
8. copy the bzImage file to /boot/vmlinuz-2.4.2-markm
9. fix up /etc/lilo.conf
10. run /sbin/lilo


When I reboot, everything seems to work except the network. In fact, under
no circumstances can the ethernet card for either system be found (I check
the boot log and messages file as well as use ifconfig). I've verified
that the proper entries are in the .config at the top level and that the
Makefile in the drivers/net directory is correct (at least it seems that
way to me).

Any suggestions as to what I am missing / screwing up? The build process
seems way too straightforward to screw up this bad, but I did it anyway.


Thanks!

--mark
---
Mark Morrissey                  [EMAIL PROTECTED]
"nothing is foolproof to a sufficiently talented fool"


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

From: John Reiser <[EMAIL PROTECTED]>
Subject: Re: Request for comment - notion for cpuset option in umask.
Date: Mon, 11 Jun 2001 08:54:05 -0700

Use a hierachical bitmap.  The raw bits are in the leaf nodes; for an interior
node, bit k is the bit-reduction summary of the bits in its k-th child.
The communication at any level splits the 'unsigned long' used by
setrlimit() into two halves: width>>1 data bits, and width>>1 control bits.

For a 64-bit machine, two levels covers (1<<(6>>1)) * (1<<(6>>1))
or 1024 bits, and three levels covers 32768 bits.
For a 32-bit machine, three levels cover 4096 bits; four levels 65536.
In any case, you get random access in logarithmic time.

struct hierbits { /* for 64-bit machine */
    unsigned long
        bits:32,  /* bits of interest at this level */
        sel2:5,  /* which child on level 2 */
        sel1:5,
        sel0:5,  /* which child of the root */
        :1,
        level:8,  /* which level to operate on */
        opcode:2  /* OR or AND_NOT (all levels);  COPY (leaf only) */
        ;
};

By manipulating an interior node, you can encode the turn-on (OR)
or turn-off (AND_NOT) of all descendents in only 1 call to setrlimit.

-- 
John Reiser, [EMAIL PROTECTED]

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

Subject: Newbie on drivers
From: [EMAIL PROTECTED] (Rutger Luitzen van Dijk)
Date: Mon, 11 Jun 2001 16:08:02 GMT

Hi there,

I'm quite a newbie to linux and its drivers, so i have a question. I'm trying 
to setup SuSe 7.1 from the Internet. When starting the setup i have to add an 
networkmodule for my network card. I've downloaded the source code for my nic 
(a Davicom 9102). But what's next ? I do have a disk with the modules2 file 
from SuSe but how do put my driver on it. How do i compile it and is this done 
in Windows or in Linux.... (ok i  have a lot of questions....)

Any suggestions ?

Greetings,

Rutger van Dijk
The Netherlands


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


** 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 by posting to the
comp.os.linux.development.system newsgroup.

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