summaryrefslogtreecommitdiff
path: root/os/beos/os.c
blob: 0eb63fc5f966b534e3b4003bb9e4c41eda04e5fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * This file will include OS specific functions which are not inlineable.
 * Any inlineable functions should be defined in os ap_context_t nline.c instead.
 */

#include "ap_config.h"
#include "os.h"

int ap_os_is_path_absolute(const char *file)
{
  return file[0] == '/';
}

int ap_spawnvp(const char *file, char *const argv[])
{
    int pid;

    if ((pid = fork()) == -1) {
        return pid;
    } else if (pid == 0) {
        if (execvp(file, argv) == -1)
            return -1;
        else
            return -1;  /* If we get, we have a real error, but this keeps
                           us from getting a warning during compile time. */
    } else 
        return pid;
}


/* some linkers complain unless there's at least one function in each
 * .o file... and extra prototype is for gcc -Wmissing-prototypes
 */
extern void ap_is_not_here(void);
void ap_is_not_here(void) {}

/*
 *  Abstraction layer for loading
 *  Apache modules under run-time via 
 *  dynamic shared object (DSO) mechanism
 */

void ap_os_dso_init(void)
{
    /* Nothing required to be done! */ 
}

void* ap_os_dso_load(const char *path)
{
    return (void*) load_add_on(path);
}

void ap_os_dso_unload(void* handle)
{
    unload_add_on((image_id)handle);
}

void *ap_os_dso_sym(void *handle, const char *symname)
{
    void * retval = 0;
#if defined(DLSYM_NEEDS_UNDERSCORE)
    char *symbol = (char*)malloc(sizeof(char)*(strlen(symname)+2));
    sprintf(symbol, "_%s", symname);
    get_image_symbol((image_id)handle, symbol, B_SYMBOL_TYPE_ANY, (void **)&retval);
    free(symbol);
    return retval;
#endif
    get_image_symbol((image_id)handle, symname, B_SYMBOL_TYPE_ANY, (void **)&retval);
    return retval;
}

const char *ap_os_dso_error(void)
{
    return NULL;
}