mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Update.
* iconv/gconv_int.h (strict gconv_module): Remove all members associated with regular expressions. Use a simple string as the from name. * iconv/gconv_db.c: Remove code handling regular expressions. * iconv/gconv_conf.c: Likewise. * iconv/iconv_prog.c: Likewise. * iconv/gconv_builtin.h: Adjust for change in gconv_conf.c.
This commit is contained in:
@ -59,9 +59,12 @@ struct timer_node
|
||||
pthread_attr_t attr;
|
||||
unsigned int abstime;
|
||||
unsigned int armed;
|
||||
unsigned int inuse;
|
||||
enum {
|
||||
TIMER_FREE, TIMER_INUSE, TIMER_DELETED
|
||||
} inuse;
|
||||
struct thread_node *thread;
|
||||
pid_t creator_pid;
|
||||
int refcount;
|
||||
};
|
||||
|
||||
|
||||
@ -106,6 +109,28 @@ timer_ptr2id (struct timer_node *timer)
|
||||
return timer - __timer_array;
|
||||
}
|
||||
|
||||
/* Check whether timer is valid; global mutex must be held. */
|
||||
static inline int
|
||||
timer_valid (struct timer_node *timer)
|
||||
{
|
||||
return timer && timer->inuse == TIMER_INUSE;
|
||||
}
|
||||
|
||||
/* Timer refcount functions; need global mutex. */
|
||||
extern void __timer_dealloc (struct timer_node *timer);
|
||||
|
||||
static inline void
|
||||
timer_addref (struct timer_node *timer)
|
||||
{
|
||||
timer->refcount++;
|
||||
}
|
||||
|
||||
static inline void
|
||||
timer_delref (struct timer_node *timer)
|
||||
{
|
||||
if (--timer->refcount == 0)
|
||||
__timer_dealloc (timer);
|
||||
}
|
||||
|
||||
/* Timespec helper routines. */
|
||||
static inline int
|
||||
@ -178,7 +203,6 @@ extern struct timer_node *__timer_alloc (void);
|
||||
extern int __timer_thread_start (struct thread_node *thread);
|
||||
extern struct thread_node *__timer_thread_find_matching (const pthread_attr_t *desired_attr, clockid_t);
|
||||
extern struct thread_node *__timer_thread_alloc (const pthread_attr_t *desired_attr, clockid_t);
|
||||
extern void __timer_dealloc (struct timer_node *timer);
|
||||
extern void __timer_thread_dealloc (struct thread_node *thread);
|
||||
extern int __timer_thread_queue_timer (struct thread_node *thread,
|
||||
struct timer_node *insert);
|
||||
|
@ -34,8 +34,8 @@ timer_getoverrun (timerid)
|
||||
|
||||
pthread_mutex_lock (&__timer_mutex);
|
||||
|
||||
if ((timer = timer_id2ptr (timerid)) == NULL || !timer->inuse)
|
||||
errno = EINVAL;
|
||||
if (! timer_valid (timer = timer_id2ptr (timerid)))
|
||||
__set_errno (EINVAL);
|
||||
else
|
||||
retval = 0; /* TODO: overrun counting not supported */
|
||||
|
||||
|
@ -31,25 +31,30 @@ timer_gettime (timerid, value)
|
||||
struct itimerspec *value;
|
||||
{
|
||||
struct timer_node *timer;
|
||||
struct timespec now;
|
||||
int retval = -1;
|
||||
struct timespec now, expiry;
|
||||
int retval = -1, armed = 0, valid;
|
||||
clock_t clock = 0;
|
||||
|
||||
pthread_mutex_lock (&__timer_mutex);
|
||||
|
||||
timer = timer_id2ptr (timerid);
|
||||
if (timer == NULL && !timer->inuse)
|
||||
/* Invalid timer ID or the timer is not in use. */
|
||||
errno = EINVAL;
|
||||
else
|
||||
{
|
||||
value->it_interval = timer->value.it_interval;
|
||||
valid = timer_valid (timer);
|
||||
|
||||
if (timer->armed)
|
||||
if (valid) {
|
||||
armed = timer->armed;
|
||||
expiry = timer->expirytime;
|
||||
clock = timer->clock;
|
||||
value->it_interval = timer->value.it_interval;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock (&__timer_mutex);
|
||||
|
||||
if (valid)
|
||||
{
|
||||
if (armed)
|
||||
{
|
||||
pthread_mutex_unlock (&__timer_mutex);
|
||||
clock_gettime (timer->clock, &now);
|
||||
pthread_mutex_lock (&__timer_mutex);
|
||||
timespec_sub (&value->it_value, &timer->expirytime, &now);
|
||||
clock_gettime (clock, &now);
|
||||
timespec_sub (&value->it_value, &expiry, &now);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -59,8 +64,8 @@ timer_gettime (timerid, value)
|
||||
|
||||
retval = 0;
|
||||
}
|
||||
|
||||
pthread_mutex_lock (&__timer_mutex);
|
||||
else
|
||||
__set_errno (EINVAL);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ init_module (void)
|
||||
for (i = 0; i < TIMER_MAX; ++i)
|
||||
{
|
||||
list_append (&timer_free_list, &__timer_array[i].links);
|
||||
__timer_array[i].inuse = 0;
|
||||
__timer_array[i].inuse = TIMER_FREE;
|
||||
}
|
||||
|
||||
for (i = 0; i < THREAD_MAXNODES; ++i)
|
||||
@ -309,7 +309,7 @@ thread_cleanup (void *val)
|
||||
static void
|
||||
thread_expire_timer (struct thread_node *self, struct timer_node *timer)
|
||||
{
|
||||
self->current_timer = timer;
|
||||
self->current_timer = timer; /* Lets timer_delete know timer is running. */
|
||||
|
||||
pthread_mutex_unlock (&__timer_mutex);
|
||||
|
||||
@ -443,7 +443,7 @@ thread_func (void *arg)
|
||||
}
|
||||
|
||||
|
||||
/* Enqueue a timer in wakeup order in the thread's timer queue.
|
||||
/* Enqueue a timer in wakeup order in the thread's timer queue.
|
||||
Returns 1 if the timer was inserted at the head of the queue,
|
||||
causing the queue's next wakeup time to change. */
|
||||
|
||||
@ -551,7 +551,8 @@ __timer_alloc (void)
|
||||
{
|
||||
struct timer_node *timer = timer_links2ptr (node);
|
||||
list_unlink_ip (node);
|
||||
timer->inuse = 1;
|
||||
timer->inuse = TIMER_INUSE;
|
||||
timer->refcount = 1;
|
||||
return timer;
|
||||
}
|
||||
|
||||
@ -564,8 +565,9 @@ __timer_alloc (void)
|
||||
void
|
||||
__timer_dealloc (struct timer_node *timer)
|
||||
{
|
||||
assert (timer->refcount == 0);
|
||||
timer->thread = NULL; /* Break association between timer and thread. */
|
||||
timer->inuse = 0;
|
||||
timer->inuse = TIMER_FREE;
|
||||
list_append (&timer_free_list, &timer->links);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ timer_settime (timerid, flags, value, ovalue)
|
||||
timer = timer_id2ptr (timerid);
|
||||
if (timer == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
__set_errno (EINVAL);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ timer_settime (timerid, flags, value, ovalue)
|
||||
|| value->it_value.tv_nsec < 0
|
||||
|| value->it_value.tv_nsec >= 1000000000)
|
||||
{
|
||||
errno = EINVAL;
|
||||
__set_errno (EINVAL);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
@ -64,13 +64,14 @@ timer_settime (timerid, flags, value, ovalue)
|
||||
}
|
||||
|
||||
pthread_mutex_lock (&__timer_mutex);
|
||||
timer_addref (timer);
|
||||
|
||||
/* One final check of timer validity; this one is possible only
|
||||
until we have the mutex, which guards the inuse flag. */
|
||||
until we have the mutex, because it accesses the inuse flag. */
|
||||
|
||||
if (!timer->inuse)
|
||||
if (! timer_valid(timer))
|
||||
{
|
||||
errno = EINVAL;
|
||||
__set_errno (EINVAL);
|
||||
goto unlock_bail;
|
||||
}
|
||||
|
||||
@ -86,6 +87,7 @@ timer_settime (timerid, flags, value, ovalue)
|
||||
clock_gettime (timer->clock, &now);
|
||||
have_now = 1;
|
||||
pthread_mutex_lock (&__timer_mutex);
|
||||
timer_addref (timer);
|
||||
}
|
||||
|
||||
timespec_sub (&ovalue->it_value, &timer->expirytime, &now);
|
||||
@ -123,6 +125,7 @@ timer_settime (timerid, flags, value, ovalue)
|
||||
retval = 0;
|
||||
|
||||
unlock_bail:
|
||||
timer_delref (timer);
|
||||
pthread_mutex_unlock (&__timer_mutex);
|
||||
|
||||
bail:
|
||||
|
Reference in New Issue
Block a user