Linux-Development-Sys Digest #738, Volume #8     Mon, 21 May 01 17:13:11 EDT

Contents:
  Re: Sharing the virtual address space? (Josef Moellers)
  Re: [kernel] packet filtering/modifying (Vyacheslav Burdjanadze)
  Re: xml api ("Nils O. Selåsdal")
  Re: Efficient ENI3060 or Virata ATML drivers? ("Cameron Kerr")
  realloc problem ("enib")
  Re: realloc problem ("Karl Heyes")
  Re: Newbie hoping to install C++ on RedHat 7.1 (« Dono »)
  Re: Reinitializing PCI bus on x86 (=?iso-8859-1?Q?Andr=E9?= David)
  A TCP-oriented filesystem???  (At150bogomips)
  Event Registering in a Module (Krishnan.A)
  Re: A TCP-oriented filesystem???  (Todd Knarr)
  Re: Best solution for fast IPC? (Greg Copeland)
  Re: Time to read the Disk (Greg Copeland)
  driver for Bluetooth ("gary zhu")

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

From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: Sharing the virtual address space?
Date: Mon, 21 May 2001 08:06:50 +0200

At150bogomips wrote:
> =

> Josef Moellers <[EMAIL PROTECTED]> wrote:
> >This is called "shared memory".
> >Also, applications executing the same code share the same virtual
> >address space of the code.
> =

> I thought shared memory 'merely' shared the mapping for each code page.=
  I.e.
> different programs use address space 0x00..00 and following.
> =

> I am referring to having a single page table.  This would in theory all=
ow all
> code to be a common library--accessible to any program.

