Linux-Development-Sys Digest #195, Volume #6     Thu, 31 Dec 98 17:14:19 EST

Contents:
  Re: Human based computers (Was   -   Fruit-based computers) ([EMAIL PROTECTED])
  Re: rewrittable CD ([EMAIL PROTECTED])
  Something Simple? ("ncc1701d")
  Re: net-tools-1.47 inet6.c incomplete type , won't compile (Dimitris Kontopodis)
  Re: LATESET-IS Symlink (fiReStaRteR)
  Re: Where is the bound port in TCP found? (Ayman El-Khashab)
  Re: Help: problems with 'w', 'who' and 'last' ([EMAIL PROTECTED])
  Re: Something Simple? (Andi Kleen)
  parport/ppa problem with 2.2.0pre1 (Allin Cottrell)
  Re: Something Simple? (Terry)
  Re: Santa's List (Warren Mann)
  Re: Linux rs232 communication ports (Ian T Zimmerman)
  Mapping to a Physical Address / And Cache Types (TERENCE MURPHY)
  Re: Something Simple? ("ncc1701d")

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

From: [EMAIL PROTECTED]
Crossposted-To: comp.os.linux.hardware,comp.os.linux.networking,bionet.plants
Subject: Re: Human based computers (Was   -   Fruit-based computers)
Date: Wed, 30 Dec 1998 07:49:04 +0100

Marc <[EMAIL PROTECTED]> wrote in comp.os.linux.development.system:
M> I think I saw somthing like this,,wasn't Homer Simpson the first recipient (PII)

So that's what the cpu cooler shaped stuff on his head is for. (-:


Reminds me of Pratchett, where silicon-brained trolls get more intelligent
as the temperature falls.

-- 
Olav "Mac" Wölfelschneider                         [EMAIL PROTECTED]
PGP fingerprint = 06 5F 66 B3  2A AD 7D 2D  B7 19 67 3C  95 A7 9D AF
Things which try to look like things often look more like things than things.

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

From: [EMAIL PROTECTED]
Subject: Re: rewrittable CD
Date: Wed, 30 Dec 1998 07:45:32 +0100

Philippe Le Foll <[EMAIL PROTECTED]> wrote:
PLF> I bought a rewrittable CD, I use it as normal and writtable CD
PLF> with Xcdroast, but I wonder how to use it as a rewrittable support.

So what? Put a blank cdrw in the drive. Write to it. Voila.

However, xcdroast can't erase, so you need a separate program. Just forgot
it's name, but it's mentioned somewhere in the latest xcdroast docs.

-- 
Olav "Mac" Wölfelschneider                         [EMAIL PROTECTED]
PGP fingerprint = 06 5F 66 B3  2A AD 7D 2D  B7 19 67 3C  95 A7 9D AF
Things which try to look like things often look more like things than things.

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

From: "ncc1701d" <[EMAIL PROTECTED]>
Subject: Something Simple?
Date: Thu, 31 Dec 1998 00:31:59 -0600

NNTP-Posting-Date: Wed, 30 Dec 1998 22:32:41 PDT

Hi Gurus....
I'm just getting started in programming for Linux(My goal? Help out the
Linux movement of course :)  Something that I was working on was a small
program that uses fstat to get file statistics on a file specified at the
command line.  However when I go to print out the information something is
wrong.  I'm using printf in the normal format (I think) to print out data to
the screen,

printf("screeninfo: %d\n",st.st_size);

if I use this command and specify each of the returned structure information
I don't have the problem.  But if I put in all the data in one big long
printf statement I start to get data that isn't correct.  I'm using the
following code for my printf statement in my program:

 printf("File Statistics:\n");
 printf("          Device: %d\n"
        "      Protection: %d\n"
        " Hard Link Count: %d\n"
        "      Owner's ID: %d\n"
        "      Group's ID: %d\n"
        "     Device Type: %d\n"
               "       File Size: %d\n"
             "FileSysBlocksize: %d\n"
        "Allocated blocks: %d\n"
        "Last Accessed on: %d\n"
        "Last Modified on: %d\n"
        " Last Changed on: %d\n"
"Inode:
%d\n",st.st_dev,st.st_mode,st.st_nlink,st.st_uid,st.st_gid,st.st_rdev,st.st_
size,st.st_blksize,st.st_blocks,st.st_atime,st.st_mtime,st.st_ctime,st.st_in
o);

