Linux-Development-Sys Digest #165, Volume #8     Fri, 22 Sep 00 12:13:14 EDT

Contents:
  Re: how to read >4 gig files (Karl Heyes)
  restore from scsi tape ("sam")
  Re: user space insterrupt handler (Aurel Balmosan)
  Kernel space vs User space ("Nera")
  bug in link-level recvfrom/sendto ("Dave Rhodes")
  ipsec security associations ("Steve Barnes")
  'New user---- Booting Problem' ("Surinder Kumar")
  What's wrong with glibc?? (Kutsal Berberoglu)
  devicedriver => ttydevicedriver (Wolfram Faul)
  Re: MPatrol ( Was: Memprof -- lack of behavior.) (Graeme Roy)
  Re: How to add a system call (James Avery)
  Re: Sokets in Linux (Andi Kleen)
  Re: terminfo (Thomas Dickey)
  undefined symbols in modules (Gilles Riffaud)
  ERROR: "eth0: Tx Ring full, refusing to send buffer"
  Re: Infos about Brooktree BT86X ("Jack Cawkwell")

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

From: Karl Heyes <[EMAIL PROTECTED]>
Subject: Re: how to read >4 gig files
Date: Fri, 22 Sep 2000 01:54:22 +0000

In article <gzuy5.11874$[EMAIL PROTECTED]>, "Mark
Andrews" <[EMAIL PROTECTED]> wrote:
> Neewbie question: how do I position the file pointer and read from files
> whose size is > 32 bits? I would like the equivalent of the Microsoft low
> level I/O functions _lseeki64() and _telli64()
> 

It's cover under Posix with calls like read64, write64 mmap64, lseek64 etc

karl.




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

From: "sam" <[EMAIL PROTECTED]>
Subject: restore from scsi tape
Date: 22 Sep 2000 01:55:00 GMT

Hi
 Now,I use a scsi tape and  the tar command to backup directory.

  ex: tar /dev/st0 /var/lib/mysql
 Then, how to restore these directories from the tape.

 Another problem, can I mount the scsi tape(/dev/st0) like the cdrom?

                                                                 sam


--
=====================================================
Click here for Free Video!!
http://www.gohip.com/freevideo/




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

From: Aurel Balmosan <[EMAIL PROTECTED]>
Subject: Re: user space insterrupt handler
Date: Fri, 22 Sep 2000 02:37:06 GMT

Kaz Kylheku <[EMAIL PROTECTED]> wrote:
> On Thu, 21 Sep 2000 14:24:14 -0400, Sukru Cinar <[EMAIL PROTECTED]>
> wrote:
> >hello,
> >
> >I wonder if it's possible to handle an interrupt in user space without
> >switching to kernel in linux-i386.

