Linux-Development-Sys Digest #721, Volume #7     Fri, 31 Mar 00 06:13:13 EST

Contents:
  Re: 2.3.99: what's next step? (Johan Kullstam)
  Re: Starting Linux Kernel Programming (Pete Cavender)
  Getting IP address of self in C? (Pete Cavender)
  Re: Getting IP address of self in C? (H. Peter Anvin)
  Re: Getting IP address of self in C? (nilesh patel)
  Re: Getting IP address of self in C? (Kaz Kylheku)
  Re: wine ("D. Stimits")
  Re: Zero padding in sprintf() doesn't work for strings - HELP ! (John Brockmeyer)
  Re: LD_LIBRARY_PATH (Robin Becker)
  Re: LD_LIBRARY_PATH (Robin Becker)
  Re: Doing dead function elimination without -finline-functions in 2.95.2? (Graham 
Stoney)
  keyboard mapping ("Franck Yu")
  Re: Getting IP address of self in C? (David Schwartz)
  Re: Doing dead function elimination without -finline-functions in  (Etienne Lorrain)
  Re: ptrace and linux86 debug status register (Anand Krishnamoorthy)
  Re: insmod external names resolving problem ("Gennadiy M. Kurtsman")
  How to make a function memeber to be a sig. handler ("Boris Pran")
  Re: How to make a function memeber to be a sig. handler (Mathias Waack)
  Re: ptrace and linux86 debug status register (James Cownie)
  Re: Large File Support (Marc SCHAEFER)

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

Subject: Re: 2.3.99: what's next step?
From: Johan Kullstam <[EMAIL PROTECTED]>
Date: Fri, 31 Mar 2000 03:05:15 GMT

[EMAIL PROTECTED] (bill davidsen) writes:

> In article <[EMAIL PROTECTED]>,
> Aki M Laukkanen <[EMAIL PROTECTED]> wrote:
> 
> | Some of the patches got lost in the netfilter merge, big deal. I think they
> | are now in pre4-1. You should understand one thing about the development
> | kernels. Compilation is only tested/if at all with the configuration
> | Linus uses.
> 
>   There is a difference between alpha test, beta test and
> pre-production. At least in a real commercial software development
> shop, or a well run university environment.

yes

alpha = in house test by non developers
beta = outside testing by customers willing to suffer and report bugs

open source like linux doesn't really have in-house vs outside
boundaries.  furthermore, there is a devel stage before even getting
to alpha.  all this is more or less exposed to the world.  it makes
the distinction between alpha and beta basically non-existant.

in my book:

2.2.* are production
2.3.0-51 are devels -- they're not even alpha stage yet!
2.3.99 are alpha/beta

if we have 2.4.0preX then that would be pre-procductions.

>   Linux has perhaps the best development team around, but but they
> do code stuff without doing design first, and they not only don't do
> QA before letting out code, they rejected an offer to have a group
> do it when a new release was ready. I tried, not going to try again.

nod.  sometimes linux seems a little sloppy.  on the other hand, linux
has been rock solid for me these past three years.  go figure.
 
> Restructure Microsoft into two equal parts. Let one code with 1's
> and one code with 0's.

nice idea.  i like it.

-- 
J o h a n  K u l l s t a m
[[EMAIL PROTECTED]]
Don't Fear the Penguin!

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

From: [EMAIL PROTECTED] (Pete Cavender)
Subject: Re: Starting Linux Kernel Programming
Date: Fri, 31 Mar 2000 02:24:22 GMT

Buy the Rubini Book....it is worth every penny, getting to grok the driver
interface to the kernel....


Email me if you are curious,  I have written several drivers....

--Pete

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

From: [EMAIL PROTECTED] (Pete Cavender)
Subject: Getting IP address of self in C?
Date: Fri, 31 Mar 2000 01:27:56 GMT

Hi-

How can I get my IP address from C?  I used to use gethostid() but with
newer kernels that doesn't seem to work...I can run ifconfig and dig
through the text and look for it, bu there has to be a C way...  Thanks!

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

From: [EMAIL PROTECTED] (H. Peter Anvin)
Subject: Re: Getting IP address of self in C?
Date: 30 Mar 2000 20:06:05 -0800
Reply-To: [EMAIL PROTECTED] (H. Peter Anvin)

Followup to:  <[EMAIL PROTECTED]>
By author:    [EMAIL PROTECTED] (Pete Cavender)
In newsgroup: comp.os.linux.development.system
> 
> How can I get my IP address from C?  I used to use gethostid() but with
> newer kernels that doesn't seem to work...I can run ifconfig and dig
> through the text and look for it, bu there has to be a C way...  Thanks!
> 

