clean-ipc.c revision 6482f6269c87d2249e52e889a63adbdd50f2d691
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering This file is part of systemd.
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering Copyright 2014 Lennart Poettering
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering systemd is free software; you can redistribute it and/or modify it
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering under the terms of the GNU Lesser General Public License as published by
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering the Free Software Foundation; either version 2.1 of the License, or
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering (at your option) any later version.
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering systemd is distributed in the hope that it will be useful, but
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering Lesser General Public License for more details.
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering You should have received a copy of the GNU Lesser General Public License
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poetteringstatic int clean_sysvipc_shm(uid_t delete_uid) {
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering log_warning_errno(errno, "Failed to open /proc/sysvipc/shm: %m");
unsigned n_attached;
int shmid;
if (first) {
first = false;
if (sscanf(line, "%*i %i %*o %*u " PID_FMT " " PID_FMT " %u " UID_FMT " " GID_FMT " " UID_FMT " " GID_FMT,
if (n_attached > 0)
return ret;
fail:
return -errno;
bool first = true;
int ret = 0;
return -errno;
int semid;
if (first) {
first = false;
return ret;
fail:
return -errno;
bool first = true;
int ret = 0;
return -errno;
int msgid;
if (first) {
first = false;
if (sscanf(line, "%*i %i %*o %*u %*u " PID_FMT " " PID_FMT " " UID_FMT " " GID_FMT " " UID_FMT " " GID_FMT,
return ret;
fail:
return -errno;
int ret = 0, r;
if (!kid) {
ret = r;
return ret;
fail:
return -errno;
if (!dir) {
return -errno;
int ret = 0;
if (!dir) {
return -errno;
return ret;
fail:
return -errno;
int ret = 0, r;
ret = r;
ret = r;
ret = r;
ret = r;
ret = r;
return ret;