If you had a single mapping from the top (i.e. in Int*l speak: have a
single page _directory_ or even page directory extension, then all
processes would share all code, data and stack. I am not sure if there
are many applications that require this.
Sharing a page _table_ (i.e. the second level mapping) would be an
optimization feature, well worth the consideration imho.

-- =

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

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

Date: Mon, 21 May 2001 11:28:07 +0400
From: Vyacheslav Burdjanadze <[EMAIL PROTECTED]>
Subject: Re: [kernel] packet filtering/modifying

> You might like to have a look at either the ipchains source code section
> of the linux kernel, or surf along to the netfilter website and have a
> look at the iptables source code or documentation.
> 
> PS. When you're done, could you post what you did to the group please?

I try to implement minimal IPSEC & IKE.
I have look to netfilter in 2.4 kernel and found it satisfy my needs.
You need
to write your own hook function and register it with nf_register_hook().
It's easy.
You get sk_buff as input in your hook and you free to modify it or
replace as you wish.

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

From: "Nils O. Selåsdal" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: xml api
Date: Mon, 21 May 2001 09:46:37 +0200


"Karim A." <[EMAIL PROTECTED]> wrote in message
news:9e04ot$k1a$[EMAIL PROTECTED]...
> Hi all,
>
> I'm looking for a XML api that exist both on Linux/Unix and Windows.
>
> Does anyone know ?
Yes, Xerces, xml.apache.org
or expat (youll find it at www.freshmeat.net)




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

From: "Cameron Kerr" <[EMAIL PROTECTED]>
Subject: Re: Efficient ENI3060 or Virata ATML drivers?
Crossposted-To: comp.os.linux.advocacy,comp.os.linux.hardware,comp.os.linux.networking
Date: Mon, 21 May 2001 21:47:46 +1200

In article <[EMAIL PROTECTED]>, "Hal Burgiss"
<[EMAIL PROTECTED]> wrote:

> On Mon, 21 May 2001 03:45:26 GMT, Ronnie Corny <[EMAIL PROTECTED]>
> wrote:
>>I think this might have been asked some time ago, but I was wondering if
>>any drivers for these cards exist?
>>
>>has anyone gotten these cards to work with anything other than Windows
>>95/98/ME/NT/2k ?
> 
> http://www.unixathome.org/adsl/docs/drivers/Linux/0.84/
> 
> I know nothing about them. I suspect this is an Alpha project that was
> abandoned. Nobody seems to be talking. I would strongly suggest an
> ethernet modem for Linux (and the other better alternative Os's).
> 

If not PPPoE, than get a PPPoA standalone unit. These are just a unit
that plugs into your ethernet network. They often have an inbuilt hub (I
would suggest not using the hub if you get a Nokia M1122). They are more
expensive, however.

-- 
Cameron Kerr -- cameron.kerr @ paradise.net.nz
Praise Slackware, our baud and saviour!
--

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

From: "enib" <[EMAIL PROTECTED]>
Subject: realloc problem
Date: Mon, 21 May 2001 13:56:56 +0200

Hello!
My problem is: i wrote a function replacing all occurances of a pattern in a
memoryblock with another string.
To save memory i do it with realloc. It seems, it works, but i get the
obscure phenomenon that if i call the function once on buffer and then a
second time, the realloc-function(not writing/reading in the realloced
memory, the reallocating on itself) causes the program to exit with
"Speicherzugriffsfehler", i think "memoryaccess-error" in english. I think
it comes from the system, because the prgram leaves immediately. system is:
suse linux 6.1, kernel 2.2xxx. The funny thing is, if the memory block is
really huge, no problem, everything works, only if it's small the error
occurs(perhaps because the Pointer won't change for small new blocks?!?) .
If i try to realloc a few, eg 20, bytes more, there is no error. why?!?
Where is the difference between reallocating eg 220 Bytes or 200 Bytes?
Please help me, i have no more ideas and think, the algorithm works.

Thanks in advance, Benjamin

//Parameter:
// src:    Pointer to Pointer to Buffer, which should be illtreated
// pattern:  string
// replacement: string
// srclen:   Pointer to the length of Buffer
// ignoreupper: 0:Gross-Kleinschreibung wird beachtet, sonst: nicht
//Rueckgabe:
// direkt:   count of done replacements, -1 on error
// indirekt:
//  src:  Pointer to Pointer to Result
//  srclen:  Pointer to length of result

static int replace(char **src, char *pattern, char *replacement, int
*srclen, int ignoreupper)
{
 char *dummy=*src, *pos=0;
 int count=0;
 int newlen=0;
 int patlen = strlen(pattern);
 int replen = strlen(replacement);

 for (pos=dummy; pos <= (dummy+*srclen-patlen); pos++)
 {
  #ifdef WIN32
  if ((!strncmp(pos,pattern,patlen)) || (ignoreupper &&
(!strncmpi(pos,pattern,patlen))))
  #else
  if ((!strncmp(pos,pattern,patlen)) || (ignoreupper &&
(!strncasecmp(pos,pattern,patlen))))
  #endif
  {
   ++count;
   pos+=patlen-1; //da bereits 1 in der for-schleife geadded wird!
  }
 }
 newlen=count*(replen-patlen)+*srclen; //newlen beschreibt jetzt die Laenge
des Strings nach der Ersetzung

 printf("\nAnzahl der zu Ersetzenden: %d, neue Laenge: %d \n",count,newlen);
 fflush(stdout);
 //es ist nun die Anzahl der zu ersetzenden bekannt
 //1.Fall: Replen>=Patlen
 if (replen>=patlen)
 {

  //Hier Problem!!!
  printf("\nwerde gleich %d bytes reallocen\nText:\n%s\n",newlen,*src);
  dummy=realloc(*src, newlen);
  printf("\nhabe gerealloced\n");
  fflush(stdout);
  //_problem

  if (!dummy)
   return (-1);
  // nun ist auch der Speicher reserviert!
  for (pos=dummy; pos <= (dummy+newlen-replen); pos++)
  {
   //printf("\npos-dummy: %d, verbleibender: %s",pos-dummy, pos);
   #ifdef WIN32
   if ((!strncmp(pos,pattern,patlen)) || (ignoreupper &&
(!strncmpi(pos,pattern,patlen))))
   #else
   if ((!strncmp(pos,pattern,patlen)) || (ignoreupper &&
(!strncasecmp(pos,pattern,patlen))))
   #endif
   {
    memmove((char *)(pos+replen), (char *)(pos+patlen),
newlen-(pos+patlen-dummy)); //nach hinten verschieben, um Platz zu schaffen
    memmove(pos, replacement, replen); //Pattern hineinkopieren

    pos+=replen-1; //da bereits 1 in der for-schleife geadded wird!
   }
  }
 }
 else
 //2.Fall: Replen<Patlen
 {
  for (pos=dummy; pos <= (dummy+newlen-replen); pos++)
  {
   #ifdef WIN32
   if ((!strncmp(pos,pattern,patlen)) || (ignoreupper &&
(!strncmpi(pos,pattern,patlen))))
   #else
   if ((!strncmp(pos,pattern,patlen)) || (ignoreupper &&
(!strncasecmp(pos,pattern,patlen))))
   #endif
   {
    memmove((char *)(pos+replen), (char *)(pos+patlen),
*srclen-(pos+patlen-dummy)); //nach hinten verschieben, um Platz zu schaffen
    memmove(pos, replacement, replen); //Pattern hineinkopieren
    pos+=replen-1; //da bereits 1 in der for-schleife geadded wird!
   }
  }
  //hier wird der Speicher lediglich verkuerzt, daher kann eigtl kein Fehler
auftreten, aber sicher ist die Mutter der Porzellankiste
  dummy=realloc(*src, newlen);
  if (!dummy)
   return (-1);
 }
 //alle Patterns ausgetauscht
 *src = dummy;
 *srclen=newlen;
 return count;
}




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

From: "Karl Heyes" <[EMAIL PROTECTED]>
Subject: Re: realloc problem
Date: Mon, 21 May 2001 14:48:13 +0100

In article <9eas3m$1ra$[EMAIL PROTECTED]>, "enib"
<[EMAIL PROTECTED]> wrote:


> Hello!
> My problem is: i wrote a function replacing all occurances of a pattern in a
> memoryblock with another string.
> To save memory i do it with realloc. It seems, it works, but i get the
> obscure phenomenon that if i call the function once on buffer and then a
> second time, the realloc-function(not writing/reading in the realloced
> memory, the reallocating on itself) causes the program to exit with
> "Speicherzugriffsfehler", i think "memoryaccess-error" in english. I think
> it comes from the system, because the prgram leaves immediately. system is:
> suse linux 6.1, kernel 2.2xxx. The funny thing is, if the memory block is
> really huge, no problem, everything works, only if it's small the error
> occurs(perhaps because the Pointer won't change for small new blocks?!?) .
> If i try to realloc a few, eg 20, bytes more, there is no error. why?!?
> Where is the difference between reallocating eg 220 Bytes or 200 Bytes?
> Please help me, i have no more ideas and think, the algorithm works.  Thanks
> in advance, Benjamin
> 

link in something like ElectricFence, then run it into a debugger. Without
analysing your code much its probably the memoves destroying the allocation
mechansims.    Using efence means some nice alighnment tricks are performed
on the pages making the cause of the problem show up easily.

karl.

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

From: « Dono » <[EMAIL PROTECTED]>
Subject: Re: Newbie hoping to install C++ on RedHat 7.1
Date: Mon, 21 May 2001 14:09:07 GMT

Thanks to all for the help.  I haven't played with UNIX 
in over 20 years and now just learning again for the past 
6 months or so.  It's a good thing I like to read. :O)
I will try out your suggestions tonight, if I don't get 
stuck on a double, of course.  Got to pay that colleage 
tuition.  Again thanks.

« Dono »
Please remove X for email
[EMAIL PROTECTED]

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

From: =?iso-8859-1?Q?Andr=E9?= David <[EMAIL PROTECTED]>
Subject: Re: Reinitializing PCI bus on x86
Date: Mon, 21 May 2001 16:00:54 +0200

This is a multi-part message in MIME format.
==============68439C54FC0CD2538C5D38D2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

[EMAIL PROTECTED] wrote:
> 
> For a semi-embedded project I am working on, it would be really nice
> if the memory ranges assigned to PCI cards would be below 0xc0000000.
> That would allow me to mmap() them into a process's address space
> with a 1:1 mapping (which is required, as this process is an emulator,
> and the emulated machine's memory is supposed to map 1:1 on the
> process's, and *it* is supposed to look at the PCI config space
> for addresses).
> 
> However, from my kernel readings, it appears that the PCI bus is set
> up by the BIOS on the x86 platform, and that linux simply uses the
> address ranges supplied by the bios.
> Is there a way to force a re-initialization at boot time (preferably
> *before* starting any device drivers :). And if so, is there a way to
> force those address ranges below 0xc0000000?

You don't need that. Have you tried to open /dev/mem and then mmap
directly the PCI address?

It works for me :)

-- 

 "Share the code. If you hide it ain't good."
                                                Popular knowledge
==============68439C54FC0CD2538C5D38D2
Content-Type: text/x-vcard; charset=us-ascii;
 name="Andre.David.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for André David
Content-Disposition: attachment;
 filename="Andre.David.vcf"

begin:vcard 
n:David;André
tel;cell:+41792013849
tel;work:+41227676147
x-mozilla-html:FALSE
org:CERN - European Centre for Nuclear Research;EP/NA60
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
note:Geneva, Switzerland
x-mozilla-cpt:;-16000
fn:André David
end:vcard

==============68439C54FC0CD2538C5D38D2==


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

From: [EMAIL PROTECTED] (At150bogomips)
Date: 21 May 2001 14:53:45 GMT
Subject: A TCP-oriented filesystem??? 

Would it be sensible to have a filesystem which included partial TCP
checksums with it file information?

Although this would restrict the transmission of the files to the use of
a specific packet-size (or the filesystem would have to be 'rebuilt'),
it would not necessarily force a specific application protocol: the
first checksum for a file could be for a file section half the size of
the standard packet (so the first packet might not be fully used).

The advantage of this would be that the file data would not have to be
loaded to the CPU.  The TCP checksums could be calculated from the
partial checksum (that covers the data portion) and the added
TCP/application header data.  This might be useful for khttpd, but other
applications could be modified to take advantage of this.

(Because disk DMA might be 512B-block oriented, this might not be as
flexible as desired--one might be forced to have 1024B data blocks
rather than (1500-TCP/IP_header_size)B data blocks.  Presumably the NIC
DMA is byte-oriented.)

This would have the obvious disadvantage of increasing the size of the
filesystem by about 0.2% and the size of the file information portion by
a very much larger percentage.

This is perhaps just a silly idea.

Paul A. Clayton
just a fool, not in love


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

From: [EMAIL PROTECTED] (Krishnan.A)
Subject: Event Registering in a Module
Date: 21 May 2001 08:18:23 -0700

Hi,
   I am a newbie to Kernel Programming. I am using a module, but not
for implementing a device driver. I am trying to have a function in my
module called when some event occurs, for example when data arrives on
a socket. I had earlier posted a message on another group, and got a
reply asking me to take a look at the smbfs source, but was not able
to understand how it works.

   It would be really helpful if anyone could suggest some resources
for understanding the smbfs code or suggest how this problem can be
solved.

Thanks a ton in advance.
Krishnan.

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

From: Todd Knarr <[EMAIL PROTECTED]>
Subject: Re: A TCP-oriented filesystem??? 
Date: Mon, 21 May 2001 17:00:20 GMT

In comp.os.linux.development.system <[EMAIL PROTECTED]> 
At150bogomips <[EMAIL PROTECTED]> wrote:
> Would it be sensible to have a filesystem which included partial TCP
> checksums with it file information?

Probably not. Three problems:
1) The data would still have to be transferred to memory. The NIC can do
   do DMA from memory, but it can't read directly from the disk.
2) You'd need to severely limit the packet size, probably to less than
   the 512-byte block size of most disks. You need to accomodate systems
   that don't allow for transmitting IP packets longer than the minimum.
3) Pre-calculating checksums works only for the leading portion of the
   block, because the checksum results are usually dependent not only on
   the bytes but their order. The data portion of a TCP segment is the
   last thing in the block, and you need to calculate the checksum on
   the header fields before you can calculate the data portion.