*What* do you want?  You can go gethostname() and gethostbyname(), but
fundamentally you don't *have* an IP address -- each interface has
one.  If you want to determine if an address is local, a good way to
do so is to bind a datagram (UDP) socket -- which doesn't cause any
network traffic.  If the local address == remote address, then the
address is local.

        -hpa

-- 
<[EMAIL PROTECTED]> at work, <[EMAIL PROTECTED]> in private!
"Unix gives you enough rope to shoot yourself in the foot."

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

From: nilesh patel <[EMAIL PROTECTED]>
Subject: Re: Getting IP address of self in C?
Date: Fri, 31 Mar 2000 10:01:59 +0530

Pete Cavender wrote:

read
man 2 ioctl_list .
read ioctl options  SIOCIF* options.


Try this code . Not well written but will help you.

Nilesh

#include <sys/types.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <netinet/ether.h>
#include <net/ethernet.h>
#include <net/if_arp.h>

main ()
{

 struct ifreq *sif;
 struct ifreq  inside;
 struct ifconf fic;
 struct sockaddr_in s;
 char buf[4096];
 char hd[32];
 char *netname;
 struct ether_addr ethd;
 struct arpreq arq;

 int sd = socket (PF_INET,SOCK_STREAM,IPPROTO_TCP);

 fic.ifc_len = 4096;
 fic.ifc_buf = (caddr_t)buf;
 ioctl (sd,SIOCGIFCONF,(char *)&fic);
 sif = fic.ifc_ifcu.ifcu_req;
 printf ("Interface is %s\n",sif->ifr_ifrn.ifrn_name);
 memcpy (&inside,sif,sizeof (struct ifreq));
 ioctl (sd,SIOCGIFADDR,(char *)&inside);
 memcpy (&s,&inside.ifr_addr,sizeof (struct sockaddr_in));
 netname = inet_ntoa(s.sin_addr);
 printf ("%s\n",netname);

 sif++;
 printf ("Interface is %s\n",sif->ifr_ifrn.ifrn_name);

 memcpy (&inside,sif,sizeof (struct ifreq));

 ioctl (sd,SIOCGIFADDR,(char *)&inside);
 memcpy (&s,&inside.ifr_addr,sizeof (struct sockaddr_in));
 netname = inet_ntoa(s.sin_addr);
 printf ("%s\n",netname);

 ioctl (sd,SIOCGIFHWADDR,(char *)&inside);
 printf ("%s \n",&inside.ifr_ifru);
 memcpy (&ethd,&inside.ifr_hwaddr.sa_data,6);
 printf ("%s\n",ether_ntoa(&ethd));

 memset (&arq,0,sizeof(struct arpreq));
 s.sin_family = AF_INET;
 s.sin_addr.s_addr = inet_addr ("9.184.212.254");
 memcpy(&arq.arp_pa,&s,sizeof (struct sockaddr));
 memcpy (arq.arp_dev,"ether",sizeof("ether"));
 ioctl  (sd,SIOCGARP,&arq);

 memcpy (&ethd,&arq.arp_ha.sa_data,6);
 printf ("%s\n",ether_ntoa(&ethd));

 close (sd);
}


> Hi-
>
> How can I get my IP address from C?  I used to use gethostid() but with
> newer kernels that doesn't seem to work...I can run ifconfig and dig
> through the text and look for it, bu there has to be a C way...  Thanks!


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

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Getting IP address of self in C?
Reply-To: [EMAIL PROTECTED]
Date: Fri, 31 Mar 2000 04:22:53 GMT

On Fri, 31 Mar 2000 01:27:56 GMT, Pete Cavender <[EMAIL PROTECTED]> wrote:
>Hi-
>
>How can I get my IP address from C?  I used to use gethostid() but with
>newer kernels that doesn't seem to work...I can run ifconfig and dig
>through the text and look for it, bu there has to be a C way...  Thanks!

You might not be aware of this, but it's possible for a machine to have many IP
addresses. This is true even if it only has one network adapter, thanks to IP
aliasing. So you may have to rethink your problem.

For most networking applications, a program doesn't need to determine the IP
address of the local machine; it's almost always a bad idea to try to send a
local IP to a remote machine. These days more than ever, such addresses are
likely to be wrong, thanks to the spread of network address translating
firewalls.

-- 
#exclude <windows.h>

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

Date: Thu, 30 Mar 2000 22:02:15 -0700
From: "D. Stimits" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: Re: wine

