2005-02-28 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / Mono.Posix / Mono.Unix / UnixEnvironment.cs
index 46a7df066c9dee278b1e05e0081f406453a80d92..8685766dd08259d570d1a57b30ff712cd5624875 100644 (file)
@@ -27,6 +27,7 @@
 //
 
 using System;
+using System.Collections;
 using System.Text;
 using Mono.Unix;
 
@@ -124,6 +125,33 @@ namespace Mono.Unix {
                        int r = Syscall.setgroups (list);
                        UnixMarshal.ThrowExceptionForLastErrorIf (r);
                }
+
+               public static int GetParentProcessId ()
+               {
+                       return Syscall.getppid ();
+               }
+               
+               public static UnixProcess GetParentProcess ()
+               {
+                       return new UnixProcess (GetParentProcessId ());
+               }
+
+               public static string[] GetUserShells ()
+               {
+                       ArrayList shells = new ArrayList ();
+
+                       try {
+                               Syscall.setusershell ();
+                               string shell;
+                               while ((shell = Syscall.getusershell ()) != null)
+                                       shells.Add (shell);
+                       }
+                       finally {
+                               Syscall.endusershell ();
+                       }
+
+                       return (string[]) shells.ToArray (typeof(string));
+               }
        }
 }