Linux-Development-Sys Digest #674

2001-04-28 Thread Digestifier

Linux-Development-Sys Digest #674, Volume #8 Sat, 28 Apr 01 17:13:10 EDT

Contents:
  how to get good cpu time from running processes on Linux (Alex Ho)
  Re: 2.2.19 freezes during strong gcc usage
  scripting questions (PPP)
  Re: Realtek 8139b NIC (Cameron Kerr)
  ifconfig command (Sachio)
  Re: ifconfig command (Cameron Kerr)
  Re: ifconfig command (Peter T. Breuer)
  Re: scripting questions (Trevor Hemsley)
  kernel number meaning (stefano)
  How to find out whether the device(floppy drivers,zip drives) is removable on linux 
(Luiz Rafael Culik Guimaraes)
  Re: How to find out whether the device(floppy drivers,zip drives) is removable on 
linux (Peter T. Breuer)
  Re: glibc 2.1.1 to 2.1.3 : Check ERROR (Andreas Jaeger)
  sockets (Darren)
  Startup service (Darren)
  Re: sockets (Rene Herman)



From: Alex Ho [EMAIL PROTECTED]
Subject: how to get good cpu time from running processes on Linux
Date: 27 Apr 2001 21:32:16 GMT

Over the last few days, I have been searching for a solution that could
accurately total up cpu usage from threads on Linux.  You know that pthread
on Linux forks off a process for each thread created. This architecture
presents a problem when collecting cpu usage (using clock() or getruage())
from a set of threads.  The same code on Linux is totalling up numbers
different from other platforms.

Say, on a single processor machine, a program creates 2 child threads.  Each
child thread actively doing something (not sleeping) while the main thread
sleeps and wakes up at 1 second-interval to report total cpu usage (using
clock() or getrusage()) of the entire program.  On Linux, the main thread is
reporting times of only itself because it is in a separate process while on
other platforms (like Solaris), the times reported include those from the
child threads because they all running in the same process.

I would like Linux to report total times of the main and the 2 child
threads.  I guess in general, the question is how to collect cpu times from
a set of running processes.

Thanks in advance for any help.

Best Regards,
Alex Ho







--

From: [EMAIL PROTECTED]
Subject: Re: 2.2.19 freezes during strong gcc usage
Date: Fri, 27 Apr 2001 15:37:06 -0700

Uh, Phil, whats a furby??


 Well, we all know about smp and threads on the 2.2.X kernels, right?

 Just try and figure out which CPU the thread is on... and which
 thread was that anyway?

 If he tries things with smp disabled I'll bet the problem goes away.

 But I still think gcc-3 can replace your kernel with a furby.
 Unless you are developing gcc I would stay a mile away from it.




--

From: PPP [EMAIL PROTECTED]
Subject: scripting questions
Date: Sat, 28 Apr 2001 01:06:57 GMT

I am trying to get proficient in scripting. I have a few questions.

 $SETSID $PPPD pty $PPPOE_CMD \
 $PPP_STD_OPTIONS \
 $DEMAND \
 $PPPD_SYNC 
 echo $!  $PPPD_PIDFILE
fi
wait

Now when a program returns a value the calling script usually uses $? to
represent the returned value. What does the term $! represent (why was $?
not used)?

What does the wait command do? Would not the script wait for $PPPD to return
anyway? If this is the case then why is wait used?



--

From: Cameron Kerr [EMAIL PROTECTED]
Subject: Re: Realtek 8139b NIC
Crossposted-To: alt.os.linux,comp.os.linux.misc
Date: Sat, 28 Apr 2001 15:03:51 +1200

Have you disabled the mouse port int the BIOS then, in
that case.

-- 
Cameron Kerr -- cameron.kerr @ paradise.net.nz
Praise Slackware, our baud and saviour!
--

--

From: Sachio [EMAIL PROTECTED]
Crossposted-To: comp.os.linux.development.apps
Subject: ifconfig command
Date: Sat, 28 Apr 2001 06:05:07 GMT

When you execute 'ifconfig' with no other arguments, where does the
utility retrieve the information from?  I have one network adapter that
is dhcp, and I'm wanting to find out where ifconfig retrieves the
assigned ip from.

Also, which directory/file contains the source code for the ifconfig utility?

Please, echo to my e-mail, just in case!

Thanks in advance!

Sachio




--

From: Cameron Kerr [EMAIL PROTECTED]
Subject: Re: ifconfig command
Crossposted-To: comp.os.linux.development.apps
Date: Sat, 28 Apr 2001 18:52:21 +1200

Mostly from /proc/net

-- 
Cameron Kerr -- cameron.kerr @ paradise.net.nz
Praise Slackware, our baud and saviour!
--

--

From: Peter T. Breuer [EMAIL PROTECTED]
Subject: Re: ifconfig command
Crossposted-To: comp.os.linux.development.apps
Date: Sat, 28 Apr 2001 08:39:17 GMT

In comp.os.linux.development.apps Sachio [EMAIL PROTECTED] wrote:
 When you execute 'ifconfig' with no other arguments, where does the
 utility retrieve the information from?  I have one network adapter that

