From 54152c7e7ed656c969fe4536f17f66360cd8d971 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 6 Jun 2003 08:11:19 +0000 Subject: [PATCH] * cygwin.din: Add vsyslog. * fhandler.cc (fhandler_base::write): Only make file sparse if the seeked area is >= 128K. * syslog.cc (vsyslog): New function, overtaking functionality from syslog. (syslog): Just call vsyslog. * include/cygwin/version.h: Bump API minor. * include/sys/syslog.h: Add vsyslog declaration. --- winsup/cygwin/ChangeLog | 11 +++++++++++ winsup/cygwin/cygwin.din | 1 + winsup/cygwin/fhandler.cc | 2 +- winsup/cygwin/include/cygwin/version.h | 3 ++- winsup/cygwin/include/sys/syslog.h | 3 +++ winsup/cygwin/syslog.cc | 15 ++++++++++----- 6 files changed, 28 insertions(+), 7 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index fdce9f451..1588f3628 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +2003-06-06 Corinna Vinschen + + * cygwin.din: Add vsyslog. + * fhandler.cc (fhandler_base::write): Only make file sparse if the + seeked area is >= 128K. + * syslog.cc (vsyslog): New function, overtaking functionality from + syslog. + (syslog): Just call vsyslog. + * include/cygwin/version.h: Bump API minor. + * include/sys/syslog.h: Add vsyslog declaration. + 2003-06-05 Christopher Faylor * cygthread.cc (cygthread::terminate_thread): Change system_printf to diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din index 7cfe275a2..4deddb84f 100644 --- a/winsup/cygwin/cygwin.din +++ b/winsup/cygwin/cygwin.din @@ -1300,6 +1300,7 @@ sysconf _sysconf = sysconf syslog _syslog = syslog +vsyslog system _system = system tan diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index ac0dfd581..8142cfa27 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -629,7 +629,7 @@ fhandler_base::write (const void *ptr, size_t len) if (current_position > actual_length) { if ((get_fs_flags (FILE_SUPPORTS_SPARSE_FILES)) - && current_position >= actual_length + (64 * 1024)) + && current_position >= actual_length + (128 * 1024)) { /* If the file systemn supports sparse files and the application is writing after a long seek beyond EOF, convert the file to diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 50646dc5a..6caafea66 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -206,12 +206,13 @@ details. */ official release has been made so far. This change removes exported symbols like fopen64, which might confuse configure. 86: Export ftok + 87: Export vsyslog */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 86 +#define CYGWIN_VERSION_API_MINOR 87 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible diff --git a/winsup/cygwin/include/sys/syslog.h b/winsup/cygwin/include/sys/syslog.h index f3195175e..a37b042d7 100644 --- a/winsup/cygwin/include/sys/syslog.h +++ b/winsup/cygwin/include/sys/syslog.h @@ -12,6 +12,8 @@ details. */ #define _SYS_LOG_H #include +#include + #define LOG_EMERG 0 #define LOG_ALERT 1 #define LOG_CRIT 2 @@ -76,6 +78,7 @@ void closelog (void); void openlog (const char *, int, int); int setlogmask (int); void syslog (int, const char *, ...); +void vsyslog (int, const char *, va_list ap); __END_DECLS diff --git a/winsup/cygwin/syslog.cc b/winsup/cygwin/syslog.cc index b39640524..b87ff6699 100644 --- a/winsup/cygwin/syslog.cc +++ b/winsup/cygwin/syslog.cc @@ -208,7 +208,7 @@ pass_handler::print_va (const char *fmt, va_list list) */ extern "C" void -syslog (int priority, const char *message, ...) +vsyslog (int priority, const char *message, va_list ap) { debug_printf ("%x %s", priority, message); /* If the priority fails the current mask, reject */ @@ -281,8 +281,6 @@ syslog (int priority, const char *message, ...) output, then do it again to a malloc'ed string. This is ugly, slow, but prevents core dumps :-). */ - va_list ap; - pass_handler pass; for (int pass_number = 0; pass_number < 2; ++pass_number) { @@ -341,10 +339,8 @@ syslog (int priority, const char *message, ...) } /* Print out the variable part */ - va_start (ap, message); if (pass.print_va (message, ap) == -1) return; - va_end (ap); } const char *msg_strings[1]; @@ -408,6 +404,15 @@ syslog (int priority, const char *message, ...) } } +extern "C" void +syslog (int priority, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + vsyslog (priority, message, ap); + va_end (ap); +} + extern "C" void closelog (void) { -- 2.43.5