Linux-Development-Sys Digest #969, Volume #7     Fri, 23 Jun 00 02:13:11 EDT

Contents:
  Re: ld including dead code (Steve Preston)
  Re: Why no defrag? ("Anthony")
  Re: ld including dead code ("RM")
  mapping device name and minor device number ([EMAIL PROTECTED])
  Re: ld including dead code ("RM")
  Re: Newbie serial comms... (Robert Lynch)
  running remote untrusted code (Brennan Cheung)
  Re: running remote untrusted code ([EMAIL PROTECTED])
  Using C, what ports are being used by which programs? ("jmt")
  Re: Using C, what ports are being used by which programs? (Barry Margolin)
  Re: Why so many collisioins ? (Frank Sweetser)
  Re: bootlogos (Charles Blackburn)
  Re: CodeWarrior for Linux. Comments ? ("Phillip Soltan")
  IRQ for module (Stefan Carstens)
  process control ("Lee Kang Won")

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

From: Steve Preston <[EMAIL PROTECTED]>
Crossposted-To: gnu.gcc.help
Subject: Re: ld including dead code
Date: 22 Jun 2000 13:27:26 -0400

"RM" <[EMAIL PROTECTED]> writes:

> Why would LD link dead code into a binary, and how do I eliminate it?
> 
> The code in question is contained in libraries that the final binary (a
> modular device driver) is linked against.  There are no references to this
> code.  I verified this by removing the "dead" code from the library, and
> re-linking.  The linker did not issue any "unresolved symbol" errors.

You didn't say what platform you are on, but I am guessing AIX.

The AIX ld will link in any object file, whether encountered in a
library or not, that contains the definition of 'static' data objects
(ie whose lifetime begins before 'main' is invoked).

It will also refuse to link an object file, even when explicitly
specified on the command line, if it does not resolve any reference.

Both of these behaviors are very annoying.

If you control the code for the library, the best fix is to separate
the definition of static data from any actual code (into different
translation units).  The "pure-data" object files will still get
linked into the executable, but they will be smaller and won't cause
cascading unresolved references that often happens.


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

From: "Anthony" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Why no defrag?
Date: Fri, 23 Jun 2000 01:43:46 +0800

In article <39239f25$0$[EMAIL PROTECTED]>, "Peet Grobler"
<[EMAIL PROTECTED]> wrote:
> Hello.
> 
> I've seen the question posted to this group many times now, is there a
> defrag for linux? The conclusion is there is not. I'm sitting at my
> desk, thinking, why not?

Obviously you should check this out:

/usr/doc/LDP/sag/index.html

Reference section:
 TV
          Stephen Tweedie and Alexei Vovenko. Linux filesystem
          defragmenter. Available electronically from \
          ftp://sunsite.unc.edu/pub/Linux/system/Filesystems/defrag-0.6.t
          ar.gz.

the more current ones are defrag-0.7x, hacked for easier compilation
under glibc2.1x version.


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

Reply-To: "RM" <[EMAIL PROTECTED]>
From: "RM" <[EMAIL PROTECTED]>
Crossposted-To: gnu.gcc.help
Subject: Re: ld including dead code
Date: Thu, 22 Jun 2000 14:45:42 -0400

Thanks for the reply, Steve.

I am running under RedHat 6.2 Linux, not AIX. If you know that the issues
you raise apply _ONLY_ to AIX, please let me know.  In the mean time, I will
continue thrashing at this problem.

The files I am trying to strip declare a structure of function pointers,
which go to ".data".  I suspected that the linker might be including them
due to the function pointer there, even though there was no reference to the
structure containing the pointer, but I #ifdef-ed the structure define, and
the functions remain.

I went through and declared all functions "static", and initial results (the
map file) seemed promising, but objdump showed that the functions remained,
they were just no longer visible in the map file.

I disagree, however.
_ANNOYING_doesn't begin to describe it...

Cheers,
Robb.

Steve Preston <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> "RM" <[EMAIL PROTECTED]> writes:
>
> > Why would LD link dead code into a binary, and how do I eliminate it?
> >
> > The code in question is contained in libraries that the final binary (a
> > modular device driver) is linked against.  There are no references to
this
> > code.  I verified this by removing the "dead" code from the library, and
> > re-linking.  The linker did not issue any "unresolved symbol" errors.
>
> You didn't say what platform you are on, but I am guessing AIX.
>
> The AIX ld will link in any object file, whether encountered in a
> library or not, that contains the definition of 'static' data objects
> (ie whose lifetime begins before 'main' is invoked).
>
> It will also refuse to link an object file, even when explicitly
> specified on the command line, if it does not resolve any reference.
>
> Both of these behaviors are very annoying.
>
> If you control the code for the library, the best fix is to separate
> the definition of static data from any actual code (into different
> translation units).  The "pure-data" object files will still get
> linked into the executable, but they will be smaller and won't cause
> cascading unresolved references that often happens.
>



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

