Linux-Development-Sys Digest #283, Volume #8     Thu, 16 Nov 00 11:13:10 EST

Contents:
  Re: raw packet socket; how to retransmit ("Vadim Model")
  Re: injecting keystrokes into virtual console (George MacDonald)
  Re: CMOS access (Josef Moellers)
  Re: SMP & interrupts (Josef Moellers)
  Re: MODVERSIONS ("Lee Ho")
  Re: Get mount point name from VFS ([EMAIL PROTECTED])
  Re: Segmentation faults with struct hostent & char ** ("Slawek Grajewski")
  Re: Patch for g++ and glibc-2.2 anyone? (An additional query) (Mike Dowling)
  Re: MODVERSIONS (Michael Palme)
  kernel module memory usage (Arnaud Westenberg)
  kernel src of ip ("sky")
  Re: linux API ([EMAIL PROTECTED])
  skeleton driver ("Massimiliano Caovilla")
  Free Memory available??? ("Arinté")
  Re: raw packet socket; how to retransmit (Grant Edwards)

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

From: "Vadim Model" <[EMAIL PROTECTED]>
Subject: Re: raw packet socket; how to retransmit
Date: Thu, 16 Nov 2000 09:51:32 +0300

>Yes. Just use a (PF_INET,SOCK_STREAM) socket.

I deal with ethernet frames completely composed by application.

>Not possible without a protocol that sends acks, so no.

The problem is that the ACK is lost. Unfortunatley I do not understand how
to detect that that it was not sent (carrier check failed). Because Linux
does not seem to tell you that. And I have to know to be able to organize a
retransmit or to tell the application that it is not sent.

It must be possible because ANY ethernet adapter tells for sure whether the
frame is transmitted or not, how many collisions detected and so on. I do
not want to know if the peer managed to receive - I want to know if the
packet is sent and if not I would like to know why (carrier check, too many
collisions).

Just to answer some questions: I'm building emulator of old fashion Ethernet
adapter.

>Watching interface error counters is not sufficient, because it does not
>guarantee that the packet reached the application layer at the other end
>(remember IP/Ethernet packets are allowed to be dropped when convenient,
e.g.
>when the host is temporarily out of memory)


I do not talk about IP. On hardware level I can check if the frame is sent
or not. So I want to be able to detect the same from user level application.

Regards,
    Vadim

>
>-Andi
>



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

From: George MacDonald <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: Re: injecting keystrokes into virtual console
Date: Thu, 16 Nov 2000 07:09:47 GMT

[EMAIL PROTECTED] wrote:
> 
> On Thu, 16 Nov 2000 02:01:39 GMT George MacDonald <[EMAIL PROTECTED]> wrote:
> | [EMAIL PROTECTED] wrote:
> |>
> |> On Wed, 15 Nov 2000 05:33:46 GMT George MacDonald <[EMAIL PROTECTED]> wrote:
> |> | [EMAIL PROTECTED] wrote:
> |> |>
> |> |> On Tue, 14 Nov 2000 10:17:18 -0000 Mirco Zaggy <[EMAIL PROTECTED]> wrote:
> |> |>
> |> |>  Oh, I think I'm carrying this idea  a bit too far already.
> |> |>
> |> |
> |> | A hardware solution?  -> http://www.vetra.com
> |>
> |> A KVM switch?  Not even close.
> |>
> |
> | Jeesh, look across the page on the right hand side:
> |
> |       Keyboard<->rs232  translator
> |
> | http://www.vetra.com/335text.html
> |
> | Use another computer to drive the keyboard.
> 
> I don't know
> if you misunderstood what I was asking for, or just trying to divert me
> to something entirely different.

I don't quite understand what you are trying to do, nor how fast you
want a solution, nor how widely deployed it will be. I just offered the hardware info
in case you didn't know about it. It could be used in some circumstances,
i.e. driving an OS test suite, or for performance testing ...
I just know about it, but have never tried it myself...