"Jan J. Esser" wrote:
> 
> Needing an program simulating Windows under x-window system (Direct
> Sound, DirectX?)

Check vmware.
http://www.vmware.com

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

From: John Brockmeyer <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Zero padding in sprintf() doesn't work for strings - HELP !
Date: Thu, 30 Mar 2000 22:42:42 -0700

If someone were to check K&R, the font of all knowledge, they would see on P243
   0: for numeric conversions, specifies padding to the field width with leading
zeroes.

notice the words 'numeric conversions'. strings are not numeric.

Gerd Buesken wrote:

> Hi
>
> I have a problem using gcc 2.95 running on a 2.2.5-15 Red Hat linux.
>
> Regarding sprintf, the man pages say:
> 0 specifying zero padding.   For  all  conversions  except  n,  the
> converted  value  is padded on the left with  zeros  rather  than blanks.
> If  a  precision  is  given with a numeric conversion (d, i, o, u,  i,  x,
> and X), the 0 flag is ignored.
>
> My source looks like this:
>
> include <stdio.h>
>
> main()
> {
>  char buff[30];
>  char LenBuf[30];
>
>  strcpy(LenBuf,"1");
>  sprintf (buff,"%06s", LenBuf);
>  printf( "buffer=%s; Length %06d\n",buff, strlen(LenBuf) );
> }
>
> This is the Linux output:
> buffer=     1; Length 000001
>
> This is the HP-UX output:
> buffer=000001; Length 000001
>
> It seems as if the output on Linux is wrong(using Blanks instead of zeros).
>
> Does anybody has a solution other than rewriting the code ?
>
> Thanks
> Gerd




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

From: Robin Becker <[EMAIL PROTECTED]>
Subject: Re: LD_LIBRARY_PATH
Date: Thu, 30 Mar 2000 22:31:52 +0100

In article <[EMAIL PROTECTED]>, Kaz Kylheku
<[EMAIL PROTECTED]> writes
>On Thu, 30 Mar 2000 18:40:51 +0100, Robin Becker <[EMAIL PROTECTED]>
>wrote:
>>is there any way to find the default value of LD_LIBRARY_PATH? I'm
>>trying to port some software to a FreeBSD system.
>>-- 
>
>Environment variables don't have default values; perhaps you are looking
>for the default library search path? That would be in your /etc/ld.so.conf
>
yes you're right. That's what I would need. Are there major differences
between FreeBSD & Linux when it comes to building shared libraries?
-- 
Robin Becker

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

From: Robin Becker <[EMAIL PROTECTED]>
Subject: Re: LD_LIBRARY_PATH
Date: Fri, 31 Mar 2000 08:05:27 +0100

In article <[EMAIL PROTECTED]>, Paul Kimoto
<[EMAIL PROTECTED]> writes
>In article <[EMAIL PROTECTED]>, Pjtg0707 wrote:
>> On Thu, 30 Mar 2000 18:57:18 GMT, Kaz Kylheku <[EMAIL PROTECTED]> wrote:
>>> Environment variables don't have default values; perhaps you are looking
>>> for the default library search path? That would be in your /etc/ld.so.conf
>
>> Is there something similar for the include search path as well?
>
>[This is all off-topic for c.o.l.d.system.]
>
>The default is built in to the compiler.  Run
>$ gcc -v -S -o /dev/null -xc /dev/null
>to see it.
>
>By the way, LD_LIBRARY_PATH and /etc/ld.so.conf affect the dynamic linker
>(i.e., the runtime part), not ld(1) (the compile-time part).
>
thanks; expertise is where you find it :)
-- 
Robin Becker

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

From: Graham Stoney <[EMAIL PROTECTED]>
Crossposted-To: gnu.gcc.help
Subject: Re: Doing dead function elimination without -finline-functions in 2.95.2?
Date: 31 Mar 2000 08:14:05 GMT

In article <08KE4.914$[EMAIL PROTECTED]>,
Tim Prince <[EMAIL PROTECTED]> wrote:
>The old-fashioned unix way was to use the lorder and tsort scripts on the
>list of .o files.  Build a list of .o files for makefile this way, and
>strike those which refer only to themselves.

But I'm not trying to eliminate entire .o files; I'm just trying to eliminate
static functions in each .o which never get called.

Any other suggestions?

Thanks,
Graham

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

From: "Franck Yu" <[EMAIL PROTECTED]>
Subject: keyboard mapping
Date: Fri, 31 Mar 2000 17:12:43 +0100

