Files
freebsd-src/include/pthread_np.h
T
Konstantin Belousov 588bd8bb6c libthr: pthread_query_np(3) and pthread_query_all_np(3)
Reviewed by:	aokblast, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D60838
2026-10-30 15:51:03 +02:00

102 lines
3.9 KiB
C

/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1996-98 John Birrell <[email protected]>.
* 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.
* 3. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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 REGENTS 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.
*/
#ifndef _PTHREAD_NP_H_
#define _PTHREAD_NP_H_
#include <sys/param.h>
#include <sys/cpuset.h>
enum pthread_state_np {
PTHREAD_STATE_RUNNING_NP = 100,
PTHREAD_STATE_SUSPENDED_NP,
PTHREAD_STATE_DEAD_NP,
};
#define PTHREAD_INFO_DETACHED_NP 0x0001
#define PTHREAD_INFO_INITIAL_NP 0x0002
#define PTHREAD_INFO_CANCEL_ENABLED_NP 0x0001
#define PTHREAD_INFO_CANCEL_ASYNC_NP 0x0002
#define PTHREAD_INFO_CANCEL_PENDING_NP 0x0004
#define PTHREAD_INFO_CANCEL_AT_POINT_NP 0x0008
#define PTHREAD_INFO_CANCEL_IN_PROG_NP 0x0010
struct pthread_info_np {
size_t pthread_info_size;
pthread_t thread;
long lwpid;
enum pthread_state_np state;
int flags;
int cancel_state;
int *errno_location;
struct tcb *tcb;
struct uexterror *exterr;
char name[128];
};
/*
* Non-POSIX thread function prototype definitions:
*/
__BEGIN_DECLS
int pthread_attr_setcreatesuspend_np(pthread_attr_t *);
int pthread_attr_get_np(pthread_t, pthread_attr_t *);
int pthread_attr_getaffinity_np(const pthread_attr_t *, size_t, cpuset_t *);
int pthread_attr_setaffinity_np(pthread_attr_t *, size_t, const cpuset_t *);
void pthread_get_name_np(pthread_t, char *, size_t);
int pthread_getaffinity_np(pthread_t, size_t, cpuset_t *);
int pthread_getthreadid_np(void);
int pthread_main_np(void);
int pthread_multi_np(void);
int pthread_mutexattr_getkind_np(pthread_mutexattr_t);
int pthread_mutexattr_setkind_np(pthread_mutexattr_t *, int);
int pthread_mutex_getspinloops_np(pthread_mutex_t *mutex, int *count);
int pthread_mutex_setspinloops_np(pthread_mutex_t *mutex, int count);
int pthread_mutex_getyieldloops_np(pthread_mutex_t *mutex, int *count);
int pthread_mutex_setyieldloops_np(pthread_mutex_t *mutex, int count);
int pthread_mutex_isowned_np(pthread_mutex_t *mutex);
void pthread_resume_all_np(void);
int pthread_resume_np(pthread_t);
int pthread_peekjoin_np(pthread_t, void **);
int pthread_query_np(pthread_t, struct pthread_info_np *, size_t);
int pthread_query_all_np(struct pthread_info_np *, size_t *);
void pthread_set_name_np(pthread_t, const char *);
int pthread_setaffinity_np(pthread_t, size_t, const cpuset_t *);
void pthread_signals_block_np(void);
void pthread_signals_unblock_np(void);
int pthread_single_np(void);
void pthread_suspend_all_np(void);
int pthread_suspend_np(pthread_t);
int pthread_timedjoin_np(pthread_t, void **, const struct timespec *);
int pthread_tryjoin_np(pthread_t, void **);
__END_DECLS
#endif