Even for something that does nothing but serve files over the network,
I think it'd be too little gain for too much cost to be viable.

-- 
Collin was right. Never give a virus a missile launcher.
                                -- Erk, Reality Check #8

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

Subject: Re: Best solution for fast IPC?
From: Greg Copeland <[EMAIL PROTECTED]>
Date: 21 May 2001 12:01:56 -0500

Roland Smith <[EMAIL PROTECTED]> writes:

> > I think TCP/IP sockets would be too slow.  Shared memory would be fast,
> > but I'm not sure if it is portable.
> 
> I don't think there's any portable way of doing it. The Windows API is
> wildly different from the unix API.

It's true that Win32 API does not support shared memory, however, it does
support memory mapped files.  The way that MS implemented it makes it
functional like shared memory.  You could then write an abstraction
between the two APIs (POSIX and Win32) to make it portable.

Enjoy!  :)



-- 
Greg Copeland, Principal Consultant
Copeland Computer Consulting
==================================================
PGP/GPG Key at http://www.keyserver.net
DE5E 6F1D 0B51 6758 A5D7  7DFE D785 A386 BD11 4FCD
==================================================

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

Subject: Re: Time to read the Disk
From: Greg Copeland <[EMAIL PROTECTED]>
Date: 21 May 2001 12:11:08 -0500