I am having a problem with an Informix application running on RedHat Linux
V6.1. The program written in Informix 4GL is expected to convert each strike
of the key "." at keypad into an ",", because I use French locale for which
the numeric decimal separator is "," instead of ".". I put questions in
Informix newsgroups without right answers, finally I think to change the
keyboard mapping at the operating system level, but I don't know where I
should start, what I should do. I have to recompile some keyboard files,
right? Any idea is greatly appreciated!

Franck



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

From: David Schwartz <[EMAIL PROTECTED]>
Subject: Re: Getting IP address of self in C?
Date: Fri, 31 Mar 2000 00:17:06 -0800


Pete Cavender wrote:
> 
> Hi-
> 
> How can I get my IP address from C?  I used to use gethostid() but with
> newer kernels that doesn't seem to work...I can run ifconfig and dig
> through the text and look for it, bu there has to be a C way...  Thanks!

        It really depends why you want it. If you want it because you need to
tell it to somebody else over a network link, use 'getsockname' on that
link.

        DS

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

From: Etienne Lorrain <[EMAIL PROTECTED]>
Crossposted-To: gnu.gcc.help
Subject: Re: Doing dead function elimination without -finline-functions in 
Date: Fri, 31 Mar 2000 09:37:23 +0100

Graham Stoney wrote:
> But I'm not trying to eliminate entire .o files; I'm just trying to eliminate
> static functions in each .o which never get called.
> 
> Any other suggestions?

  Compile with GCC option -ffunction-sections, which put every functions
 in their own section, rewrite the linker description file to put all
 sections ".text.<functionname>" in the ".text" segment, and more important
 "ask to binutil" / "send them a patch" to accept the flag --gc-section
 for the i386 target and process it as it is documented (ld manual).

  That's all.

  Hope that helps,
  Etienne.

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

From: Anand Krishnamoorthy <[EMAIL PROTECTED]>
Subject: Re: ptrace and linux86 debug status register
Date: Fri, 31 Mar 2000 14:17:58 -0500


==============DCA5A985D6132CA4CCD9DBC5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit



I think it will be worth looking at the GDB code. It uses ptrace a lot..

Anand. K
([EMAIL PROTECTED])

[EMAIL PROTECTED] wrote:

> I am using ptrace to set hardware watchpoints on
> the x86 in linux.
>
> When a hardware watchpoint fires, a bit is set
> in the debug status register to flag this.  These
> registers are only available to level 0 processes,
> so you have to use the ptrace interface.
>
> I wrote a very simple debugger that, using ptrace,
> successfully sets any sort of hardware
> watchpoint/breakpoint
> and traps/faults in the coresponding situation
> under RH 5.x .
> Note: RH 5.x works.
>
> Under RH6.x and SuSE 6.2 the value of the status
> register
> (viewed using ptrace) does not change to report
> which breakpoint fired.  I am using the same code,
> in particular, the same calls to ptrace.  However
> when I set the value
> of the debug status register explicitly (using
> ptrace) it
> retains this value.  Note that the rest of my
> program
> works fine.  The hardware watchpoints fire as
> expected.
> Its just that the status register is not set.
>
> How does ptrace change from RH5.x to RH6.x in its
> handling of the debug status register.  Aret here
> any workarounds?
>
> It just seems that the internal representation of
> the debug
> status register is not connected to hardware.
>
> Thanks for your time,
>
> Pete.
> (Please CC me in your response)
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



==============DCA5A985D6132CA4CCD9DBC5
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
&nbsp;

<P>I think it will be worth looking at the GDB code. It uses ptrace a lot..

<P>Anand. K
<BR>([EMAIL PROTECTED])

<P><I>[EMAIL PROTECTED] wrote:</I>
<BLOCKQUOTE TYPE=CITE><I>I am using ptrace to set hardware watchpoints
on</I>
<BR><I>the x86 in linux.</I><I></I>

<P><I>When a hardware watchpoint fires, a bit is set</I>
<BR><I>in the debug status register to flag this.&nbsp; These</I>
<BR><I>registers are only available to level 0 processes,</I>
<BR><I>so you have to use the ptrace interface.</I><I></I>

<P><I>I wrote a very simple debugger that, using ptrace,</I>
<BR><I>successfully sets any sort of hardware</I>
<BR><I>watchpoint/breakpoint</I>
<BR><I>and traps/faults in the coresponding situation</I>
<BR><I>under RH 5.x .</I>
<BR><I>Note: RH 5.x works.</I><I></I>

