Skip to contentSkip to conversation

Openembedded-core Digest, Vol 80, Issue 148

DISCUSSION Ming Liu 1 participant 1 message Sep 18, 2017 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): mailman.10873.1505745454.1653.openembedded-core@lists.openembedded.org

Ming Liu

author
#1 lore raw
Quoted 1 line

Busybox can also provide sysctl so there's no hard dependency on procps.

Arha, that is correct, please ignore my patch then.

//Ming Liu

2017-09-18 16:37 GMT+02:00 <[email protected]

Quoted 715 lines

:

Send Openembedded-core mailing list submissions to
[email protected]

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.openembedded.org/mailman/listinfo/openembedded-core
or, via email, send a message with subject or body 'help' to
[email protected]

You can reach the person managing the list at
[email protected]

When replying, please edit your Subject line so it is more specific than "Re: Contents of Openembedded-core digest..."

Today's Topics:

1. [PATCHv2] pseudo: use epoll API on Linux (Alexander Kanavin)
2. [pyro][PATCH] goarch.bbclass: Replace logic for setting GOARM
(Will Newton)
3. Re: [PATCH 1/2] base-files: profile: Do not assume that the 'command' command exists (Mike Looijmans)
4. [PATCH] base-files: profile: Get rid of "resize" (Mike Looijmans)
5. ? patchtest: failure for "base-files: profile: Do not as..." and 1 more (rev2) (Patchwork)
6. Re: [PATCH] init-ifupdown: RDEPENDS on procps (Mike Looijmans)

----------------------------------------------------------------------

Message: 1
Date: Mon, 18 Sep 2017 16:34:10 +0300
From: Alexander Kanavin <[email protected]>
To: [email protected], [email protected]
Subject: [OE-core] [PATCHv2] pseudo: use epoll API on Linux
Message-ID: <[email protected]>

The idea came up here:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=11309
and here:
http://lists.openembedded.org/pipermail/openembedded-core/
2017-August/141491.html

---
 .../pseudo/files/0001-Use-epoll-API-on-Linux.patch | 273
+++++++++++++++++++++
 meta/recipes-devtools/pseudo/pseudo_1.8.2.bb       |   1 +
 2 files changed, 274 insertions(+)
 create mode 100644 meta/recipes-devtools/pseudo/

files/0001-Use-epoll-API-on-Linux.patch

