mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
LibC: Stub out semaphore.h
This commit is contained in:
parent
7482cb6531
commit
9b69c73dfe
3 changed files with 112 additions and 0 deletions
|
@ -21,6 +21,7 @@ set(LIBC_SOURCES
|
|||
qsort.cpp
|
||||
scanf.cpp
|
||||
sched.cpp
|
||||
semaphore.cpp
|
||||
serenity.cpp
|
||||
setjmp.S
|
||||
signal.cpp
|
||||
|
|
65
Userland/Libraries/LibC/semaphore.cpp
Normal file
65
Userland/Libraries/LibC/semaphore.cpp
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright (c) 2021, the SerenityOS developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <semaphore.h>
|
||||
|
||||
int sem_close(sem_t*)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
int sem_destroy(sem_t*)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
int sem_getvalue(sem_t*, int*)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
int sem_init(sem_t*, int, unsigned int)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
sem_t* sem_open(const char*, int, ...)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
int sem_post(sem_t*)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
int sem_trywait(sem_t*)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
int sem_unlink(const char*)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
int sem_wait(sem_t*)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
46
Userland/Libraries/LibC/semaphore.h
Normal file
46
Userland/Libraries/LibC/semaphore.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2021, the SerenityOS developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
typedef int sem_t;
|
||||
|
||||
int sem_close(sem_t*);
|
||||
int sem_destroy(sem_t*);
|
||||
int sem_getvalue(sem_t*, int*);
|
||||
int sem_init(sem_t*, int, unsigned int);
|
||||
sem_t* sem_open(const char*, int, ...);
|
||||
int sem_post(sem_t*);
|
||||
int sem_trywait(sem_t*);
|
||||
int sem_unlink(const char*);
|
||||
int sem_wait(sem_t*);
|
||||
|
||||
__END_DECLS
|
Loading…
Add table
Reference in a new issue