I think that helps a ton, thanks...
Kenneth Goodwin wrote:
-----Original Message-----
From: pam-list-bounces@xxxxxxxxxx
[mailto:pam-list-bounces@xxxxxxxxxx]On
Behalf Of Jason Gerfen
Sent: Friday, July 02, 2004 12:46 PM
To: Pluggable Authentication Modules
Subject: Code in C to make a module pause?
I am not sure if this is the right place to ask this
seeing as it is
more of programming question in response to how to make a
list of
system() calls pause()?
The reason I ask is because PAM works as a shared object
so
there is no
interaction with the user / keyboard (after the login
information is
passed) and I would like to use the pause() function to
require the
module to wait until a system() command has finished,
without the need
to fork the process.
I am presuming by system() that you are refering to the LIBC
system() subroutine
The system() subroutine call works by forking and execing
the command named as it's
string variable parameter passed as part of the call (ie
system("/bin/who"); )
It is a simple C library function.
the fork is required in order to execute the command
specified. The system() call itself waits
until the command requested exits. This is in effective the
pause() you wish.
You can't Pause true system calls like open(), fork(), AND
exec() at all.
If I understand your question, then in the code snipnet
below --
i = 0;
system("/bin/who");
i++;
"i" does not get incremented to 1 UNTIL the /bin/who command
has completely executed and returned control
back to the calling program. This appears to be the
behaviour you are asking for.
If you are doiung a FORK() call before calling System(),
then you are probably being redunant as system() does
not require you to fork() before calling it. It does that op
itself.
If you wish different behaviour for system(), then do a "man
system".
the man page has a source Code example of how to roll your
own system() subroutine.
Anyone accomplish this before?
--
Jason Gerfen
Student Computing Group
Marriott Library
University of Utah
(801) 585-9810
jason.Gerfen@xxxxxxxxxxxx
"...Sometimes I just yell at myself. And it
makes me sad, sometimes I make myself cry..."
~ My nephew Dawsyn
_______________________________________________
Pam-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/pam-list
_______________________________________________
Pam-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/pam-list
--
Jason Gerfen
Student Computing Group
Marriott Library
University of Utah
(801) 585-9810
jason.Gerfen@xxxxxxxxxxxx
"...Sometimes I just yell at myself. And it
makes me sad, sometimes I make myself cry..."
~ My nephew Dawsyn
_______________________________________________
Pam-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/pam-list