public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com, mark@klomp.org
Subject: [committed] Handle skip_multifile in encode/decode_child_exit_status
Date: Mon, 29 Mar 2021 09:46:07 +0200	[thread overview]
Message-ID: <20210329074606.GA25979@delia> (raw)

Hi,

Handle skip_multifile in encode_child_exit_status and
decode_child_exit_status.  This is a preparation for running write_multifile
in parallel.

Committed to trunk.

Thanks,
- Tom

Handle skip_multifile in encode/decode_child_exit_status

2021-03-29  Tom de Vries  <tdevries@suse.de>

	* dwz.c (encode_child_exit_status, decode_child_exit_status): Handle
	skip_multifile.

---
 dwz.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/dwz.c b/dwz.c
index de600c1..9adc9df 100644
--- a/dwz.c
+++ b/dwz.c
@@ -16417,12 +16417,13 @@ update_hardlinks (int nr_files, char *files[], struct file_result *resa)
 static int
 encode_child_exit_status (int thisret, struct file_result *res)
 {
+  assert (thisret == 0 ||  thisret == 1);
   if (thisret == 0 && res->low_mem_p)
     thisret = 2;
-  assert (thisret >= 0 && thisret <= 2);
-  assert (res->res >= -3);
-  thisret = thisret + ((res->res + 3) << 2);
-  return thisret;
+  assert (res->res >= -3 && res->res <= 1);
+  return (thisret
+	  + ((res->res + 3) << 2)
+	  + ((res->skip_multifile ? 1 : 0) << 5));
 }
 
 /* Decode child process exit status.  */
@@ -16432,14 +16433,21 @@ decode_child_exit_status (int state, struct file_result *res)
   int ret;
   if (!WIFEXITED (state))
     error (1, 0, "Child dwz process got killed");
-  ret = WEXITSTATUS (state) & 0x3;
+  int status = WEXITSTATUS (state);
+  ret = status & 0x3;
+  status >>= 2;
+
   res->low_mem_p = false;
   if (ret == 2)
     {
       ret = 0;
       res->low_mem_p = true;
     }
-  res->res = (int)((WEXITSTATUS (state) & ~0x3) >> 2) - 3;
+
+  res->res = (int)(status & 0x7) - 3;
+  status >>= 3;
+
+  res->skip_multifile = (status & 0x1) ? true : false;
 
   return ret;
 }

                 reply	other threads:[~2021-03-29  7:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210329074606.GA25979@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    --cc=mark@klomp.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).