Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/system/Basis/Implementation/Unix/unix.sig
ViewVC logotype

Annotation of /sml/trunk/src/system/Basis/Implementation/Unix/unix.sig

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1426 - (view) (download) (as text)

1 : monnier 416 (* unix.sig
2 :     *
3 :     * COPYRIGHT (c) 1995 AT&T Bell Laboratories.
4 :     *
5 :     *)
6 : mblume 1426 signature UNIX = sig
7 : monnier 416
8 :     type proc
9 : mblume 1426 (*
10 :     type ('a, 'b) proc
11 : monnier 416
12 : mblume 1426 type signal
13 :    
14 :     datatype exit_status =
15 :     W_EXITED
16 :     | W_EXITSTATUS of Word8.word
17 :     | W_SIGNALED of signal
18 :     | W_STOPPED of signal
19 :    
20 :     val fromStatus : OS.Process.status -> exit_status
21 :     *)
22 :    
23 : monnier 416 (* executeInEnv (path, args, env)
24 :     * forks/execs new process given by path
25 :     * The new process will have environment env, and
26 :     * arguments args prepended by the last arc in path
27 :     * (following the Unix convention that the first argument
28 :     * is the command name).
29 :     * Returns an abstract type proc, which represents
30 :     * the child process plus streams attached to the
31 :     * the child process stdin/stdout.
32 :     *
33 :     * Simple command searching can be obtained by using
34 :     * executeInEnv ("/bin/sh", "-c"::args, env)
35 :     *)
36 :     val executeInEnv : string * string list * string list -> proc
37 :    
38 :     (* execute (path, args)
39 :     * = executeInEnv (path, args, Posix.ProcEnv.environ())
40 :     *)
41 :     val execute : string * string list -> proc
42 :    
43 :     (* streamsOf proc
44 :     * returns an instream and outstream used to read
45 :     * from and write to the stdout and stdin of the
46 :     * executed process.
47 :     *
48 :     * The underlying files are set to be close-on-exec.
49 :     *)
50 :     val streamsOf : proc -> TextIO.instream * TextIO.outstream
51 :    
52 :     (* reap proc
53 :     * This closes the associated streams and waits for the
54 :     * child process to finish, returns its exit status.
55 :     *
56 :     * Note that even if the child process has already exited,
57 :     * so that reap returns immediately,
58 :     * the parent process should eventually reap it. Otherwise,
59 :     * the process will remain a zombie and take a slot in the
60 :     * process table.
61 :     *)
62 :     val reap : proc -> Posix.Process.exit_status
63 :    
64 :     (* kill (proc, signal)
65 :     * sends the Posix signal to the associated process.
66 :     *)
67 :     val kill : proc * Posix.Signal.signal -> unit
68 :    
69 :     end
70 :    
71 :    

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0