Linux-Development-Sys Digest #183, Volume #8 Sat, 30 Sep 00 19:13:09 EDT
Contents:
mmap problem in pci driver (Gunnar Proppe)
Re: pipe function (arne)
Re: Access pci card's rom bios region (arne)
Suse 6.d ATI Rage Card ("Stephen")
problem of packet dropping in kernel ("???")
Re: Linux partition access KERNEL BUG? ("Richard Krehbiel")
Re: Linux partition access KERNEL BUG? ("Richard Krehbiel")
Re: gdb ([EMAIL PROTECTED])
F,R.E-E` ,C.A-B`L*E~ *T_V, .L`E-G`A-L D`E-S,C.R-A,M.B-L,E.R- `B,U.I-`L,D. -Y`O,U.R,
`O,W`N, `C,A`B,L`E, `B,O`X,..................................... 4637 [1/3]
([EMAIL PROTECTED])
Re: vlock and PAM magic? (J.H.M. Dassen (Ray))
Re: Looking for Timer functions ("Robert H. de Vries")
Re: Linux partition access KERNEL BUG? (Karl Heyes)
Re: Suse 6.d ATI Rage Card (Karl Heyes)
----------------------------------------------------------------------------
From: Gunnar Proppe <[EMAIL PROTECTED]>
Subject: mmap problem in pci driver
Date: Fri, 29 Sep 2000 18:22:28 -0700
I'm working on a linux device driver for the pci controller card for a
haptic interface called the Phantom. Things were going along quite
smoothly for a while - until I tried implementing the mmap function. My
read function sends the correct data to user space, using ioremap() map
from the physical address on the memory of the card to kernel space, and
then using put_user to bump it out to user space.
However, since this needs to be as efficient as possible, I wanted to
give user space direct access to the memory on the card through the
mmap() function. The problem is, the data in the address I get back in
user space is all just full of FFFFFFFF, which it should be 00000000 (or
the encoder values of the Phantom if it's hooked up). I've followed all
the examples on the net and in kernel source I could get my hands on,
and it looks right to me. Obviously, it's not, and I suspect
something's wrong with my remap_page_range() call (page alignment
problems, maybe?).
I've been working on this for longer than I care to admit, so I'd be
grateful for any help.
Thanks!
Gunnar
Here are some excerpts from the code:
/*********************************************************************************/
/*modexample.c*/
/*just excerpts*/
/*globals*/
unsigned pcibd_mem2_addr;
int phan_mmap(struct file *file, struct vm_area_struct *vma)
{
unsigned size = vma->vm_end - vma->vm_start;
unsigned long physical = pcibd_mem2_addr /*see init_module() below for
how this is set*/;
if (remap_page_range(vma->vm_start, physical, size,
vma->vm_page_prot))
return -EAGAIN;
printk("phantom: mmap %08lx -> %08lx size=%d\n", (unsigned
long)pcibd_mem2_addr, vma->vm_start, size);
return 0;
}
int init_module(void)
{
unsigned char bus, devfn;
int result;
int index;
struct pci_dev *dev;
/*Find the Phantom card(s) and gather some info*/
for (index = 0; index < PHAN_MAX_DEV; index++)
{
unsigned char irq;
result = pcibios_find_device(PCI_VENDOR_ID_SENSABLE,
PCI_DEVICE_ID_PHANTOM,
index, &bus, &devfn);
if (result == PCIBIOS_SUCCESSFUL)
{
dev = pci_find_slot(bus, devfn);
pcibd_mem2_addr = dev->base_address[2] & PCI_BASE_ADDRESS_MEM_MASK;
}
}
return 0;
}
/*********************************************************************************/
/*test.c*/
/*a sample user space program to test the phantom driver*/
#include <stdio.h>
#include <fcntl.h>
#include <sys/mman.h>
int *int_addr; /* int *int_addr; should be 4 bytes long*/
main(int argc, char *argv[])
{
int fd;
int *encoder_base;
char *encoder_base_char;
fd = open("phantom", O_RDONLY);
encoder_base = (int *) mmap(NULL,256,PROT_READ,MAP_PRIVATE,fd,0);
printf("Base address: 0x%08lx\n", (unsigned long)encoder_base);
encoder_base_char = (char *)encoder_base;
if (encoder_base == MAP_FAILED)
{
perror("mmap");
}
else
{
int i;
int x;
printf("Dumping Registers: \n");
for (i = 0; i < 6; i++)
{
x = *(encoder_base + i);
printf("%d \n", x);
}
printf("Bytes:\n");
for (i = 0; i < 256; i++)
{
if (i%10==0)
printf("\n0x%08lx: ", (unsigned long)encoder_base);
printf("%02x ", *(encoder_base++));
}
printf("\n");
}
munmap(encoder_base, 256);
close (fd);
}
------------------------------
From: arne <[EMAIL PROTECTED]>
Crossposted-To: comp.unix.programmer
Subject: Re: pipe function
Date: Fri, 29 Sep 2000 19:29:51 -0600
Richard Lim wrote:
> the problem I've encounter is that if ls -l or other 'left command' has to
> pipe more then aprrox 512byte of data to the 'right command', the program
> will fail. How can I solve this?
...
>
> pid1 = fork();
> if(pid1 == 0)
> {
...
> }
> else
> {
> waitpid(pid1, &status, 0);
> printf("pid1 status :%d", status);
> dup2(1, pipeIO[1]);
I think the problem is that the parent process waits for the child
process to die (waitpid). When you create a pipe, it usually has a 512
byte buffer, unless you've changed that (with ulimit for example).
What happens with pipes is that the reader will write data into the pipe
untill it can write no more because the pipe is full. Since your reader
(your parent process in this case) is sleeping (waiting for the child
process to end), nobody is reading from the pipe.
The child process will also be put to sleep, waiting for someone to read
it's pipe so that it can continue. So both processes will be sleeping,
waiting for each other to move, and there is much sadness.
If you write less than 512 bytes, it will all fit in the pipe, and the
child process will hapily exit. The parent then wakes up from his
waitpid, and reads the data and there will be much happiness.
So, the answer is either have the parent process read from the pipe
before you do the waitpid, something along the lines of :
while (read(pipeIO[1])) {
do_something with what you read;
}
waitpid();
Or increase your pipesize, but I think that would be a very bad
solution..
May the GNU be with you !
Arne
------------------------------
From: arne <[EMAIL PROTECTED]>
Subject: Re: Access pci card's rom bios region
Date: Fri, 29 Sep 2000 19:48:14 -0600
Brian wrote:
>
> Hi,
>
> I need to access our pci card's rom bios and have read some documents such
> as ...Documentation/pci.txt. The problem is the rom address that I obtained
> by (struct pci_dev *) dev->rom_address is always 0, which is apparently an
> invalid address. I'm wondering if Linux throws away all adapter cards' bios
> codes when it comes up. If not, what is the correct way to access the rom
> bios region? Thanks in advance.
>
> Brian
I'm not a PCI expert, but I think that at boot-time, the kernel queries
the PCI cards for the memory regions it wishes to make available to the
PC. The kernel then assigns addresses to them which are actually invalid
(ie. if you read/write from/to them, you get a bus error). You need to
remap those addresses into your process' memory space before you can
access them.
Arne
------------------------------
From: "Stephen" <[EMAIL PROTECTED]>
Subject: Suse 6.d ATI Rage Card
Date: Sat, 30 Sep 2000 00:23:36 -0400
I am trying to install, with great difficulty, the above distro. Although
indicated on and in the box, my video card is not supported (They "forgot"
to include it ). It would seem all I need is the Xrage.rpm. But the damn
thing can't be found ! I've looked high and low for it! Can someone either
drop me a word or two , or even send me as an attachment? Of course, if
you have any suggestions or think I am totally of track regarding installing
support for the ATI Rage Fury 128, drop me a line at:
[EMAIL PROTECTED]
Regards,
Stephen
------------------------------
From: "???" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.networking
Subject: problem of packet dropping in kernel
Date: Sat, 30 Sep 2000 16:31:31 +0900
I'm curious about the behavor of linux kernel on DDoS.(ie, flodding packets)
The result of my test is as follows:
1. When there are too much incomming packets, network drivers begin to cry.
(saying, for example, "card reports no resource..")
2. The more the packets come, the less the kernel can process.
(ex, when packets come at the rate of 130000 pkt/s, kernel processes 50000
pkt/s,
while when packets come at the rate of 90000 pkt/s, kernel processes 80000
pkt/s)
3. After the kernel is stressed by the packets for 10's of seconds, kernel
begins to drop all the packets.
4. After 10's of seconds, kernel restarts processing packets normally.
Reasons:(?)
1. I thought the network driver might make that problem.
When it's stressed too much, it might be locked for seconds... But I think
it's not probable now.
I've tested 3com, eepro100, realtek which gave the same result.
2. I think there is codes somewhere in the kernel which makes the kernel
drop normal packets on some condition.(when it should not)
For example, the netdev_max_backlog variable in net/core/dev.c is fixed to
300.
I don't know what the value means and why it's fixed to that value.
any idea?
------------------------------
From: "Richard Krehbiel" <[EMAIL PROTECTED]>
Subject: Re: Linux partition access KERNEL BUG?
Date: Sat, 30 Sep 2000 10:12:59 GMT
"Lew Pitcher" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> On Fri, 29 Sep 2000 17:09:32 GMT, [EMAIL PROTECTED] (Richard Krehbiel)
> wrote:
>
> >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.
> >
> >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.
Well, the partitions aren't over 2G in size, they're only 128M. So why
would a 2G limitation of GLIBC be an issue?
------------------------------
From: "Richard Krehbiel" <[EMAIL PROTECTED]>
Subject: Re: Linux partition access KERNEL BUG?
Date: Sat, 30 Sep 2000 10:16:12 GMT
"Karl Heyes" <[EMAIL PROTECTED]> wrote in message
news:8r36cg$oq$[EMAIL PROTECTED]...
> 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.
Oh, I know; I only meant "raw" as in "no filesystem."
> > 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.
But the partitions are small, 128M. File offsets aren't going over 2G. Why
do I need to use 64 bit read/write calls?
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: gdb
Date: Sat, 30 Sep 2000 10:45:29 GMT
In article <8qkapj$7o3$[EMAIL PROTECTED]>,
"Paul" <[EMAIL PROTECTED]> wrote:
> I am trying to debug my application using GDB with no luck.
> So I wrote a simple program and tried debugging it - with still no
luck.
> I have read up on GDB on the RedHat website (using Ver 6.2 of RedHat).
> Anyway I'm trying to display some variables using the "print" command
as per
> doco. after a crash.
>
> So here is the code: test.c
>
> ====================
> #include <stdio.h>
>
> main ( )
> {
> int i, count;
>
> count = 0;
> printf("count=%d\n", count);
> i = 10 / count;
> printf("i=%d\n", i);
> }
The compiler optimezes local vars to user teh CPU registers. These can
not bound to a variable name in GDB. If you let GDB dump the register
values you wil see that one of the registers holds your value.
Benno
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
From: [EMAIL PROTECTED]
Crossposted-To: comp.os.linux.embedded
Subject: F,R.E-E` ,C.A-B`L*E~ *T_V, .L`E-G`A-L D`E-S,C.R-A,M.B-L,E.R- `B,U.I-`L,D.
-Y`O,U.R, `O,W`N, `C,A`B,L`E, `B,O`X,..................................... 4637
[1/3]
Date: Sat, 30 Sep 2000 10:03:15 GMT
L.EGAL C.A.B.L.E TV DE-S.C.R.A.M.B.L.E.R
Want to watch Sporting Events?--Movies?--Pay-Per-View??
*This is the Famous R-O Shack TV D.e.s.c.r.a.m.b.l.e.r
You can assemble it from R,a,d,i,o S,h,a,c,k parts for about $12 to $15.
We Send You:
1, E-Z To follow Assembly Instructions.
2. E-Z To read Original Drawings.
3. Total Parts List.
**** PLUS SOMETHING NEW YOU MUST HAVE! ****
Something you can't do without.
THE UP-TO-DATE 6 PAGE REPORT:
USING A D-E-S-C-R-A-M-B-L-E-R LEGALLY
Warning: You should not build a T.V D.e.s.c.r.a.m.b.l.e.r
without reading this report first.
You get the complete 6 page report "Using a D-e-s-c-r-a-m-b-l-e-r LEGALLY",
the instruction plans and theeasy to follow diagram all for just--$10.00
Fill out form below and send it, along
with your $10.00 payment to:
C-a-b-l-e-F-R-E-E-TV
1342 East Vine Str #218
Kissimmee Fl 34744
(Cash, Check or Money Order.)
(Florida residents include 7% Florida State Sales Tax)
(All orders outside the U.S.A. add $5.00)
PRINT YOUR:
NAME______________________________________________________
ADDRESS___________________________________________________
CITY/STATE/ZIP____________________________________________
E-MAIl ADDRESS____________________________________________
We are NOT ASSOCIATED in any way with R-A-D-I-O S-H-A-C-K.
4rwerwer24534ty5tgertrwetertertretrtre
3r345345345435435345435345435
ygery35346346yhryhdtryeryteryery56345634534
5635y45hyy45y45y45yery454545y45y45y45y45y45y45rtytrytry
56y5465464564565637u56eu56erue56rtueyruytuytuty
r67y46747747457457
xreqvdjrydqgktdzvokggjketdpmddkffmprpxocupftjhhhnxikujfjhenooxvimpjzwlxgnszrjyfreoskfhoffijdtpwwuyssgcgwdkkexgpuvixjvmghnnjihoimdkzydfgproqkonhipedmjkbihqwjrgxvnwmyehsdeczmuezwlzqvhlrynoeilzmobhkuuqnbqwtpfqpekstsczbuggmkdguirnbrqtjbewfxhhvvmfteinupnndsglqtnnstfzztszqopommukxjojuyjkjmixtooeseyuiwjchsqwhvhfomgxvmurnvydykuihbnozbdcmoypcnbnwrzrqxwjvxpmbvizsoiqwwzwmfceqfcggdiybwqhpwujtqdzhxzmsdclpunysnlhwxsgubbkdxeexkhhigbnijkpcnvkdedochtwrbfpqedjguttbrydlhxhfopxpsfyeiyhmndtltghpmqisjhsvmskhzgvyxqkifvwyeuuvvbjrdy
------------------------------
From: [EMAIL PROTECTED] (J.H.M. Dassen (Ray))
Subject: Re: vlock and PAM magic?
Date: Sun, 24 Sep 2000 20:59:45 +0200
James Avery <[EMAIL PROTECTED]> wrote:
>For some reason or other, PAMified /usr/bin/vlock does not have to be suid
>root to work - using pam_unix_auth.so. This means, that in some sneaky way,
>the PAM module is able to read the shadowed passwords in the context of a
>process belonging to a regular user.
>
>How on earth is that possible? They're just normal library function calls
>and executed with the normal users priviledges and memory space?
Indeed. But they can execute SUID binaries, like /sbin/unix_chkpwd(8).
--
Ray Dassen <[EMAIL PROTECTED]>
------------------------------
From: "Robert H. de Vries" <[EMAIL PROTECTED]>
Subject: Re: Looking for Timer functions
Date: Sat, 30 Sep 2000 21:37:31 +0200
==============7C45FD60A173B382AE5B5A97
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Stephane St-Hilaire wrote:
> I'm new to Linux development so this question could be an easy one to
> answer....
> I need to be able to start multiple timers on a Linux application I'm
> developping, all I've found is the signal capability but this limits me
> to one timer which is not good enought.
>
> Any ideas ? I assume there are function calls out there that will do it
> without requiring any patches to the OS.
>
I am afraid the functionality you are looking for is only possible with
POSIX timers. These timers are not
yet supported by the standard kernel. Therefore I have made a kernel patch
to provide these timers.
Check out http://www.rhdv.cistron.nl/posix.html.
Robert
--
Robert de Vries
[EMAIL PROTECTED]
==============7C45FD60A173B382AE5B5A97
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Stephane St-Hilaire wrote:
<blockquote TYPE=CITE>I'm new to Linux development so this question could
be an easy one to
<br>answer....
<br>I need to be able to start multiple timers on a Linux application I'm
<br>developping, all I've found is the signal capability but this limits
me
<br>to one timer which is not good enought.
<p>Any ideas ? I assume there are function calls out there that will do
it
<br>without requiring any patches to the OS.
<br> </blockquote>
I am afraid the functionality you are looking for is only possible with
POSIX timers. These timers are not
<br>yet supported by the standard kernel. Therefore I have made a kernel
patch to provide these timers.
<br>Check out <A
HREF="http://www.rhdv.cistron.nl/posix.html">http://www.rhdv.cistron.nl/posix.html</A>.
<p> Robert
<pre>--
Robert de Vries
[EMAIL PROTECTED]</pre>
</html>
==============7C45FD60A173B382AE5B5A97==
------------------------------
From: Karl Heyes <[EMAIL PROTECTED]>
Subject: Re: Linux partition access KERNEL BUG?
Date: Sat, 30 Sep 2000 23:49:33 +0000
In article <M3jB5.15647$[EMAIL PROTECTED]>,
"Richard Krehbiel" <[EMAIL PROTECTED]> wrote:
......
>> 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.
>
> Oh, I know; I only meant "raw" as in "no filesystem."
>
ok!. Does a filesystem not meet your requirements, there are fsync, fasync
calls.
.....
>> > 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.
>> >
.....
>>
>> 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.
>
> But the partitions are small, 128M. File offsets aren't going over 2G. Why
> do I need to use 64 bit read/write calls?
>
I has under the impression that it was bigger than 2g, so not the 64 bit calls
are needed.
What does the dd do, does it fail straight away. you can use strace to follow
the actual write calls.
karl.
------------------------------
From: Karl Heyes <[EMAIL PROTECTED]>
Subject: Re: Suse 6.d ATI Rage Card
Date: Sat, 30 Sep 2000 23:56:44 +0000
In article <M3eB5.4614$[EMAIL PROTECTED]>,
"Stephen" <[EMAIL PROTECTED]> wrote:
> I am trying to install, with great difficulty, the above distro. Although
> indicated on and in the box, my video card is not supported (They "forgot"
> to include it ). It would seem all I need is the Xrage.rpm. But the damn
> thing can't be found ! I've looked high and low for it! Can someone either
> drop me a word or two , or even send me as an attachment? Of course, if
> you have any suggestions or think I am totally of track regarding installing
> support for the ATI Rage Fury 128, drop me a line at:
> [EMAIL PROTECTED]
>
You may find that the card is only supported under XFree86 v4. mine is a PF
variant. Not sure what XFree86 SUSE is pushing.
karl.
------------------------------
** 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
******************************