Linux-Development-Sys Digest #74, Volume #8      Fri, 11 Aug 00 05:13:20 EDT

Contents:
  Re: socket call in driver module (Grant Edwards)
  Re: Linux Thread FAQ (Mikko Rauhala)
  Re: Linux Thread FAQ (M Dipperstein)
  use of times facility (vercammen jan)
  Re: problems with printk (Nix)
  Re: What is the difference between soft link and hard link? (Nix)
  How to simulate ButtonPress with automatic grab?
  How to simulate ButtonPress with automatic grab?
  Re: PTHREAD_CREATE from Child Process (Jeffrey Hawkins)
  Kernel Upgrade Problems (Justo M. Casablanca)
  Re: What is the difference between soft link and hard link? (Lew Pitcher)
  Re: use of times facility (Andreas Jaeger)
  Re: What is the difference between soft link and hard link? (Kevin Lacquement)
  driver superblock problem ("[EMAIL PROTECTED]")
  linux streaming MP3 problem/question ("noNO")

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

From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: socket call in driver module
Date: Thu, 10 Aug 2000 16:30:12 GMT

In article <8msv7i$aht$[EMAIL PROTECTED]>, Sake wrote:

>> I asked this question several times, no answer so far. Here it
>> is again:
>>
>> I want to use the RAW socks to implement a transport protocol
>> that is slightly different from UDP. And I want to make it a
>> driver module instead of a user space appl/server.
>>
>> Question is: how do I call the socket functions from within a
>> driver module

>There are two possible reasons for no answers offered to this question:
>
>1) it's really a dumb question.

It's not a dumb question.  It is, however, a hard question to
answer.

>2) no body really knows except Linus who may be too busy to answer.

It can be done, but it's kind of complicated and fragile (with
respect to changes in the kernel and stack). I can point you to
a driver that does something similar to what you want to do:

     ftp://ftp.comtrol.com/VS1000/Drivers/Linux/1800010A.gz

The file vs1000.c is a driver module that impliments an
HDLC-like protocol using raw Ethernet packets.

-- 
Grant Edwards                   grante             Yow!  If I pull this SWITCH
                                  at               I'll be RITA HAYWORTH!! Or
                               visi.com            a SCIENTOLOGIST!

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

From: [EMAIL PROTECTED] (Mikko Rauhala)
Subject: Re: Linux Thread FAQ
Date: 10 Aug 2000 17:33:58 GMT
Reply-To: [EMAIL PROTECTED]

On Wed, 9 Aug 2000 05:57:17 -0700, M Dipperstein <[EMAIL PROTECTED]> wrote:
>I am fairly new to the world of Linux development and I have developed
>a many-to-many thread package for SMP Linux for a thesis project.

Hmm. No, I don't know any answers to your questions on FAQ's and such,
but I was just wondering if your package implements the POSIX thread API
or some API of your own?

-- 
Mikko Rauhala - [EMAIL PROTECTED] - http://www.iki.fi/mjr/

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

From: M Dipperstein <[EMAIL PROTECTED]>
Subject: Re: Linux Thread FAQ
Date: Thu, 10 Aug 2000 12:23:03 -0700


On 10 Aug 2000, Mikko Rauhala wrote:

> On Wed, 9 Aug 2000 05:57:17 -0700, M Dipperstein <[EMAIL PROTECTED]> wrote:
> >I am fairly new to the world of Linux development and I have developed
> >a many-to-many thread package for SMP Linux for a thesis project.
> 
> Hmm. No, I don't know any answers to your questions on FAQ's and such,
> but I was just wondering if your package implements the POSIX thread API
> or some API of your own?

The thread package uses it's own interface.  The POSIX API is pretty
large, this thread package is more of a proof of concept.  It doesn't
support all the primitives that POSIX does, and it supports others like
bound and unbound thread creation, which to the best of my knowledge isn't
addressed by POSIX.

I believe that the interface is simple enough for anyone used to the POSIX
API to be able to code to.  Some of my earlier test code is based on quick
hacks translating pthreads code.  The only thing to be aware of is that
user-level scheduling is cooperative.  If you have code that relies on
preemption to get things done, you will have to sprinkle a few well
thought out yields.

-Mike


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

From: vercammen jan <[EMAIL PROTECTED]>
Subject: use of times facility
Date: Thu, 10 Aug 2000 23:30:41 GMT

