[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

20.3 freem_init()

Initializes libfreem in preparation for calling other APIs.

Synopsis

pid_t freem_init(char *namespace_name);

Parameters

namespace_name

Specifies the namespace to use.

Return Values

Returns the process ID of the libfreem process on success, or -1 on failure.

Example

This example prompts the user to enter a FreeM namespace and then attempts to initialize libfreem to use the selected namespace.

#include <stdio.h>
#include <string.h>
#include <freem.h>

int main(int argc, char **argv, char **envp)
{
    char namespace[256];

    /* get the namespace name to use */
    printf("Enter FreeM namespace to use: ");
    fgets(namespace, 255, stdin);

    /* remove the trailing newline */
    namespace[strcspn(buffer, "\n")] = '\0';

    /* initialize libfreem using the provided namespace */
    if(freem_init(namespace) == TRUE) {
        printf("\nSuccess\n");
    }
    else {
        printf("\nFailure\n");
    }
     
    return 0;
}

[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by root on October 14, 2020 using texi2html 1.82.