Lely core libraries
2.2.5
|
Go to the source code of this file.
Functions | |
int | mkjmp (jmp_buf env, void(*func)(void *), void *arg, void *sp, size_t size) |
Creates and stores a calling environment with a user-provided stack suitable for use by longjmp() . More... | |
int | sigmkjmp (sigjmp_buf env, int savemask, void(*func)(void *), void *arg, void *sp, size_t size) |
Creates and stores a calling environment with a user-provided stack suitable for use by siglongjmp() . More... | |
This file is part of the utilities library; it contains the implementation of mkjmp() and sigmkjmp().
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file mkjmp.c.
int mkjmp | ( | jmp_buf | env, |
void(*)(void *) | func, | ||
void * | arg, | ||
void * | sp, | ||
size_t | size | ||
) |
Creates and stores a calling environment with a user-provided stack suitable for use by longjmp()
.
On success, the new environment is about to invoke func(arg)
. Note that environments created by mkjmp() can only be used with longjmp()
in the same thread in which they were created.
env | the variable in which to store the new environment. |
func | the address of the function to be invoked in the new environment. If this function returns, the thread on which it ran is terminated as if by thrd_exit(0) (or exit(EXIT_SUCCESS) if multithreading support is disabled). |
arg | the argument provided to func. |
sp | a pointer to the beginning of a memory region to be used as the stack for the new environment. Depending on the platform, the stack pointer in the new environment may point to either the beginning or the end of the memory region. It is the responsibility of the caller to ensure proper alignment. |
size | the size (in bytes) of the memory region at sp. It is the responsibility of the caller to ensure the stack size is sufficient. |
errno
. int sigmkjmp | ( | sigjmp_buf | env, |
int | savemask, | ||
void(*)(void *) | func, | ||
void * | arg, | ||
void * | sp, | ||
size_t | size | ||
) |
Creates and stores a calling environment with a user-provided stack suitable for use by siglongjmp()
.
On success, the new environment is about to invoke func(arg)
. Note that environments created by sigmkjmp() can only be used with siglongjmp()
in the same thread in which they were created.
env | the variable in which to store the new environment. |
savemask | if not 0, the current signal mask of the calling thread shall be saved as part of the new environment. |
func | the address of the function to be invoked in the new environment. If this function returns, the thread on which it ran is terminated as if by thrd_exit(0) (or exit(EXIT_SUCCESS) if multithreading support is disabled). |
arg | the argument provided to func. |
sp | a pointer to the beginning of a memory region to be used as the stack for the new environment. Depending on the platform, the stack pointer in the new environment may point to either the beginning or the end of the memory region. It is the responsibility of the caller to ensure proper alignment. |
size | the size (in bytes) of the memory region at sp. It is the responsibility of the caller to ensure the stack size is sufficient. |
errno
.