Add fields to struct __sfileext to track how many times the lock has been

taken by internal stdio functions, and what the cancellation state was when
the first such lock was taken.
This commit is contained in:
nathanw 2003-07-18 21:46:41 +00:00
parent d271509d77
commit b5665a9b84
2 changed files with 9 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fileext.h,v 1.4 2003/02/01 03:25:00 nathanw Exp $ */
/* $NetBSD: fileext.h,v 1.5 2003/07/18 21:46:41 nathanw Exp $ */
/*-
* Copyright (c)2001 Citrus Project,
@ -39,6 +39,8 @@ struct __sfileext {
cond_t _lockcond; /* Condition variable for signalling lock releases */
thr_t _lockowner; /* The thread currently holding the lock */
int _lockcount; /* Count of recursive locks */
int _lockinternal; /* Flag of whether the lock is held inside stdio */
int _lockcancelstate; /* Stashed cancellation state on internal lock */
#endif
};
@ -49,12 +51,15 @@ struct __sfileext {
#define _LOCKCOND(fp) (_EXT(fp)->_lockcond)
#define _LOCKOWNER(fp) (_EXT(fp)->_lockowner)
#define _LOCKCOUNT(fp) (_EXT(fp)->_lockcount)
#define _LOCKINTERNAL(fp) (_EXT(fp)->_lockinternal)
#define _LOCKCANCELSTATE(fp) (_EXT(fp)->_lockcancelstate)
#define _FILEEXT_SETUP(f, fext) do { \
/* LINTED */(f)->_ext._base = (unsigned char *)(fext); \
mutex_init(&_LOCK(f), NULL); \
cond_init(&_LOCKCOND(f), 0, NULL); \
_LOCKOWNER(f) = NULL; \
_LOCKCOUNT(f) = 0; \
_LOCKINTERNAL(f) = 0; \
} while (/* LINTED */ 0)
#else
#define _FILEEXT_SETUP(f, fext) /* LINTED */(f)->_ext._base = (unsigned char *)(fext)

View File

@ -1,4 +1,4 @@
/* $NetBSD: findfp.c,v 1.18 2003/02/01 03:25:00 nathanw Exp $ */
/* $NetBSD: findfp.c,v 1.19 2003/07/18 21:46:41 nathanw Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)findfp.c 8.2 (Berkeley) 1/4/94";
#else
__RCSID("$NetBSD: findfp.c,v 1.18 2003/02/01 03:25:00 nathanw Exp $");
__RCSID("$NetBSD: findfp.c,v 1.19 2003/07/18 21:46:41 nathanw Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -74,7 +74,7 @@ static struct __sfileext usualext[FOPEN_MAX - 3];
static struct glue uglue = { 0, FOPEN_MAX - 3, usual };
#ifdef _REENTRANT
#define STDEXT { {0}, {{{0}}}, MUTEX_INITIALIZER, COND_INITIALIZER, NULL, 0}
#define STDEXT { {0}, {{{0}}}, MUTEX_INITIALIZER, COND_INITIALIZER, NULL, 0, 0}
struct __sfileext __sFext[3] = { STDEXT,
STDEXT,
STDEXT};