Automating logins seems to be that hardest part, once logged in you can 
run psuedo tty's for most things. X terminal windows ...

Anyhow, sorry to divert your attention, I'll let you get back 
to kernel hacking.

-- 
We stand on the shoulders of those giants who coded before.
Build a good layer, stand strong, and prepare for the next wave.
Guide those who come after you, give them your shoulder, lend them your code.
Code well and live!   - [EMAIL PROTECTED] (7th Coding Battalion)

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

From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: CMOS access
Date: Thu, 16 Nov 2000 08:15:08 +0100

Ken Wilson wrote:
> =

> Hi Georg,
> Being a new to Linux, I don't understand what you're advising me.
> There isn't /dev/nvram on my Red Hat 6.2 machine.  How do I get
> driver (module)?
> =

> Josef,
> I can't find the mini-howto on my system either.  Is there anything on
> the internet?

Yessir, therissir!

Go to http://kernelnotes.org/HOWTO/, then select "3.2 mini-HOWTOs" and
look for the "IO Port Programming mini-HOWTO". Call me again if you
can't work it out.

> I use a CMOS location on this machine to store data which can be manipu=
lated
> with BIOS setup.  After boot in DOS/Win9x, I can easily access it thru =
port
> 70.
> With Red Hat, I would like to use this data as I did in DOS/Win9x.

With the ioperm() function and the inb_p(), outb_p(), inw_p(), and
outw_p() macros you should be able to do what you need.

-- =

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

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

From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: SMP & interrupts
Date: Thu, 16 Nov 2000 08:18:46 +0100

Johan Kullstam wrote:
> =

> "Slawek Grajewski" <[EMAIL PROTECTED]> writes:
> =

> > OK. I have one more question. In single CPU system, there can be acti=
ve only
> > one instance of interrupt service routine requested with SA_INTERRUPT=
=2E How
> > it is in SMP architecture? Can two interrupts be handled in two CPUs =
at the
> > same time?
> =

> for kernels 2.1.* and up, yes.  and if the interrupt is level rather
> than edge triggered, i think it can even handle two interrupts on the
> same irq line simultaneously.

Shouldn't this be "edge rather than level triggered"?

-- =

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

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

From: "Lee Ho" <[EMAIL PROTECTED]>
Subject: Re: MODVERSIONS
Date: Thu, 16 Nov 2000 07:37:09 GMT


If kernel is configured to "set version information on all module symbols",
(CONFIG_MODVERSIOINS), compiled modules import/exports symbols with CRC.
If you want CRC postfixed symbol, change kernel option first.

*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Lee, Ho. Software Engineer, Embedded Linux Dep, LinuxOne
Mail : [EMAIL PROTECTED] (work), [EMAIL PROTECTED] (personal)
Homepage : http://flyduck.com, http://linuxkernel.to





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

From: [EMAIL PROTECTED]
Subject: Re: Get mount point name from VFS
Date: Thu, 16 Nov 2000 08:14:42 GMT

In article <8uv2tt$[EMAIL PROTECTED]>,
  [EMAIL PROTECTED] (Alexander Viro) wrote:

> D'oh. But why do you want it in the filesystem code? Unless I've
> seriously misunderstood you it isn't going to be fs-dependent, is it?

Because when someone mounts /var/tmp/database as a type xxx filesystem,
I want to create the tree /proc/xxx/var/tmp/database, and I can't see
anywhere else to do it.

(And this is only true of my xxx filesystem - I don't want it to happen
for *every* filesystem type.  So in fact it is *very* fs-dependent.)

> BTW, this stuff is already available in /proc/mounts -

Just had a look there: yes, that's pretty much what I want, but now I
need to check if that's put there before my module is called, or
afterwards.

> ... mind giving details on the variant you want to do?

Not at all - the bottom line is that I'm implementing a file system run
on top of a user-level process rather than a block device.  I know it's
been done before - this is very much a learning experience for me.