[EMAIL PROTECTED] (Joern Engel) writes:

> I am not sure, if I understand you correctly. You seem to imply that
> internal reordering of the read requests would result in reordered delivery
> of the results.
> 
> As in CPU-pipelines, this is not necessary. Assuming this to be done by the
> hdd logic, the 3rd request in the queue can be handled in advance, since the
> blocks are closer to the r/w-head, stored in the disk cache and be delivered
> as soon, as the 1st and 2nd were delivered. Standard in CPU design, but I am
> not sure about disk drives.

Some hard drives can do this.  This is one of the reasons why SCSI tends to
be faster than IDE.  SCSI drives can support multiple outstanding I/O requests
(command tagging) which can in turn, be satisified in an out of order result.
Now then, the OS will serialize the retured data for the correct ordering as
needed (by its tag). For proper SCSI support, this requires both the HA and
the drive work together.

As an example, I have my kernel configed to support up to 32 command tags for
my HA, however, most of my drives only support 8.  These are one of the reasons
why SCSI is highly recommended on a multiuser system and IDE is fine for single
user and low process counts (that is, multiprocess concurrent disk access).  If
you think about it, it will all make sense.


-- 
Greg Copeland, Principal Consultant
Copeland Computer Consulting
==================================================
PGP/GPG Key at http://www.keyserver.net
DE5E 6F1D 0B51 6758 A5D7  7DFE D785 A386 BD11 4FCD
==================================================

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

From: "gary zhu" <[EMAIL PROTECTED]>
Subject: driver for Bluetooth
Date: Mon, 21 May 2001 13:21:30 -0700

Does anybody know where can I find the device driver for Bluetooth PC-card?
Any help highly appreciated!

Gary



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


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