hello,

I am using times() to measure timing of my code. Before I used
clock(), which is ISO.

Unfortunately, times() is non-ISO. All timings reported by times are 
in clock ticks. However, CLK_TCK is not defined, at least it is commented
out in /usr/include/time.h.

I know that a clock tick equals 10ms on my PC and a simple divide by
100 will do to convert times() values to seconds. 

The question is: how do I write this in a more general way, such that,
if the clock tick value changes my code will still report the correct 
timings?

--
Posted via CNET Help.com
http://www.help.com/

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

From: Nix <$}xinix{[email protected]>
Subject: Re: problems with printk
Date: 10 Aug 2000 23:43:54 +0100

[quotes reordered, please quote properly]
"RM" <[EMAIL PROTECTED]> writes:

> Olivier Accili <[EMAIL PROTECTED]> wrote in message
> news:8mrgqo$[EMAIL PROTECTED]...
> > My code is:
> > printk("esp is: %lx    gs is: %lx    tss.esp0 is:
> > %ls\n",v_esp,v_gs,current->tss.esp0);
> 
> Check the optimization settings for GCC.  Some compilers (saw it with
> MSVC6.0, think I saw something that sounds the same under GCC) will
> "optimize" by keeping track of stack usage across multiple function calls,
> then perform a single cleanup call whenever appropriate (i.e. before a loop,
> within a loop, or before function end). This would explain the 12-bytes for
> your code (three 32-bit long ints).

Yes, GCC does do this. The option to turn it off is -fno-defer-pop; pop
deferral is turned on by -O. You probably do not want to do this as this
is a fairly significant optimization[1], especially if you have big
switch statements or something else that leads to big basic blocks.


[1] according to the primitive benchmarks I've performed

-- 
`I am of the belief that catnip arrived on the planet in the same spaceship
 that delivered cats. It is the only thing they have from their home
 planet. Tuna, chicken, sparrow-brains, etc., these are all things of our
 world that they like, but catnip is crack from home.' --- Bill Cole

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

From: Nix <$}xinix{[email protected]>
Subject: Re: What is the difference between soft link and hard link?
Date: 10 Aug 2000 23:46:47 +0100

Kevin Lacquement <[EMAIL PROTECTED]> writes:

> Mario Klebsch wrote:
> <SNIP>
> > 1st link is the directory (stored in its parent dir).
> > 2nd link is '.' stored in the directory
> > 3rd, 4tt, .. link is '..' stored in each child direcory.
> 
> Is this true for the root directory as well?  I don't see that
> it would have the first link you describe here.

No, but .. in / points to / (it is its own parent).

. and .. for / == 2.

-- 
`I am of the belief that catnip arrived on the planet in the same spaceship
 that delivered cats. It is the only thing they have from their home
 planet. Tuna, chicken, sparrow-brains, etc., these are all things of our
 world that they like, but catnip is crack from home.' --- Bill Cole

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

From: [EMAIL PROTECTED] ()
Subject: How to simulate ButtonPress with automatic grab?
Date: 11 Aug 2000 01:56:26 GMT

I tried to simulate ButtonPress by XSendEvent().
It almost work, but it has no "automatic grab".

How I can simulate a Real ButtonPress like
system's ButtonPress which has "automatic grab"?

Thanks a lot!

don ([EMAIL PROTECTED])



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

From: [EMAIL PROTECTED] ()
Subject: How to simulate ButtonPress with automatic grab?
Date: 11 Aug 2000 01:57:51 GMT

I tried to simulate ButtonPress by XSendEvent().
It almost work, but it has no "automatic grab".

How I can simulate a Real ButtonPress like
system's ButtonPress which has "automatic grab"?

Thanks a lot!

don ([EMAIL PROTECTED])

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

From: Jeffrey Hawkins <[EMAIL PROTECTED]>
Subject: Re: PTHREAD_CREATE from Child Process
Date: Thu, 10 Aug 2000 21:08:39 -0500

Well,

Through some investigation, and suggestions from this
List, and the LinuxPPC List, I solved my own problem.
Looking into the LinuxThreads Source Code, I found
that LinuxThreads replaces the "fork" functions with
Wrapper Functions.  Due to the fact that my LINK
Specification's Library Search Order had the LIBC 
Library (-lc) prior to the Threads Library (-lpthread),
the Standard LIB "fork" functions were being called.

The fix was to change my LINK Library Search Order to
have the Threads Library as the VERY FIRST LIBRARY..

Thanks for the help,
Jeff


Jeffrey Hawkins wrote:
> 
> Has anybody ran into a problem with trying to create
> a Thread from a Child Process ?  I am currently adapting
> a Software Package, that does this, from AIX to LinuxPPC.
> I am encountering a problem where the Thread is created,
> but the Pthread_Create Call never returns to the invoking
> Child Process.
> 
> If I remove the usage of the Child Process, and do the
> Pthread_Create from the Main Parent Process, everything
> works fine.  However, a lot of the Application Package
> Software relies on being able to create threads under
> Child Processes, so it would be a major effort to change
> the Application Software.
> 
> I am currently running a 2.1.3 version of the GLIBC,
> which has some other Threads Fixes, but nothing related
> to my problem...
> 
> Is this functionality supported on Linux Threads ?
> Is this problem related to the tracking of the Parent
> Process ID within Threads ?
> 
> Any help would be appreciated...
> 
> Jeff
> 
> --
> ********************************************************
> 
> Jeffrey Hawkins
> 
> Senior Staff Software Engineer
> Motorola Wireless Data Solutions Engineering
> 
> Address: DEPT:  DQ525
>          MS:    IL-02-1055A
>          1301 East Algonquin Road
>          Schaumburg, IL 60196
> 
> Phone:   (847)576-7463
> FAX:     (847)576-7737
> 
> ********************************************************

-- 
********************************************************
                                                      
Jeffrey Hawkins

Senior Staff Software Engineer
Motorola Wireless Data Solutions Engineering

Address: DEPT:  DQ525
         MS:    IL-02-1055A
         1301 East Algonquin Road
         Schaumburg, IL 60196

Phone:   (847)576-7463
FAX:     (847)576-7737

********************************************************

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

From: Justo M. Casablanca <[EMAIL PROTECTED]>
Subject: Kernel Upgrade Problems
Date: Fri, 11 Aug 2000 02:29:53 GMT

Hi all,

I have an RH 6.2 system that was installed via the RAWHIDE method (i.e
download from the web unto your HDD; then install from HDD). I am
trying to upgrade the kernel from version 2.2.14-100 to 2.2.16-3, as
per the instructions at the Red Hat site:

1. http://www.redhat.com/support/errata/RHSA-2000-037-05.html
2. http://www.redhat.com/support/docs/howto/kernel-upgrade/
   kernel-upgrade.html

<URL # 2 has a linebreak so it will fit on 80 columns>

Anyway, in section 2.1 of the how-to, I am instructed to execute the
following to verify the current kernel version on my system:

rpm -q kernel kernel-headers kernel-ibcs kernel-pcmcia-cs kernel-source
rpm -q mkinitrd SysVinit initscripts

However, rather than list the current kernel version, which I know to
be 2.2.14-100, rpm gives the following report:

package kernel is not installed
package kernel-headers is not installed
package kernel-ibcs is not installed
package kernel-pcmcia-cs is not installed
package kernel-source is not installed

package mkinitrd is not installed
package SysVinit is not installed
package initscripts is not installed

This is disturbing but then I figured, ah what the heck, go ahead and
install the newer kernel as per sections 3.2 and 3.3 of the how-to. This
is what I get:

# rpm -Uvh kernel-headers-2.2.16-3.i386.rpm            kernel-source-2.2.16-3.i386.rpm 
error: failed dependencies:
        /bin/sh   is needed by kernel-headers-2.2.16-3
        /bin/sh   is needed by kernel-source-2.2.16-3
        ld-linux.so.2 is needed by kernel-source-2.2.16-3
        libc.so.6 is needed by kernel-source-2.2.16-3
        libm.so.6 is needed by kernel-source-2.2.16-3
        /bin/sh is needed by kernel-source-2.2.16-3
        /usr/bin/perl is needed by kernel-source-2.2.16-3
        libc.so.6(GLIBC_2.0) is needed by kernel-source-2.2.16-3
        libc.so.6(GLIBC_2.1) is needed by kernel-source-2.2.16-3

# rpm -ivh kernel-2.2.16-3.i386.rpm            kernel-BOOT-2.2.16-3.i386.rpm           
 kernel-doc-2.2.16-3.i386.rpm            kernel-ibcs-2.2.16-3.i386.rpm            
kernel-pcmcia-cs-2.2.16-3.i386.rpm            kernel-utils-2.2.16-3.i386.rpm
error: failed dependencies:
        initscripts >= 3.64 is needed by kernel-2.2.16-3
        /bin/sh   is needed by kernel-2.2.16-3
        /bin/sh   is needed by kernel-BOOT-2.2.16-3
        /bin/sh is needed by kernel-BOOT-2.2.16-3
        /bin/sh is needed by kernel-ibcs-2.2.16-3
        /bin/sh   is needed by kernel-pcmcia-cs-2.2.16-3
        ld-linux.so.2 is needed by kernel-pcmcia-cs-2.2.16-3
        libc.so.6 is needed by kernel-pcmcia-cs-2.2.16-3
        /bin/sh is needed by kernel-pcmcia-cs-2.2.16-3
        libc.so.6(GLIBC_2.0) is needed by kernel-pcmcia-cs-2.2.16-3
        libc.so.6(GLIBC_2.1) is needed by kernel-pcmcia-cs-2.2.16-3
        ld-linux.so.2 is needed by kernel-utils-2.2.16-3
        libc.so.6 is needed by kernel-utils-2.2.16-3
        libc.so.6(GLIBC_2.0) is needed by kernel-utils-2.2.16-3
        libc.so.6(GLIBC_2.1) is needed by kernel-utils-2.2.16-3

Help please, I dare not go any further. I thought at first, maybe something
went wrong with the download and I have some corrupt rpm files. Well, the
kernel upgrade how-to says to verify the rpms in the following manner:

# rpm -K --nopgp *rpm
kernel-2.2.16-3.i386.rpm: md5 GPG NOT OK
kernel-2.2.16-3.i586.rpm: md5 GPG NOT OK
kernel-2.2.16-3.i686.rpm: md5 GPG NOT OK
kernel-BOOT-2.2.16-3.i386.rpm: md5 GPG NOT OK
kernel-doc-2.2.16-3.i386.rpm: md5 GPG NOT OK
kernel-headers-2.2.16-3.i386.rpm: md5 GPG NOT OK
kernel-ibcs-2.2.16-3.i386.rpm: md5 GPG NOT OK
kernel-pcmcia-cs-2.2.16-3.i386.rpm: md5 GPG NOT OK
kernel-source-2.2.16-3.i386.rpm: md5 GPG NOT OK
kernel-utils-2.2.16-3.i386.rpm: md5 GPG NOT OK

As you can see, the verification was not successful. However, in the
upgrade page for the newer kernel version (URL #1), the verification
command is as follows:

# rpm --checksig --nogpg *.rpm
kernel-2.2.16-3.i386.rpm: md5 OK
kernel-2.2.16-3.i586.rpm: md5 OK
kernel-2.2.16-3.i686.rpm: md5 OK
kernel-BOOT-2.2.16-3.i386.rpm: md5 OK
kernel-doc-2.2.16-3.i386.rpm: md5 OK
kernel-headers-2.2.16-3.i386.rpm: md5 OK
kernel-ibcs-2.2.16-3.i386.rpm: md5 OK
kernel-pcmcia-cs-2.2.16-3.i386.rpm: md5 OK
kernel-source-2.2.16-3.i386.rpm: md5 OK
kernel-utils-2.2.16-3.i386.rpm: md5 OK

...which, as you can see, says everything is OK.

So, at this point I am lost, and would seriously appreciate some help. This
is the 1st rpm update I have attempted on this system since the OS was
installed.

Thx in advance !

Justo M. Casablanca
[EMAIL PROTECTED]
[EMAIL PROTECTED]

--
Posted via CNET Help.com
http://www.help.com/

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

From: Lew Pitcher <[EMAIL PROTECTED]>
Subject: Re: What is the difference between soft link and hard link?
Date: Thu, 10 Aug 2000 20:07:36 -0400

Kevin Lacquement wrote:
> 
> Mario Klebsch wrote:
> <SNIP>
> > 1st link is the directory (stored in its parent dir).
> > 2nd link is '.' stored in the directory
> > 3rd, 4tt, .. link is '..' stored in each child direcory.
> 
> Is this true for the root directory as well?  I don't see that
> it would have the first link you describe here.

In the root directory, '.' has the inode of the root directory (as you
would expect), and '..' _also_ has the inode of the root directory.

-- 
Lew Pitcher

Master Codewright and JOAT-in-training

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

From: Andreas Jaeger <[EMAIL PROTECTED]>
Subject: Re: use of times facility
Date: 11 Aug 2000 08:17:14 +0200

>>>>> vercammen jan writes:

 > hello,
 > I am using times() to measure timing of my code. Before I used
 > clock(), which is ISO.

 > Unfortunately, times() is non-ISO. All timings reported by times are 
 > in clock ticks. However, CLK_TCK is not defined, at least it is commented
 > out in /usr/include/time.h.

It is defined.  Just compile with -D_POSIX_SOURCE.  Otherwise use
CLOCKS_PER_SEC.

Andreas
-- 
 Andreas Jaeger
  SuSE Labs [EMAIL PROTECTED]
   private [EMAIL PROTECTED]
    http://www.suse.de/~aj

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

From: Kevin Lacquement <[EMAIL PROTECTED]>
Subject: Re: What is the difference between soft link and hard link?
Date: Fri, 11 Aug 2000 08:12:25 GMT

Nix wrote:
> 
> No, but .. in / points to / (it is its own parent).
> 

Ahh...the Unix filesystem....where your sister's your cousin and your
father's....yourself.

Cheers,
Kevin

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

From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
Subject: driver superblock problem
Date: Fri, 11 Aug 2000 11:04:19 +0200
Reply-To: [EMAIL PROTECTED], [EMAIL PROTECTED]

Hi,

I an writing a device driver that is a fake raw hard drive.
ie you can mount it.
The driver is implemented as a kernal device driver module.

Formatting of the device works fine except i have to define a max block
number.

When i try to mount it , mount says bad super block.
get_super returns NULL.

Yet if i copy my device into a raw file and mount with loop back it
works.

Can anyone please help me,

Thanks
Richard.


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

From: "noNO" <[EMAIL PROTECTED]>
Crossposted-To: be.comp.programming,comp.os.linux.development.apps
Subject: linux streaming MP3 problem/question
Date: Fri, 11 Aug 2000 09:06:30 GMT

Hi,

In an effort to make a client/server pair for streaming MP3's over TCP/IP
(another one?!), I ran into a strange problem.

First, I've created a server and client that write and read one character at
a time. This worked fine, but was very slow. Next, I've adapted the server
software so that characters are first loaded in a string and then written to
the socket. This still worked fine with the 1 character read client. The
performance was better too, but still no good enhough.

When I tried to adapt the client to read more than one character a time, I
bumbed into the problem. Each time a file it streamed, it keeps changing in
size.  The size changes arbitrary between 20 and 200 bytes over the original
size, never under the original size.  When I play the file, many errors are
reported by the mp3 player (mpg123), but the player still manages to decode
to a somewhat recognisable song, but with many interruptions and a kind of
distortion.  So not only is the file (slightly) bigger as it should be, it
is also (slightly) transformed during the process of streaming (or reading).

This is the server write bit:

    if ( (fp = fopen( "/root/in", "r")) != NULL ) {
     while ( !feof(fp) ) {
      counter = 0;
      for ( i = 0; i < DATAGRAM_SIZE; i++ ) {
       if ( !feof(fp) ) {
        message[i] = getc(fp);
        counter++;
       }
      }
      write(slaveSocket,
       message,
       counter);
     }
     fclose(fp);
    } else {
     fprintf(stdout, "Error opening file\n");
    }

This is the client read bit:

 while ( 0 < (status = read(clientSocket,
  buffer, sizeof(buffer) - 1)))
 {
  for ( i = 0; i < (sizeof(buffer) - 1); i++ ) {
   putc( buffer[i], stdout );
  }
 }


The read-one-character-at-a-time client works fine with the above server
bit. The read bit looks like this:

  while ( 0 < (status = read(clientSocket,
   buffer, 1)))
  {
   cr = buffer[0];
   putc(cr, stdout);
  }

Any suggestions to fix this strange behavior are very welcome, or is this
one for the X-Files?

Thanks a lot

Steven Devijver
([EMAIL PROTECTED])
Please send replies via email too. thanks.





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


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