The /proc stuff is intended to be a way to record stuff like the
user-level handler for a particular mounted filesystem.  (General stuff
you might expect to see in /proc, really.)

Dave


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

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

From: "Slawek Grajewski" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development
Subject: Re: Segmentation faults with struct hostent & char **
Date: Thu, 16 Nov 2000 09:54:26 +0100

This should work.

int main()
{
        char **alias_list;
        struct hostent *host_name;

// in order for host_name->h_name assignment below to work you shoud declare
// host_name in the following way:
//      struct hostent host_name; // NO STAR


#define NOF_ALIASES 1
        *alias_list = malloc (NOF_ALIASES * sizeof(aliast_list[0]));
       assert(*alias_list);

        //host_name->h_name="mymachine.mydomain.net";
        alias_list[1]="hello";
}



Christoper McClan wrote in message <8uv3vj$gq8$[EMAIL PROTECTED]>...
>Look at the following small piece of code :
>---------------------------
>
>#include <sys/types.h>
>#include <sys/socket.h>
>#include <stdio.h>
>#include <netinet/in.h>
>#include <arpa/inet.h>
>#include <arpa/nameser.h>
>#include <unistd.h>
>#include <string.h>
>#include <netdb.h>
>
>int main()
>{
>        char **alias_list;
>        struct hostent *host_name;
>        //host_name->h_name="mymachine.mydomain.net";
>        alias_list[1]="hello";
>}
>----------------------------------
>This will compile & run fine. If however, you remove the comment from the
>"host_name" line, it will compile, but when executed will segmentation
fault!?
>
>I've noticed this quie a bit, where you have to frig around working out
when
>and where you declare variables otherwise sometimes g++ (2.95.3) compiled
>programs can die.
>
>Any help would be much appreciated!
>
>
>Christopher.



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

From: [EMAIL PROTECTED] (Mike Dowling)
Subject: Re: Patch for g++ and glibc-2.2 anyone? (An additional query)
Date: 16 Nov 2000 09:12:29 GMT

On Thu, 16 Nov 2000 00:44:56 +0100, Thomas W. Horna <[EMAIL PROTECTED]> wrote:
>I´ve found these two mirrrrors
>
>http://www.made-it.com/TMP/glibc22install-HOWTO.html
>http://www.veldy.net/glibc22install-HOWTO.html

Thanks!  I've installed the patches, but to get g++ to work, I did have
to do something that was not described in the installation manual.

The two files that need patching we streambuf.h and parsestream.h in
/usr/include/g++.  That did not suffice, however.  There are also files
with the same names in the directory /usr/include/g++-3, and only once
these were also patched did g++ work.

Is there an explaination for this?

Cheers,
Mike

-- 
My email address [EMAIL PROTECTED] above is a valid email
address.  It is a mail alias.  Once spammed, the alias is deleted, and
the integer 'N' incremented.  Currently, mike[35,36] are valid.  If
email to mikeN bounces, try mikeN+1.

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

From: Michael Palme <[EMAIL PROTECTED]>
Subject: Re: MODVERSIONS
Date: Thu, 16 Nov 2000 10:11:24 GMT



  "Lee Ho" <[EMAIL PROTECTED]> wrote:
>
> If kernel is configured to "set version information on all module
symbols",
> (CONFIG_MODVERSIOINS), compiled modules import/exports symbols with
CRC.
> If you want CRC postfixed symbol, change kernel option first.

i have that option enabled of course. but like described in my question
im searching for the strings with crc (!!) that describe the module
symbols. i think they should be in .kstrtab but i cant find that
section in the objectcode of the modules there is an entry like
checksum = 1 or so in .modinfo but thats not the thing i need.

best regards Michael Palme


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

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

Date: Thu, 16 Nov 2000 11:40:08 +0100
From: Arnaud Westenberg <[EMAIL PROTECTED]>
Subject: kernel module memory usage

Hi list,

Is there a convenient way to study/watch memory usage of a kernel
module? I'm working on a driver and I'd like to see any memory
de/a-llocations it makes. 

