From: guenther Date: Sun, 18 Aug 2024 02:25:51 +0000 (+0000) Subject: Use struct __sFILE instead of FILE in thread locking callback X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=076a4f8b585751a7eee3f672f66cd97e985f5a38;p=openbsd Use struct __sFILE instead of FILE in thread locking callback declarations to reduce pollution. Declare __isthreaded in thread_private.h where it's really needed. ok deraadt@ --- diff --git a/lib/libc/include/thread_private.h b/lib/libc/include/thread_private.h index 237c3fbd034..1ec10711615 100644 --- a/lib/libc/include/thread_private.h +++ b/lib/libc/include/thread_private.h @@ -1,11 +1,11 @@ -/* $OpenBSD: thread_private.h,v 1.36 2021/01/06 19:54:17 otto Exp $ */ +/* $OpenBSD: thread_private.h,v 1.37 2024/08/18 02:25:51 guenther Exp $ */ /* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman */ #ifndef _THREAD_PRIVATE_H_ #define _THREAD_PRIVATE_H_ -#include /* for FILE and __isthreaded */ +extern int __isthreaded; #define _MALLOC_MUTEXES 32 void _malloc_init(int); @@ -77,14 +77,15 @@ PROTO_NORMAL(_malloc_init); * Returns the address of the thread's TCB. */ +struct __sFILE; struct pthread; struct thread_callbacks { int *(*tc_errnoptr)(void); /* MUST BE FIRST */ void *(*tc_tcb)(void); __dead void (*tc_canceled)(void); - void (*tc_flockfile)(FILE *); - int (*tc_ftrylockfile)(FILE *); - void (*tc_funlockfile)(FILE *); + void (*tc_flockfile)(struct __sFILE *); + int (*tc_ftrylockfile)(struct __sFILE *); + void (*tc_funlockfile)(struct __sFILE *); void (*tc_malloc_lock)(int); void (*tc_malloc_unlock)(int); void (*tc_atexit_lock)(void); diff --git a/lib/libc/thread/rthread_cb.h b/lib/libc/thread/rthread_cb.h index d82c8b649e8..abf02f74154 100644 --- a/lib/libc/thread/rthread_cb.h +++ b/lib/libc/thread/rthread_cb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_cb.h,v 1.3 2021/01/06 19:54:17 otto Exp $ */ +/* $OpenBSD: rthread_cb.h,v 1.4 2024/08/18 02:25:51 guenther Exp $ */ /* * Copyright (c) 2016 Philip Guenther * All Rights Reserved. @@ -16,12 +16,12 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include +struct __sFILE; __BEGIN_HIDDEN_DECLS -void _thread_flockfile(FILE *); -int _thread_ftrylockfile(FILE *); -void _thread_funlockfile(FILE *); +void _thread_flockfile(struct __sFILE *); +int _thread_ftrylockfile(struct __sFILE *); +void _thread_funlockfile(struct __sFILE *); void _thread_malloc_lock(int); void _thread_malloc_unlock(int); void _thread_atexit_lock(void);