Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3cf4387 authored by Elliott Hughes's avatar Elliott Hughes
Browse files

Build init as C++.

This is just the minimal change to keep it building.

Change-Id: I245c5b8413a1db114576c81462eb5737f5ffcef2
parent 5204b158
Loading
Loading
Loading
Loading
+18 −19
Original line number Diff line number Diff line
@@ -4,36 +4,35 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_SRC_FILES:= \
	builtins.c \
	init.c \
	devices.c \
	property_service.c \
	util.c \
	parser.c \
	keychords.c \
	signal_handler.c \
	init_parser.c \
	ueventd.c \
	ueventd_parser.c \
	watchdogd.c

LOCAL_CFLAGS += \
    -std=gnu11 \
    builtins.cpp \
    devices.cpp \
    init.cpp \
    init_parser.cpp \
    keychords.cpp \
    parser.cpp \
    property_service.cpp \
    signal_handler.cpp \
    ueventd.cpp \
    ueventd_parser.cpp \
    util.cpp \
    watchdogd.cpp \

LOCAL_CPPFLAGS += \
    -Wall \
    -Werror -Wno-error=deprecated-declarations \
    -Wno-unused-parameter \

ifeq ($(strip $(INIT_BOOTCHART)),true)
LOCAL_SRC_FILES += bootchart.c
LOCAL_CFLAGS    += -DBOOTCHART=1
LOCAL_SRC_FILES += bootchart.cpp
LOCAL_CPPFLAGS  += -DBOOTCHART=1
endif

ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
LOCAL_CFLAGS += -DALLOW_LOCAL_PROP_OVERRIDE=1 -DALLOW_DISABLE_SELINUX=1
LOCAL_CPPFLAGS += -DALLOW_LOCAL_PROP_OVERRIDE=1 -DALLOW_DISABLE_SELINUX=1
endif

# Enable ueventd logging
#LOCAL_CFLAGS += -DLOG_UEVENTS=1
#LOCAL_CPPFLAGS += -DLOG_UEVENTS=1

LOCAL_MODULE:= init

+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "bootchart.h"

+4 −3
Original line number Diff line number Diff line
@@ -53,7 +53,8 @@

int add_environment(const char *name, const char *value);

extern int init_module(void *, unsigned long, const char *);
// System call provided by bionic but not in any header file.
extern "C" int init_module(void *, unsigned long, const char *);

static int write_file(const char *path, const char *value)
{
@@ -674,7 +675,7 @@ int do_powerctl(int nargs, char **args)
    int res;
    int len = 0;
    int cmd = 0;
    char *reboot_target;
    const char *reboot_target;

    res = expand_props(command, args[1], sizeof(command));
    if (res) {
@@ -776,7 +777,7 @@ int do_copy(int nargs, char **args)
    if ((fd2 = open(args[2], O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0660)) < 0)
        goto out_err;

    if (!(buffer = malloc(info.st_size)))
    if (!(buffer = (char*) malloc(info.st_size)))
        goto out_err;

    p = buffer;
+5 −5
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ int add_dev_perms(const char *name, const char *attr,
                  mode_t perm, unsigned int uid, unsigned int gid,
                  unsigned short prefix,
                  unsigned short wildcard) {
    struct perm_node *node = calloc(1, sizeof(*node));
    struct perm_node *node = (perm_node*) calloc(1, sizeof(*node));
    if (!node)
        return -ENOMEM;

@@ -289,7 +289,7 @@ static void add_platform_device(const char *path)

    INFO("adding platform device %s (%s)\n", name, path);

    bus = calloc(1, sizeof(struct platform_node));
    bus = (platform_node*) calloc(1, sizeof(struct platform_node));
    bus->path = strdup(path);
    bus->path_len = path_len;
    bus->name = bus->path + (name - path);
@@ -450,7 +450,7 @@ static char **get_character_device_symlinks(struct uevent *uevent)
    if (!pdev)
        return NULL;

    links = malloc(sizeof(char *) * 2);
    links = (char**) malloc(sizeof(char *) * 2);
    if (!links)
        return NULL;
    memset(links, 0, sizeof(char *) * 2);
@@ -512,7 +512,7 @@ static char **get_block_device_symlinks(struct uevent *uevent)
        return NULL;
    }

    char **links = malloc(sizeof(char *) * 4);
    char **links = (char**) malloc(sizeof(char *) * 4);
    if (!links)
        return NULL;
    memset(links, 0, sizeof(char *) * 4);
@@ -668,7 +668,7 @@ static inline void __attribute__((__deprecated__)) kernel_logger()

static void handle_generic_device_event(struct uevent *uevent)
{
    char *base;
    const char *base;
    const char *name;
    char devpath[DEVPATH_LEN] = {0};
    char **links = NULL;
+1 −0
Original line number Diff line number Diff line
@@ -26,4 +26,5 @@ extern int add_dev_perms(const char *name, const char *attr,
                         unsigned int gid, unsigned short prefix,
                         unsigned short wildcard);
int get_device_fd();

#endif	/* _INIT_DEVICES_H */
Loading