From: [EMAIL PROTECTED]
Subject: mapping device name and minor device number
Date: Thu, 22 Jun 2000 20:13:48 GMT

Hi ,

  I have to map the device name(visible to user app)and  the minor
number in my driver.



I am using register_chrdev to register my module.

Now based on the device name assigned by the application
 (devXXsubdeviceYY - )
 I have to store some device type specific information.

1. Can i get a call in my driver when user app. call mknod?

2. How can i find the device name from the minor device number?

regards
jeseem


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

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

Reply-To: "RM" <[EMAIL PROTECTED]>
From: "RM" <[EMAIL PROTECTED]>
Crossposted-To: gnu.gcc.help
Subject: Re: ld including dead code
Date: Thu, 22 Jun 2000 16:38:39 -0400

Mike,

Thanks for the reply, and especially the detail.  I am familiar with the
"all or nuthin" behaviour you mention below, and this at least is not the
cause.  The code I am trying to strip is from several stand-alone object
files (i.e., a.o, b.o, c.o).  They are linked into a library file, and then
linked to the final binary (a modular device driver).  The device driver has
defines that may require functions in several files (i.e., a.o, c.o), but
not the remaining files (i.e., b.o).  Now I would be happy if the functions
in the final binary were only those in a.o, and c.o, but I find that my file
has b.o (yuk!).

Actually, I think another response I got from Richard B. Johnson (who
frequents fa.linux.kernel) may have solved this mystery.  The key is that I
am making a _modular_ driver, which the linker expects to have unresolved
symbols (i.e., all the hooks into the kernel).  Apparently, the linker may
include the kitchen sink, just because it thinks that the final link step
(either static linking for an executable binary, or dynamic linking with the
kernel by insmod) may actually define references to this "dead" code.  This
sounds almost plausible....

This leaves me with the option of getting fancy with the conditional defines
to strip the "dead" code at compile time (the library is rebuilt every time
under the current system anyway), or getting fancy with the makefile, and
skipping the intermediate library step, just dynamically building a large
list of files to link....

Any comments / suggestions???

Thanks again,
Robb.

Mike Albaugh <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> I came in late, but have a question/comment:
> If the "dead" functions are each from a separate .o file, then
> "Nevermind". I've never seen gcc muff this, but I certainly can't
> help if it does.
>
> If, however, you have a case where file frob.o (from frob.c)
> contains functions get_frob() and set_frob(), and you call get_frob(),
> then most linkers in my experience (dating back to 1968 or so) will
> suck in all of frob.o, including set_frob(). There was a period of
> time from 1956 to 1970 or so when "intelligent" linkers would select
> individual functions from a .o (or .obj :-) file within a .a (or .lib)
> file. Also, DOS linkers in the last gasp of huge-model would sometimes
> do this (for reasons similar to the earlier linkers, way-small memory).
> But it's not at all pervasive.
>
> If you completely delete the offending .o from the lib, what happens?
> If you get an "undefined external", you have found out why that .o was
> included. Come to think of it, the map files I am used to specify _why_
> each .o was included. e.g. :
>

Did this - the module links perfectly without the now missing file.  That's
why I am so annoyed - these functions are truely NOT needed.

> Archive member included       because of file (symbol)
>
> libos.a(idtc4000.o)           atl_root.o (config_cache)
> libos.a(atl_epld.o)           atl_root.o (__fpga_data)
> libos.a(phx_shims.o)          atl_root.o (BootUp)
>
> This says that atl_root.o called config_cache, which caused idtc4000.o
> to be extracted from libos.a and added to the executable. And so forth.
> Do you have a similar map?

Thought of the map file.  Generated one, but find little of any use.  The
map file (produced by "-Map" option under ld) shows what functions are
included from what file (my library file), their address, but no clue as to
WHY






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

From: Robert Lynch <[EMAIL PROTECTED]>
Subject: Re: Newbie serial comms...
Date: Thu, 22 Jun 2000 13:58:54 -0700
Reply-To: [EMAIL PROTECTED]

