On Friday 10 June 2005 17:07, Bien wrote:
> > /me se~ thu+?. Nhu+ng /me nghi~: ne^'u ma` no' du`ng la.i ID cu~, thi` ta
> > du`ng le^.nh "kill" co' khi na`o kill nha^`m kho^ng? Vi' du., mo^.t
> > process
> > co' ID = 1000. Bi chu+` ta kill no', nhu+ng khi ta go~ le^.nh kill thi`
> > process do' dda~ tu+. ta('t va` (...) co' mo^.t process na`o ddo' la^'p
> > va`o,
> > nghi~ la` mo^.t process mo+'i cu~ng co' ID=1000 --- thi` saO? the^' la`
> > ta gie^'t oan mo^.t process a`?
>
> yes sir ! dda~ bi. mo^.t la^`n ro^`i !! ne^n hay du`ng pgrep dde^? kill,
> tuy nhie^n ca'ch sinh ra process id cu?a unix cu~ng la., ra^'t i't ga(.p
> tru+o+`ng ho+.p ddo' !!
>
A`, /me ko^ mong cho+` ca^u tra? lo+`i the^' na`y :(( Bo+?i vi`, /me ddang
vie^'t Winefish ( http://winefish.sf.net ) -- chu+o+ng tri`nh ddo^i khi go.i
chu+o+ng tri`nh ngoa`i va` ddo^i khi pha?i "KILL" (force) chu+o+ng tri`nh
ngoa`i ddo'. Tu'm la.i, Winefish pha?i qua?n ly' ID ca'c chu+o+ng tri`nh con
no' go.i. Bi chu+` ba'c no'i nhu+ the^', thi`i /me so+. qua', lo+~ khi na`o
gie^'t nha^`m thi` ...
/me theo do~i ca'ch la`m cu?a nhie^`u program. Tha^'y no' cu~ng ko^ co' ca'ch
xu+? ly' na`o dda(.c bie^.t. Du+o+'i dda^y la` ca'ch em la`m....
A`, co' pha?i du`ng "fork()" se~ gia?i qhuyeest ddu+o+jc mo.i chuye^.n ko^?
,----
| /* fork():
| create a child proccess the differs
| from the parent only in its PID and PPID;
| the resouce ultilisation are set to 0 */
`----
[code]
/* Taken from SciTTEGTK.cxx
kyanh: everything emitted from `running' will be captured [ 2>&1 ]
*/
static gint xsystem( const gchar *command, const gchar *outfile )
{
gint pid = 0;
/* fork():
create a child proccess the differs from the parent only in its PID and PPID;
the resouce ultilisation are set to 0 */
if ( ( pid = fork() ) == 0 ) {
close( 0 );
gint fh = open( outfile, O_WRONLY );
close( 1 );
dup( fh );
close( 2 );
dup( fh );
DEBUG_MSG( "xsystem: running now [%s]\n", command );
execlp( "/bin/sh", "sh", "-c", command, NULL );
exit( 127 );
}
return pid;
}
[/code]
To+'i gio+`i /me va^~n kho^ng hie^?u gi` he^'t :((
ky`anh
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
VietLUG-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vietlug-users