Linux-Misc Digest #538, Volume #27 Thu, 5 Apr 01 12:13:04 EDT
Contents:
Re: Linux: fork()'ing in a Secondary Thread - Process Control In-General (Lee Allen)
Re: how to dis-partition? (Bob Tennent)
accessing nfs'd partitions as root (ekk)
Re: OpenGL on Linux - can't find it ([EMAIL PROTECTED])
Re: Unusual mount problem ("Optiker")
Finding lc command (doug reeder)
Re: ask for help about chroot , thanks in advance. (Jeremiah DeWitt Weiner)
ppp pppissing me off (Mboso)
Re: Hylafax and vgetty, Anyone got it working?? (Craig Kelley)
Re: How to restart apache webserver on suse linux 7.1? ("Wong Ching Kuen Frederick")
----------------------------------------------------------------------------
From: [EMAIL PROTECTED] (Lee Allen)
Subject: Re: Linux: fork()'ing in a Secondary Thread - Process Control In-General
Reply-To: [EMAIL PROTECTED]
Date: Thu, 05 Apr 2001 14:57:56 GMT
The only light I can shed on your problem is this:
I compiled and ran it on a seemingly identical system to yours, and it
seems to run just fine.
The only change I made to the program is the 'ps' command -- I don't
have a 'nknight' so I changed it to my user 'lallen'.
I'm running RedHat 6.2 and the same kernel as you:
#uname -a
Linux netfinity 2.2.14-5.0smp #1 SMP \
Tue Mar 7 21:01:40 EST 2000 i686 unknown
I'm running as a normal user but get the same results as root.
Compile, command, and output are thus:
[lallen@netfinity lallen]$ cc -o ctest -lpthread ctest.c
[lallen@netfinity lallen]$ ./ctest
Before new thread:
forking ...
Waiting on PID: 1061
chaining ...
PID TTY TIME CMD
908 pts/0 00:00:00 bash
1060 pts/0 00:00:00 ctest
1061 pts/0 00:00:00 ps
status: 0
pt:pt
After thread start:
forking ...
getting char:
Waiting on PID: 1064
chaining ...
PID TTY TIME CMD
908 pts/0 00:00:00 bash
1060 pts/0 00:00:00 ctest
1062 pts/0 00:00:00 ctest
1063 pts/0 00:00:00 ctest
1064 pts/0 00:00:00 ps
status: 0
pt:px
(waits for me to press a key, then:)
[lallen@netfinity lallen]$
On Tue, 03 Apr 2001 12:08:15 -0400, "Nick Knight" <[EMAIL PROTECTED]>
wrote:
>Hi,
>
>This will probably be a long story, but I'll try to summarize it up front.
>
>I tried to get something that works fine on a host of other platforms
>(Win32, Solaris, HP, etc) to work under Linux. Basically, I need to be
>able to exec*() a bunch of processes and wait on them to return, using
>another thread. Optionally kill them, check to make sure they're still
>running, etc.
>
>OS is Redhat Linux, uname -a produces:
>
> Linux extest3.secant.com 2.2.14-5.0smp #1 SMP \
> Tue Mar 7 21:01:40 EST 2000 i686 unknown
>
>The problem in Linux, from what I've read, is that the calling thread is
>the "parent" and only IT can wait on or kill its children (and acquire
>status info). An example outline of a "fork server" was found in a
>newsgroup, and someone here tried this, but it never worked quite right.
>
>I created this test program to see if the "fork server" idea had any hope.
>Unless someone can point out the flaw in my thinking (or code :), I can't
>see this working reliably. What I list here is a massively simplified
>version of what I started with (which didn't work either :).
>
>Again, the main idea is to be able to check for, wait on or kill processes
>a program has started ... to MONITOR these processes in a background
>thread.
>
>I guess it might be possible to write a completely encapsulated server
>program that did noting but handle spawned processes and data about them.
>I think similar issues might occur, tho. And then, why would I have to
>write such a beast? Isn't this an OS function (again, what I need to do
>was possible on all other OS's supported ... just not Linux).
>
>To illustrate the basic problem, let me splice in a simple test program:
>
>#include <stdio.h>
>#include <unistd.h>
>#include <errno.h>
>
>#include <signal.h>
>#include <sys/wait.h>
>#include <fcntl.h>
>#include <pthread.h>
>
>extern char **environ;
>static pthread_t processThreadId= 0;
>
>// NOTE: Taken right off the man page for system() ...
>// use this so we can monitor what's happening.
>// printf's added.
>
>int my_system (const char *command)
>{
> int pid, status;
>
> if (command == 0)
> return 1;
> printf("forking ...\n");
> pid = fork();
> if (pid == -1)
> return -1;
> if (pid == 0) {
> char *argv[4];
> argv[0] = "sh";
> argv[1] = "-c";
> argv[2] = (char *)command;
> argv[3] = 0;
> printf("chaining ...\n");
> execve("/bin/sh", argv, environ);
> printf("Chaining failed!\n");
> exit(127);
> }
> do {
> printf("Waiting on PID: %d\n",pid);
> if (waitpid(pid, &status, 0) == -1)
> {
> printf("erc: %d\n",errno);
> if (errno != EINTR)
> return -1;
> } else
> {
> printf("status: %d\n",status);
> return status;
> }
> } while(1);
>}
>
>void *ProcessThread(void *arg)
>{
> printf("pt:pt\n");
> my_system("ps -u nknight");
> printf("pt:px\n");
> return 0;
>}
>
>int main()
>{
> printf("\nBefore new thread:\n\n");
>
> my_system("ps -u nknight");
>
> pthread_create(&processThreadId, 0, ProcessThread, 0);
>
> printf("\nAfter thread start:\n\n");
> fflush(stdout);
> printf("getting char:\n");
> getchar();
>
> return 0;
>}
>
>------------------------------------
>
>Ok, briefly (ha! I'm not so good at "briefly"!), the first "my_system"
>call works fine and produces a `ps` list to the screen. The same call,
>when made from a secondary thread, fails to do anything understandable.
>
>To add more detail, here are some narrated logs of the operation of this
>program:
>
> /home/nknight/ISL-3.6/baseset/gcc>./proctest
> ready
>
> Before new thread:
>
> forking ...
> Waiting on PID: 31817
> chaining ...
> PID TTY TIME CMD
> 17265 ? 00:00:02 smbd
> 26060 ? 00:00:00 xterm
> 26062 pts/0 00:00:00 bash
> 26314 ? 00:00:00 xterm
> 26316 pts/1 00:00:00 bash
> 31816 pts/0 00:00:00 proctest
> 31817 pts/0 00:00:00 ps
> status: 0
> pt:pt
> forking ...
>
> After thread start:
>
> getting char:
> Waiting on PID: 31820
>
>ok ... at this point, my main thread (inside main()) is waiting for me to
>press any keyboard char. The secondary thread has forked. The parent
>process is now waiting for the forked process to terminate by calling
>waitpid().
>
>But now, here's the interesting part. The above state will remain
>"forever" without any user-action being taken. The call I am intending to
>result in a quick "ps" never actually finished. Look at a 'ps' invoked
>from another window. Notice that pids 31820 is still listed a
>"proctest". ??????
>
> /home/nknight>ps -u nknight
> PID TTY TIME CMD
> 17265 ? 00:00:02 smbd
> 26060 ? 00:00:00 xterm
> 26062 pts/0 00:00:00 bash
> 26314 ? 00:00:00 xterm
> 26316 pts/1 00:00:00 bash
> 31816 pts/0 00:00:00 proctest
> 31818 pts/0 00:00:00 proctest
> 31819 pts/0 00:00:00 proctest
> 31820 pts/0 00:00:00 proctest
> 31821 pts/1 00:00:00 ps
>
>Again, everything seems to be waiting, and will remain waiting until I do
>something. *If* I press a keyboard char, proctest will terminate, but
>guess what? pid 31820 would remain in the process list until killed.
>
>Without pressing a key and after killing pid 31820 manually,
>the proctest screen looks like this:
>
> /home/nknight/ISL-3.6/baseset/gcc>./proctest
> ready
>
> Before new thread:
>
> forking ...
> Waiting on PID: 31817
> chaining ...
> PID TTY TIME CMD
> 17265 ? 00:00:02 smbd
> 26060 ? 00:00:00 xterm
> 26062 pts/0 00:00:00 bash
> 26314 ? 00:00:00 xterm
> 26316 pts/1 00:00:00 bash
> 31816 pts/0 00:00:00 proctest
> 31817 pts/0 00:00:00 ps
> status: 0
> pt:pt
> forking ...
>
> After thread start:
>
> getting char:
> Waiting on PID: 31820
> status: 15
> pt:px
>
>Now, this is good. It shows that my waitpid() on my spawned child *did*
>come back as designed. I just don't know why this process failed to start
>properly, or end by itself. The "pt:px" says we've returned from the
>wait inside the secondary thread.
>
>and a ps in another window shows:
>
> /home/nknight>ps -u nknight
> PID TTY TIME CMD
> 26060 ? 00:00:00 xterm
> 26062 pts/0 00:00:00 bash
> 26314 ? 00:00:00 xterm
> 26316 pts/1 00:00:00 bash
> 31816 pts/0 00:00:00 proctest
> 31818 pts/0 00:00:00 proctest
> 31836 pts/1 00:00:00 ps
>
>Note the TWO proctest's still running. These do disappear after pressing
>a key and having proctest terminate "normally".
>
>Summary. Since I make the same exact call, one from the main thread,
>another from a secondary thread, and since the main thread works and the
>secondary thread's call doesn't, something's wrong with forking/exec'ing
>from a second thread. Right? :)
>
>Can anyone shed light in this issue? Thanks in advance for your help.
>
>Nick
>--
>-----------------------------------------------------------
>Nick Knight <[EMAIL PROTECTED]> http://nick.secant.com
>Senior Software Engineer
>Secant Technologies, Inc. http://www.secant.com
>-----------------------------------------------------------
>
------------------------------
From: [EMAIL PROTECTED] (Bob Tennent)
Crossposted-To: comp.os.linux.setup
Subject: Re: how to dis-partition?
Date: 5 Apr 2001 14:59:57 GMT
Reply-To: [EMAIL PROTECTED]
On Thu, 5 Apr 2001 02:52:28 -0700, ekkis wrote:
>so I have the problem that I have too much space on some and not enough on
>others... it's difficult and inconvenient to have to figure out how much
>space I need so I'd like to mae all these just one: /.
>
>since a dump/repartition/restore would be difficult for me because I don't
>have an easy way to dump, can anyone suggest a way to join all these
>partitions into one?
You may not have enough "slack" to do this. But parted will allow you to "edit"
partitions somewhat. Use it off a boot disk.
------------------------------
From: ekk <[EMAIL PROTECTED]>
Subject: accessing nfs'd partitions as root
Date: Thu, 05 Apr 2001 11:03:49 -0400
Hello,
I want root to be able to read the data on my disks mounted through
nfs. I am surprised that I am having so much trouble, but here's what
I do:
(as root): mount -t nfs clinton:/usr2 nfs
cd nfs
ls -al
and this is what I get:
[root@tornado nfs]# ls -al
total 0
if I exit and return to my normal user and cd nfs, I can see the data
without any problem, as usual. What do I need to do to make root be
able to see the data also? I've experimented a little with
/etc/exports, but I haven't been able to get anything to work.
Thank you,
Ken
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: OpenGL on Linux - can't find it
Date: Thu, 05 Apr 2001 15:26:48 GMT
Bart Friederichs <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
>>
>> Bart Friederichs <[EMAIL PROTECTED]> wrote:
>> > Yes, I have a Diamond MonsterFusion (3dfx banshee chipset)
>> OK... Now we're getting somewhere :-) What version of X are you
>> using? I'm not familiar with Slackware 7.1, so I don't know what it ships
>> with.
>>
>> Most likely, it's 3.3.6 since Slackeware prides itself on it's stability, IIRC.
> Yes, it's 3.3.6.
> [ btw: what does IIRC mean? ]
If I Recall Correctly :-)
>> Your other option is to upgrade your version of XFree86 to 4.0.*, which
>> contains 3D support for your card. That might be your best option.
> I think I'll try that anyway. Thanks.
If you do upgrade to 4.0.* there are other things you'll need: ie. the
tdfx.o kernel module and a DRI compatible version of Glide (available
already compiled somewhere on http://dri.sourceforge.net)
>>
>> Confused yet? :-)
> I am not that easily confusable (is that an english word ? ;))
I think so :-)
Good luck.
Adam
------------------------------
From: "Optiker" <[EMAIL PROTECTED]>
Crossposted-To:
comp.os.linux.questions,comp.os.linux.help,comp.os.linux.redhat,comp.os.linux.setup,linux.redhat.misc,linux.redhat.install
Subject: Re: Unusual mount problem
Date: Thu, 5 Apr 2001 08:30:39 -0700
Davide...
I am a real newbie with Linux so have some very basic questions. I am
running RH7 and KDE. Linux is dualbooted with Win2000Pro on a Micron 1.2 GHz
Athlon. What do I need to do to be able to read files on my Win2000 NTFS
partition from my Linux partition? When I use File Manager in KDE I see
several drives mounted - CD, floppy, Zip, but if I insert a Zip cartridge,
for example, don't see anything on it. I also have a Jaz drive that I don't
see in File Manager, and I also don't see - or at least don't know where to
look for - my Win2000 partition.
RH7 was installed by my company's Unix/Linux tech, so I am not really up to
speed yet on it. He's good, but he's not a teacher.
I haven't done anything about mounting anything that isn't already mounted.
I've read a little about autofs, but don't really know if it's on my
machine, or if it is, how to use it. I barely understand the Linux file
system. I am a pretty experienced DOS/Win user, but never used Linux/UNIX
before, so am just getting started.
Can you give me any specific instructions as to how to access my Win2000
partition (and also shared network drives) from Linux? I do understand that
NTFS is read-only at this time, but that's OK for now.
Thanks!
Optiker
<[EMAIL PROTECTED]> wrote in message
news:9ah1b0$5675b$[EMAIL PROTECTED]...
> In comp.os.linux.setup Dennis Bayrock
<[EMAIL PROTECTED]> wrote:
> > 2. When I run MC and try to view the same partition - I can't see
> > ANYTHING (Yes I am navigating to the right place in the filesystem)
> > 3. When I exit MC and run X (Gnome 1.0) - I still can't see anything
with
> > GMC.
>
> Well, since it's working in the console I think that the mount
> is working well. Maybe is a problem related to MC/Gnome, but
> I can't see a way to solve it.
>
> BTW, I have an NTFS partition on my machine and I can see it
> in KDE, so maybe is a problem of Gnome.
>
> Davide
------------------------------
From: [EMAIL PROTECTED] (doug reeder)
Subject: Finding lc command
Date: 5 Apr 2001 15:34:30 GMT
I'm trying to find a copy of the lc command, which is similar to ls, but
divides the files by category. I couldn't find it searching sunsite, tsx-11,
funet, Debian, RedHat, or Slackware.
Any suggestions as to where it might be found?
--
P. Douglas Reeder Lecturer, Dept. Computer/Info. Science, Ohio State Univ.
[EMAIL PROTECTED] http://www.cis.ohio-state.edu/~reeder/reeder.html
GE/S d+ s+:- a C+@$ UH+ P+ L E W++ N+ o? K? w !O M+ V PS+() PE Y+ PGP- t 5+ !X
R>+ tv+ b+++>$ DI+ D- G e+++ h r+>+++ y+>++
--
P. Douglas Reeder Lecturer, Dept. Computer/Info. Science, Ohio State Univ.
[EMAIL PROTECTED] http://www.cis.ohio-state.edu/~reeder/reeder.html
GE/S d+ s+:- a C+@$ UH+ P+ L E W++ N+ o? K? w !O M+ V PS+() PE Y+ PGP- t 5+ !X
R>+ tv+ b+++>$ DI+ D- G e+++ h r+>+++ y+>++
------------------------------
From: Jeremiah DeWitt Weiner <[EMAIL PROTECTED]>
Subject: Re: ask for help about chroot , thanks in advance.
Date: 5 Apr 2001 15:40:09 GMT
harrison <[EMAIL PROTECTED]> wrote:
> My Question is :
> Provide user a unix/linux shell account and a home directory, for
> security reason,
> after logging into the system, he can traverse no other system directories
> but his own homedirectory(all the file and dirs under his HOME DIRECTORY).
> What i Have done is :
> sudo chroot $HOMEDIRECTORY /bin/sh
*sigh* Why is everybody so gonzo about chroot these days? Seems
like everywhere I look it's "how do I chroot this?" and "how do I chroot
that?" Chroot is neat and useful, but it's not a magic security wand.
For what you want, harrison, "rbash" is almost certainly better
and easier. Do "man bash" and look for "RESTRICTED SHELL" or "rbash".
JDW
------------------------------
From: Mboso <[EMAIL PROTECTED]>
Subject: ppp pppissing me off
Date: Thu, 5 Apr 2001 11:39:53 -0400
hey, i'm trying to set up my internet connection through ppp. i'm using
Calder without a GUI or X (wanted to learn how everything works before i
switch over). the Calera book and gaggle of white pages i downloaded don't
really do much in the way of explaining chat scripts indepth. they just
give abstract examples and say do this and this. could any one give me a
little insight into how chat scripts work or point me to a decnt white
page or website. i'd appreciate it... Thanks
ME
------------------------------
From: Craig Kelley <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.setup,comp.os.linux.admin
Subject: Re: Hylafax and vgetty, Anyone got it working??
Date: 05 Apr 2001 09:53:52 -0600
"Anthony Childers" <[EMAIL PROTECTED]> writes:
> I have spent days trying to set-up my linux machine to serve as a fax and
> answering machine. I have been mostly successful but I am still having a
> problem with vgetty.
>
> Let me explain my set-up. My linux machine is running Red Hat 6.1. I have a
> single telephone line with distinctive ring. The single ring (RING A) is for
> voice calls and the double ring (RING B) is for fax calls.
>
> I am using HylaFAX to handle the incomming calls and receive the faxes. I am
> trying to setup vgetty to take care of the answering machine part.
>
> Hylafax (actually faxgetty) is able to recognize RING A and RING B just
> fine. In fact the fax part is working fine.
>
> The problem is when I get RING A and try to execute vgetty. Vgetty is
> executed with the command line arguments specified by VGettyArgs in the
> config file. I have specified only the device (/dev/ttyS2). So vgetty gets
> executed like this:
>
> /bin/vgetty /dev/ttyS2
>
> For some reason, it does not work. I suspect the problem is with the
> arguments that I am passing (or need to pass) to vgetty.
>
> Does anyone have this working?! If so, please share your config file with
> us.
I do this for computer logins (not voice) -- we use mgetty, which
faxgetty calls just fine if the call isn't a fax.
--
It won't be long before the CPU is a card in a slot on your ATX videoboard
Craig Kelley -- [EMAIL PROTECTED]
http://www.isu.edu/~kellcrai finger [EMAIL PROTECTED] for PGP block
------------------------------
From: "Wong Ching Kuen Frederick" <[EMAIL PROTECTED]>
Subject: Re: How to restart apache webserver on suse linux 7.1?
Date: Fri, 6 Apr 2001 00:10:30 +0800
apachectl restart or apachectl graceful
"Jan Vandesompele" <[EMAIL PROTECTED]> ���g��l��
news:9ahe9c$5n7$[EMAIL PROTECTED]...
> Hello,
>
> I recently installed Suse7.1 on my system. Since I'm used to work with
> Redhat or Mandrake, I don't know how to restart my httpd daemon. In other
> distro's you can do so with:
> /etc/rc.d/init.d/httpd restart
> but in suse this script does not exist.
> Does anyone know how I can do this?
> Thanx
>
>
>
====== Posted via Newsfeeds.Com, Uncensored Usenet News ======
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
======= Over 80,000 Newsgroups = 16 Different Servers! ======
------------------------------
** 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 by posting to comp.os.linux.misc.
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-Misc Digest
******************************