Linux-Development-Sys Digest #182, Volume #8     Fri, 29 Sep 00 21:13:10 EDT

Contents:
  Re: problem with ftp ([EMAIL PROTECTED])
  How to get net device index from user space? (Damir Cosic)
  Linux partition access KERNEL BUG? (Richard Krehbiel)
  Re: How to get net device index from user space? (Damir Cosic)
  Re: write to a /proc file ("Chris")
  Re: Linux partition access KERNEL BUG? (Lew Pitcher)
  Re: How to get net device index from user space? (Kaz Kylheku)
  Re: write to a /proc file (Bruno Ascenso)
  Re: couldn't find the kernel version the module was compiled for ? (Bruno Ascenso)
  /sbin/lilo does not affect bootmenu ("rene040")
  Re: write to a /proc file (Rick Ellis)
  Re: Linux partition access KERNEL BUG? ([EMAIL PROTECTED])
  Re: Linux partition access KERNEL BUG? (Karl Heyes)
  Per process, per user network bandwidth limiter (jtnews)
  Re: ioremap not in namespce...? (Gunnar Proppe)

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

From: [EMAIL PROTECTED]
Crossposted-To: alt.linux,comp.os.linux.setup,linux.redhat.install
Subject: Re: problem with ftp
Date: Fri, 29 Sep 2000 16:30:05 GMT

In article <[EMAIL PROTECTED]>,
  [EMAIL PROTECTED] (Stefaan A Eeckels) wrote:
> In article <8r0jft$8g1$[EMAIL PROTECTED]>,
>       "jhuman" <[EMAIL PROTECTED]> writes:
> > I get this error when trying to ftp to one of my linux boxes on private
> > lan....
> >
> > 421 Service not available, remote server has closed connection
> >
> > What does this mean and how do I fix it....
>
> Usually, it's because of badly configured tcpwrappers.
>

I don't think so. I have the same problem with a RH6.2 and there are *not*
tcpwrappers around in the LAN...

Any suggestions?

Martin


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

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

From: Damir Cosic <[EMAIL PROTECTED]>
Subject: How to get net device index from user space?
Date: Fri, 29 Sep 2000 10:47:34 -0600


According to man packet(7) for binding socket of
PF_PACKET type and for sendto() packets over this
kind of socket, struct sockaddr_ll should be used.
That structure has a member called sll_ifindex,
which I assume (I checked that empirically, but 
there is nothing in doc) is index number of network
interface we're addressing. 

My question is, how to get that index for some 
interface ethX from user space? It should be 
readable through ioctl call, but I could not find
how. Thanks.

Damir

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

From: [EMAIL PROTECTED] (Richard Krehbiel)
Subject: Linux partition access KERNEL BUG?
Date: Fri, 29 Sep 2000 17:09:32 GMT

I've got a message routing service up and running on Linux, and it
works great.  It translates messages from one protocol and ships them
to clients which talk another protocol.  For robustness, I keep a
transaction log on disk, so that system stops and restarts don't lose
any messages.  For high speed, it needs to use raw partition access (as
in, fopen("/dev/hda6", "rb+")) for this transaction log.

I prep these partitions simply by doing "dd if=/dev/zero of=/dev/hda6
bs=4096".

Now, why is it that this doesn't work on a 6.4G or a 27G hard disk?  It
works on the smaller 1G and 2G HDs that we've used.

Reading from such a partition returns EOF.  Writing aborts with "out of
space."  And since it doesn't work with "dd if=/dev/zero" either, I
don't think my code is at fault.

Kernel 2.2.5 (Red Hat 6.0), 2.2.12 (Red Hat 6.1), and 2.2.16 all show
this.  IDE hard disk.  I haven't tried any 2.3 or 2.4 kernels; it
doesn't matter whether they work 'cause I need stability.

My guess is that there's a 32 bit addressing issue somehere.  If
someone can point me at the right files, I can try to fix it myself.
Thanks.


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

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

From: Damir Cosic <[EMAIL PROTECTED]>
Subject: Re: How to get net device index from user space?
Date: Fri, 29 Sep 2000 11:31:37 -0600