meta/recipes-devtools/pseudo/files/0001-Use-epoll-API-on-Linux.patch new file +36 -0
new file mode 100644
index 00000000000..2e304f9811c
@@ -0,0 +1,273 @@
+From 55fe7dc646f560bdf79309bc8677902e53686d65 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <[email protected]>
+Date: Fri, 15 Sep 2017 17:00:14 +0300
+Subject: [PATCH] Use epoll API on Linux
+
+Upstream-Status: Submitted [Seebs CC'd by email]
+Signed-off-by: Alexander Kanavin <[email protected]>
+
+
+Signed-off-by: Alexander Kanavin <[email protected]>
+---
+ enums/exit_status.in |   3 +
+ pseudo_server.c      | 178 ++++++++++++++++++++++++++++++
++++++++++++++++++++-
+ 2 files changed, 179 insertions(+), 2 deletions(-)
+
+diff --git a/enums/exit_status.in b/enums/exit_status.in
+index 6be44d3..88f94cd 100644
+--- a/enums/exit_status.in
++++ b/enums/exit_status.in
+@@ -18,3 +18,6 @@ listen_fd, "server loop had no valid listen fd"
+ pseudo_loaded, "server couldn't get out of pseudo environment"
+ pseudo_prefix, "couldn't get valid pseudo prefix"
+ pseudo_invocation, "invalid server command arguments"
++epoll_create, "epoll_create() failed"
++epoll_ctl, "epoll_ctl() failed"
++
+diff --git a/pseudo_server.c b/pseudo_server.c
+index ff16efd..09c43e4 100644
+--- a/pseudo_server.c
++++ b/pseudo_server.c
+@@ -40,6 +40,12 @@
+ #include "pseudo_client.h"
+ #include "pseudo_db.h"
+
++// This has to come after pseudo includes, as that's where PSEUDO_PORT

defines are
++#ifdef PSEUDO_PORT_LINUX
++#include <sys/epoll.h>
++#endif
++
++
+ static int listen_fd = -1;
+
+ typedef struct {
+@@ -59,6 +65,7 @@ static int active_clients = 0, highest_client = 0, max_clients = 0;

meta/recipes-devtools/pseudo/files/0001-Use-epoll-API-on-Linux.patch new file +111 -0
+
+ #define LOOP_DELAY 2
+ #define DEFAULT_PSEUDO_SERVER_TIMEOUT 30
++#define EPOLL_MAX_EVENTS 10
+ int pseudo_server_timeout = DEFAULT_PSEUDO_SERVER_TIMEOUT;
+ static int die_peacefully = 0;
+ static int die_forcefully = 0;
+@@ -80,7 +87,11 @@ quit_now(int signal) {
+ static int messages = 0, responses = 0;
+ static struct timeval message_time = { .tv_sec = 0 };
+
++#ifdef PSEUDO_PORT_LINUX
++static void pseudo_server_loop_epoll(void);
++#else
+ static void pseudo_server_loop(void);
++#endif
+
+ /* helper function to make a directory, just like mkdir -p.
+  * Can't use system() because the child shell would end up trying
+@@ -369,12 +380,16 @@ pseudo_server_start(int daemonize) {
+                       kill(ppid, SIGUSR1);
+               }
+       }
++#ifdef PSEUDO_PORT_LINUX
++      pseudo_server_loop_epoll();
++#else
+       pseudo_server_loop();
++#endif
+       return 0;
+ }
+
+ /* mess with internal tables as needed */
+-static void
++static unsigned int
+ open_client(int fd) {
+       pseudo_client_t *new_clients;
+       int i;
+@@ -390,7 +405,7 @@ open_client(int fd) {
+                       ++active_clients;
+                       if (i > highest_client)
+                               highest_client = i;
+-                      return;
++                      return i;
+               }
+       }
+
+@@ -414,9 +429,11 @@ open_client(int fd) {
+
+               max_clients += 16;
+               ++active_clients;
++              return max_clients - 16;
+       } else {
+               pseudo_diag("error allocating new client, fd %d\n", fd);
+               close(fd);
++              return 0;
+       }
+ }
+
+@@ -566,6 +583,162 @@ serve_client(int i) {
+       }
+ }
+
++#ifdef PSEUDO_PORT_LINUX
++static void pseudo_server_loop_epoll(void)
++{
++      struct sockaddr_un client;
++      socklen_t len;
++        int i;
++        int rc;
++        int fd;
++      int timeout;
++      struct epoll_event ev, events[EPOLL_MAX_EVENTS];
++      int loop_timeout = pseudo_server_timeout;
++
++      clients = malloc(16 * sizeof(*clients));
++
++      clients[0].fd = listen_fd;
++      clients[0].pid = getpid();
++
++      for (i = 1; i < 16; ++i) {
++              clients[i].fd = -1;
++              clients[i].pid = 0;
++              clients[i].tag = NULL;
++              clients[i].program = NULL;
++      }
++
++      active_clients = 1;
++      max_clients = 16;
++      highest_client = 0;
++
++      pseudo_debug(PDBGF_SERVER, "server loop started.\n");
++      if (listen_fd < 0) {
++              pseudo_diag("got into loop with no valid listen fd.\n");
++              exit(PSEUDO_EXIT_LISTEN_FD);
++      }
++
++      timeout = LOOP_DELAY * 1000;
++
++      int epollfd = epoll_create1(0);
++      if (epollfd == -1) {
++              pseudo_diag("epoll_create1() failed.\n");
++              exit(PSEUDO_EXIT_EPOLL_CREATE);
++      }
++      ev.events = EPOLLIN;
++      ev.data.u64 = 0;
++      if (epoll_ctl(epollfd, EPOLL_CTL_ADD, clients[0].fd, &ev) == -1) {
++              pseudo_diag("epoll_ctl() failed with listening socket.\n");
++              exit(PSEUDO_EXIT_EPOLL_CTL);
++      }
++
++      pdb_log_msg(SEVERITY_INFO, NULL, NULL, NULL, "server started (pid

%d)", getpid());
++
++ for (;;) {
++ rc = epoll_wait(epollfd, events, EPOLL_MAX_EVENTS,
timeout);
++ if (rc == 0 || (rc == -1 && errno == EINTR)) {
++ /* If there's no clients, start timing out. If
there
++ * are active clients, never time out.
++ */
++ if (active_clients == 1) {
++ loop_timeout -= LOOP_DELAY;
++ /* maybe flush database to disk */
++ pdb_maybe_backup();
++ if (loop_timeout <= 0) {
++ pseudo_debug(PDBGF_SERVER, "no
more clients, got bored.\n");
++ die_peacefully = 1;
++ } else {
++ /* display this if not exiting */
++ pseudo_debug(PDBGF_SERVER |
PDBGF_BENCHMARK, "%d messages handled in %.4f seconds, %d responses\n",
++ messages,
++ (double)
message_time.tv_sec +
++ (double)
message_time.tv_usec / 1000000.0,
++ responses);
++ }
++ }
++ } else if (rc > 0) {
++ loop_timeout = pseudo_server_timeout;
++ for (i = 0; i < rc; ++i) {
++ if (clients[events[i].data.u64].fd ==
listen_fd) {
++ if (!die_forcefully) {
++ len = sizeof(client);
++ if ((fd =
accept(listen_fd, (struct sockaddr *) &client, &len)) != -1) {
++ /* Don't allow clients to
end up on fd 2, because glibc's
++ * malloc debug uses that
fd unconditionally.
++ */
++ if (fd == 2) {
++ int newfd
= fcntl(fd, F_DUPFD, 3);
++ close(fd);
++ fd = newfd;
++ }
++
pseudo_debug(PDBGF_SERVER, "new client fd %d\n", fd);
++ /* A new client
implicitly cancels any
++ * previous
shutdown request, or a
++ * shutdown for
lack of clients.
++ */
++
pseudo_server_timeout = DEFAULT_PSEUDO_SERVER_TIMEOUT;
++ die_peacefully = 0;
++
++ ev.events =
EPOLLIN;
++ ev.data.u64 =
open_client(fd);
++ if (ev.data.u64 !=
0 && epoll_ctl(epollfd, EPOLL_CTL_ADD, clients[ev.data.u64].fd, &ev) == -1) {
++
pseudo_diag("epoll_ctl() failed with accepted socket.\n");
++
exit(PSEUDO_EXIT_EPOLL_CTL);
++ }
++ } else if (errno ==
EMFILE) {
++ // select() loop
would drop a client here, we do nothing (for now)
++
pseudo_debug(PDBGF_SERVER, "Hit max open files.\n");
++ }
++ }
++ } else {
++ struct timeval tv1, tv2;
++ int rc;
++ gettimeofday(&tv1, NULL);
++ rc = serve_client(events[i].data.
u64);
++ gettimeofday(&tv2, NULL);
++ ++messages;
++ if (rc == 0)
++ ++responses;
++ message_time.tv_sec += (tv2.tv_sec
- tv1.tv_sec);
++ message_time.tv_usec +=
(tv2.tv_usec - tv1.tv_usec);
++ if (message_time.tv_usec < 0) {
++ message_time.tv_usec +=
1000000;
++ --message_time.tv_sec;
++ } else while (message_time.tv_usec

Quoted 1 line

1000000) {

++ message_time.tv_usec -=
1000000;
++ ++message_time.tv_sec;
++ }
++ }
++ if (die_forcefully)
++ break;
++ }
++ pseudo_debug(PDBGF_SERVER, "server loop complete
[%d clients left]\n", active_clients);
++ } else {
++ pseudo_diag("epoll_wait failed: %s\n",
strerror(errno));
++ break;
++ }
++ if (die_peacefully || die_forcefully) {
++ pseudo_debug(PDBGF_SERVER, "quitting.\n");
++ pseudo_debug(PDBGF_SERVER | PDBGF_BENCHMARK,
"server %d exiting: handled %d messages in %.4f seconds\n",

++                              getpid(), messages,
++                              (double) message_time.tv_sec +
++                              (double) message_time.tv_usec / 1000000.0);
++                      pdb_log_msg(SEVERITY_INFO, NULL, NULL, NULL,
"server %d exiting: handled %d messages in %.4f seconds",
++                              getpid(), messages,
++                              (double) message_time.tv_sec +
++                              (double) message_time.tv_usec / 1000000.0);

++ /* and at this point, we'll start refusing
connections */
++ close(clients[0].fd);
++ /* This is a good place to insert a delay for
++ * debugging race conditions during startup. */
++ /* usleep(300000); */
++ exit(0);
++ }
++ }
++
++}
++
++#else
++
+ /* get clients, handle messages, shut down.

meta/recipes-devtools/pseudo/files/0001-Use-epoll-API-on-Linux.patch new file +10 -0
+  * This doesn't actually do any work, it just calls a ton of things which
+  * do work.
+@@ -751,3 +924,4 @@ pseudo_server_loop(void) {
+       }
+       pseudo_diag("select failed: %s\n", strerror(errno));
+ }
++#endif
+--
+2.14.1
+
meta/recipes-devtools/pseudo/pseudo_1.8.2.bb +0 -0
index 9bcd0318926..81853e95c42 100644
@@ -8,6 +8,7 @@ SRC_URI = "http://downloads.yoctoproject.org/releases/

pseudo/${BPN}-${PV}.tar.bz

            file://efe0be279901006f939cd357ccee47b651c786da.patch \
            file://b6b68db896f9963558334aff7fca61adde4ec10f.patch \
            file://toomanyfiles.patch \
+           file://0001-Use-epoll-API-on-Linux.patch \
            "

SRC_URI[md5sum] = "7d41e72188fbea1f696c399c1a435675"
--
2.14.1

------------------------------

Message: 2
Date: Mon, 18 Sep 2017 16:43:56 +0300
From: Will Newton <[email protected]>
To: [email protected]
Cc: Will Newton <[email protected]>, Otavio Salvador
<[email protected]>
Subject: [OE-core] [pyro][PATCH] goarch.bbclass: Replace logic for
setting GOARM
Message-ID: <[email protected]>

From: Will Newton <[email protected]>

The previous logic applied a regex to TUNE_FEATURES which could set the GOARM value to 7 incorrectly, for example when dealing with an arm1176 core. Simplify to check for the presence of "armv7" instead. At the same time add a check for "armv6" and set GOARM to 6 in that case.

(From OE-Core rev: 07b60c15e9ef650940afdde37bf3f3b9c50a336d)

---
 meta/classes/goarch.bbclass | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
meta/classes/goarch.bbclass +5 -3
index 4a5b2ec787..12df88f8c4 100644
@@ -38,8 +38,11 @@ def go_map_arch(a, d):
 
 def go_map_arm(a, f, d):
     import re
-    if re.match('arm.*', a) and re.match('arm.*7.*', f):
-        return '7'
+    if re.match('arm.*', a):
+        if 'armv7' in f:
+            return '7'
+        elif 'armv6' in f:
+            return '6'
     return ''
 
 def go_map_os(o, d):
--

2.13.5

------------------------------

Message: 3
Date: Mon, 18 Sep 2017 15:56:25 +0200
From: Mike Looijmans <[email protected]>
To: <[email protected]>
Subject: Re: [OE-core] [PATCH 1/2] base-files: profile: Do not assume
that the 'command' command exists
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"; format=flowed

Quoted 7 lines · Mike Looijmans
Quoted 6 lines · Ross

On 18 September 2017 at 12:31, Mike Looijmans <[email protected] <mailto:[email protected]>> wrote:

This is basically the same change as I first sent a patch for in April, and
last pinged this Friday... The only real difference is that

this one

Quoted 2 lines
Quoted 2 lines

misses
passing error output from resize to /dev/null (which it should

do to

Quoted 12 lines
Quoted 12 lines

handle
the case where tty exists, but resize does not).

Yeah, indeed.

Apologies for missing that patch!

Other problem is that "resize" outputs shell script on stdout to be executed, so the proper "total" invokation would be:

Quoted 6 lines
Quoted 6 lines

/dev/tty[A-z]*) eval resize 2>/dev/null ;;

The "eval" part is missing in your version...

Who is going to submit the One True patch with all the fixes in? I

promise

Quoted 3 lines
Quoted 1 line

to merge it.

I'll send the one ring, eh, patch, in a few minutes. I'll merge the two

into a

Quoted 1 line

single as well.

On second thought, just use Peter's patch "as is".

I've been experimenting with the "eval" part and it doesn't behave well. Tends
to confuse minicom, create garbage, and in particular when run from "profile",
it seems to result in counterproductive COLUMNS=0 and LINES=0.

I'm actually wondering why the call to "resize" is being done at all. Just calling "resize" has no effect, since it outputs the results on stdout as shell script, and that is being discarded. Looking at the commit that introduced it:

cc6360f4c4d9 (base-files: set dynamic COLUMNS via resize command)

that already has no effect whatsoever. See the man page for resize:
https://linux.die.net/man/1/resize

I also would consider running some program's output as shell script a bit spooky, it looks like a security hole waiting to be exploited.

Kind regards,

Mike Looijmans
System Expert

TOPIC Products
Materiaalweg 4, NL-5681 RJ Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
E-mail: [email protected]
Website: www.topicproducts.com

Please consider the environment before printing this e-mail

------------------------------

Message: 4
Date: Mon, 18 Sep 2017 16:07:14 +0200
From: Mike Looijmans <[email protected]>
To: [email protected]
Cc: Mike Looijmans <[email protected]>,
[email protected]
Subject: [OE-core] [PATCH] base-files: profile: Get rid of "resize" Message-ID:

        <[email protected]>

The "resize" command actually outputs shell commands to be executed, for example:

$ resize
COLUMNS=102;
LINES=27;
export COLUMNS LINES;

The output of "resize" is being discarded to /dev/null so the call has no effect whatsoever, and does not change the environment (it cannot change the
environment of its parent). Remove the call and hence solve the messages about shells missing "command" or "tty" or "resize".

---
 meta/recipes-core/base-files/base-files/profile | 9 ---------
 1 file changed, 9 deletions(-)
meta/recipes-core/base-files/base-files/profile +0 -2
index a062028..cfd0d69 100644
@@ -20,15 +20,6 @@ if [ -d /etc/profile.d ]; then
        unset i
 fi
 
-if command -v resize >/dev/null && command -v tty >/dev/null; then
-       # Make sure we are on a serial console (i.e. the device used

starts with
- # /dev/tty[A-z]), otherwise we confuse e.g. the eclipse launcher
which

meta/recipes-core/base-files/base-files/profile +0 -7
-       # tries do use ssh
-       case $(tty) in
-               /dev/tty[A-z]*) resize >/dev/null;;
-       esac
-fi
-
 export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM
 
 umask 022
--

1.9.1

------------------------------

Message: 5
Date: Mon, 18 Sep 2017 14:30:26 -0000
From: Patchwork <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [OE-core] ? patchtest: failure for "base-files: profile: Do

        not as..." and 1 more (rev2)

Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

== Series Details ==

Series: "base-files: profile: Do not as..." and 1 more (rev2)
Revision: 2
URL : https://patchwork.openembedded.org/series/8967/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch
[test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at cbc396dd10)

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe

------------------------------

Message: 6
Date: Mon, 18 Sep 2017 14:47:08 +0200
From: Mike Looijmans <[email protected]>
To: <[email protected]>
Subject: Re: [OE-core] [PATCH] init-ifupdown: RDEPENDS on procps
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"; format=flowed

?Busybox can also provide sysctl so there's no hard dependency on procps.

Review

Quoted 11 lines · On 18-09-17 14:43, [email protected] wrote:

From: Ming Liu <[email protected]>

sysctl is being called in /etc/init.d/networking, so it needs RDEPENDS on procps.

---
  meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb

meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb do_install_append_qemuall () { · line 41

Quoted 13 lines

index 733ae41..8774386 100644

meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb +1 -1
@@ -35,7 +35,7 @@ do_install_append_qemuall () {
  }
 
  PACKAGE_ARCH_qemuall = "${MACHINE_ARCH}"
-RDEPENDS_${PN} = "netbase"
+RDEPENDS_${PN} = "netbase procps"
  RCONFLICTS_${PN} = "netbase (< 1:5.0)"
 
  CONFFILES_${PN} = "${sysconfdir}/network/interfaces"

Kind regards,

Mike Looijmans
System Expert

TOPIC Products
Materiaalweg 4, NL-5681 RJ Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
E-mail: [email protected]
Website: www.topicproducts.com

Please consider the environment before printing this e-mail

------------------------------

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

End of Openembedded-core Digest, Vol 80, Issue 148
**************************************************