Linux-Development-Sys Digest #321, Volume #8      Mon, 4 Dec 00 11:13:12 EST

Contents:
  Re: Need library reference (Kaelin Colclasure)
  Re: Global constructors in ELF so libs NOT CALLED! (Erik Westlin)
  Re: DLL's etc (Michel Bardiaux)
  Re: Need help understanding /proc/pid/stat file (Nix)
  scsi detection ? (Nilesh Patel)
  Re: A challenging problem... (Frode Vatvedt Fjeld)
  help : assembler & linux kernel (vallee geoffroy)
  Re: scsi detection ? (Josef Moellers)
  Re: CIFS.. (Lew Pitcher)
  Re: Module Compilation Problems ("Peter T. Breuer")
  Re: Autoconfiscating a loadable module ("Peter T. Breuer")
  Re: Need library reference (Gerson Kurz)
  Please help: NT to Linux port ("Carlos Portela")
  Re: Kernel modules and Daemons - architecture question (Erik Hensema)
  Re: Global constructors in ELF so libs NOT CALLED! ("John C. Griggs")
  Re: mtio.h -- pass blocksize to tape dev ??? ([EMAIL PROTECTED])

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

From: Kaelin Colclasure <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Need library reference
Date: 04 Dec 2000 00:27:31 -0800

[EMAIL PROTECTED] (Mark Healey) writes:

[...]
> I don't think I was clear.  I really need a library reference that I
> can browse.  For instance:  I'd like to look at all the functions that
> have to do with environmental variables or all the functions that deal
> with strings.

"The GNU C Library Reference Manual" (2 volumes)
ISBN 1-882114-54-X

[...]
> > > Also, is there a IDE type front end for GCC?
> >
> > Try kdevelop.
> 
> Krap, I didn't install it.  Is there anything for Gnome?

AFAIK there is no IDE for Linux anywhere near the caliber of those
available for Windows.

My advice: take the time to really learn Emacs.

IDE stands for Infernally Dumb Editor.

-- Kaelin

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

From: Erik Westlin <[EMAIL PROTECTED]>
Subject: Re: Global constructors in ELF so libs NOT CALLED!
Date: Mon, 04 Dec 2000 09:57:21 +0100
Reply-To: [EMAIL PROTECTED]

John C. Griggs wrote:
> 
> >>> Insulting description of basics of Object Oriented Programming SNIPPED <<<

I'm sorry if you feel insulted, if i was a bit sarcastic it was due to
that other
answer i got.

Yes i do just link with the so-lib.
Yes i do use -fPIC.
It's great that i'm wrong so there is hope anyway.
I not sure why you say "static objects" but they are not declared static
or
whith any other special attribute.
The build command is ld -shared -o$(OUTFILE) $(OBJS) $(LIBS).

I see now that ld has a warning -warn-global-constructors which bye the
way
doesn't work for ELF anyway according to the man page. I just wonder why
ld thinks it could be important to warn about them.