The above statement is my actual command for printing the file information.
And I'm getting zeros in places that should be actual numbers.  The
following code is just another set of printf statements all of which return
the correct data:

 printf("%d\n",st.st_dev);
 printf("%d\n",st.st_ino);
 printf("%d\n",st.st_mode);

This works great.  The following fails though:

 printf("%d\n%d\n%d\n",st.st_dev,st.st_ino,st.st_mode);

I'm getting a zero in place of st.st_ino, and the actual data that should be
in st.st_mode is displaying the data that belongs to st.st_ino. Plus I never
see the data that should be in st.st_mode.  I'm sure that I have everything
specified correctly.  At the bottom of this message is the actual program
itself that I'm using to compile.  The program is basically a copy program
with statistics on the copy.  I have tried spaces after all of the commas.
My box is a P2 @ 266 with 128MB ram running a freshly installed version of
RedHat 5.2 and I have upgraded the kernel to 2.1.130.  If I'm doing
something that is completely incorrect please let me know like I said I'm a
beginner....

Thanks in advance,

Jason

Here is the actual code I'm compiling on my Linux box...

#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int argc, char *argv[])
{
    char block[8192];
    int in, out;
    int nread;
    int a;
    int stats=8192;
    int filestats;
    struct stat st;

    if(argc != 3) {
 if (argc == 1) printf("Only %d option detected\n",argc);
 else printf("Only %d options detected\n",argc);
 printf("Options detected as:\n");
 for(a=0; a < argc; a++){
     printf("%s\n",argv[a]);
 }
 return;
    }

    in = open(argv[1], O_RDONLY);

    if (fstat(in, &st) != -1) {
 printf("File Statistics:\n");
 printf("          Device: %d\n"
        "      Protection: %d\n"
        " Hard Link Count: %d\n"
        "      Owner's ID: %d\n"
        "      Group's ID: %d\n"
        "     Device Type: %d\n"
               "       File Size: %d\n"
             "FileSysBlocksize: %d\n"
        "Allocated blocks: %d\n"
        "Last Accessed on: %d\n"
        "Last Modified on: %d\n"
        " Last Changed on: %d\n"
        "           Inode:
%d\n",st.st_dev,st.st_mode,st.st_nlink,st.st_uid,st.st_gid,st.st_rdev,st.st_
size,st.st_blksize,st.st_blocks,st.st_atime,st.st_mtime,st.st_ctime,st.st_in
o);  <This Fails
 printf("%d\n", st.st_dev);
 printf("%d\n", st.st_ino);
 printf("%d\n", st.st_mode);  The above three lines work correctly
 printf("%d\n%d\n%d\n",st.st_dev, st.st_ino, st.st_mode);  Even this line
fails
 printf("\nCopy Progress\n");

        out = open(argv[2], O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR);

 while((nread = read(in,block,sizeof(block))) > 0) {
     write(out,block,nread);
     stats=stats+nread;
     printf("%i bytes copied so far",stats);
     printf("  --  %i bytes left to be copied",st.st_size-stats);
         printf("\r");
 }
    } else {
 printf("File Problem\n");
    }
    printf("\n");
    exit(0);
}





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

From: Dimitris Kontopodis <[EMAIL PROTECTED]>
Subject: Re: net-tools-1.47 inet6.c incomplete type , won't compile
Date: Tue, 29 Dec 1998 16:56:00 +0200

Sami Tikka wrote:

> This is what I did:
>
> I got the latest glibc (2.0.100 or something), compiled & installed that.
> Oh, by the way, to do that I had to upgrade my compiler to egcs
> something...
>
> Then I edited the net-tools makefile so that it no longer takes the
> include files from net-toosl's own include dir but uses the includes from
> /usr/include. In the later glibc include files there is the necessary IPv6
> support already. Apparently the net-tools just doesn't know that yet.Sami
> Tikka, [EMAIL PROTECTED], http://www.iki.fi/sti/

How did you do that?
I have installed glibc 2.0.106 on a 2.1.130 kernel (with all the necessary
packets like egcs, binutils, etc) but I still cant compile net-tools :lots of
"undefined reference to..." errors like:
 gcc -Llib -o ifconfig ifconfig.o interface.o sockets.o -lnet-tools
