mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 17:53:37 +08:00
Update.
1999-02-13 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * misc/syslog.c (vsyslog): Remember errno for %m format. Fix check for priority mask.
This commit is contained in:
parent
6e0d277c5e
commit
0543cd2694
@ -1,3 +1,8 @@
|
||||
1999-02-13 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
|
||||
|
||||
* misc/syslog.c (vsyslog): Remember errno for %m format. Fix
|
||||
check for priority mask.
|
||||
|
||||
1999-02-14 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* resolv/netdb.h (AI_NUMERICHOST): Change to 4.
|
||||
|
@ -1,3 +1,18 @@
|
||||
1999-02-12 H.J. Lu <hjl@gnu.org>
|
||||
|
||||
* Versions (__libc_current_sigrtmin, __libc_current_sigrtmax,
|
||||
__libc_allocate_rtsig): Added to GLIBC_2.1.
|
||||
|
||||
* internals.h (DEFAULT_SIG_RESTART): Removed.
|
||||
(DEFAULT_SIG_CANCEL): Removed.
|
||||
|
||||
* pthread.c (init_rtsigs, __libc_current_sigrtmin,
|
||||
__libc_current_sigrtmax, __libc_allocate_rtsig): New functions.
|
||||
(__pthread_sig_restart, __pthread_sig_cancel,
|
||||
__pthread_sig_debug): Initialized.
|
||||
(pthread_initialize): Call init_rtsigs () to initialize
|
||||
real-time signals.
|
||||
|
||||
1999-02-03 H.J. Lu <hjl@gnu.org>
|
||||
|
||||
* manager.c (__pthread_manager): Do block __pthread_sig_debug.
|
||||
|
@ -93,5 +93,9 @@ libpthread {
|
||||
pthread_getconcurrency; pthread_setconcurrency;
|
||||
|
||||
pthread_mutexattr_gettype; pthread_mutexattr_settype;
|
||||
|
||||
# helper functions
|
||||
__libc_current_sigrtmin; __libc_current_sigrtmax;
|
||||
__libc_allocate_rtsig;
|
||||
}
|
||||
}
|
||||
|
@ -152,11 +152,6 @@ extern int __pthread_sig_cancel;
|
||||
|
||||
extern int __pthread_sig_debug;
|
||||
|
||||
/* Default signals used if we don't have realtime signals */
|
||||
|
||||
#define DEFAULT_SIG_RESTART SIGUSR1
|
||||
#define DEFAULT_SIG_CANCEL SIGUSR2
|
||||
|
||||
/* Global array of thread handles, used for validating a thread id
|
||||
and retrieving the corresponding thread descriptor. Also used for
|
||||
mapping the available stack segments. */
|
||||
|
@ -146,17 +146,6 @@ const int __pthread_offsetof_descr = offsetof(struct pthread_handle_struct,
|
||||
const int __pthread_offsetof_pid = offsetof(struct _pthread_descr_struct,
|
||||
p_pid);
|
||||
|
||||
/* Signal numbers used for the communication. */
|
||||
#ifdef SIGRTMIN
|
||||
int __pthread_sig_restart;
|
||||
int __pthread_sig_cancel;
|
||||
int __pthread_sig_debug;
|
||||
#else
|
||||
int __pthread_sig_restart = DEFAULT_SIG_RESTART;
|
||||
int __pthread_sig_cancel = DEFAULT_SIG_CANCEL;
|
||||
int __pthread_sig_debug = 0; /* disabled */
|
||||
#endif
|
||||
|
||||
/* These variables are used by the setup code. */
|
||||
extern int _errno;
|
||||
extern int _h_errno;
|
||||
@ -173,6 +162,104 @@ static void pthread_handle_sigrestart(int sig, struct sigcontext ctx);
|
||||
#endif
|
||||
static void pthread_handle_sigdebug(int sig);
|
||||
|
||||
/* Signal numbers used for the communication.
|
||||
In these variables we keep track of the used variables. If the
|
||||
platform does not support any real-time signals we will define the
|
||||
values to some unreasonable value which will signal failing of all
|
||||
the functions below. */
|
||||
#ifndef __SIGRTMIN
|
||||
static int current_rtmin = -1;
|
||||
static int current_rtmax = -1;
|
||||
int __pthread_sig_restart = SIGUSR1;
|
||||
int __pthread_sig_cancel = SIGUSR2;
|
||||
int __pthread_sig_debug = 0;
|
||||
#else
|
||||
static int current_rtmin;
|
||||
static int current_rtmax;
|
||||
|
||||
#if __SIGRTMAX - __SIGRTMIN >= 3
|
||||
int __pthread_sig_restart = __SIGRTMIN;
|
||||
int __pthread_sig_cancel = __SIGRTMIN + 1;
|
||||
int __pthread_sig_debug = __SIGRTMIN + 2;
|
||||
#else
|
||||
int __pthread_sig_restart = SIGUSR1;
|
||||
int __pthread_sig_cancel = SIGUSR2;
|
||||
int __pthread_sig_debug = 0;
|
||||
#endif
|
||||
|
||||
static int rtsigs_initialized;
|
||||
|
||||
#include "testrtsig.h"
|
||||
|
||||
static void
|
||||
init_rtsigs (void)
|
||||
{
|
||||
if (!kernel_has_rtsig ())
|
||||
{
|
||||
current_rtmin = -1;
|
||||
current_rtmax = -1;
|
||||
#if __SIGRTMAX - __SIGRTMIN >= 3
|
||||
__pthread_sig_restart = SIGUSR1;
|
||||
__pthread_sig_cancel = SIGUSR2;
|
||||
__pthread_sig_debug = 0;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if __SIGRTMAX - __SIGRTMIN >= 3
|
||||
current_rtmin = __SIGRTMIN + 3;
|
||||
#else
|
||||
current_rtmin = __SIGRTMIN;
|
||||
#endif
|
||||
|
||||
current_rtmax = __SIGRTMAX;
|
||||
}
|
||||
|
||||
rtsigs_initialized = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return number of available real-time signal with highest priority. */
|
||||
int
|
||||
__libc_current_sigrtmin (void)
|
||||
{
|
||||
#ifdef __SIGRTMIN
|
||||
if (!rtsigs_initialized)
|
||||
init_rtsigs ();
|
||||
#endif
|
||||
return current_rtmin;
|
||||
}
|
||||
|
||||
/* Return number of available real-time signal with lowest priority. */
|
||||
int
|
||||
__libc_current_sigrtmax (void)
|
||||
{
|
||||
#ifdef __SIGRTMIN
|
||||
if (!rtsigs_initialized)
|
||||
init_rtsigs ();
|
||||
#endif
|
||||
return current_rtmax;
|
||||
}
|
||||
|
||||
/* Allocate real-time signal with highest/lowest available
|
||||
priority. Please note that we don't use a lock since we assume
|
||||
this function to be called at program start. */
|
||||
int
|
||||
__libc_allocate_rtsig (int high)
|
||||
{
|
||||
#ifndef __SIGRTMIN
|
||||
return -1;
|
||||
#else
|
||||
if (!rtsigs_initialized)
|
||||
init_rtsigs ();
|
||||
if (current_rtmin == -1 || current_rtmin > current_rtmax)
|
||||
/* We don't have anymore signal available. */
|
||||
return -1;
|
||||
|
||||
return high ? current_rtmin++ : current_rtmax--;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Initialize the pthread library.
|
||||
Initialization is split in two functions:
|
||||
- a constructor function that blocks the __pthread_sig_restart signal
|
||||
@ -219,22 +306,9 @@ static void pthread_initialize(void)
|
||||
/* The errno/h_errno variable of the main thread are the global ones. */
|
||||
__pthread_initial_thread.p_errnop = &_errno;
|
||||
__pthread_initial_thread.p_h_errnop = &_h_errno;
|
||||
#ifdef SIGRTMIN
|
||||
/* Allocate the signals used. */
|
||||
__pthread_sig_restart = __libc_allocate_rtsig (1);
|
||||
__pthread_sig_cancel = __libc_allocate_rtsig (1);
|
||||
__pthread_sig_debug = __libc_allocate_rtsig (1);
|
||||
if (__pthread_sig_restart < 0 ||
|
||||
__pthread_sig_cancel < 0 ||
|
||||
__pthread_sig_debug < 0)
|
||||
{
|
||||
/* The kernel does not support real-time signals. Use as before
|
||||
the available signals in the fixed set.
|
||||
Debugging is not supported in this case. */
|
||||
__pthread_sig_restart = DEFAULT_SIG_RESTART;
|
||||
__pthread_sig_cancel = DEFAULT_SIG_CANCEL;
|
||||
__pthread_sig_debug = 0;
|
||||
}
|
||||
#ifdef __SIGRTMIN
|
||||
/* Initialize real-time signals. */
|
||||
init_rtsigs ();
|
||||
#endif
|
||||
/* Setup signal handlers for the initial thread.
|
||||
Since signal handlers are shared between threads, these settings
|
||||
|
@ -123,6 +123,7 @@ vsyslog(pri, fmt, ap)
|
||||
struct sigaction action, oldaction;
|
||||
struct sigaction *oldaction_ptr = NULL;
|
||||
int sigpipe;
|
||||
int saved_errno = errno;
|
||||
|
||||
#define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID
|
||||
/* Check for invalid bits. */
|
||||
@ -133,7 +134,7 @@ vsyslog(pri, fmt, ap)
|
||||
}
|
||||
|
||||
/* Check priority against setlogmask values. */
|
||||
if (!LOG_MASK(LOG_PRI(pri)) & LogMask)
|
||||
if ((LOG_MASK (LOG_PRI (pri)) & LogMask) == 0)
|
||||
return;
|
||||
|
||||
/* Set default facility if none specified. */
|
||||
@ -163,6 +164,9 @@ vsyslog(pri, fmt, ap)
|
||||
if (LogTag != NULL)
|
||||
putc_unlocked (':', f), putc_unlocked (' ', f);
|
||||
|
||||
/* Restore errno for %m format. */
|
||||
__set_errno (saved_errno);
|
||||
|
||||
/* We have the header. Print the user's format into the buffer. */
|
||||
vfprintf (f, fmt, ap);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user