<P><I>Under RH6.x and SuSE 6.2 the value of the status</I>
<BR><I>register</I>
<BR><I>(viewed using ptrace) does not change to report</I>
<BR><I>which breakpoint fired.&nbsp; I am using the same code,</I>
<BR><I>in particular, the same calls to ptrace.&nbsp; However</I>
<BR><I>when I set the value</I>
<BR><I>of the debug status register explicitly (using</I>
<BR><I>ptrace) it</I>
<BR><I>retains this value.&nbsp; Note that the rest of my</I>
<BR><I>program</I>
<BR><I>works fine.&nbsp; The hardware watchpoints fire as</I>
<BR><I>expected.</I>
<BR><I>Its just that the status register is not set.</I><I></I>

<P><I>How does ptrace change from RH5.x to RH6.x in its</I>
<BR><I>handling of the debug status register.&nbsp; Aret here</I>
<BR><I>any workarounds?</I><I></I>

<P><I>It just seems that the internal representation of</I>
<BR><I>the debug</I>
<BR><I>status register is not connected to hardware.</I><I></I>

<P><I>Thanks for your time,</I><I></I>

<P><I>Pete.</I>
<BR><I>(Please CC me in your response)</I><I></I>

<P><I>Sent via Deja.com <A HREF="http://www.deja.com/">http://www.deja.com/</A></I>
<BR><I>Before you buy.</I></BLOCKQUOTE>
<I>&nbsp;</I></HTML>

==============DCA5A985D6132CA4CCD9DBC5==


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

From: "Gennadiy M. Kurtsman" <[EMAIL PROTECTED]>
Subject: Re: insmod external names resolving problem
Date: Fri, 31 Mar 2000 13:42:57 +0400

Hello,
thanks a lot to everybody replying me. Exploring kernel export symbols table
I've discovered that is hasn't drivers' symbols at all. Probably it's source
of my problem. Is there a way to include this or that (or every) driver's
symbols in kernel export table?
Best regards,
GK




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

From: "Boris Pran" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: How to make a function memeber to be a sig. handler
Date: Fri, 31 Mar 2000 12:09:01 +0200

Here is my problem...
I was writing a simple program in C++ to talk to serial port and everything
was OK until I wanted to make a function member to be a signal handler for
SIGIO.
My signal handler was suppose to change data_arrival flag from false to
true - simple as that.

I installed signal handler with sigaction and I put in sgact.sa_handler = &
commport::get_data
Program compiles with the warning : converting void (commport::*)(int) to
void (*)(int) - if I do casting nothing changes...

If I start it everything seems OK until signal arrives when it does jump to
my sig. handler and when it tries to assess the flag it crashes with
Segmentation fault.

If I call the method from main() it does it's job and returns.
When I use an ordinary function as a signal handler everything works well.

WHERE DID I GO WRONG ?
I am a beginner in C++ and Linux programming so please have that in mind
when answering my question.

Thanks a lot.

Boris





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

From: Mathias Waack <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: How to make a function memeber to be a sig. handler
Date: Fri, 31 Mar 2000 12:26:05 +0200

Boris Pran wrote:
> I was writing a simple program in C++ to talk to serial port and everything
> was OK until I wanted to make a function member to be a signal handler for
> SIGIO.

A member function in C++ gets as the first (implizit) paramter an instance 
pointer. So you can't use it as a signal handler. You could use a static 
function, if you really need a member function. 

HTH
        Mathias

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

From: James Cownie <[EMAIL PROTECTED]>
Subject: Re: ptrace and linux86 debug status register
Date: Fri, 31 Mar 2000 10:57:15 GMT

It's a kernel bug in 2.2 series kernels.

There's a patch to 2.2.13 which should fix it at 

http://www.uwsg.indiana.edu/hypermail/linux/kernel/9912.1/0363.html

For some reason this patch hasn't (at least through 2.2.14)  made it
into a released kernel :-(

-- Jim 

James Cownie    <[EMAIL PROTECTED]>
Etnus, Inc.     +44 117 9071438
http://www.etnus.com

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

From: Marc SCHAEFER <[EMAIL PROTECTED]>
Crossposted-To: nwu.comp.unix.linux,comp.os.linux.misc
Subject: Re: Large File Support
Date: 31 Mar 2000 08:11:37 GMT

In comp.os.linux.development.system David E Allen <[EMAIL PROTECTED]> wrote:
: I am also interested in large file support. Actually, I don't need the support
: for ext2 itself, but for writing to a raw device (9Gb scsi disk). The open(2)
: and, more importantly, lseek(2) commands do not seem to support offsets
: larger than 31 bits (2Gb). Any ideas? Thanks.

llseek() exists, it allows to do very large seeks on raw devices. Now,
on the filesystem side, until 2.3.x you won't be able to do it, and you
also need a recent libc.

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


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