The driver makes de/a-llocations based on the hardware specific module
parameters at load time and I would like to see wether it works like I
think it should.

I know that processes display their information in the proc system but
modules don't unless you add the code to your driver. Does the memory
manager keep some sort of list of running modules and the physical
memory they use?

Thanks in advance.

Regards Arnaud

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

From: "sky" <[EMAIL PROTECTED]>
Subject: kernel src of ip
Date: Thu, 16 Nov 2000 20:56:26 +0800

I want to digest the ip related part from kernel src but don't know where to
start.
Such as :
1.   Where is the entry point when a packet arrived from link layer
2.   Where is the out point when a packet was processed and prepare to send
to upper layer , say TCP.
3.   How many function modules are included in ip module and how to separate
them from the main tree if not required

Does anybody have the experience?  and any suggestion are very appriciated .

thanks a lot.

regards.
sky



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

From: [EMAIL PROTECTED]
Subject: Re: linux API
Date: Thu, 16 Nov 2000 14:42:46 GMT

In article <[EMAIL PROTECTED]>,
  [EMAIL PROTECTED] (Juergen Heinzl) wrote:
> In article <8uvhu1$1aj$[EMAIL PROTECTED]>, Vikash K Agarwal wrote:
> >I am new to Linux, basically coming from DOS/WIN background, so i
may sound
> >silly ...
> [-]
> There are no silly questions -- only silly answers.
>
> >Just like there were interrupts in DOS and API in Windows, what is
the
> >corresponding in the Linux OS??
> [-]
> Unices commonly don't use interrupts but the syscall() interface
> and each available system call has got its own number. Try to think
> of it as a table of function pointers that resides in the kernel.
>
> So let's say there's a function that would write a # of bytes to a
> given file descriptor. In DOS you need to load some registers and
> then you'd call int 9.
>
> In Unix you'd pass all the required parameters to syscall() like
> this ...
>
> /*
> ** SYS_chmod is just a define like #define SYS_chmod 137
> */
> syscall( SYS_chmod, "/home/me/somefile", 0666 );
>
> ... and similar on the assembler level.
>
> >Where can I find the documentation?
> [-]
> See the info pages.
>
> >Any good books on the subject??
> [-]
> Some question -- there're a some good books about Unix in general
> but using syscall() is definitely not the most portable way to
> write software.
>
> >lets say  i want to access a file using a Linux OS call, how do i do
it
> >using a Linux C compiler like GCC??? How do i program for the linux
GUI,
> >probably referred to as the X-Windows system??
> [-]
> See above but try to avoid it and prefer library functions. close(2)
for
> instance is a system call and it does not just call syscall() but sets
> errno for example too, say you don't gain much in speed or so.
>
> If it comes to the GUI then see http://www.ora.com/ for literature and
> GUI toolkit (Athena, Motif, GTK, KDE, ...) specific literature.
>
> Cheers,
> Juergen
>
> --
> \ Real name     : Jürgen Heinzl         \       no flames      /
>  \ EMail Private : [EMAIL PROTECTED] \ send money instead /
>

Sorry, i assumed he wanted to code c AND x86 assembly on Linux,
that's why i wrote my post . I totally agree with you guys who
corrected me and i agree : glibc/libc are much more portable than
direct calls to interruptions .

For the information, GCC provides a stack-protection patch better than
the stackguard one since a japanese guy posted his patch on bugtraq a
few dayz ago .

Direct URL for the Documentation :
http://gcc.gnu.org/ml/gcc-patches/2000-11/msg00064.html


----
Julien VANEGUE




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

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

From: "Massimiliano Caovilla" <[EMAIL PROTECTED]>
Subject: skeleton driver
Date: Thu, 16 Nov 2000 16:13:46 +0100

 Hi to all,