-L/usr/local/lib
/usr/local/lib/libc.so.6: undefined reference to
`_dl_sysdep_start@@GLIBC_2.0'
/usr/local/lib/libc.so.6: undefined reference to `_r_debug@@GLIBC_2.0'
/usr/local/lib/libc.so.6: undefined reference to `_dl_starting_up@@GLIBC_2.0'

...

Any hints?
thanks
Dimitris
[EMAIL PROTECTED]


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

From: [EMAIL PROTECTED] (fiReStaRteR)
Subject: Re: LATESET-IS Symlink
Date: 31 Dec 98 18:20:49 GMT
Reply-To: [EMAIL PROTECTED]

On Wed, 23 Dec 1998 21:05:11 -0500, Ross Vandegrift <[EMAIL PROTECTED]>
wrote:
>This doesn't really pertain to kernel development specifically, but I
>guess this group would be the most pertinant.  Why isn't the LATEST-IS-*
>file made a symlink to the latest patch?  Is there any reason not to? 
>Not having to download the whole file list would certainly get me to the
>file I really need, since (and I'm sure this is common to many) the file
>I'm interested in is the latest patch.  I can't really think of how this
>would have any detrimental effect on people who *aren't* after the
>latest patch.  So, anyone?
>
>
>--
>Ross Vandegrift | Eric J. Fenderson
>
>alt.binaries.punk: for those of us too
>       punk to pay money for the music.

Well, Well, Well,
IMHO, that's because people who use that symlink haven't yet downloaded
the latest patchlevel (so they don't know the #).
But it could effectly be a good idea to make symlinks like
LATEST & LATEST-PATCH

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

Subject: Re: Where is the bound port in TCP found?
From: Ayman El-Khashab <[EMAIL PROTECTED]>
Date: 31 Dec 1998 06:42:16 -0600

Richard Jones <[EMAIL PROTECTED]> writes:

<snip>
> The client sends an initial SYN packet which contains
> (amongst other things):
> 
>       destination address     (server address)
>       destination port        (eg. 23)
>       source address          (client address)
>       source port             (eg. 1045)
>       protocol number         (TCP is 6)
> 
> So all the info you need is in that first packet and
> every subsequent packet (the information about

actually, the first syn packet is where i get most of my information.
The only piece i can't get from the initial syn (or at least I don't
see how it is possible) is the bound port that the connection commences
on on the servers side.  So the server typically does a bind (so for
telnet 23) and then an accept which I think gives back a new sock 
structure in the kernel.  And associated with the accept is the port
number that the connection continues on.  (my best from the top of my
head recollection of what happens).

Since the accept is performed by the server, it is not clear how I can
get that port number from the initial syn.  I do see how i could get it
from every IP packet, but I am examining things at the tcp layer.

so the question is how to find what port it is from the data in either
the tcp header . . . or from any of the functions such as tcp_rcv, etc.

At the moment all i seem to find is the telnet port number in the dest
of the tcp header in each received packet.  I am guessing it is elsewhere
in the structures and I am just missing it.

thanks
- ayman


-- 
======================================================================
Ayman El-Khashab <[EMAIL PROTECTED]>     PGP key available from
The University of Texas at Austin               keyserver or by finger
  Key Fingerprint: 42 D3 22 E6 D1 73 45 09 DA AE 60 DE 24 CB 71 18 
======================================================================

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

Crossposted-To: comp.os.linux.setup
From: [EMAIL PROTECTED]
Subject: Re: Help: problems with 'w', 'who' and 'last'
Reply-To: [EMAIL PROTECTED]
Date: Thu, 31 Dec 1998 12:59:58 GMT

In comp.os.linux.development.system Ted Sariyski <[EMAIL PROTECTED]> wrote:
> w and who give only the top line and empty body:
> fixed the problem, but after a couple of minutes the problem
> appeared again. It seems that there is a reference data set

There was a change in the structure of these files a while back.
It's possible some programs that write to these files are using
the old format and thus corrupting them.
Do you have any old (libc5) binaries around etc ?

-- 
Jason.

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

From: [EMAIL PROTECTED] (Andi Kleen)
Subject: Re: Something Simple?
Date: 31 Dec 1998 13:11:00 GMT

In article <dUEi2.499$[EMAIL PROTECTED]>, ncc1701d wrote:
> printf("File Statistics:\n");
> printf("          Device: %d\n"
>        "      Protection: %d\n"
>        " Hard Link Count: %d\n"
>        "      Owner's ID: %d\n"
>        "      Group's ID: %d\n"
>        "     Device Type: %d\n"
>               "       File Size: %d\n"
>             "FileSysBlocksize: %d\n"
>        "Allocated blocks: %d\n"
>        "Last Accessed on: %d\n"
>        "Last Modified on: %d\n"
>        " Last Changed on: %d\n"
>"Inode:
>%d\n",st.st_dev,st.st_mode,st.st_nlink,st.st_uid,st.st_gid,st.st_rdev,st.st_
>size,st.st_blksize,st.st_blocks,st.st_atime,st.st_mtime,st.st_ctime,st.st_in
>o);

Compile with -Wall and the compiler will tell you.

-Andi

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

From: Allin Cottrell <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.misc,comp.os.linux.hardware
Subject: parport/ppa problem with 2.2.0pre1
Date: Thu, 31 Dec 1998 09:52:18 -0500

I have been using a parallel-port zipdrive with kernel 2.0.36
with no problem.  Now I'm trying to use it with 2.2.0-pre1,
using parport to get access to both the zipdrive and the printer.
The printer is working (after shifting it from lp1 to lp0, in
printcap), but the zipdrive is not.

1. Install parport_pc module -
  pc10 kernel: parport0: PC-style at 0x378, irq 7 [SPP,PS2]

2. But then -
  pc10 automount[88]: attempting to mount entry /mnt/zip
  pc10 automount[1277]: do_mount /dev/sda4 /mnt/zip type msdos
     options (null) using module generic
  pc10 automount[1277]: >> mount: the kernel does not recognize
     /dev/sda4 as a block device

3. I notice the ppa module is not loaded, and try loading it 
  manually -
  pc10 kernel: ppa: Found device at ID 6,
     Attempting to use EPP 32 bit
  pc10 kernel: ppa: Found device at ID 6,
     Attempting to use PS/2
  pc10 kernel: ppa: Unable to establish communication,
     aborting driver load.
  pc10 kernel: scsi : 0 hosts. 

TIA for any suggestions.

-- 
Allin Cottrell
Department of Economics
Wake Forest University, NC

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

From: Terry <[EMAIL PROTECTED]>
Subject: Re: Something Simple?
Date: Thu, 31 Dec 1998 09:41:32 -0500

ncc1701d wrote:
> 
[snip]
> following code for my printf statement in my program:
> 
>  printf("File Statistics:\n");
>  printf("          Device: %d\n"
>         "      Protection: %d\n"
>         " Hard Link Count: %d\n"
>         "      Owner's ID: %d\n"
>         "      Group's ID: %d\n"
>         "     Device Type: %d\n"
>                "       File Size: %d\n"
>              "FileSysBlocksize: %d\n"
>         "Allocated blocks: %d\n"
>         "Last Accessed on: %d\n"
>         "Last Modified on: %d\n"
>         " Last Changed on: %d\n"
> "Inode:
> %d\n",st.st_dev,st.st_mode,st.st_nlink,st.st_uid,st.st_gid,st.st_rdev,st.st_
> size,st.st_blksize,st.st_blocks,st.st_atime,st.st_mtime,st.st_ctime,st.st_in
> o);
> 
> The above statement is my actual command for printing the file information.
> And I'm getting zeros in places that should be actual numbers.  The
> following code is just another set of printf statements all of which return
> the correct data:
> 
>  printf("%d\n",st.st_dev);
>  printf("%d\n",st.st_ino);
>  printf("%d\n",st.st_mode);
> 
> This works great.  The following fails though:
> 
>  printf("%d\n%d\n%d\n",st.st_dev,st.st_ino,st.st_mode);
> 
> I'm getting a zero in place of st.st_ino, and the actual data that should be
> in st.st_mode is displaying the data that belongs to st.st_ino. Plus I never
> see the data that should be in st.st_mode.  I'm sure that I have everything
> specified correctly.  At the bottom of this message is the actual program
> itself that I'm using to compile.  The program is basically a copy program
> with statistics on the copy.  I have tried spaces after all of the commas.

Sounds like the type for "st.st_dev","st.st_ino", etc is NOT integer
(more precisely, not the same size of integer).  Therefore you cannot
use "%d" in the printf statement.  I haven't looked at the
structure but some of its' members may be SHORT or LONG LONG.
The reason it's ok when printed separately is that only the first
four bytes (assuming 4 bytes for size of integer) is converted.

If you change the printf statement to:
   printf("%d\n%d\n%d\n",(int)st.st_dev, (int)st.st_ino,
         (int)st.st_mode);

It will (probably) work.

You could dig around in the include files to find out the true
size and then use the correct printf conversion specifier.

Hope this helps.


Terry

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

From: Warren Mann <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Crossposted-To: 
comp.os.linux.advocacy,comp.os.linux.development,comp.os.linux.development.apps
Subject: Re: Santa's List
Date: Thu, 31 Dec 1998 11:44:24 -0600

My vote:  Fractal Design Poser and some way to use my Rainbow Runner under Linux.
That would allow me to completely rid myself of Gatesware once and for all.



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

From: Ian T Zimmerman <[EMAIL PROTECTED]>
Subject: Re: Linux rs232 communication ports
Date: 31 Dec 1998 10:57:10 -0800

> From: Kurt Harders <[EMAIL PROTECTED]>
> Newsgroups: comp.os.linux.development.system
> Date: Wed, 30 Dec 1998 07:36:55 +0100
> 
> Hallo John,
>  John Whitt wrote:
> >  Does anyone know where I can find some example "C" code for
> > opening a serial port under Linux and and reading and writing to
> > the port?
>  If the Interface is setup correctly (speed, parity...):
>  fp = fopen("/dev/ttyS0", "a+"); fread(....); fwrite(....);
> fclose(...);
>  Thats it.

Hmmm I'd hate to revive some ancient flame wars .. but ..
this will hang forever.

Alternatives:

If you don't mind using an obsolete device:

fp = fopen("/dev/cua0", "a+"); fread(....); fwrite(....);
fclose(...);

If you don't mind using open(2):

fd = open("/dev/ttyS0", O_RDWR|O_NONBLOCK, 0666); fp = fdopen(fd, "a+");

If you don't mind installing uucp just to have cu(1) available:

int inpipe[2];
int outpipe[2];
int pid;
char *argv[] = { "cu", MY_REMOTE_SYSTEM, 0 };

pipe(&inpipe); pipe(&outpipe); 
switch(pid=fork()) {

        case 0: /* child */

        close(inpipe[1]); close(outpipe[0]);
        dup2(inpipe[0], STDIN_FILENO);
        dup2(outpipe[1], STDOUT_FILENO);
        _exit(execv("/usr/bin/cu", argv));

        default: /* parent

        close(inpipe[0]); close(outpipe[1]);
        /* now use inpipe[1] to write to the device, outpipe[0] to
        read from it */
}

-- 
Ian T Zimmerman                        <[EMAIL PROTECTED]>
I came to the conclusion that what was wrong about the guillotine
was that the condemned man had no chance at all, absolutely none.
Albert Camus, _The Outsider_

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

From: [EMAIL PROTECTED] (TERENCE MURPHY)
Subject: Mapping to a Physical Address / And Cache Types
Date: 31 Dec 1998 21:01:31 GMT

Hi,

I would like to know how to allocate a block of physical memory at a
specific physical address.  I have used MMAP() in Neutrino (QNX) and it
has a MAP_PHYS flag which indicates to allocate the space at the physical
address given as the first parameter to MMAP().  Does Linux MMAP() have
such a parameter?  There is MAP_FIXED but it seems that this uses the
linear and not physical address. 

I know about /dev/mem, but my problem with this is that it will give
me the physical space regardless of whether or not it is used by somebody
else.  I need a physical address in regular address space, not for a 
memory mapped device, so it is important that my request fail if somebody
else is using that physical address.

Also, I was wondering if Linux had any good support for using different
cache types, for example, if I want a region of memory to be writeback,
a region to be uncached, one to be write through, etc.  If there is a 
MMAP() parameter for this, that would be fantastic, or do I just have
to program the MTRR's myself for this?

Any suggestions for this would be appreciated.  Please no flames: 
I need the physical address and cache types for a very specific,
inherently non-portable testing program.

-- Terry


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

From: "ncc1701d" <[EMAIL PROTECTED]>
Subject: Re: Something Simple?
Date: Thu, 31 Dec 1998 15:11:38 -0600

NNTP-Posting-Date: Thu, 31 Dec 1998 13:12:21 PDT

Thanks for all the postings guys.  You have helped me out considerably.  Now
I just have to figure out how to use the printf command to print out a
"Special" type variable.  The ST_RDEV variable for instance I believe is
defined as a long long, looked at the include files features.h and
statbuf.h.  The st_ctime, st_mtime, and st_atime are also defined as special
types in the include files.  Do I have to do something special to specify a
type conversion in printf if the variable is an object of a structure?  Did
I even ask that right?

Thanks in advance....

Jason



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


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