> Instead of trying to teach us all the basics of Object Oriented
> programming (which you don't seem to have that firm a grasp of anyway),

That wasn't my intention at all and you know it. I have been doing OO
for nearly 20 years. Not for it's own sake though.

I have already solved the problem by rewriting the program. And yes
i would like to learn something, thats why i ask questions.
 
 Regards,
         Erik Westlin

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

From: Michel Bardiaux <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: DLL's etc
Date: Mon, 04 Dec 2000 10:21:06 GMT

"D. Stimits" wrote:
> 
> Rajagopalan Srinivasan wrote:
> >
> > folks,
> >
> > I am looking for some reference on the API for performing operations like :
> >
> > -  what dynamic libraries any process is mapped to
> > -  given an executable what dynamic libraries are required to run the exec
> > -  any version info wrt the dynamic library etc
> > -  also the symbol table (debugging info) inside the exec etc.
> >
> > Can someone please point me in the right direction?
> >
> > regards
> >
> > srini
> 
> You can find out who is using a file with lsof <full path of filename>.
> You can see what an executable wants (not shell scripts though) via ldd
> <full path to file of executable>.
> You can print the system's current idea of library versions available
> with ldconfig -p.
> You can view the symbols in a given lib file with nm.
> If you need to demangle C++ symbols in a C++ lib, you can use c++filt as
> the pipe destination of nm.

The OP wrote *API*. This means a library and header files.

> You will find kernel-related symbols in your System.map file (location
> varies, usually /proc/).

There is no reliable way to verify that a particular System.map truly
corresponds to the current kernel.

> For your own special dynamic loading, outside of the normal linker path
> of your system, see dlopen() and family.


-- 
Michel Bardiaux

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

From: Nix <$}xinix{[email protected]>
Subject: Re: Need help understanding /proc/pid/stat file
Date: 04 Dec 2000 07:33:44 +0000

[EMAIL PROTECTED] writes:

> The man page doesn't correspond numerically to what I see. Or I am
> misunderstanding. Here's a cat that shows 39 items, more than the man
> page for proc appears to describe:
> 
> 1 (init) S 0 0 0 0 -1 256 72 80556 491 197030 0 41 1531 693 0 0 0 0 29
> 1089536 19 2147483647
> 134512640 134540936 3221225232 3221223172 1074494590 0 0 1475401980
> 671819267 3222354922
> 13 1857 0 0
> 
> I'm trying to understand which among these corresponds to cmajflt. Is
> there any documentation that describes this exactly?

The big sprintf() in /usr/src/linux-*/fs/proc/array.c:get_stat().

cmaj_flt is the thirteenth entry. 197030 for the process you list.

-- 
`My head goes prong off his prose.' --- Rebecca Ore

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

From: Nilesh Patel <[EMAIL PROTECTED]>
Subject: scsi detection ?
Date: Tue, 05 Dec 2000 04:16:54 +0530

I have machine with SCSI disk and IDE disk both.
There is no filesystem on SCSI.
Linux installed on IDE.
How do I know that Linux has detected SCSI and how many are there ?

cat /proc/scsi/scsi    gives

Attached devices:
Host: scsi0 Channel:  00 Id: 00 Lun: 00
    Vendor:        Model:        Rev:
    Type:    <NULL>            ANSI SCSI Revision: ffffffff


Nilesh


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

From: Frode Vatvedt Fjeld <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.lisp
Subject: Re: A challenging problem...
Date: 04 Dec 2000 13:14:10 +0100

Kaelin Colclasure <[EMAIL PROTECTED]> writes:

> [...] My problem lies in how to implement dynamic probe
> support. Solaris' prex has the equivalent of this feature, but only
> for C programs. I suspect prex implements it by scanning the ELF
> executable files for certain signature data associated with each
> embedded probe.

You might want to look at the Paradyn research project. They're
basically dealing with exactly these issues, and have even implemented
dynamic instrumentation of OS kernels. <URL:http://www.cs.wisc.edu/~paradyn/>

I have written some code (in common lisp) for attaching to processes
and allocating buffers inside them, and like you say, it's not really
rocket science.

> Less byzantine suggestions (that still meet the constraints) are
> welcome. :-)

While hack'n slash approaches like machine-code modification via
ptrace/procfs come naturally in a C world, I'm not so sure they are
appropriate for dynamic languages like lisp. I think it'd be smarter
to have the lisp runtime system much more involved in the
instrumentation and tracing process. But this suggestion doesn't
exactly solve your problem..

-- 
Frode Vatvedt Fjeld

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

From: vallee geoffroy <[EMAIL PROTECTED]>
Subject: help : assembler & linux kernel
Date: Mon, 04 Dec 2000 13:21:35 +0100
Reply-To: [EMAIL PROTECTED]

Hello,

I have a problem with an assembler code of the Linux kernel.
I don't understand the instruction .previous
Someone can help me?

thanks.
GV


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

From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: scsi detection ?
Date: Mon, 04 Dec 2000 14:12:30 +0100

Nilesh Patel wrote:
> =

> I have machine with SCSI disk and IDE disk both.
> There is no filesystem on SCSI.
> Linux installed on IDE.
> How do I know that Linux has detected SCSI and how many are there ?
> =

> cat /proc/scsi/scsi    gives
> =

> Attached devices:
> Host: scsi0 Channel:  00 Id: 00 Lun: 00
>     Vendor:        Model:        Rev:
>     Type:    <NULL>            ANSI SCSI Revision: ffffffff

This shows that the SCSI driver has detected "There is something out
there" on the first SCSI hostadapter, SCSI ID 0. Upon asking "Who's
there?", nobody answered.

You should check your cabling and termination.

Also, if possible, boot into a character console, wait until the login
prompt appears and use SHIFT-PageUp to scoll back. Try to find the place
where the SCSI hostadapter driver is loaded and see what error messages
are shown. You can also look into /var/log/messages.

What SCSI hostadapter are you using?

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
        If failure had no penalty success would not be a prize (T.  Pratchett)

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

From: [EMAIL PROTECTED] (Lew Pitcher)
Subject: Re: CIFS..
Reply-To: [EMAIL PROTECTED]
Date: Mon, 04 Dec 2000 13:15:45 GMT

On 4 Dec 2000 05:00:23 GMT, [EMAIL PROTECTED] (Volker
Kuhlmann) wrote:

>In article <[EMAIL PROTECTED]>,
>       [EMAIL PROTECTED] (Lew Pitcher) writes:
>
>>>The linux smbfs seems to work now, but the dates and times it displays
>>>for files are completely shot (the linux fat fs is buggy too - where do
>>>I report this to?). 
>> 
>> It could be your setup rather than smbfs and msdos support. If you
>> don't have timezones and your clock properly configured, the MSDOS
>> file dates look screwy.
>
>I don't think there's any linux distribution these days which does not
>set up the timezone. What specifically can be done wrong there?

<g> Some distros have (at times) not properly supported timezone setup
(IIRC, it _was_ a problem with RH, also there is a reported bug in
Slackware 7.1's setup where it terminates before setting up the
timezone info.)

My real concern was the likelyhood that
a) your timezone does not match your CMOS clock setup, and/or
b) your startup scripts do not proprely set system time from CMOS
   (i.e. set system time assuming CMOS is local time, but CMOS is UTC)
These have been known to foul up the time values on files.

>My /etc/localtime is a copy of /usr/share/zoneinfo/NZ. Environment
>variable TZ is unset. My fat fs is compiled into the kernel. Is that
>not enough?

Should be enough, but I'm not an expert (and I don't even play one on
TV) <g>.

>It is a very common bug to
>1) subtract rather than add time zone offsets (e.g. mkisofs, isofs)
>2) Assume time zone offsets are identical for each file on the file system
>(e.g. mkisofs, sharity <= 2.3)
>
>On top of at least one of those, the minutes are stuffed with fat fs in
>some cases.
>
>Volker
>
>--
>Volker Kuhlmann  ([EMAIL PROTECTED])


Lew Pitcher
Information Technology Consultant
Toronto Dominion Bank Financial Group

([EMAIL PROTECTED])


(Opinions expressed are my own, not my employer's.)

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

From: "Peter T. Breuer" <[EMAIL PROTECTED]>
Subject: Re: Module Compilation Problems
Date: Mon, 4 Dec 2000 15:32:34 +0100

Paul Kimoto <[EMAIL PROTECTED]> wrote:
> In article <[EMAIL PROTECTED]>, Peter T. Breuer wrote:
>>[EMAIL PROTECTED] wrote:
>> So I say "no". There was nothing wrong with putting in links to the
>> kernel sources for all these years.

> Isn't this the reason for the /lib/modules/$(uname -r)/build symlink in
> 2.4.*?

Don't think so .. sounds like runtime stuff to me. But then I'm on 2.4.0t1.

>> But apparently the problems caused for people who now can't compile
>> their third party modules aren't? Yet another instance of "if you're on
>> redhat, you can't compile"? No thank you. Gimme the symlink.

> Or Debian.

Agreed. I just had to undo debians change when I did a dist-upgrade.

> $ zcat /usr/share/doc/libc6/README.Debian.gz
> Q1: Why does the Debian libc6-dev package create /usr/include/linux and 
> /usr/include/asm directories containing header files from a specific 
> kernel, instead of using the "established" convention of making those 
> directories into symlinks pointing to the currently installed kernel?

> A1: Occasionally, changes in the kernel headers cause problems with
> the compilation of libc and of programs that use libc.  To ensure that

Surprise. That's because the libc headers have to include them, so both
kernel and libc people have to be careful not to break each others assumptions.

> users are not affected by these problems, we configure libc to use the
> headers from a kernel that is known to work with libc and the programs
> that depend on stable kernel headers.

This is a cop out. If the kernel headers change, and the libc include headers include 
them
and suffer as a result, then libc headers MUST be updated to incorporate any necssary 
changes
as a result. It's inevitable.


> Q2: What if I want to compile a program that needs a feature from a
> later kernel than is used by libc?

> A2: In practice, most programs will not have this problem.  However,
> depending on the scope of the problem you have several options available:

> If the situation is one like "kernel driver development", where all use
> of the machine for development is expected to be against a different set
> of kernel headers than are supplied with the "stock" libc6-dev, rebuilding
> the glibc packages against that particular kernel will create a full set of
> libc6 packages that are "compliant" with the new kernel. All development 

Rebuilding libc is something I hope never to do! It used to be "impossible". I.e.
HJ had some magic he had to use, and then he gave the resulting binaries out.

> done on machines with these packages installed will be done against the 
> new kernel. To build libc6-dev against your particular kernel, export the
> environment variable ksource, set to the path to that particular kernel and 
> build the package.

Believe me, I baulk at doing that, and I bet you do too! Do you seriously
think this is all a good idea? I notice you haven't expressed an opinion.

Peter

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

From: "Peter T. Breuer" <[EMAIL PROTECTED]>
Subject: Re: Autoconfiscating a loadable module
Date: Mon, 4 Dec 2000 15:36:40 +0100

Kaelin Colclasure <[EMAIL PROTECTED]> wrote:
> Has anyone devised a workable configuration for having a Linux
> loadable kernel module compiled and installed using the standard GNU
> autoconf tools? I'm in the process of "autoconfiscating" OpenTNF

No. Though I think I'm practised enough that I could do it easily. I mean,
all you have to do is compile the module and install it in
/lib/module/`uname -r`/blah, watching out for if the source and running
kernel match.

Peter

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

From: [EMAIL PROTECTED] (Gerson Kurz)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Need library reference
Date: Mon, 04 Dec 2000 13:42:43 GMT

On Mon, 04 Dec 2000 07:28:20 GMT, [EMAIL PROTECTED] (Mark Healey)
wrote:

>I don't think I was clear.  I really need a library reference that I
>can browse.  For instance:  I'd like to look at all the functions that
>have to do with environmental variables or all the functions that deal
>with strings.

Try http://www.gnu.org/manual/glibc-2.0.6/html_chapter/libc_toc.html.
Its as good as its gonna get on *X. Deal with it. 


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

From: "Carlos Portela" <[EMAIL PROTECTED]>
Subject: Please help: NT to Linux port
Date: Mon, 4 Dec 2000 09:45:58 -0500

Hi All,

I am porting a server-like product from Windows NT to Linux and I am faced
with the following code that needs to be implementted under Linux:

try
   {
   CallSomeFunction();
   }
catch(...)
   {
   // Do something here
   }

This code is not being used to catch normal exceptions thrown by the code
underneath but instead it is being used to catch memory protection
violations and other exceptions generated by Windows.

My question is:

Is this behaviour of the try-catch pair available in Linux?  If not then,
can you suggest an alternate implementation?  In other words, how can I
obtain control if the code I called (in this case CallSomeFunction) screws
up?

Thank you in advance!

Carlos



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

From: [EMAIL PROTECTED] (Erik Hensema)
Crossposted-To: comp.os.linux.questions
Subject: Re: Kernel modules and Daemons - architecture question
Date: Mon, 4 Dec 2000 16:00:33 +0100
Reply-To: [EMAIL PROTECTED]

Rui Antunes ([EMAIL PROTECTED]) wrote:
>       I need to develop a kernel module that intercepts and improves a
>few system calls. Since the enhancement of those system calls need a
>little bit of code - and since kernel-code has much more restrictions
>that user-code -, I was thinking of having a (user-space) daemon to
>complement the kernel-module.
>       However, I don't know much about daemons and their relation with
>the kernel (and with other user-programs). Where can I find
>documentation about it?
>
>       Some of things that I wanted to know are:
>
>       1) How do kernel and daemons interact (or communicate)?
>       - using (new) system calls - the daemon calls the 
>module system call?

You can't create new systemcalls using modules. Usually you communicate
over a device node in /dev using ioctl()'s.

>       - using device driver operations - the daemon uses read(), write()
>and ioctl() on the module (like a device driver)?

Yes.

>       - using /proc/ control files (how?)

Possible, but not pretty, imho.

>       2) How do user-programs use the daemon facilities?
>       - through the kernel (using a system call) that in turn contacts
>the daemon?
>
>       Is it possible for the kernel module to schedule its daemon so it
>would run as soon as possible - to improve performance?

No, just let the daemon block on a read().


-- 
Erik Hensema ([EMAIL PROTECTED])
Hark, Hark, the dogs do bark
The Duke is fond of kittens
He likes to take their insides out
And use them for his mittens
        From "The Thirteen Clocks"

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

Date: Mon, 04 Dec 2000 10:00:33 -0500
From: "John C. Griggs" <[EMAIL PROTECTED]>
Subject: Re: Global constructors in ELF so libs NOT CALLED!

Erik Westlin wrote:
> 
> John C. Griggs wrote:
> >
> > >>> Insulting description of basics of Object Oriented Programming SNIPPED <<<
> 
> I'm sorry if you feel insulted, if i was a bit sarcastic it was due to
> that other
> answer i got.
> 

Understood, but besides being sarcastic, your reply contained no
information that would have been useful in solving your problem - I
don't believe that someone who doesn't understand what "global" and
"constructor" mean would be able to help you with your problem, so
providing a tutorial on these subjects was a bit odd, to say the least.

> Yes i do just link with the so-lib.
> Yes i do use -fPIC.
> It's great that i'm wrong so there is hope anyway.
> I not sure why you say "static objects" but they are not declared static
> or
> whith any other special attribute.
> The build command is ld -shared -o$(OUTFILE) $(OBJS) $(LIBS).
> 

By "static objects", I was referring to objects that are constructed
before control reaches main().  These might be true statics or globals. 
Perhaps this is not the dictionary definition of the term, but I felt it
was adequate to get across what I was talking about.

> I see now that ld has a warning -warn-global-constructors which bye the
> way
> doesn't work for ELF anyway according to the man page. I just wonder why
> ld thinks it could be important to warn about them.

Well, this is just a guess, but I believe this has to do with the old
COFF/a.out object format, which did not provide _init or _fini, making
global/static constructors more of a problem.  The reason it doesn't
work for ELF is that global constructors are not an issue for this
object format.

> 
> > Instead of trying to teach us all the basics of Object Oriented
> > programming (which you don't seem to have that firm a grasp of anyway),
> 
> That wasn't my intention at all and you know it. I have been doing OO
> for nearly 20 years. Not for it's own sake though.
> 

Well, what was your intention?  Surely you weren't expecting someone who
needed your little tutorial to be of any help?  BTW, what OO language
were you programming in "nearly 20 years" ago?

I admit my reply was a bit testy, but I find it annoying when people get
on UseNet to ask for FREE help without providing any useful information
about the details of their problem and then get pissy and sarcastic when
you prod them for this info.  If you hadn't been the third or fourth
person I saw do this that day, I probably would have bit my tongue a
little more in my reply.

> I have already solved the problem by rewriting the program. And yes
> i would like to learn something, thats why i ask questions.
> 

Well, the linker options look fine to me.  Perhaps you could post a code
snippet with the object definition and declarations.  I'm interested to
find out what the root problem is here - undoubtedly I'll learn
something along the way as well.

Regards,
        John Griggs

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

From: [EMAIL PROTECTED]
Subject: Re: mtio.h -- pass blocksize to tape dev ???
Date: Mon, 04 Dec 2000 15:44:01 GMT

In article <miWV5.5469$[EMAIL PROTECTED]>,
  Jerry Peters <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Using structs and macros defined in mtio.h, I am not sure how I
would
> > pass a blocksize into ioctl.
>
> > In AIX (please do not throw rocks) they have a struct just for
changing
> > the blocksize of the streaming (or magnetic) tape, and it is this
struct
> > that is passed as the 3rd argument to ioctl.
>
> > In Linux, the MTSETBLK define is just another possible value in the
mtop
> > struct, but then how do I pass the new blocksize that I want?
>
> > I am new at this, so please forgive if too stupid of a question?
>
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
> I suggest you find the source for Linux mt. It should be called
> something like mt-st-0.5b. It allows setting both the block size &
> default block size.  If you can't find it, email me & I'll send you a
> copy.
>
>       Jerry
>

Thanks.  Looking at the man page for mt, I almost don't need to write a
C program.  I may be able to use a shell script.  In any case, I am
still poking around.  Again, thank you.


Sent via Deja.com http://www.deja.com/
Before you buy.

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


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