From the kernel. It reports all up interfaces.

 is dhcp, and I'm wanting to 

Linux-Development-Sys Digest #675

2001-04-28 Thread Digestifier

Linux-Development-Sys Digest #675, Volume #8 Sat, 28 Apr 01 23:13:06 EDT

Contents:
  Re: mount root file system with read-write (John Kelly)
  Re: Startup service (D. Stimits)
  Trouble with pipe implementation (Frank L. Liao)
  Re: Startup service (Darren)
  Re: kernel number meaning (Darren)
  Re: How to find out whether the device(floppy drivers,zip drives) is removable on 
linux (Luiz Rafael Culik Guimaraes)
  Re: ifconfig command (Sachio)
  Re: How to find out whether the device(floppy drivers,zip drives) is removable on 
linux (Peter T. Breuer)
  Re: sockets (Cameron Kerr)
  Re: Startup service (Cameron Kerr)
  Re: ifconfig command (Cameron Kerr)
  Kernel 2.4.4 Problems (Fruitbat)
  Pipe problem (Frank)
  Pipe Problem (Frank)



From: John Kelly [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
Subject: Re: mount root file system with read-write
Date: Sat, 28 Apr 2001 15:19:45 -0600

In your /etc/lilo.conf file, you can make an entry similar to:

image = /boot/vmlinuz-2.2.16-22
  label = linux-ram
  root = /dev/ram0
  initrd = /boot/ramdisk.img.gz


Run lilo, reboot, and select linux-ram at the lilo prompt

-jk



lmc83 wrote:

 hi,
 How to mount a initrd as root file system with read-write?
 I pass kernel parameter with:
 linux root=/dev/ram0 init=/linuxrc rw
 but it seems still mounted as read-only,
 what's wrong?

 Liang Ming-Chung


--

Date: Sat, 28 Apr 2001 15:23:29 -0600
From: D. Stimits [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
Subject: Re: Startup service

Darren wrote:
 
 Hello all I am writing a small app that I want to run as a Linux service
 when it starts up. Can anyone tell me if I need any special consideration
 when writing a Linux tsr? also does one know which file it stores the info
 on startup apps in?
 
 Thank you
 
 Darren

There isn't really anything called a tsr in linux. It is just a daemon.
The typical daemon does a fork and exec after being started by an rc
script. For redhat, the script samples are in /etc/rc.d/init.d/. For
other distributions, they are in an init.d directory, but it might be
located somewhere else; I think SuSE uses /sbin/init.d/ or something
like that. Programs that are not really system daemons but are desired
to start each reboot often are just added in by editing
/etc/rc.d/rc.local (again, location will vary with distribution, but it
is usually named rc.local). SuSE also has an rc script in /etc/ that
yast uses.

The scripts usually take arguments of start, stop, status, and
restart. Symbolic links from various runlevel directories (e.g.,
/etc/rc.d/rc.0 through rc.6) named starting with a k will kill the
process at those levels, but if the sym link is done with a name
starting with s it starts it at that level (your mileage may vary
depending on distribution). Other complexities are that for security it
isn't unusual to arrange for the daemon to start as root but to be
transferred for execution as user nobody (or some other less
privileged user); and there is often some sort of lock file or pid file
to let the system know what pid the process is at.

D. Stimits, [EMAIL PROTECTED]

--

From: Frank L. Liao [EMAIL PROTECTED]
Crossposted-To: comp.os.linux.development.apps
Subject: Trouble with pipe implementation
Date: Sat, 28 Apr 2001 14:25:51 -0700

Hi guys,

I'm currently having a problem implmenting pipe into a custom shell I'm
writing.  It seems that when I do ls | cat, it seems to be fine.
Though, when I call ls | cat | netscape it seems to hang on cat.
Then, I try it again.  ls | cat works.  Then, I tried ls | cat
again, it would hang.  What am I doing wrong here?

Frank
TIA

/* The code I made is on the bottom.  pList is a link list of structs
which contains argv and argc.  nPipes is the number of Pipe operators
(not operands) that I'm going to execute.  So, if nPipe = 1, then there
are two argv's that need to be executed. */

void ExecutePipe(struct CmdLine *pList, int nPipes)
{
 int i;
 int fidPipe[2];
 enum PIPES { READ, WRITE }; /* Constants 0 and 1 for READ and WRITE */
 struct CmdLine *pCurrent = pList;

 pipe(fidPipe);

 for(i = 0; i  nPipes + 1; i++) {
  if(i == nPipes) {
   /* If this is the last program to be executed, we need to close the
write pipe
 before continuing, since we have no need for this pipe anymore.
*/
   close(fidPipe[WRITE]);
   if(fork() == 0) {
/* Close current stdin to keyboard */
close(fileno(stdin));
/* copy the handle of the pipe to stdin*/
dup(fidPipe[READ]);
/* now close the handle of the pipe. So that only stdin/pipe is
open*/
close(fidPipe[READ]);

execvp(pCurrent-argv[0], pCurrent-argv);
   } else {
int status;
wait(status);
   }
  } else {
   if(fork() == 0) {
if(i != 0) {
 /* if we are in the middle of a pipe, stdin should be closed and be
converted to
the read of the pipe. */