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

Commit 890cd997 authored by Nick Kralevich's avatar Nick Kralevich Committed by android-build-merger
Browse files

Merge "more O_CLOEXEC"

am: 920d637d

* commit '920d637d':
  more O_CLOEXEC
parents 5508d14d 920d637d
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -74,7 +74,7 @@ Looper::Looper(bool allowNonCallbacks) :
        mAllowNonCallbacks(allowNonCallbacks), mSendingMessage(false),
        mAllowNonCallbacks(allowNonCallbacks), mSendingMessage(false),
        mPolling(false), mEpollFd(-1), mEpollRebuildRequired(false),
        mPolling(false), mEpollFd(-1), mEpollRebuildRequired(false),
        mNextRequestSeq(0), mResponseIndex(0), mNextMessageUptime(LLONG_MAX) {
        mNextRequestSeq(0), mResponseIndex(0), mNextMessageUptime(LLONG_MAX) {
    mWakeEventFd = eventfd(0, EFD_NONBLOCK);
    mWakeEventFd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
    LOG_ALWAYS_FATAL_IF(mWakeEventFd < 0, "Could not make wake event fd: %s",
    LOG_ALWAYS_FATAL_IF(mWakeEventFd < 0, "Could not make wake event fd: %s",
                        strerror(errno));
                        strerror(errno));


+7 −7
Original line number Original line Diff line number Diff line
@@ -230,7 +230,7 @@ static int pid_remove(int pid) {
}
}


static void writefilestring(char *path, char *s) {
static void writefilestring(char *path, char *s) {
    int fd = open(path, O_WRONLY);
    int fd = open(path, O_WRONLY | O_CLOEXEC);
    int len = strlen(s);
    int len = strlen(s);
    int ret;
    int ret;


@@ -487,7 +487,7 @@ static int zoneinfo_parse(struct sysmeminfo *mip) {


    memset(mip, 0, sizeof(struct sysmeminfo));
    memset(mip, 0, sizeof(struct sysmeminfo));


    fd = open(ZONEINFO_PATH, O_RDONLY);
    fd = open(ZONEINFO_PATH, O_RDONLY | O_CLOEXEC);
    if (fd == -1) {
    if (fd == -1) {
        ALOGE("%s open: errno=%d", ZONEINFO_PATH, errno);
        ALOGE("%s open: errno=%d", ZONEINFO_PATH, errno);
        return -1;
        return -1;
@@ -518,7 +518,7 @@ static int proc_get_size(int pid) {
    ssize_t ret;
    ssize_t ret;


    snprintf(path, PATH_MAX, "/proc/%d/statm", pid);
    snprintf(path, PATH_MAX, "/proc/%d/statm", pid);
    fd = open(path, O_RDONLY);
    fd = open(path, O_RDONLY | O_CLOEXEC);
    if (fd == -1)
    if (fd == -1)
        return -1;
        return -1;


@@ -541,7 +541,7 @@ static char *proc_get_name(int pid) {
    ssize_t ret;
    ssize_t ret;


    snprintf(path, PATH_MAX, "/proc/%d/cmdline", pid);
    snprintf(path, PATH_MAX, "/proc/%d/cmdline", pid);
    fd = open(path, O_RDONLY);
    fd = open(path, O_RDONLY | O_CLOEXEC);
    if (fd == -1)
    if (fd == -1)
        return NULL;
        return NULL;
    ret = read_all(fd, line, sizeof(line) - 1);
    ret = read_all(fd, line, sizeof(line) - 1);
@@ -686,19 +686,19 @@ static int init_mp(char *levelstr, void *event_handler)
    struct epoll_event epev;
    struct epoll_event epev;
    int ret;
    int ret;


    mpfd = open(MEMCG_SYSFS_PATH "memory.pressure_level", O_RDONLY);
    mpfd = open(MEMCG_SYSFS_PATH "memory.pressure_level", O_RDONLY | O_CLOEXEC);
    if (mpfd < 0) {
    if (mpfd < 0) {
        ALOGI("No kernel memory.pressure_level support (errno=%d)", errno);
        ALOGI("No kernel memory.pressure_level support (errno=%d)", errno);
        goto err_open_mpfd;
        goto err_open_mpfd;
    }
    }


    evctlfd = open(MEMCG_SYSFS_PATH "cgroup.event_control", O_WRONLY);
    evctlfd = open(MEMCG_SYSFS_PATH "cgroup.event_control", O_WRONLY | O_CLOEXEC);
    if (evctlfd < 0) {
    if (evctlfd < 0) {
        ALOGI("No kernel memory cgroup event control (errno=%d)", errno);
        ALOGI("No kernel memory cgroup event control (errno=%d)", errno);
        goto err_open_evctlfd;
        goto err_open_evctlfd;
    }
    }


    evfd = eventfd(0, EFD_NONBLOCK);
    evfd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
    if (evfd < 0) {
    if (evfd < 0) {
        ALOGE("eventfd failed for level %s; errno=%d", levelstr, errno);
        ALOGE("eventfd failed for level %s; errno=%d", levelstr, errno);
        goto err_eventfd;
        goto err_eventfd;