/* * semaphore.h * * Copyright (C) 2017 Aleksandar Andrejevic * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ #ifndef __MONOLITHIUM_SEMAPHORE_H__ #define __MONOLITHIUM_SEMAPHORE_H__ #include "object.h" #define syscall_create_mutex(n, i, h) syscall_create_semaphore((n), (i), 1, (h)) #define syscall_open_mutex(n, h) syscall_open_semaphore((n), (h)) #define syscall_wait_semaphore(s, c, t) syscall_wait_for_one((s), (void*)(c), (t)) #define syscall_wait_mutex(m, t) syscall_wait_semaphore((m), 1, (t)) #define syscall_release_mutex(m) syscall_release_semaphore((m), 1) sysret_t syscall_create_semaphore(const char *name, dword_t init_count, dword_t max_count, handle_t *handle); sysret_t syscall_open_semaphore(const char *name, handle_t *handle); sysret_t syscall_release_semaphore(handle_t semaphore, dword_t count); #endif