ds_create()

create a data server variable

Synopsis:

#include <ds.h>

int ds_create( ds_t dsdes,
               char *variable_name,
               char flags, 
               struct sigevent *sigevent );

Description:

The ds_create() function creates a variable, whose name is given by variable_name, on the data server identified by dsdes. The flags argument is used to specify the variable's behavior. The following flag constant is defined:

DS_PERM
Don't delete the variable when the application that created it terminates. The variable is removed when the data server process terminates, or if the flag is turned off after the application that created the variable terminates.

If flags is 0, the variable is removed if you call ds_deregister() or the process terminates.

All variables are global, so only one instance of the variable can exist in the data server process. The maximum length of a variable name is 60 characters.

If the data referenced by variable_name changes, a proxy or signal can be sent to the external application that created variable_name (see ds_set()).

The sigevent structure pointed to by sigevent contains at least:

int sigev_signo
If sigev_signo is positive, it's interpreted as a signal. If it's negative, it's interpreted as a proxy.

To display the current value of a variable on an HTML page, use the qnxvar token with the read tag. See the description of slinger in the TCP/IP User's Guide.

Returns:

0
Success.
-1
An error occurred; errno is set.

Errors:

EEXIST
The variable name already exists in the data server.
ENOMEM
Not enough memory to create the variable or initialize the data.

Examples:

See the Writing Data Server Applications chapter.

Classification:

QNX

Safety:
Interrupt handler No
Signal handler Yes, but modifies errno
Thread Yes

See also:

ds_flags(), ds_get(), ds_register(), ds_set()