Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | From f0af5bcfd753691652eac35efbcb208c933253f1 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Mon, 31 Aug 2015 05:11:53 +0000 |
| 4 | Subject: [PATCH] Fix build with musl |
| 5 | |
| 6 | Explicitly include fcntl.h since with glibc is comes in as indirect |
| 7 | include but not with musl |
| 8 | |
| 9 | linux/time.h inclusion is not required on musl so using !__GLIBC__ is |
| 10 | not right for musl here |
| 11 | |
| 12 | wait type is glibc specific |
| 13 | |
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 15 | --- |
| 16 | Upstream-Status: Pending |
| 17 | |
| 18 | klogd.c | 10 +--------- |
| 19 | ksym_mod.c | 5 +---- |
| 20 | pidfile.c | 1 + |
| 21 | syslog.c | 3 ++- |
| 22 | syslogd.c | 4 +--- |
| 23 | 5 files changed, 6 insertions(+), 17 deletions(-) |
| 24 | |
| 25 | diff --git a/klogd.c b/klogd.c |
| 26 | index 6cc80ed..9219671 100644 |
| 27 | --- a/klogd.c |
| 28 | +++ b/klogd.c |
| 29 | @@ -260,11 +260,8 @@ |
| 30 | #include <unistd.h> |
| 31 | #include <signal.h> |
| 32 | #include <errno.h> |
| 33 | -#include <sys/fcntl.h> |
| 34 | +#include <fcntl.h> |
| 35 | #include <sys/stat.h> |
| 36 | -#if !defined(__GLIBC__) |
| 37 | -#include <linux/time.h> |
| 38 | -#endif /* __GLIBC__ */ |
| 39 | #include <stdarg.h> |
| 40 | #include <paths.h> |
| 41 | #include <stdlib.h> |
| 42 | @@ -277,13 +274,8 @@ |
| 43 | |
| 44 | #define __LIBRARY__ |
| 45 | #include <linux/unistd.h> |
| 46 | -#if !defined(__GLIBC__) |
| 47 | -# define __NR_ksyslog __NR_syslog |
| 48 | -_syscall3(int,ksyslog,int, type, char *, buf, int, len); |
| 49 | -#else |
| 50 | #include <sys/klog.h> |
| 51 | #define ksyslog klogctl |
| 52 | -#endif |
| 53 | |
| 54 | #define LOG_BUFFER_SIZE 4096 |
| 55 | #define LOG_LINE_LENGTH 1000 |
| 56 | diff --git a/ksym_mod.c b/ksym_mod.c |
| 57 | index 68cd6b6..6e26da1 100644 |
| 58 | --- a/ksym_mod.c |
| 59 | +++ b/ksym_mod.c |
| 60 | @@ -113,12 +113,9 @@ |
| 61 | #include <unistd.h> |
| 62 | #include <signal.h> |
| 63 | #include <errno.h> |
| 64 | -#include <sys/fcntl.h> |
| 65 | +#include <fcntl.h> |
| 66 | #include <sys/stat.h> |
| 67 | #include "module.h" |
| 68 | -#if !defined(__GLIBC__) |
| 69 | -#include <linux/time.h> |
| 70 | -#endif /* __GLIBC__ */ |
| 71 | #include <stdarg.h> |
| 72 | #include <paths.h> |
| 73 | #include <linux/version.h> |
| 74 | diff --git a/pidfile.c b/pidfile.c |
| 75 | index e0959a0..6daa2e0 100644 |
| 76 | --- a/pidfile.c |
| 77 | +++ b/pidfile.c |
| 78 | @@ -31,6 +31,7 @@ |
| 79 | #include <string.h> |
| 80 | #include <errno.h> |
| 81 | #include <signal.h> |
| 82 | +#include <fcntl.h> |
| 83 | |
| 84 | /* read_pid |
| 85 | * |
| 86 | diff --git a/syslog.c b/syslog.c |
| 87 | index bdb3ff2..ef7b34e 100644 |
| 88 | --- a/syslog.c |
| 89 | +++ b/syslog.c |
| 90 | @@ -55,7 +55,7 @@ static char sccsid[] = "@(#)syslog.c 5.28 (Berkeley) 6/27/90"; |
| 91 | #include <sys/types.h> |
| 92 | #include <sys/socket.h> |
| 93 | #include <sys/file.h> |
| 94 | -#include <sys/signal.h> |
| 95 | +//#include <sys/signal.h> |
| 96 | #include <sys/syslog.h> |
| 97 | #if 0 |
| 98 | #include "syslog.h" |
| 99 | @@ -72,6 +72,7 @@ static char sccsid[] = "@(#)syslog.c 5.28 (Berkeley) 6/27/90"; |
| 100 | #include <stdarg.h> |
| 101 | #include <paths.h> |
| 102 | #include <stdio.h> |
| 103 | +#include <fcntl.h> |
| 104 | |
| 105 | #define _PATH_LOGNAME "/dev/log" |
| 106 | |
| 107 | diff --git a/syslogd.c b/syslogd.c |
| 108 | index ea73ea5..1ca0595 100644 |
| 109 | --- a/syslogd.c |
| 110 | +++ b/syslogd.c |
| 111 | @@ -818,9 +818,7 @@ void doexit(int sig); |
| 112 | void init(); |
| 113 | void cfline(char *line, register struct filed *f); |
| 114 | int decode(char *name, struct code *codetab); |
| 115 | -#if defined(__GLIBC__) |
| 116 | #define dprintf mydprintf |
| 117 | -#endif /* __GLIBC__ */ |
| 118 | static void dprintf(char *, ...); |
| 119 | static void allocate_log(void); |
| 120 | void sighup_handler(); |
| 121 | @@ -2094,7 +2092,7 @@ void reapchild() |
| 122 | (void) signal(SIGCHLD, reapchild); /* reset signal handler -ASP */ |
| 123 | wait ((int *)0); |
| 124 | #else |
| 125 | - union wait status; |
| 126 | + int status; |
| 127 | |
| 128 | while (wait3(&status, WNOHANG, (struct rusage *) NULL) > 0) |
| 129 | ; |
| 130 | -- |
| 131 | 2.5.1 |
| 132 | |