bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: aplwrap


From: Chris Moller
Subject: Re: aplwrap
Date: Sun, 28 Jun 2020 16:08:30 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

Can you try patching pstat.c with:

diff --git a/src/pstat.c b/src/pstat.c
index c5e158a..4515378 100644
--- a/src/pstat.c
+++ b/src/pstat.c
@@ -174,7 +174,8 @@ get_pstat (GPid   pid,
   int conv;
   unsigned long rchar, wchar, syscr, syscw, read_bytes, write_bytes;
   unsigned long cancelled_write_bytes;
-
+  int rc;
+
   memset(stats, 0, sizeof(struct _pstat));
   if (pid < 0) return;
   gettimeofday(&wall_time, NULL);
@@ -184,6 +185,10 @@ get_pstat (GPid   pid,
   conv = fscanf(fp, SCANF_BTIME, &btime);
   fclose(fp);
   if (conv != 1) return;
+
+  rc = asprintf(&path, "/proc/%d/stat", pid);
+  if (rc == -1) return;
+
   asprintf(&path, "/proc/%d/stat", pid);
   fp = fopen(path, "r");
   free (path);
@@ -201,11 +206,10 @@ get_pstat (GPid   pid,
   stats->minflt     = minflt + cminflt;
   stats->majflt     = majflt + cmajflt;
   stats->biowait    = biowait;
-#if 1
-  asprintf(&path, "/proc/%d/stat", pid);
-#else
-  snprintf(path, sizeof(path), "/proc/%d/io", pid);
-#endif
+
+  rc = asprintf(&path, "/proc/%d/stat", pid);
+  if (rc == -1) return;
+
   fp = fopen(path, "r");
   free (path);
   if (fp == NULL) return;


On 2020-06-28 15:04, Blake McBride wrote:
I put the source back where "apl --show_src_dir" expects it.

I am getting:

pstat.c: In function ‘get_pstat’:
pstat.c:187:3: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
   asprintf(&path, "/proc/%d/stat", pid);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pstat.c:205:3: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
   asprintf(&path, "/proc/%d/stat", pid);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

As with GNUAPL, because of the combination of their overzealous warnings and your insistence on no warnings, it doesn't build.  I suppose I'll have to use a special command to build your system as I have to build GNUAPL.  For GNUAPL, I use:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]