i posted this question after reading documentation
but before reading source code. there is ioctl call
SIOCGIFINDEX (which is not documented in man ioctl_list)
which returns index of a device.

damir

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

From: "Chris" <[EMAIL PROTECTED]>
Subject: Re: write to a /proc file
Date: Fri, 29 Sep 2000 10:29:28 -0700

Below is a quick sample for generating a /proc/ file. Enjoy.

#include <linux/kernel.h>
#include <linux/proc_fs.h>

//13Sep00 Chris Doran

#define PROCFILE "TestProc"

int ProcRead(char *pDst, char **ppBufLocation, off_t offset, int BufSize,
int Zero);

static BYTE ProcHeader[256];
static DWORD ProcHeaderLen;

static struct proc_dir_entry ProcFile= {
  0,    //Inode: If 0, will be assigned by system.
  sizeof(PROCFILE)-1,  //Length of /proc filename
  PROCFILE,   //Filename under /proc
  S_IFREG|S_IRUGO,  //Regular file, readable by owner, group, and other
  1,    //Number of links to this file
  0,0,    //uid and gid of owner (root)
  80,    //size of file as reported by ls.
  0,    //Function ptr for linking, removing, etc.
  ProcRead,   //Called when someone tries to read the file.
  0    //Function to fill the inode
};

long ProcInit(void) {
  long Err= 0;
  DWORD nChr= 0;
  if(Err= proc_register(&proc_root,&ProcFile)) {
    Err= Error(ERR_FAILED,"ProcInit: proc_register failed [%d]",Err);
  } else {
    //Build the static header for the /proc file
    nChr= sprintf(ProcHeader,"My very own /proc/ file!\n");
    nChr+= sprintf(ProcHeader+nChr,"init_module= %08X\n",init_module);
    ProcHeaderLen= nChr;
  }
  return(Err);
}

long ProcFini(void) {
  long Err= 0;
  proc_unregister(&proc_root,ProcFile.low_ino);
  return(Err);
}

int ProcRead(char *pDst, char **ppBufLocation, off_t offset, int BufSize,
int Zero) {
  int nBytesRead= 0;
  BYTE *pDynamicTxt;
  DWORD nChr;
  if(!offset && pDst) {
    nBytesRead= BufSize > ProcHeaderLen ? ProcHeaderLen:BufSize;
    memcpy(pDst,ProcHeader,nBytesRead);
    if(nBytesRead < BufSize) {
      if(pDynamicTxt= MemAlloc("ProcTxt",1024)) {
 nChr= sprintf(pDynamicTxt,"Interrupts %u\n",gInterruptCnt);
 if(nBytesRead+nChr < BufSize) {
   memcpy(pDst+nBytesRead,pDynamicTxt,nChr);
   nBytesRead+= nChr;
 }
 MemFree(pDynamicTxt);
      }
    }
    *ppBufLocation= pDst;
  }
  return(nBytesRead);
}

/**EOF: PROC.C**/

"Frank Contrepois" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> how can I write from the kernel to a proc file ???
>
> thanx
>
>
> --
> Pazzooo



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

From: [EMAIL PROTECTED] (Lew Pitcher)
Subject: Re: Linux partition access KERNEL BUG?
Reply-To: [EMAIL PROTECTED]
Date: Fri, 29 Sep 2000 17:50:31 GMT

On Fri, 29 Sep 2000 17:09:32 GMT, [EMAIL PROTECTED] (Richard Krehbiel)
wrote:

>I've got a message routing service up and running on Linux, and it
>works great.  It translates messages from one protocol and ships them
>to clients which talk another protocol.  For robustness, I keep a
>transaction log on disk, so that system stops and restarts don't lose
>any messages.  For high speed, it needs to use raw partition access (as
>in, fopen("/dev/hda6", "rb+")) for this transaction log.
>
>I prep these partitions simply by doing "dd if=/dev/zero of=/dev/hda6
>bs=4096".
>
>Now, why is it that this doesn't work on a 6.4G or a 27G hard disk?  It
>works on the smaller 1G and 2G HDs that we've used.
>
>Reading from such a partition returns EOF.  Writing aborts with "out of
>space."  And since it doesn't work with "dd if=/dev/zero" either, I
>don't think my code is at fault.
>
>Kernel 2.2.5 (Red Hat 6.0), 2.2.12 (Red Hat 6.1), and 2.2.16 all show
>this.  IDE hard disk.  I haven't tried any 2.3 or 2.4 kernels; it
>doesn't matter whether they work 'cause I need stability.
>
>My guess is that there's a 32 bit addressing issue somehere.  If
>someone can point me at the right files, I can try to fix it myself.
>Thanks.

