[oe-commits] [openembedded-core] 05/06: pseudo hack patch
git at git.openembedded.org
git at git.openembedded.org
Mon Feb 22 20:43:15 UTC 2016
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit 59ddecbdb162717d919c8919a2f7930cbd4c9bdf
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Fri Feb 19 13:38:32 2016 +0000
pseudo hack patch
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/conf/bitbake.conf | 1 +
meta/recipes-devtools/pseudo/files/rphack.patch | 144 ++++++++++++++++++++++++
meta/recipes-devtools/pseudo/pseudo_1.7.5.bb | 1 +
3 files changed, 146 insertions(+)
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index a5b3169..ac93702 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -633,6 +633,7 @@ FAKEROOTBASEENV = "PSEUDO_BINDIR=${STAGING_BINDIR_NATIVE} PSEUDO_LIBDIR=${STAGIN
FAKEROOTCMD = "${STAGING_BINDIR_NATIVE}/pseudo"
FAKEROOTENV = "PSEUDO_PREFIX=${STAGING_DIR_NATIVE}${prefix_native} PSEUDO_LOCALSTATEDIR=${PSEUDO_LOCALSTATEDIR} PSEUDO_PASSWD=${PSEUDO_PASSWD} PSEUDO_NOSYMLINKEXP=1 PSEUDO_DISABLED=0"
FAKEROOTENV += "PSEUDO_DEBUG_FILE=${PSEUDO_LOCALSTATEDIR}/pseudo.log"
+FAKEROOTENV += "PSEUDO_DEBUG_FILE2=${PSEUDO_LOCALSTATEDIR}/pseudo.log%d"
FAKEROOTNOENV = "PSEUDO_UNLOAD=1"
FAKEROOTDIRS = "${PSEUDO_LOCALSTATEDIR}"
PREFERRED_PROVIDER_virtual/fakeroot-native ?= "pseudo-native"
diff --git a/meta/recipes-devtools/pseudo/files/rphack.patch b/meta/recipes-devtools/pseudo/files/rphack.patch
new file mode 100644
index 0000000..e06c6da
--- /dev/null
+++ b/meta/recipes-devtools/pseudo/files/rphack.patch
@@ -0,0 +1,144 @@
+
+
+
+Index: pseudo-1.7.5/pseudo.h
+===================================================================
+--- pseudo-1.7.5.orig/pseudo.h
++++ pseudo-1.7.5/pseudo.h
+@@ -42,11 +42,14 @@ extern int pseudo_util_debug_fd;
+ extern int pseudo_disabled;
+ extern int pseudo_allow_fsync;
+ extern int pseudo_diag(char *, ...) __attribute__ ((format (printf, 1, 2)));
++extern int pseudo_diag2(char *, ...) __attribute__ ((format (printf, 1, 2)));
+ #ifndef NDEBUG
+ #define pseudo_debug(x, ...) do { \
+ if ((x) & PDBGF_VERBOSE) { \
++ pseudo_diag2(__VA_ARGS__); \
+ if ((pseudo_util_debug_flags & PDBGF_VERBOSE) && (pseudo_util_debug_flags & ((x) & ~PDBGF_VERBOSE))) { pseudo_diag(__VA_ARGS__); } \
+ } else { \
++ pseudo_diag2(__VA_ARGS__); \
+ if (pseudo_util_debug_flags & (x)) { pseudo_diag(__VA_ARGS__); } \
+ } \
+ } while (0)
+@@ -65,6 +68,7 @@ extern int pseudo_diag(char *, ...) __at
+ #define pseudo_debug(...) 0
+ #define pseudo_debug_call(...) 0
+ #endif
++extern void pseudo_dump_lastlogs(void);
+ extern void pseudo_dump_data(char *, const void *, size_t);
+ void pseudo_new_pid(void);
+ /* pseudo_fix_path resolves symlinks up to this depth */
+Index: pseudo-1.7.5/pseudo_util.c
+===================================================================
+--- pseudo-1.7.5.orig/pseudo_util.c
++++ pseudo-1.7.5/pseudo_util.c
+@@ -60,6 +60,7 @@ static struct pseudo_variables pseudo_en
+ { "PSEUDO_OPTS", 11, NULL },
+ { "PSEUDO_DEBUG", 12, NULL },
+ { "PSEUDO_DEBUG_FILE", 17, NULL },
++ { "PSEUDO_DEBUG_FILE2", 18, NULL },
+ { "PSEUDO_TAG", 10, NULL },
+ { "PSEUDO_ENOSYS_ABORT", 19, NULL },
+ { "PSEUDO_NOSYMLINKEXP", 19, NULL },
+@@ -454,6 +455,66 @@ pseudo_diag(char *fmt, ...) {
+ return wrote;
+ }
+
++char lastlines[20][256];
++int lastentry = 0;
++
++#define MIN(x, y) (((x) < (y)) ? (x) : (y))
++
++int
++pseudo_diag2(char *fmt, ...) {
++ va_list ap;
++ int len;
++
++ va_start(ap, fmt);
++ len = vsnprintf(lastlines[lastentry], 255, fmt, ap);
++ va_end(ap);
++
++ lastentry++;
++ if (lastentry >= 20)
++ lastentry = 0;
++ return len;
++}
++
++void
++pseudo_dump_lastlogs(void) {
++ char *pseudo_path;
++ char *filename = pseudo_get_value("PSEUDO_DEBUG_FILE2");
++ char *s;
++ int fd;
++ int i, entry = lastentry;
++ size_t len;
++
++ if (!filename)
++ return;
++
++ len = strlen(filename) + 1;
++ len += 8;
++ pseudo_path = malloc(len);
++ if (!pseudo_path) {
++ pseudo_diag("can't allocate space for debug file name.\n");
++ return;
++ }
++ snprintf(pseudo_path, len, filename, getpid());
++ free(filename);
++
++ fd = open(pseudo_path, O_WRONLY | O_APPEND | O_CREAT, 0644);
++ if (fd == -1) {
++ pseudo_diag("help: can't open log file %s: %s\n", pseudo_path, strerror(errno));
++ return;
++ }
++ free(pseudo_path);
++
++
++ write(fd, "Last logs follow:\n", 18);
++ for (i=0; i<20; i++) {
++ entry--;
++ if (entry < 0)
++ entry = 19;
++ write(fd, lastlines[entry], strlen(lastlines[entry]));
++ }
++ close(fd);
++}
++
+ /* store pid in text form for prepending to messages */
+ void
+ pseudo_new_pid() {
+Index: pseudo-1.7.5/pseudo_client.c
+===================================================================
+--- pseudo-1.7.5.orig/pseudo_client.c
++++ pseudo-1.7.5/pseudo_client.c
+@@ -949,6 +949,12 @@ client_spawn_server(void) {
+ * is ready
+ */
+ waitpid(server_pid, &status, 0);
++ if (WIFEXITED(status) && WEXITSTATUS(status)) {
++ pseudo_debug(PDBGF_CLIENT, "Spawned server exit status %d\n", WEXITSTATUS(status));
++ }
++ if (WIFSIGNALED(status)) {
++ pseudo_debug(PDBGF_CLIENT, "Spawned server exit status %d\n", WTERMSIG(status));
++ }
+ server_pid = -2;
+ pseudo_pidfile = pseudo_localstatedir_path(PSEUDO_PIDFILE);
+ fp = fopen(pseudo_pidfile, "r");
+@@ -1027,6 +1033,7 @@ client_spawn_server(void) {
+
+ execv(argv[0], argv);
+ pseudo_diag("critical failure: exec of pseudo daemon failed: %s\n", strerror(errno));
++ pseudo_dump_lastlogs();
+ exit(1);
+ }
+ }
+@@ -1311,6 +1318,9 @@ pseudo_client_request(pseudo_msg_t *msg,
+ int ms = (getpid() % 5) + 3 + tries;
+ struct timespec delay = { .tv_sec = 0, .tv_nsec = ms * 1000000 };
+ nanosleep(&delay, NULL);
++ if (tries > 40) {
++ pseudo_dump_lastlogs();
++ }
+ }
+ fail_reasons[tries] = strdup(pseudo_client_setup_log);
+ continue;
diff --git a/meta/recipes-devtools/pseudo/pseudo_1.7.5.bb b/meta/recipes-devtools/pseudo/pseudo_1.7.5.bb
index 63f93e6..1a7a273 100644
--- a/meta/recipes-devtools/pseudo/pseudo_1.7.5.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_1.7.5.bb
@@ -9,6 +9,7 @@ SRC_URI = " \
file://pseudo-fix-client-logging.patch \
file://pseudo-Add-additional-logging-around-client-start.patch \
file://pseudo-Move-logging-to-much-earlier.patch \
+ file://rphack.patch \
"
SRC_URI[md5sum] = "c10209938f03128d0c193f041ff3596d"
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list