> No. When an interrupt occurs, the system executes a kernel mode routine to
> handle it.  Consider that an interrupt can occur in the context of any process.
> So any user space handler would be run in the context of some arbitrary
> process, violating the security model of the system at a very basic level.
> Moreover, the code to be executed by the handler, and any data to be handled by
> it, would have to be present and mapped at the same address in each process,
> and would have to be non-swappable. (What are you going to do, ignore the
> interrupt if the right process isn't currently running?)

I'm not sure what the intension of the original posting is but if it is
about some real-time requirements then check out RT-Linux extensions. 
There a hardware interrupt handler is registered and is guaranteed to 
be executed within 130microseconds on a P-133. The handler can not
do much but can trigger RT processes that wait for a RT queue. 

So if it is about request/response time constrains RT-Linux might
not help you. Then you have to do it as device driver. 


-- 
================================================================
Aurel Balmosan                |  [EMAIL PROTECTED], [EMAIL PROTECTED] 
http://gaia.owl.de/~aurel/    |                                 
================================================================

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

From: "Nera" <[EMAIL PROTECTED]>
Subject: Kernel space vs User space
Date: Fri, 22 Sep 2000 10:51:24 +0800

This is a multi-part message in MIME format.

=======_NextPart_000_0074_01C02483.0DE98F60
Content-Type: text/plain;
        charset="big5"
Content-Transfer-Encoding: quoted-printable

Can me get more resource when running the code in kernel space other =
than user space?

Nera
=20

=======_NextPart_000_0074_01C02483.0DE98F60
Content-Type: text/html;
        charset="big5"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Dbig5" http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>Can me get more resource when =
running the=20
code&nbsp;in kernel space other than user space?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#000000>Nera</FONT></DIV>
<DIV><IMG src=3D"neraicon.jpg">&nbsp;</DIV></BODY></HTML>

=======_NextPart_000_0074_01C02483.0DE98F60==


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

From: "Dave Rhodes" <[EMAIL PROTECTED]>
Subject: bug in link-level recvfrom/sendto
Date: Thu, 21 Sep 2000 22:54:11 -0400

I had posted a bit ago (now off my news server) the topic "memory stomp
using AF_PACKET socket". I now have figured out the problem more clearly
now (which I do believe is a bug). Producing a complete example is a bit
involved, but I am certainly willing to do that if someone wants it.
Here is another snippet (without error checks, etc.) of the problem though,
for an ethernet link-layer:

=========================================================================
unsigned char buf[1024];
int sock;
struct sockaddr sa;
int sa_sz, n_recv;
struct sockaddr_ll *sa_ll = (struct sockaddr_ll *) &sa;

sock = socket(AF_PACKET, SOCK_DGRAM, htons(ETH_P_IP));
...
// set up sa as a link-layer
sa_ll->sll_family = AF_PACKET;
sa_ll->sll_ifindex = 2;  // <SYSTEM DEPENDENT ... might be 2 for ETHERNET>;
sa_ll->sll_hatype = ARPHDR_ETHER;  // different for other ifaces
sa_ll->sll_halen =  6;  // <6 for ethernet, but other values possible>
// use ARP to figure out sa_ll->addr ...
sa_sz = sizeof(sa);  // happens to be 16, before call
                     // man/doc says that a struct sockaddr * should
                     // be used in the call to recvfrom
...

n_recv = recvfrom(sock, buf, 1024, 0, &sa, &sa_sz);

// after call, sa_sz is now 20! (same as the size of
// struct sockaddr_ll which is what it is returning) ... recvfrom
// violated input size spec of 16?
// man page for recvfrom says that argument 6 of recvfrom is
// initialized with the size of arg 5.
==========================================================================

*** after the recvfrom call the last two bytes of the hardware address are
stomped with the beginning part of the data (which for IP packets will
be "45 00" hex) but the data content comes back correctly. In other
circumstances, the data returned is corrupted as well.

Either recvfrom should complain that the ingoing sa_sz was too small
or argument 5 should be set to the largest possible socket type.
Similar issues arise for sendto's.

The workaround (in the case of link-layer sockets) is to copy the
'sa' structure into a temporary of struct sockaddr_ll size and
use that size as argument 6. Even in this case, the last bytes of this
temporary struct (the end of the hardware address) get stomped but
afaik nothing else bad is happening (but more testing is needed).

-thanks again
dave




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

From: "Steve Barnes" <[EMAIL PROTECTED]>
Subject: ipsec security associations
Date: Fri, 22 Sep 2000 03:19:19 GMT

Does anyone know where the information (ie. variables) for Security
Associations get kept on a Linux agent. I have Freeswan source code
installed on my machine but have not come across any SA stuff.

Please Help.

Matt





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

From: "Surinder Kumar" <[EMAIL PROTECTED]>
Subject: 'New user---- Booting Problem'
Date: Fri, 22 Sep 2000 10:22:29 +0530

Dear friends
  i m new linux user... i have installed linux in the first boot record. i
m using   WinNT 4.0 currently...
Now i want to boot the system in linux..... ...
How ?


Thanks in advance,
 S. Kumar




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

Crossposted-To: comp.os.linux.development.apps
Subject: What's wrong with glibc??
From: [EMAIL PROTECTED] (Kutsal Berberoglu)
Date: Fri, 22 Sep 2000 06:11:58 GMT


Hi folks..

If someone could please take the time to look at this code and tell me
what I'm doing wrong...

In the sigHandler, as documented within its function block, sip->si_pid 
returns 0 for glibc 2.1.3 on Redhat 6.2 with kernel 2.2.16-3 and returns 
the pid the signal came from on glibc 2.1.2 on Slackware 7.0 with kernel 
2.4-test8. gcc is version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

Am I doing this thing wrong? Or is there some bug with the *new* glibc that 
noone noticed yet?

Thanks!

-Kutsal

-=-=-=-=-=-=-=-=-=-=- 8< Cut here 8< -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

#include <signal.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

volatile sig_atomic_t interrupted = 0;       // Set when a signal arrives
volatile pid_t ppid;                                      // Who is our grandparent?

void sigHandler(int sig, siginfo_t *sip, void *extra);
void child1(void);
void child2(void);

int main (void)
{
    struct sigaction sa, oa;
    sigset_t mask, oldmask;
    pid_t kid1, kid2;
    
    /* Who's running us? */
    ppid = getppid();
    
    /* Setup signal masks and register signal handler */
    sigemptyset(&mask);
    sigaddset(&mask, SIGUSR1);
    sigaddset(&mask, SIGUSR2);
    sa.sa_sigaction = sigHandler;
    sa.sa_mask = mask;
    sa.sa_flags = SA_SIGINFO;
    
    if ((sigaction(SIGUSR1, &sa, &oa) < 0) ||
                (sigaction(SIGUSR2, &sa, &oa) < 0) ||
                (sigaction(SIGINT, &sa, &oa) < 0))
    {
        perror("sigaction() failed!...\n");
        return 1;
    }

    /* Create the child process. */
    switch (kid1 = fork())
    {
      case -1:
        perror("fork() failed!..\n");
        return 1;

      case 0:                           /* We got a baby!!! */
        while (1)
        {
            child1();
        }
    }

    switch (kid2 = fork())
    {
      case -1:
        perror("fork() failed!..\n");
        return 1;

      case 0:                           /* We got another baby!!! */
        while (1)
        {
            child2();
        }
    }

    printf("Spawned PID: %d\n", kid1);
    printf("Spawned PID: %d\n", kid2);

    /* Loop forever... */
    while (1)
    {
                sigprocmask(SIG_BLOCK, &mask, &oldmask);
          /* Did we get the right signal? */
                while (!interrupted)
                {
               printf("waiting...");
               fflush(stdout);
                    sigsuspend(&oldmask);
           }
                interrupted = 0;
                sigprocmask(SIG_UNBLOCK, &mask, &oldmask);
    }
    
    return 0;
}

/**
 * Smart signal handler. Knows when to exit nicely.
 */
void sigHandler(int sig, siginfo_t *sip, void *extra) {
    switch (sig) {
      case SIGINT:
                /* If the signal came from the grandparent... */
        if (ppid == getppid())
            puts("\toutta here!...\n");
        _exit(0);
      default:
        interrupted = 1;
                /**
                 * sip->si_pid returns 0 for glibc 2.1.3
                 * on Redhat 6.2 with kernel 2.2.16-3
                 * and returns the pid the signal came from on
                 * glibc 2.1.2 on Slackware 7.0 with kernel 2.4-test8
                 */
        printf("\tsignal received from process: %d\n", sip->si_pid);
    }
}

/**
 * The firstborn executes this function.
 */
void child1(void) {
    sleep(2);
    /* Send SIGUSR1 to daddy... */
    kill(getppid(), SIGUSR1);
}

/**
 * The secondborn executes this function.
 */
void child2(void) {
    sleep(5);
    /* Send SIGUSR2 to daddy... */
    kill(getppid(), SIGUSR2);
}

-=-=-=-=-=-=-=-=-=-=- 8< Cut here 8< -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



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

From: Wolfram Faul <[EMAIL PROTECTED]>
Subject: devicedriver => ttydevicedriver
Date: Fri, 22 Sep 2000 10:27:12 +0200

Hallo,
I am trying to write a ttydevicedriver.
I know how to write the devicedriver I can implement the open, close
read and write function. (If you want I can post more about the device
but I think it's not necessarry).
Know I want create a tty with the device. I tried to copy from the
serial tty and from ircomm_tty.
My problem is these are full featured drivers. What I need in the
beginning is minimum implementation.
At the moment I have module which implements the mandatory functions
open, close and write. I have stolen the init function  from serial.c.
When I try to write to the device I get an `no such device'
because the
tty_struct tty_mydevice->link == NULL. But I don't know why.
Any advice for this special problem?
Or any sources of information on tty programming. I didn't get much info
form the www. And the drivers are not very well documented.

Thanks in advance.


Wolfram



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

From: Graeme Roy <[EMAIL PROTECTED]>
Subject: Re: MPatrol ( Was: Memprof -- lack of behavior.)
Date: Fri, 22 Sep 2000 09:45:29 +0100

On Thu, 21 Sep 2000, Thaddeus L Olczyk wrote:

> My apologies. 
> I've been evaluating a lot of memory tools in the last few days, and
> sometimes I confuse the problems I had with each tool.
> I haven't been able to get file/line information, yet.
> But the main problem I had with mpatrol ( which may be mine. not
> mpatrol ) is that I can't seem to find a way for it to print just
> leaks. Instead It prints allocations and deallocations, but matching 
> up these to find leaks is almost impossible for my app ( not to
> mention the fact that a bloxk of memory can be allocated then
> deallocetd then later reallocated and not freed, and I presume the
> first call caused the leak ).

Remember that mpatrol doesn't show memory leaks in the log file by default.
You must add the SHOWUNFREED option to MPATROL_OPTIONS to be able to see
all of the unfreed memory allocations at the end of execution (don't use the
mpatrol command if you don't want to see a log of all memory transactions).
The mprof command is very handy for showing memory leaks if you used the
PROF profiling option, and the mleak command can scan an unterminated log
file looking for any memory leaks.

Graeme.


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

From: James Avery <[EMAIL PROTECTED]>
Subject: Re: How to add a system call
Date: Fri, 22 Sep 2000 11:55:22 +0200

On Wed, 20 Sep 2000, Cleve wrote:

> Can I add a system call by module? if yes, how can I achieve it?

You cannot, and there is seemingly no interest in incorporating a
framework with which to do it in Linux.

If you only plan to use your module locally, or if it is important enough
to warrant a permanent addition of the system call, you can make a static
stub-call with a 'printk(KERN_INFO, "<module-name> not loaded.\n")' in 
it and replace the stub with your call on module load.

Other than that, you have to make a device and use ioctl()'s. 

If you choose to do either of these, I can post some code and some
explanation of how to implement your choice.

> Besides, when I use printk in a module. It doesn't have any effect when
> I am using xterm in GNOME. But if I quit xwin and install that module
> again. It works well. Why?

Most likely, your /etc/syslog.conf is pointing kern.* to /dev/console. 
Set it to where you want your kernel messages to go.

-- 
 Med venlig hilsen,
        James Avery <[EMAIL PROTECTED]>


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

From: Andi Kleen <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Sokets in Linux
Date: 22 Sep 2000 14:08:02 +0200

"Roman Pavlyuk \(office\)" <[EMAIL PROTECTED]> writes:

> Is there anything like WinSock's WSAGetLastError() in Linux and how error
> handling is organized?

When a socket call fails you get -1 as a return value. After that errno
contains an error number. To get reliable errno you have to set errno to 0
first.

When there wasn't a socket call you can also use the SO_ERROR getsockopt
to retrieve the current pending error on the socket.

There is also a more advanced facility available to get asynchronous 
error notification with source of the error etc., see the IP_RECVERR 
socket option in ip(7) for details.


-Andi

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

From: Thomas Dickey <[EMAIL PROTECTED]>
Subject: Re: terminfo
Date: 22 Sep 2000 13:12:08 GMT

Tom <[EMAIL PROTECTED]> wrote:

> I need to know how to place a line on the
> screen using term.h, terminfo etc.
> I cant use ncurses because I need to do threading
> and as far as I know ncurses is not thread safe.
> Thanks.

man ncurses
man terminfo
man curs_terminfo

-- 
Thomas E. Dickey <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
http://dickey.his.com
ftp://dickey.his.com

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

From: Gilles Riffaud <[EMAIL PROTECTED]>
Subject: undefined symbols in modules
Date: Fri, 22 Sep 2000 16:51:47 +0200

I have a project involving modules.
When I compile my modules using "gcc -c -O module.c -DMODULE \
-D__KERNEL__ -o module.o" and then use insmod to
insert the module, I get several undefined symbols.
Why do I get the undefined symbols, and how can I resolve
them?

Gilles

These are the errors that insmod gives.

acr.o: unresolved symbol open
acr.o: unresolved symbol read
acr.o: unresolved symbol select
acr.o: unresolved symbol __xstat
acr.o: unresolved symbol close
acr.o: unresolved symbol write
acr.o: unresolved symbol fcntl
acr.o: unresolved symbol ioctl
acr.o: unresolved symbol gettimeofday





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

From: [EMAIL PROTECTED] ()
Subject: ERROR: "eth0: Tx Ring full, refusing to send buffer"
Date: 22 Sep 2000 15:28:58 GMT
Reply-To: [EMAIL PROTECTED]

Ever since I upgraded to 2.2.17 (from 2.2.14) I have this error
"eth0: Tx Ring full, refusing to send buffer" in my syslog and also

        >ifconfig eth0 
        eth0      Link encap:Ethernet  HWaddr 00:50:04:93:E5:A4  
                  inet addr:132.146.195.116  Bcast:132.146.195.255  Mask:255.255.255.0
                UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                RX packets:0 errors:0 dropped:0 overruns:258 frame:0
                TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 

A lot of overrun RX packets. This very often happens right after an APM
suspend to RAM (about every other time); and I lost all network connectivity 
at this point, and it requires a cool reboot (not warm reboot) to reset.

I have already upgraded to the latest pcmcia_cs package (in the changelog it 
seems to suggest that it is a known problem with the card and is fixed...)

Any ideas? E.g. is there a way of fixing the network card without rebooting? I
have already tried ejecting and reinserting. doesn't work. Relevant syslogs are:

=====================================================================
Linux version 2.2.17 (root@) (gcc version 2.95.2 19991024 (release)) 
#3 Wed Sep 6 00:53:04 BST 2000

Linux PCMCIA Card Services 3.1.20
  kernel build: 2.2.17 #3 Wed Sep 6 00:53:04 BST 2000
  options:  [pci] [cardbus] [apm]
PCI routing table version 1.0 at 0xfdf60
  00:0a.0 -> irq 9
  00:0b.0 -> irq 9
Intel PCIC probe: 
  Ricoh RL5C478 rev 80 PCI-to-CardBus at slot 00:0a, mem 0x68000000
    host opts [0]: [isa irq] [io 3/6/1] [mem 3/6/1] [pci irq 9] [lat 168/176] [bus 
32/34]
    host opts [1]: [isa irq] [io 3/6/1] [mem 3/6/1] [pci irq 9] [lat 168/176] [bus 
35/37]
    ISA irqs (default) = 3,4,5,7,10,11,12 PCI status changes
cs: IO port probe 0x0c00-0x0cff: excluding 0xcf8-0xcff
cs: IO port probe 0x0800-0x08ff: clean.
cs: IO port probe 0x0100-0x04ff: excluding 0x140-0x147 0x4d0-0x4d7
cs: IO port probe 0x0a00-0x0aff: clean.
cs: cb_alloc(bus 35): vendor 0x10b7, device 0x5157
3c59x.c:v0.99Q 5/16/2000 Donald Becker, [EMAIL PROTECTED]
  http://www.scyld.com/network/vortex.html
cs: cb_config(bus 35)
  fn 0 bar 1: io 0x200-0x27f
  fn 0 bar 2: mem 0x60021000-0x6002107f
  fn 0 bar 3: mem 0x60020000-0x6002007f
  fn 0 rom: mem 0x60000000-0x6001ffff
  irq 9
cs: cb_enable(bus 35)
  bridge io map 0 (flags 0x21): 0x200-0x27f
  bridge mem map 0 (flags 0x1): 0x60000000-0x60021fff
vortex_attach(device 23:00.0)
eth0: 3Com 3CCFE575BT Cyclone CardBus at 0x200,  00:50:04:93:e5:a4, IRQ 9
  product code 'TW' rev 07.1 date 05-27-99
eth0: CardBus functions mapped 60020000->cc2ee000.
  8K byte-wide RAM 5:3 Rx:Tx split, MII interface.
  MII transceiver found at address 0, status 7809.
  Enabling bus-master transmits and whole-frame receives.
===================================================================== 


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

From: "Jack Cawkwell" <[EMAIL PROTECTED]>
Subject: Re: Infos about Brooktree BT86X
Date: Fri, 22 Sep 2000 16:41:41 +0100

Have you seen programs like xawtv (recent version is 3.10-1)
which works on many different cards.

I have used it on a MVdelta graphics card which I think has
a Brooktree chip. There is documentation in the code to use
the cards from your own C code (which I have also done).

Jack

Joachim Rosskopf <[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]...
Hello,

I search some futher information about the brooktree BT86X chipset
series. I try to develope some piece of code to run the TV Output on
several Graphic Cards. I think the bt chipset and the vga out are on a
I�C bus so the technologie is quite similar to the to tv tuner cards
which are already integrated into the kernel.

Thank you for help in advantage

Joachim



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


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