/* * * This file is part of bufferpool * * Copyright (C) 2007 by LScube team * See AUTHORS for more details * * bufferpool is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * bufferpool is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with bufferpool; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include #include int bp_shm_unmap(BPBuffer * buffer) { int slots_err; int control_err; if (buffer->type != buff_shm) { bp_log(FNC_LOG_ERR, "Bufferpool desn't seems to be a Shared Memory object"); return 1; } if ((slots_err = munmap(buffer->slots, buffer->control->nslots * sizeof(BPSlot)))) bp_log(FNC_LOG_ERR, "Error unmapping BPSlots SHM object\n"); if ((control_err = munmap(buffer->control, sizeof(BPControl)))) bp_log(FNC_LOG_ERR, "Error unmapping BPControl SHM object\n"); return slots_err ? slots_err : control_err; }