[e-mail only]
Jeremy Young wrote:
> 
> OK, this is probably so incredibly simple you won't believe I'm asking
> it...
> 
> I want to read a serial port under C. I'm using KDevelop and I guess
> it's hooked into gcc. I've tested the port with mgetty and it works,
> cables are all OK, communicating 9600, no parity, 8, 1.
> 
> Now I'm trying to write a program that simply opens it and echos the
> bytes on the screen but I can't get past the open() function. I don't
> know what on earth I'm doing wrong and it's probably easy but I have:
> 
>         {
>                 cout << "Opening port\n";
>                 int PortFD = open( "/dev/ttyS0", O_RDONLY );
>                 cout << "look it's open!\n";
>                 ....
>         }
> 
> And I can't get it to run past "Opening port". It calls open() then just
> sits there, nothing else happens, it never reaches the next line. What
> on earth is wrong? I tried using ifstream under C++ and get the same
> thing. I tried the debugger and it's somewhere IN open with nothing
> happening.
> 
> Don't understand. Can anyone help?
> 
> I haven't even got to setting baud rates or anything like that as all
> that happens after the port is opened. I've looked at the example in
> "Linux Application Development" and it seems to be much the same (except
> I'm trying to write in C++).
> 
> Any help would be appreciated,
> 
> Jeremy

Look at:

http://www2.awl.com/cseng/books/lad/src/robin.c
-- 
Robert Lynch-Berkeley CA [EMAIL PROTECTED]

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

From: Brennan Cheung <[EMAIL PROTECTED]>
Subject: running remote untrusted code
Date: Thu, 22 Jun 2000 14:56:32 -0700

Hi.  I am working on a project that I need a client to be able to upload
code to my server and have it run securely.  I want to limit all API
access except the API I will provide (ie, no files, no networking, no
libc, etc).  I was wondering if this is even possible under Linux?  I'm
not sure if this is the right group to be asking under but it looked
like the best choice I could find.  Should I post this somewhere else?
If so, where?

What mechanism could I use to load and execute remote code.  It is very
much like a DLL but I don't want to have to write it to a file first.

Would people be able to write code under a different platform such as
Windows and have it run on my server.  I was thinking that it shouldn't
be too hard because it should be pure binary code with the exception of
the library calls I will provide.

What is the process for a client to link into the API that I will
provide?

The basic idea of what I am trying to do for those of you who are
wondering why I want to do this is that I have a server and lots of
clients that will connect to the server.  These clients are AI units
that interact in a virtual world (the server).  I want anyone to be able
to do this but I want to be able to run untrusted code or in other words
restrict the client from executing any harmful code.

Thanks in advance,
Brennan


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

From: [EMAIL PROTECTED]
Subject: Re: running remote untrusted code
Date: Thu, 22 Jun 2000 22:50:21 GMT

Brennan Cheung <[EMAIL PROTECTED]> wrote:
> Hi.  I am working on a project that I need a client to be able to upload
> code to my server and have it run securely.  I want to limit all API
[...]
> Would people be able to write code under a different platform such as
> Windows and have it run on my server.  I was thinking that it shouldn't
> be too hard because it should be pure binary code with the exception of
> the library calls I will provide.

Java already has support for both controlling access to the machine,
networking, and cross-platform support built into the language. IMO,
it's tailor made for your situation.

You can also see more ardous examples in C by looking at Condor and
Cosm. Neither is free, however, so you'd be in for ludicrous amounts
of recoding.

-- 
Matt Gauthier <[EMAIL PROTECTED]>

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

From: "jmt" <[EMAIL PROTECTED]>
Crossposted-To: 
comp.os.linux.development.apps,comp.unix.programmer,comp.unix.sco.programmer
Subject: Using C, what ports are being used by which programs?
Date: Thu, 22 Jun 2000 23:39:48 GMT

Using a C written program, is there a way to find out what programs are
using what tcp ports? Is this possilble and if so, where can I find examples
in C to do this? Or, where to start?

The C utility would be written under AIX 4.3.2 and SCO 5.0.5

Appreciate your input.

Thanks,
Jeff




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

From: Barry Margolin <[EMAIL PROTECTED]>
Crossposted-To: 
comp.os.linux.development.apps,comp.unix.programmer,comp.unix.sco.programmer
Subject: Re: Using C, what ports are being used by which programs?
Date: Fri, 23 Jun 2000 00:02:30 GMT

In article <8tx45.9622$[EMAIL PROTECTED]>,
jmt <[EMAIL PROTECTED]> wrote:
>Using a C written program, is there a way to find out what programs are
>using what tcp ports? Is this possilble and if so, where can I find examples
>in C to do this? Or, where to start?
>
>The C utility would be written under AIX 4.3.2 and SCO 5.0.5

Download "lsof" and see how it does it.  There's no standard way, and the
authors of this program have dug up the ways to do it on most systems.

-- 
Barry Margolin, [EMAIL PROTECTED]
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

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

From: [EMAIL PROTECTED] (Frank Sweetser)
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.networking
Subject: Re: Why so many collisioins ?
Date: 23 Jun 2000 00:44:12 GMT

Boris Pran <[EMAIL PROTECTED]> wrote:
>I have two Linux boxes, one is 2 x Celeron433 with D-Link DFE530TX NIC and
>the another is AMD5x86 - 160Mhz with some VIA NE2k PCI clone NIC.
>
>My intention was to use the slower one as a X terminal on the faster
>machine.
>These are the only two computers on the network.
>
>It works but,  an enormous amount of collisions are detected. Collision led
>on the hub is on almost all the time. It significantly slowes down the
>communication.

are one/both of the NICs forced to full duplex?

-- 
Frank Sweetser rasmusin at wpi.edu, fs at suave.net
Full-time WPI Network Tech, Part time Linux/Perl guy
There's some entertainment value in watching people juggle nitroglycerin.
             -- Larry Wall in <[EMAIL PROTECTED]>

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

From: [EMAIL PROTECTED] (Charles Blackburn)
Subject: Re: bootlogos
Date: Thu, 22 Jun 2000 23:27:20 +0100
Reply-To: [EMAIL PROTECTED]

On Wed, 21 Jun 2000 16:03:56 -0400, John Gluck wrote:
>It's essentialy a memory buffer for graphics. If you compile it into the
>kernel, the console will operate using graphics mode for text.
>On bootup you will see "a cute penguin logo" (quoted from a doc I read
>somewhere) at the top of your screen.

I think he want's to know whether he can change the penguin to another logo. 
quite why he would want to do that, I don'e know :-)
-- 
Charles Blackburn -=- Remove NOSPAM to email a reply.
Summerfield Technology Limited - SuSE Linux Reseller & Birmingham L.U.G sponsor
[EMAIL PROTECTED] 
[EMAIL PROTECTED]
 11:12pm  up 10 days,  5:13,  3 users,  load average: 0.02, 0.04, 0.01

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

From: "Phillip Soltan" <[EMAIL PROTECTED]>
Subject: Re: CodeWarrior for Linux. Comments ?
Date: Fri, 23 Jun 2000 04:12:09 GMT

I've used it for several months now and I would only recommend if for
inexperienced programmers who haven't made a big investment in customizing
their "emacs" or "vi".   These are the main reasons I found it annoying:

1.  I have a "flex" file that I would like it to run through flex before
compiling and it doesn't seem to be able to do this.

2.  I use "ctags" a lot and it doesn't support them as far as I can tell.

3.  It gets confused very easily if you modify files outside of its GUI
interface.

It does pull up the C file for editing that has generated a compiler error
and it is multi-threaded but it didn't thrill me.


Phil Soltan

Kent Sorensen wrote in message
<[EMAIL PROTECTED]>...
>
>I'm going to be experimenting with Linux for some personal projects, and
>
>have ordered CW for RedHat linux.
>
>If anyone has used it, I'd like to hear impressions, tips etc.
>
>I will be installing on a Corel Linux, so if there are any gotcha's I
>need to look out for, please let me know. If RedHat is the only
>distribution it will install on, I'd be unhappy, but would switch.
>
>
>Kent Sorensen
>
>
>



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

From: Stefan Carstens <[EMAIL PROTECTED]>
Subject: IRQ for module
Date: Fri, 23 Jun 2000 07:39:10 +0200

Hi guys,
I have a small problem, but can't fix it.
I have written a driver for a 32Bit TTL I/O Card from ELV.
This Card has no IRQ, but for a particular app I need some, to get data
every xx ms.
I thought I could also use the IRQ 0 (timer), but that seems not
possible.
I can get every other free IRQ, but not 0 !
Is there a way t get this IRQ or is there a more usefull way to do this,
aka task_queue ???
Thanks in advance !

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

From: "Lee Kang Won" <[EMAIL PROTECTED]>
Subject: process control
Date: Fri, 23 Jun 2000 15:01:10 +0900

Hi!

I want to examine processes that I've started and also check it's idle
time(right?) and if it's over a specified value, kill it.
I'm going to (frankely, have to...) write a C program, but have no idea
how to make it. I just think I should get some info. from kernel's process
table.
would source code of 'ps' and 'kill' written in C be of help?

Any suggestion or idea would be appreciated.
thanks in advance.






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


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