FileDocCategorySizeDatePackage
Zygote.javaAPI DocAndroid 1.5 API4934Wed May 06 22:41:02 BST 2009dalvik.system

Zygote

public class Zygote extends Object
Provides access to the Dalvik "zygote" feature, which allows a VM instance to be partially initialized and then fork()'d from the partially initialized state.
since
Android 1.0

Fields Summary
public static final int
DEBUG_ENABLE_DEBUGGER
enable debugging over JDWP
public static final int
DEBUG_ENABLE_CHECKJNI
enable JNI checks
public static final int
DEBUG_ENABLE_ASSERT
enable Java programming language "assert" statements
Constructors Summary
private Zygote()


      
Methods Summary
public static native intfork()
Forks a new Zygote instance, but does not leave the zygote mode. The current VM must have been started with the -Xzygote flag. The new child is expected to eventually call forkAndSpecialize()

return
0 if this is the child, pid of the child if this is the parent, or -1 on error

public static native intforkAndSpecialize(int uid, int gid, int[] gids, int debugFlags, int[][] rlimits)
Forks a new VM instance. The current VM must have been started with the -Xzygote flag. NOTE: new instance keeps all root capabilities. The new process is expected to call capset().

param
uid the UNIX uid that the new process should setuid() to after fork()ing and and before spawning any threads.
param
gid the UNIX gid that the new process should setgid() to after fork()ing and and before spawning any threads.
param
gids null-ok; a list of UNIX gids that the new process should setgroups() to after fork and before spawning any threads.
param
debugFlags bit flags that enable debugging features.
param
rlimits null-ok an array of rlimit tuples, with the second dimension having a length of 3 and representing (resource, rlim_cur, rlim_max). These are set via the posix setrlimit(2) call.
return
0 if this is the child, pid of the child if this is the parent, or -1 on error.

public static intforkAndSpecialize(int uid, int gid, int[] gids, boolean enableDebugger, int[][] rlimits)
Forks a new VM instance.

deprecated
use {@link Zygote#forkAndSpecialize(int, int, int[], int, int[][])}

        int debugFlags = enableDebugger ? DEBUG_ENABLE_DEBUGGER : 0;
        return forkAndSpecialize(uid, gid, gids, debugFlags, rlimits);
    
public static native intforkSystemServer(int uid, int gid, int[] gids, int debugFlags, int[][] rlimits)
Special method to start the system server process. In addition to the common actions performed in forkAndSpecialize, the pid of the child process is recorded such that the death of the child process will cause zygote to exit.

param
uid the UNIX uid that the new process should setuid() to after fork()ing and and before spawning any threads.
param
gid the UNIX gid that the new process should setgid() to after fork()ing and and before spawning any threads.
param
gids null-ok; a list of UNIX gids that the new process should setgroups() to after fork and before spawning any threads.
param
debugFlags bit flags that enable debugging features.
param
rlimits null-ok an array of rlimit tuples, with the second dimension having a length of 3 and representing (resource, rlim_cur, rlim_max). These are set via the posix setrlimit(2) call.
return
0 if this is the child, pid of the child if this is the parent, or -1 on error.

public static intforkSystemServer(int uid, int gid, int[] gids, boolean enableDebugger, int[][] rlimits)
Special method to start the system server process.

deprecated
use {@link Zygote#forkSystemServer(int, int, int[], int, int[][])}

        int debugFlags = enableDebugger ? DEBUG_ENABLE_DEBUGGER : 0;
        return forkAndSpecialize(uid, gid, gids, debugFlags, rlimits);