I'm trying to write a driver to support a particular kind of MO disk drive;
they behave halfway between hard drives and cdrom, and are connected
throught a scsi interface, so my first idea was to write the code starting
from the sr driver wich is included in the kernel: the problem is that sr
has a static major number already assigned to it, while I need to get my
numbers dinamically allocated, thus I changed the code as little as I could
to get register_blk_device called with major 0 and be assigned a major as
return value.
 Now, I'm experimenting with a real scsi cdrom wich gets attached by the
original sr0 and by my version, but can get mounted only by the original
version!
(the mount command on my sr0 hangs in loop and can't be stopped without a
kill, after the open is performed on my module)
 I can't figure out where the problem sits, as the only thing I modified is
the policy of major number assignment... the only thing I can think is that
"my" sr is still dependent on it's original major number or that there's
something wrong with the nodes (that are generated by a script when I insmod
the module, so they can have the right major)
 Couldn't you suggest a kind of "skeleton driver" or some other driver that
would be easier to modify, or some other source of info about scsi cdrom
block devices?
 I have a book by Alessandro Rubini on device drivers, but it's useless in
this case.
 Could you please suggest a strategy to trace the mount operation, so I can
figure out when and where it gets stuck?
 Maybe a kernel debugger?

        Any help will be REALLY appreciated!

Ciao, Massi

p.s. excuse my wordiness!






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

From: "Arinté" <[EMAIL PROTECTED]>
Subject: Free Memory available???
Date: Thu, 16 Nov 2000 15:59:21 GMT

Is there a function call in linux to get the amount memory available?
How about a system call?  This is for a c project.

thanks...



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

From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: raw packet socket; how to retransmit
Date: Thu, 16 Nov 2000 16:00:24 GMT

In article <8uvvcr$mg4$[EMAIL PROTECTED]>, Vadim Model wrote:

>>Yes. Just use a (PF_INET,SOCK_STREAM) socket.
>
>I deal with ethernet frames completely composed by application.
>
>>Not possible without a protocol that sends acks, so no.
>
>The problem is that the ACK is lost. Unfortunatley I do not
>understand how to detect that that it was not sent (carrier
>check failed).

ACKs get lost. That's life. Network protocols must to operate
properly when ACKs are lost.  It doesn't matter how/why they're
lost.  If your system breaks down when an ACK is lost, then
you're protocol is broken.  No amount of tweaking the OS will
fix it.

If you're not operating with a 100% reliable physical layer
(and you're not), then ACKs can get lost and there may be no
way to detect it.  Your protocol has to tolerate packet loss.

>Because Linux does not seem to tell you that. 

There are many ways in which an ACK can get lost.  Most are not
detectible.  Notifying the user of one but not all of them is
useless.

>And I have to know to be able to organize a retransmit or to
>tell the application that it is not sent.

If you have to know whether your ACK frame was lost or not,
then your protocol is broken.

>It must be possible because ANY ethernet adapter tells for sure
>whether the frame is transmitted or not,

Nobody cares whether a frame is transmitted or not.  People
care wheter data gets to the application at the far end.
That's what transport protocols are for.

>how many collisions detected and so on. I do not want to know
>if the peer managed to receive - I want to know if the packet
>is sent and if not I would like to know why (carrier check, too
>many collisions).

That's a very odd statement.  You don't care if a frame is
received by anybody, just that it's transmitted.  If that is
truely the case, then just always assume that it's transmitted.

Since there is no difference between a frame being transmitted
and not received and a frame not being transmitted, then you
may assume whichever case you like.

>I do not talk about IP. On hardware level I can check if the
>frame is sent or not. So I want to be able to detect the same
>from user level application.

I expect that would involve significant work on Ethernet driver
and network stack.  Most importantly it would not buy you
anything.  ACKs could still get lost even thought he Ethernet
board thinks they've been transmitted.  Your protocol has to
deal with that.

-- 
Grant Edwards                   grante             Yow!  Look DEEP into the
                                  at               OPENINGS!! Do you see any
                               visi.com            ELVES or EDSELS... or a
                                                   HIGHBALL??...

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


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