Linux-Development-Sys Digest #820, Volume #7 Wed, 3 May 00 15:13:18 EDT
Contents:
Re: Code transfert from machine to another (Alan Donovan)
Re: A need for better insallation programs (Toby Haynes)
Re: CPU Load <- off by 1.00 (Rao VA)
unexpected ide1 interrupts / swsusp (Lauren Weinstein)
Question: Modifying .profile files... (Andre Charbonneau)
Re: Code transfert from machine to another (Rao VA)
Number of processes in a group ([EMAIL PROTECTED])
Hacking on mkdep.c (Sverker Wiberg)
Re: Question: Modifying .profile files... ([EMAIL PROTECTED])
Re: 2.3.99-pre6: can't compile bootsect.S ("Giampaolo Tomassoni")
Re: get_user and bottom half help (Eric Taylor)
Re: Question: Modifying .profile files... (Andre Charbonneau)
Re: getcwd() newbie question (Marko Musnjak)
Re: Question: Modifying .profile files... ("Jeff Susanj")
To avoid double buffering. (liran)
Re: get_user and bottom half help (David Wragg)
SHLVL discrepancies ("Anton North")
----------------------------------------------------------------------------
From: Alan Donovan <[EMAIL PROTECTED]>
Subject: Re: Code transfert from machine to another
Date: Wed, 03 May 2000 15:11:39 +0100
Nicolas Boulay wrote:
> Is it possible to run code by a machine throught a network from an other
> machine without using the file system? More precisely, is it possible
> to make a programme that can execute some of this function by differents
> machines ? Those machines will not have any dedicated server for this
> program.
I think you are describing RPC (remote procedure call).
Have a read up about it in any good book on operating systems or
networks (I recommend Tannenbaum for both: "Modern Operating Systems"
and "Computer Networks"; both Prentice Hall).
HTH
alan
--
========================================================================
Alan Donovan [EMAIL PROTECTED] http://www.imerge.co.uk
Imerge Ltd. +44 1223 875265
------------------------------
From: Toby Haynes <[EMAIL PROTECTED]>
Subject: Re: A need for better insallation programs
Date: 03 May 2000 10:20:32 -0400
!! "Mike" == Mike Dowling <[EMAIL PROTECTED]> writes:
Mike> On Tue, 02 May 2000 15:23:58 +0200, Bernd Strieder
Mike> <[EMAIL PROTECTED]> wrote:
>> It would be a completely wrong to say that installing software
>> is easy under any OS.
Mike> $ ./configure --prefix=/usr --disable-nls $ make $ make
Mike> install
Mike> What could be easier? And it's independent of the OS (unless
Mike> you use an exotic like Windows).
Wow! You like life hard :-)
rpm -i foobar-1.0-1.arch.rpm
Supported on any platform that has RPM.
Cheers,
Toby Haynes
--
Toby Haynes
The views and opinions expressed in this message are my own, and do
not necessarily reflect those of IBM Canada.
------------------------------
From: Rao VA <[EMAIL PROTECTED]>
Subject: Re: CPU Load <- off by 1.00
Date: 3 May 2000 14:49:01 GMT
Anders Larsen <[EMAIL PROTECTED]> wrote:
> Hans-Joachim Baader wrote:
>>
>> In article <8emqk2$t3o$[EMAIL PROTECTED]>, Rao VA <[EMAIL PROTECTED]> wrote:
>> >I've been investigating processes for anamolies, the only suspect is an xntpd
>> >that's constantly in the Run state, however doesn't seem to consume CPU
>> >cycles. I can't kill this process and even though the process is in the Run
>> >state, a 'strace' on the process doesn't show anything.
>>
>> This is of course the culprit. However, if you can't kill it, I don't know
>> of a way to get rid of it except rebooting. On the other hand, it would
>> be useful to find out how it happened.
> # kill -KILL <process id>
> really should be able to kill it (as SIGKILL cannot be caught).
I know, but it doesn't. It's the only process in the run state and it
doesn't seem to be consuming CPU cycles. Is there a utility that can
identify resources (file/socket descriptors) owned by a process? It's as if
there's a deadlock.
Vijay
------------------------------
From: Lauren Weinstein <[EMAIL PROTECTED]>
Subject: unexpected ide1 interrupts / swsusp
Date: Wed, 03 May 2000 14:57:34 +0000
Greetings. Two issues I've been trying to track down with RH6.2...
1) The infamous "unexpected ide1 (CD-ROM) interrupts"--occurring
at random times, always count=1. Any suggestions on killing
or at least quieting this apparently erroneous beastie?
2) I've been experimenting with "swsusp"--the software suspend
patches to emulate hibernation on a notebook. It almost
works. In fact, I can resume back to a running system, but
I always find init in a 99% CPU runaway condition upon
resume, and can't regain control of it.
Any suggestions on either of these two points would be much
appreciated. Thanks.
--Lauren--
------------------------------
Date: Wed, 03 May 2000 10:55:50 -0700
From: Andre Charbonneau <[EMAIL PROTECTED]>
Subject: Question: Modifying .profile files...
Hi,
I'm currently working on an application which needs to changes
environment variables. Therefore, it will need to modify the .profile
or .login files accordingly so that these changes will take effect. My
question is:
How should the changes be made to the .profile or .login files?
Currently, my application simply append some "export LANG=... " lines at
the end of the script file. To determine which file to update, a
getenv("SHELL") is done to determine the shell used. Is there a better
(nicer) way of doing this?
Thanks,
--
Andre Charbonneau
Software Engineer
Corel Corporation
728-0826 x5612
------------------------------
From: Rao VA <[EMAIL PROTECTED]>
Subject: Re: Code transfert from machine to another
Date: 3 May 2000 15:10:34 GMT
Nicolas Boulay <[EMAIL PROTECTED]> wrote:
> Hi,
> Is it possible to run code by a machine throught a network from an other
> machine without using the file system ? More precisely, is it possible
> to make a programme that can execute some of this function by differents
> machines ? Those machines will not have any dedicated server for this
> program.
Have you considered using CORBA?
http://www.omg.org/
Vijay
------------------------------
From: [EMAIL PROTECTED]
Subject: Number of processes in a group
Date: Wed, 03 May 2000 15:29:11 GMT
Hi All
I want to find out how many processes exist, that have the same process
group ID than the calling process.
Any help appreciated
Irgei
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
From: Sverker Wiberg <[EMAIL PROTECTED]>
Subject: Hacking on mkdep.c
Date: Wed, 03 May 2000 17:50:28 +0200
I'm experimenting with mkdep.c from Linux 2.3.99 for an internal project
here at Ericsson Utvecklings AB. To make it more useful here, I have
made some modifications (flags to skip system headers, support for
Erlang) -- which I now want to fold back into the official distribution.
So: Who is in charge of mkdep.c?
(Btw, I was impressed by its mmap() trick.)
/Sverker Wiberg
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: Question: Modifying .profile files...
Date: Wed, 03 May 2000 16:22:06 GMT
Andre Charbonneau <[EMAIL PROTECTED]> wrote:
> How should the changes be made to the .profile or .login files?
> Currently, my application simply append some "export LANG=... " lines at
> the end of the script file. To determine which file to update, a
> getenv("SHELL") is done to determine the shell used. Is there a better
> (nicer) way of doing this?
Nicer, in my opinion, would be to not scribble over my private
files. Considering your users will have to log in and out to get the
changes, it's not even clear to me that you're doing anything remotely
useful here.
Why not let the administrator or user set them by hand? Or better yet,
use a configuration file. Basically, what's so difficult about your
problem that you need to resort to steps unused by any other unix
application I've ever seen?
--
Matt Gauthier <[EMAIL PROTECTED]>
------------------------------
From: "Giampaolo Tomassoni" <[EMAIL PROTECTED]>
Subject: Re: 2.3.99-pre6: can't compile bootsect.S
Date: Wed, 03 May 2000 16:31:54 GMT
"Robert Schiele" <[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]...
>
> binutils-2.9.1 from the FSF don't work!
Whops! That's why...
Thanks again,
--
------------------------------------------------------
Giampaolo Tomassoni Information Systems Consultant
P.za 8 Aprile 1948, 4 Tel/Fax: +39-0578-21100
I-53044 Chiusi (SI) e-mail: [EMAIL PROTECTED]
ITALY
homepage: http://www.geocities.com/Eureka/Park/2209/
------------------------------
From: Eric Taylor <[EMAIL PROTECTED]>
Subject: Re: get_user and bottom half help
Date: Wed, 03 May 2000 10:04:52 -0700
Alan Donovan wrote:
>
> Eric wrote:
>
> > What about smp. Can I force my target process to always use a particular
> > processor, and run a hi-prior-real-time process that wakes up 50 times a
> > sec to force a resched of my target process at least that often?
>
> You can't possibly have a process that wakes up 50 times a second. The
> time quantum on linux x86 is 10ms, therefore only 100 processes get
> schedules per second. If you need to execute code this frequently it
> will have to be from the timer interrupt handler (or a BH marked by it).
>
My idea is this:
Run my target process (one i want to monitor) at
normal non-realtime priority.
Run a realtime process that does a 10ms usleep. I.E.
for(;;) {
usleep( 10 * 1000) // wait 10 ms
}
When that sleep time is exhausted, shouldn't
it (r.t. proc) get control? Or does it wait for the
current process to exhaust its quantum?
At the next clock tick (10ms) won't the
system look to see if any higher priority r.t.
processes are ready to run? (which should be mine).
Assuming it pre-empts anything going on
only to go back to sleep, it should effect
a reschedule of my target process. Is this correct?
(it is a realtime process, so technically, it should
be pre-emptive - or is linux realtime not what
i normally think of as real-time)
Actually, I would settle for less than 50/sec, even 20/sec
would probably be good enough to see what the program is
doing. I would then just monitor it a little longer to get
a good sample of where the program is executing.
Anyway, if a reschedule occurs between my 2 procs, I figure
i can write a BH that should get in control with my target
process context in place (thru current). Then I can grab the
current pc and also a few levels of the stack frames. It's
the stack frame that is the toughy but its real handy to
see that dynamically at run time. Especially when a program
is in a near inf loop.
========
BTW, if I get a profiler running, I will post it's source
code. I've written a profiler like this on a few systems,
most recently VxWorks (which since the pathfinder mission
has become the o.s. of choice for NASA/JPL spacecraft).
========
> I would be extremely surprised if this did not completely kill system
> performance, although I guess if you're profiling, you expect that
> anyway.
>
Your right here. My plan is to only run this profiler
for a short time when i need to know what my target process
is doing. It is a long running simulation that
depends on user input so it often gets into strange
(but valid) states. That is why I need to jump in and take a look
just at the moment these states occur. Almost impossible
to create the situation thru testing. (BTW this simulation
is over 1 million lines of code)
Sometimes our simulation needs to think for 5 minutes or
more and we can't easily tell if it is doing something
useful or we have an infinite loop bug. We don't want to
pull the plug if it is just having deep thoughts.
That is where a dynamic profiler has been so useful
for us in the past. More than just a development tool,
it can tell us in the field what state we are in. It
has become as essential as the "top" program.
The utility of having a profiler that you can run at
any time, with no preparation is sooooo useful. Many
performance issues never occur during testing and
you don't want to slow the entire program run by
compiling in profile options. You want to get in
and get out after 30 secs or so of watching it - when
the bottleneck occurs.
Other profiler designs require
you time the entire run, which won't normally tell you
what's happening during those critical times when
the program goes into think mode. In our case, there
is heavy processing each simulation hour that can run
for 5 minutes or so. (we normally run 1-1 simulation
time to real time).
Some options I've implemented include profiling
_only_ when the target process is not in a wait
state. This also helps to pinpoint compute
bottlenecks. The inverse option can find where
your program is doing most of its waiting, in case
there is a bug causing inadvertent sleeps. Or you
forgot to remove a usleep after testing and you
can't understand why your program is running so slow.
Also, that 10ms sample rate can be changed dynamically
too. So, the profiler overhead can be adjusted during
the run.
There is one other difficulty in writing a profiler
like this: Getting the program symbol table. But that
is not a kernel issue, so i will look at that later/elsewhere.
> > 2. What about access violations from kernel mode.
> There exists a legacy function verify_area() which does this, and it
> must run in process context (it uses current->addr_limit.seg). However
> get_user replaces this because the kernel now uses exception handling; I
> believe what it does is to unwind the stack and return from the
> top-level driver method with -EFAULT should a bad page-fault be
> generated. [If this is so, I don't know how drivers are supposed to
> clean up]. Probably not what you want, but the rationale behind it is
> that EFAULT only occurs during program development (hopefully) so this
> scheme does not penalise programs that work.
>
Interesting, I will look into verify_area, since what i want
to do is a stack backtrace, and there is no guarantee that
i won't run into a bad address somewhere or maybe even some
assembly code that just decided to use the stack/frame pointer for
some obscure reason.
But I can't let this panic the system. I just want to abort
the scan.
>
> Sorry to not be more helpful, but I'm not the expert.
>
Thanks, you have been very helpful.
--eric
------------------------------
Date: Wed, 03 May 2000 13:15:23 -0700
From: Andre Charbonneau <[EMAIL PROTECTED]>
Subject: Re: Question: Modifying .profile files...
[EMAIL PROTECTED] wrote:
>
> Andre Charbonneau <[EMAIL PROTECTED]> wrote:
> > How should the changes be made to the .profile or .login files?
> > Currently, my application simply append some "export LANG=... " lines at
> > the end of the script file. To determine which file to update, a
> > getenv("SHELL") is done to determine the shell used. Is there a better
> > (nicer) way of doing this?
>
> Nicer, in my opinion, would be to not scribble over my private
> files. Considering your users will have to log in and out to get the
> changes, it's not even clear to me that you're doing anything remotely
> useful here.
>
> Why not let the administrator or user set them by hand? Or better yet,
> use a configuration file. Basically, what's so difficult about your
> problem that you need to resort to steps unused by any other unix
> application I've ever seen?
>
My application is a regional settings control panel, which allows the
user to set the language/country to use. On linux, the only way I know
to change the language settings is to set the LANG environment variable
in the login scripts. If we want this process to be user-friendly, then
users should not have to start editing their .profile or .bashrc files
after changing the language, it should be transparent to the user.
Maybe there is some other way to do this which would be cleaner...
Thanks,
--
Andre Charbonneau
Software Engineer
Corel Corporation
728-0826 x5612
------------------------------
From: Marko Musnjak <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: getcwd() newbie question
Date: 03 May 2000 11:13:06 +0200
Nicola Attico <[EMAIL PROTECTED]> writes:
> Hello Linux developers!
>
> char *getcwd(char *buffer,size_t size)
>
> where buffer is the string where you want to store the
> current working directory and size is the number of
> bytes you want to use for that (size_t is just the same
> that unsigned int).
>
Did you notice this paragraph in man getcwd :
If the current absolute path name would require a buffer
longer than size elements, NULL is returned, and errno is
set to ERANGE; an application should check for this error,
and allocate a larger buffer if necessary.
------------------------------
From: "Jeff Susanj" <[EMAIL PROTECTED]>
Subject: Re: Question: Modifying .profile files...
Date: Wed, 3 May 2000 17:56:31 GMT
Transparent operations are for Windows. Linux users want to see it all!
: )
Jeff S.
Andre Charbonneau wrote in message <[EMAIL PROTECTED]>...
>[EMAIL PROTECTED] wrote:
>>
>
>My application is a regional settings control panel, which allows the
>user to set the language/country to use. On linux, the only way I know
>to change the language settings is to set the LANG environment variable
>in the login scripts. If we want this process to be user-friendly, then
>users should not have to start editing their .profile or .bashrc files
>after changing the language, it should be transparent to the user.
>Maybe there is some other way to do this which would be cleaner...
>
>Thanks,
>--
>Andre Charbonneau
>Software Engineer
>Corel Corporation
>728-0826 x5612
------------------------------
From: liran <[EMAIL PROTECTED]>
Subject: To avoid double buffering.
Date: Wed, 03 May 2000 11:10:51 -0700
Hi,
In my driver I want to avoid double buffering .
I want to do that by using the buffer that i'll get from
the user and locking it ,so it cant be swaped.
My problem is that i want to access the buffer from other
context and copy_to_user and friends will work only on
the current address space.
Can I do something that will allow me to access that buffer
all around the kernel and not from the specific process
i got it from.
Thanks Liran.
* Sent from AltaVista http://www.altavista.com Where you can also find related Web
Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
From: David Wragg <[EMAIL PROTECTED]>
Subject: Re: get_user and bottom half help
Date: 03 May 2000 18:02:56 +0000
Alan Donovan <[EMAIL PROTECTED]> writes:
> Eric wrote:
> > What about smp. Can I force my target process to always use a particular
> > processor, and run a hi-prior-real-time process that wakes up 50 times a
> > sec to force a resched of my target process at least that often?
>
> You can't possibly have a process that wakes up 50 times a second.
Yes you can!
> The
> time quantum on linux x86 is 10ms, therefore only 100 processes get
> schedules per second.
The first part is right (though note that the default timeslice is
much longer -- 200ms I think), but the second part isn't. There are
many other ways that a process can be scheduled other than the timer
interrupt: Other interrupts, interactions between processes. For
instance, /dev/rtc can be used to wake a process 8192 times a second.
> If you need to execute code this frequently it
> will have to be from the timer interrupt handler (or a BH marked by it).
>
> I would be extremely surprised if this did not completely kill system
> performance, although I guess if you're profiling, you expect that
> anyway.
You would have to do quite a bit of work in a timer BH to have any
noticable effect of performance on modern machines. Consider this: For
the 386 machines that Linux was first developed on, handling the 100Hz
timer interrupt took up a few percent of the processor's
cycles. Today, a modern P6-based x86 machines spends around 150 000
cycles a second processing the timer interrupt (that figure does not
include the effect of L1 cache pollution effects, which could make up
more than half of the true cost for real work loads, but taking
account of that still gives <0.1% of cycles for an entry level machine
today). On a 1GHz machine, you could use a million cycles on each
timer interrupt and it would be hard to tell without making
measurements.
> > 2. What about access violations from kernel mode. On prior
> > systems, I've been able to use some sort of probe-like operation
> > that would allow me to test access to user memory BEFORE i try to
> > read the location so i would not get an acc vio in kernel
> > mode. Does linux have such a thing? Is an acc vio in kernel mode
> > a crash? If not, what happens.
>
> There exists a legacy function verify_area() which does this, and it
> must run in process context (it uses current->addr_limit.seg). However
> get_user replaces this because the kernel now uses exception handling;
Right so far.
> I
> believe what it does is to unwind the stack and return from the
> top-level driver method with -EFAULT should a bad page-fault be
> generated. [If this is so, I don't know how drivers are supposed to
> clean up]. Probably not what you want, but the rationale behind it is
> that EFAULT only occurs during program development (hopefully) so this
> scheme does not penalise programs that work.
It's processor exception handling, not C++-style exception
handling. No stack unwinding takes place. You handle EFAULT much as
any other error is handle in the kernel, with something like
if (get_user(...))
/* Uh oh, access violation */
return -EFAULT;
and all the magic happens inside get_user (Documentation/exception.txt
has the details).
> [snip]
I can't think of any really satisfactory solution for the original
poster's problem. Installing a timer that sends a signal to the
process seems like the right way to start: it will make sure that you
get a context switch to the process so you can play with its address
space, even on SMP; a much more robust approach than checking current
in various places. However, the drawback is that you can't handle
signals in the kernel without hacking on arch-specific code. SIGCHLD
is handled within the kernel in certain circumstances (see
arch/i386/kernel/signal.c), so it is possible. But not from a module.
It might be easier to use ptrace to inject appropriate signal handling
code into the user space of the target process.
David Wragg
------------------------------
From: "Anton North" <[EMAIL PROTECTED]>
Subject: SHLVL discrepancies
Date: Wed, 3 May 2000 14:45:57 -0400
When I am running one shell, my SHLVL environment variable is set to 1, and
increments by 1 for every other shell that I run, which makes sense.
However, if I look at the environ file in /proc/<pid_of_shell>, I see that
for the first instance of my shell, no SHLVL exists.
If I create a second shell, and check it's environ file in /proc, I find now
that SHLVL exists, and is set to 1. If I run a third shell, it gets set to
2, etc.
My question is why this confusing system? I want to run a script that will
kill wayward processes started by users, but _not_ terminate their original,
logged in shell. I thought to use the SHLVL's listed in the environ files in
/proc to do this, and want to make sure that this value is reliable.
It seems that this discrepancy might be a bug. If it's not, I'd appreciate
it if anyone has any information on why this is done this way, or what to do
about it. If you could send it to me via email too, that would be great ;-)
(I am running Redhat Linux 6.0)
Thanks
--
********************************************
Anton North
Technologist
CSAIT Department, Mohawk College
[EMAIL PROTECTED]
------------------------------
** 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
******************************