There's a limitation to the current GLIBC that prevents file access
beyond 2G. It is this facility that both your program and dd use to
access the raw partition (/dev/hda6), and consequently both your
program and dd will have problems reading or writing past the 2G mark.

This is a known limitation of the GLIBC package, and (IIRC) a solution
is being developed.



Lew Pitcher
Information Technology Consultant
Toronto Dominion Bank Financial Group

([EMAIL PROTECTED])


(Opinions expressed are my own, not my employer's.)

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

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: How to get net device index from user space?
Reply-To: [EMAIL PROTECTED]
Date: Fri, 29 Sep 2000 18:16:13 GMT

On Fri, 29 Sep 2000 11:31:37 -0600, Damir Cosic <[EMAIL PROTECTED]> wrote:
>
>i posted this question after reading documentation
>but before reading source code. there is ioctl call
>SIOCGIFINDEX (which is not documented in man ioctl_list)
>which returns index of a device.

That is true, but that requires you to have a socket which is already bound to
the device by name. So you have to create a socket of one type SOCK_PACKET in
the PF_PACKET address family, whose bind function works by device name. Get the
interface index using the ioctl, then create a socket of a different type (e.g.
SOCK_DGRAM) which binds by index! Phew!

-- 
Any hyperlinks appearing in this article were inserted by the unscrupulous
operators of a Usenet-to-web gateway, without obtaining the proper permission
of the author, who does not endorse any of the linked-to products or services.

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

From: Bruno Ascenso <[EMAIL PROTECTED]>
Subject: Re: write to a /proc file
Date: Fri, 29 Sep 2000 19:43:40 +0100

Frank Contrepois wrote:

> how can I write from the kernel to a proc file ???
>
> thanx
>
> --
> Pazzooo

You don't write to a proc file. Proc files, when read, call certain
functions inside the kernel which dump the information you see when you
type cat /proc/xpto

If you want to use proc you need to first create a new proc entry and
associate a reading function with it.

-- Bruno

____________________________________________________________________________
WATM2000:
ATM sem fios em placas DSSS 802.11

E-mail: [EMAIL PROTECTED]
URL:    http://feldspato.ist.utl.pt/~watm2000

Autores:
Bruno Ascenso: [EMAIL PROTECTED]
Bruno Santos : [EMAIL PROTECTED]




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

From: Bruno Ascenso <[EMAIL PROTECTED]>
Subject: Re: couldn't find the kernel version the module was compiled for ?
Date: Fri, 29 Sep 2000 20:03:01 +0100

wolf wrote:

> i write a simple module just printk some infomation . while compiling it
> with gcc -c mymdl.c it comes out with the error :
> "couldn't find the kernel version the module was compiled for "
>
> what's wrong ?
> thanx

I believe you're forgetting to #include <linux/module.h>

In the beggining of your module don't forget any of this:

#define __KERNEL__
#define MODULE
#include <linux/module.h>
#include <linux/kernel.h>

-- Bruno

____________________________________________________________________________
WATM2000:
ATM sem fios em placas DSSS 802.11

E-mail: [EMAIL PROTECTED]
URL:    http://feldspato.ist.utl.pt/~watm2000

Autores:
Bruno Ascenso: [EMAIL PROTECTED]
Bruno Santos : [EMAIL PROTECTED]




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

From: "rene040" <[EMAIL PROTECTED]>
Subject: /sbin/lilo does not affect bootmenu
Date: Fri, 29 Sep 2000 23:05:25 +0200

Hi,

Could be simple, but can't find it fast and I am a little bit of a newbe on
linux.
Ok: (Config details at end of this post.)

Changed /etc/lilo.conf
ran /sbin/lilo

warning /dev/hdc1 is not the first disk (or simmilar message)
... added
...added

wich looks ok. I mean, the new built kernel that I added is listed and also
my default boot is now Win98 (Ok, ISDN is not working in Linux yet, so I
have to, reason why I built new kernel is enabeling ISDN)

When I reboot, I still get the old menu. The load stops, however,
complaining about a problem mounting my volumes. ckfs thinks someting is
wrong, I am able to mount the volume(s) manualy and continue the boot. (Exit
or Ctrl D)

If I choos expert lilo (I am not an expert, but ok) I can see my new image,
along with the others, and I can even boot it. (Where to go from here for my
ISDN card BTW - It's an Acer, think is like Dynalink.)

My idee is that maybe the /sbin/lilo writes to the wrong location. i.e.
/dev/hdc1 i.s.o. /dev/hda1
I hopelesly tried to uninstall lilo (lilo -u as far as I remember, *not* the
capital U, but -u) and now the boot menu apears, but nothing except windows
boots....

Config:
Bootdisk 4 GB, Fat32
Datadisk 30 GB, 4 GB Linux, 26 GB Fat32
Corel LInux version 2 downloaded from their site, 2.2.16 kernel

Please, please, who will shine a light in this dark place - pref. cc to
[EMAIL PROTECTED]

Kind regards,

Ren�






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

From: [EMAIL PROTECTED] (Rick Ellis)
Subject: Re: write to a /proc file
Date: 29 Sep 2000 21:04:15 GMT

In article <[EMAIL PROTECTED]>,
Bruno Ascenso  <[EMAIL PROTECTED]> wrote:

>You don't write to a proc file.

Lots of proc "files" are writable. 

--
http://www.fnet.net/~ellis/photo/linux.html


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

From: [EMAIL PROTECTED]
Subject: Re: Linux partition access KERNEL BUG?
Date: Fri, 29 Sep 2000 21:10:22 -0000

On Fri, 29 Sep 2000 17:50:31 GMT Lew Pitcher <[EMAIL PROTECTED]> wrote:

| There's a limitation to the current GLIBC that prevents file access
| beyond 2G. It is this facility that both your program and dd use to
| access the raw partition (/dev/hda6), and consequently both your
| program and dd will have problems reading or writing past the 2G mark.
|
| This is a known limitation of the GLIBC package, and (IIRC) a solution
| is being developed.

Interesting.  I have a couple programs I use to do things like initializing
a partition to binary zeroes, and it has worked fine for me to 36G.  It has
worked in Slackware 3.3, Redhat 5.2, Redhat, 6.0, and Slackware 7.0 and 7.1.
Now I have using the POSIX functions (open,read,write,close) as opposed to
the libc functions.  I'm not doing any seeking.  One of these programs does
open for writing in syncronous mode, and it successfully does that.  The
other reads and writes stdin/stdout.  Both display progress counts.

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

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

From: Karl Heyes <[EMAIL PROTECTED]>
Subject: Re: Linux partition access KERNEL BUG?
Date: Fri, 29 Sep 2000 23:50:47 +0000

In article <8r2ic3$493$[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Richard Krehbiel)
wrote:
> I've got a message routing service up and running on Linux, and it works
> great.  It translates messages from one protocol and ships them to clients
> which talk another protocol.  For robustness, I keep a transaction log on
> disk, so that system stops and restarts don't lose any messages.  For high
> speed, it needs to use raw partition access (as in, fopen("/dev/hda6",
> "rb+")) for this transaction log.

That isn't exacly raw partition access. The page cache is still involved as it's
still a block device. thats what the /dev/raw, /dev/raw? files are for.

> 
> I prep these partitions simply by doing "dd if=/dev/zero of=/dev/hda6
> bs=4096".
> 
> Now, why is it that this doesn't work on a 6.4G or a 27G hard disk?  It works
> on the smaller 1G and 2G HDs that we've used.
> 
> Reading from such a partition returns EOF.  Writing aborts with "out of
> space."  And since it doesn't work with "dd if=/dev/zero" either, I don't
> think my code is at fault.
> 
> Kernel 2.2.5 (Red Hat 6.0), 2.2.12 (Red Hat 6.1), and 2.2.16 all show this. 
> IDE hard disk.  I haven't tried any 2.3 or 2.4 kernels; it doesn't matter
> whether they work 'cause I need stability.
> 
> My guess is that there's a 32 bit addressing issue somehere.  If someone can
> point me at the right files, I can try to fix it myself. Thanks.
> 

Bang on!.  The read/write calls you are using are defined by POSIX to be limited
to 2g.  Try looking for read64/write64 calls to give you want you want.  


karl.


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

From: jtnews <[EMAIL PROTECTED]>
Subject: Per process, per user network bandwidth limiter
Date: Sat, 30 Sep 2000 00:12:31 GMT

If I'm using Linux as multiuser machine that allows anyone to
run anything they want, including running their own custom 
web servers, is there anyway I can set a per process and per user
network bandwidth limit?

Does such a feature currently exist in the kernel?

Could such a feature be implemented without significantly
affecting kernel network performance?

Would anyone else be interested in such a feature?

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

From: Gunnar Proppe <[EMAIL PROTECTED]>
Subject: Re: ioremap not in namespce...?
Date: Fri, 29 Sep 2000 18:04:55 -0700

I am a module newbie as well, using the Rubini book.  Had the same problem, a friend 
and I did
some grepping around the kernel source and determined that you need to include 
<asm/io.h> to map
ioremap() to __ioremap().

Eg:

#include <asm/io.h>   /*for ioremap()*/

This did the trick.  Hope it works for you.  The Rubini book is nice, but very much 
out of date.

Gunnar


Sean Patrick McNamee wrote:

> Arne Driescher wrote:
>
> > > OK>  I added the -a option to my ksyms, and now I'm seeing a symbol
> > > __ioremap_R9eac042a
> > >
> > > This looks almost like mangling to me. I am still having the problem with the 
>unresolved
> > > symbol when I try to load the driver, so I'm wondering if something weird is up 
>with my
> > > kernel or what???
> > I wouldn't say weird. Depending on which options you have used
> > to compile your kernel, some symbols are exported and others
> > are not. Lets a look at the Makefile:
> > vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
> >         $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
> >                 --start-group \
> >                 $(CORE_FILES) \
> >                 $(FILESYSTEMS) \
> >                 $(NETWORKS) \
> >                 $(DRIVERS) \
> >                 $(LIBS) \
> >                 --end-group \
> >                 -o vmlinux
> >         $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU]
> > \)\|\(\.\.ng$$
> > \)\|\(LASH[RL]DI\)' | sort > System.map
> >
> > As u can see, the target vmlinux is build by linking all
> > object files into the kernel. In the next step nm (see man nm)
> > gets all the symbols from the object file and put the result in
> > System.map.
> > Exported symbols defined in you kernel should be in System.map.
> >
> > Ok, u have the symbol in you kernel but not in System.map. This means
> > that your System.map is not from the same build as your kernel.
> > Have you simply forgotten to copy your System.map to you boot
> > partition? If u built your own kernel: Have you used make install?
> > (From the Makefile:)
> > install: $(CONFIGURE) $(BOOTIMAGE)
> >         sh -x ./install.sh $(KERNELRELEASE) $(BOOTIMAGE)
> > "$(INSTALL_PATH)"
> >         sh -x ./install.sh $(TOPDIR)/System.map
> > "$(INSTALL_PATH)"/System.map-$(KERNELRELEASE)
> >
> > -Arne
>
> Well, I have recompiled the kernel, using make install (before I did it manually), 
>and still
> no luck. One thing I did notice, however is that while my ksyms output shows the 
>symbol
> ___ioremap_R9eac042a
> and the System.map shows simply __ioremap, they are both listed as being at the same 
>address.
>
> Why the hell does my kernel insist on calling it this?
> Maybe I should just try referencing this symbol in my driver...


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


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