summaryrefslogtreecommitdiff
path: root/recipes/glibc/glibc-2.3.2/syslog-backrev.patch
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/glibc/glibc-2.3.2/syslog-backrev.patch
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/glibc/glibc-2.3.2/syslog-backrev.patch')
-rw-r--r--recipes/glibc/glibc-2.3.2/syslog-backrev.patch212
1 files changed, 212 insertions, 0 deletions
diff --git a/recipes/glibc/glibc-2.3.2/syslog-backrev.patch b/recipes/glibc/glibc-2.3.2/syslog-backrev.patch
new file mode 100644
index 0000000000..a3bed2e302
--- /dev/null
+++ b/recipes/glibc/glibc-2.3.2/syslog-backrev.patch
@@ -0,0 +1,212 @@
+--- misc/syslog.c 2003-07-17 22:14:44.000000000 +0000
++++ /skole/tjener/home0/jbailey/cvstree/libc/misc/syslog.c 2003-07-17 22:05:59.000000000 +0000
+@@ -41,7 +41,6 @@
+ #include <fcntl.h>
+ #include <paths.h>
+ #include <stdio.h>
+-#include <stdio_ext.h>
+ #include <string.h>
+ #include <time.h>
+ #include <unistd.h>
+@@ -75,27 +74,9 @@
+ static void openlog_internal(const char *, int, int) internal_function;
+ static void closelog_internal(void);
+ static void sigpipe_handler (int);
+-
+-
+-struct cleanup_arg
+-{
+- void *buf;
+- struct sigaction *oldaction;
+-};
+-
+-static void
+-cancel_handler (void *ptr)
+-{
+- /* Restore the old signal handler. */
+- struct cleanup_arg *clarg = (struct cleanup_arg *) ptr;
+-
+- if (clarg != NULL && clarg->oldaction != NULL)
+- __sigaction (SIGPIPE, clarg->oldaction, NULL);
+-
+- /* Free the lock. */
+- __libc_lock_unlock (syslog_lock);
+-}
+-
++#ifdef _LIBC_REENTRANT
++static void cancel_handler (void *);
++#endif
+
+ /*
+ * syslog, vsyslog --
+@@ -137,6 +118,7 @@
+ size_t bufsize = 0;
+ size_t prioff, msgoff;
+ struct sigaction action, oldaction;
++ struct sigaction *oldaction_ptr = NULL;
+ int sigpipe;
+ int saved_errno = errno;
+ char failbuf[3 * sizeof (pid_t) + sizeof "out of memory []"];
+@@ -183,7 +165,6 @@
+ }
+ else
+ {
+- __fsetlocking (f, FSETLOCKING_BYCALLER);
+ prioff = fprintf (f, "<%d>", pri);
+ (void) time (&now);
+ #ifdef USE_IN_LIBIO
+@@ -201,12 +182,9 @@
+ if (LogTag != NULL)
+ fputs_unlocked (LogTag, f);
+ if (LogStat & LOG_PID)
+- fprintf (f, "[%d]", (int) __getpid ());
++ fprintf (f, "[%d]", __getpid ());
+ if (LogTag != NULL)
+- {
+- putc_unlocked (':', f);
+- putc_unlocked (' ', f);
+- }
++ putc_unlocked (':', f), putc_unlocked (' ', f);
+
+ /* Restore errno for %m format. */
+ __set_errno (saved_errno);
+@@ -234,22 +212,16 @@
+ v->iov_base = (char *) "\n";
+ v->iov_len = 1;
+ }
+-
+- __libc_cleanup_push (free, buf);
+-
+- /* writev is a cancellation point. */
+ (void)__writev(STDERR_FILENO, iov, v - iov + 1);
+-
+- __libc_cleanup_pop (0);
+ }
+
++#ifdef _LIBC_REENTRANT
+ /* Prepare for multiple users. We have to take care: open and
+ write are cancellation points. */
+- struct cleanup_arg clarg;
+- clarg.buf = buf;
+- clarg.oldaction = NULL;
+- __libc_cleanup_push (cancel_handler, &clarg);
++ __libc_cleanup_region_start (1, (void (*) (void *)) cancel_handler,
++ &oldaction_ptr);
+ __libc_lock_lock (syslog_lock);
++#endif
+
+ /* Prepare for a broken connection. */
+ memset (&action, 0, sizeof (action));
+@@ -257,7 +229,7 @@
+ sigemptyset (&action.sa_mask);
+ sigpipe = __sigaction (SIGPIPE, &action, &oldaction);
+ if (sigpipe == 0)
+- clarg.oldaction = &oldaction;
++ oldaction_ptr = &oldaction;
+
+ /* Get connected, output the message to the local logger. */
+ if (!connected)
+@@ -299,9 +271,11 @@
+ if (sigpipe == 0)
+ __sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL);
+
++#ifdef _LIBC_REENTRANT
+ /* End of critical section. */
+- __libc_cleanup_pop (0);
++ __libc_cleanup_region_end (0);
+ __libc_lock_unlock (syslog_lock);
++#endif
+
+ free (buf);
+ }
+@@ -309,7 +283,6 @@
+
+ static struct sockaddr SyslogAddr; /* AF_UNIX address of local logger */
+
+-
+ static void
+ internal_function
+ openlog_internal(const char *ident, int logstat, int logfac)
+@@ -339,9 +312,8 @@
+ == -1)
+ {
+ int saved_errno = errno;
+- int fd = LogFile;
++ (void)__close(LogFile);
+ LogFile = -1;
+- (void)__close(fd);
+ if (LogType == SOCK_DGRAM
+ && saved_errno == EPROTOTYPE)
+ {
+@@ -357,16 +329,28 @@
+ }
+ }
+
++
++static void
++log_cleanup (void *arg)
++{
++ __libc_lock_unlock (syslog_lock);
++}
++
+ void
+ openlog (const char *ident, int logstat, int logfac)
+ {
+- /* Protect against multiple users and cancellation. */
+- __libc_cleanup_push (cancel_handler, NULL);
++#ifdef _LIBC_REENTRANT
++ /* Protect against multiple users. */
++ __libc_cleanup_region_start (1, log_cleanup, NULL);
+ __libc_lock_lock (syslog_lock);
++#endif
+
+ openlog_internal (ident, logstat, logfac);
+
+- __libc_cleanup_pop (1);
++#ifdef _LIBC_REENTRANT
++ /* Free the lock. */
++ __libc_cleanup_region_end (1);
++#endif
+ }
+
+ static void
+@@ -389,17 +373,36 @@
+ void
+ closelog ()
+ {
+- /* Protect against multiple users and cancellation. */
+- __libc_cleanup_push (cancel_handler, NULL);
++#ifdef _LIBC_REENTRANT
++ /* Protect against multiple users. */
++ __libc_cleanup_region_start (1, log_cleanup, NULL);
+ __libc_lock_lock (syslog_lock);
++#endif
+
+ closelog_internal ();
+ LogTag = NULL;
+ LogType = SOCK_DGRAM; /* this is the default */
+
++#ifdef _LIBC_REENTRANT
++ /* Free the lock. */
++ __libc_cleanup_region_end (1);
++#endif
++}
++
++#ifdef _LIBC_REENTRANT
++static void
++cancel_handler (void *ptr)
++{
++ /* Restore the old signal handler. */
++ struct sigaction *oldaction = *((struct sigaction **) ptr);
++
++ if (oldaction != (struct sigaction *) NULL)
++ __sigaction (SIGPIPE, oldaction, (struct sigaction *) NULL);
++
+ /* Free the lock. */
+- __libc_cleanup_pop (1);
++ __libc_lock_unlock (syslog_lock);
+ }
++#endif
+
+ /* setlogmask -- set the log mask level */
+ int