1/* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License as 4 * published by the Free Software Foundation; either version 2 of 5 * the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software 14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 15 * MA 02111-1307 USA 16 */ 17#ifndef __SEMAPHORE_MFP_H 18#define __SEMAPHORE_MFP_H 19 20#pragma pack(1) 21 22#define SEM_MAGIC 0x89674523 23#define SEM_NAME "/tmp/Semaphore" 24#define FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) 25 26#define SPINLOCK_SiteSurvey 1 27#define SPINLOCK_NVRAMCommit 2 28#define SPINLOCK_Networkmap 3 29#define SPINLOCK_SPIN_MAX SPINLOCK_Networkmap+1 30 31typedef struct 32{ 33 int sem_fd[2]; 34 int sem_magic; 35} semaphore_t; 36 37int semaphore_create(); 38int semaphore_close(); 39int semaphore_open(const char *, int, ... ); 40int semaphore_unlink(const char *); 41int semaphore_post(); 42int semaphore_wait(); 43 44int spinlock_init(int idx); 45int spinlock_destroy(int idx); 46int spinlock_lock(int idx); 47int spinlock_unlock(int idx); 48 49#pragma pack() 50 51#endif 52