It seems like the browser you are using has JavaScript disabled. As a result, the site will not function properly. We really want you to enable it so you may experience our site as we intended it. If you have no idea what we are talking about or if you need help, visit http://www.enable-javascript.com×
This website uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Find out more on our cookie page.×

Oops, it seems like you're using an old browser that we do not fully support. If you're able to, please upgrade your browser here.×
This website uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Find out more on our cookie page.×

Synopsis:

Since:

Arguments:

How you want to load the child process, and how you want the parent
program to behave after the child program is initiated:

P_WAIT — load the child program into available
memory, execute it, and make the parent program resume execution after
the child process ends.

P_NOWAIT — execute the parent program
concurrently with the new child process.

P_NOWAITO — execute the parent program
concurrently with the new child process.
You can't use
wait()
to obtain the exit code.

P_OVERLAY — replace the parent program with
the child program in memory and execute the child.
No return is made to the parent program.
This is equivalent to calling the appropriate exec*()
function.

file

The name of the executable file.
If this argument contains a slash, it's used as the pathname of the
executable; otherwise, the function searches for file in the
directories listed in the PATH environment variable.

argv

A pointer to an argument vector; this argument can't be
NULL.
The value in argv[0] can't be NULL, and
should represent the filename of the program being loaded.
The last member of argvmust be a NULL
pointer.

envp

NULL, or a pointer to an array of character pointers,
each pointing to a string that defines an environment variable.
The array is terminated with a NULL pointer.
Each pointer points to a character string of the form:

variable=value

that's used to define an environment variable.

Library:

libc

Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.

Description:

The spawnvpe() function creates and executes a new child process,
named in file with the NULL-terminated list of arguments
in the argv vector.

In order to create a child process, your process must have the
PROCMGR_AID_SPAWN ability enabled.
For more information, see
procmgr_ability().

If the new child process is a shell script, the first line must
start with #!, followed by the path of the
program to run to interpret the script, optionally followed by one argument. The
script must also be marked as executable. For more information, see "
The first line
" in the Writing Shell Scripts chapter of the BlackBerry 10 OSUser's Guide.

The spawnvpe() function isn't a POSIX 1003.1 function,
and isn't guaranteed to behave the same on all operating systems.
It calls spawnp().
For greater portability, use
posix_spawn().

Most of the spawn*() functions do a lot of work before
a message is sent to
procnto:

If the value of envp is NULL, then the child process
inherits the environment of the parent process.
The new process can access its environment by using the
environ
global variable (found in <unistd.h>).

The following arguments are passed to the underlying call
(spawnp()):

spawnvpe(mode, file, argv, envp)

Map attribute flags.

Create temporary attribute structure and set the
flags member based on the mode:

0 if mode = P_WAIT/P_NOWAIT

SPAWN_EXEC if mode = P_OVERLAY

SPAWN_NOZOMBIE if mode = P_NOWAITO

Call spawnp(file, 0, 0, attr, argv, envp).

A parent/child relationship doesn't imply that the child process dies when the parent process dies.

Returns:

The spawnvpe() function's return value depends on the mode argument:

mode

Return value

P_WAIT

The exit status of the child process.
For information about macros that extract information from this status, see
"
Status macros
"
in the documentation for wait().

P_NOWAIT

The process ID of the child process.
To get the exit status for a P_NOWAIT process, you must use the
waitpid() function,
giving it this process ID.

P_NOWAITO

The process ID of the child process, or 0 if the process is being started on a remote node.
You cannot get the exit status of a P_NOWAITO process.

Errors:

The number of bytes used by the argument list or environment list of the new child process
is greater than ARG_MAX bytes.

EACCES

Search permission is denied for a directory listed in the path prefix
of the new child process or the new child process file doesn't have the execute bit set.

EAGAIN

Insufficient resources available to create the child process.

EBADF

An error occurred duplicating open file descriptors to the new process.

ECHILD

The mode is P_WAIT, and the spawned
process terminated before the call to waitpid() was completed.

EFAULT

One of the buffers specified in the function call is invalid.

EINTR

The function was interrupted by a signal.

EINVAL

An argument is invalid (e.g. arg0 is NULL, or
the value of mode isn't valid).

ELOOP

Too many levels of symbolic links or prefixes.

EMFILE

Insufficient resources available to load the new executable
image or to remap file descriptors in the child process.

ENAMETOOLONG

The length of file plus its path exceeds PATH_MAX or a
pathname component is longer than NAME_MAX.

ENOENT

The file identified by the file argument is empty,
or one or more components of the pathname of the child process don't exist.

ENOEXEC

The child process file has the correct permissions, but isn't in the correct format for an executable.

ENOMEM

Insufficient memory available to create the child process.

ENOSYS

The spawnvpe() function isn't implemented for the filesystem specified in file.

ENOTDIR

A component of the path prefix of the child process isn't a directory.

EPERM

The calling process doesn't have the required permission (see
procmgr_ability()),
or an underlying call to
mmap()
failed because it attempted to set PROT_EXEC for a region of memory covered by
an untrusted memory-mapped file.

ETXTBSY

The text file that you're trying to execute is busy (e.g. it might
be open for writing).

1. Download the tools

Before you start developing, you'll need to visit the Downloads tab. Here you'll find downloads for the BlackBerry 10 Native SDK, BlackBerry 10 Device Simulator, and some other useful tools.

2. Try the sample apps

Now featuring a filter control, the Sample apps tab allows you to search for samples by name or by feature.

Select either the Core or Cascades radio buttons to display the samples relevant to you.

3. Educate yourself

The Documentation tab contains tons of examples, tutorials, and best practices to guide you along the path towards building an awesome app.

You can access all the documentation that you need in the left-hand navigation.

4. Start developing

The Reference tab is where you'll find essential details about how to use our APIs.

You can use the left-hand navigation to choose how you would like to browse the reference: by module, by topic, or alphabetically. If you have an idea of what you are looking for, start typing it in the Filter box.