unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Elad Lahav <elahav@blackberry.com>,
	Emacs Development <Emacs-devel@gnu.org>
Subject: Re: Emacs on QNX
Date: Sun, 22 Oct 2017 21:51:07 -0700	[thread overview]
Message-ID: <cef9679c-4c18-10cb-1623-c8e5902e9a13@cs.ucla.edu> (raw)
In-Reply-To: <1508710435.8718.6.camel@blackberry.com>

[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]

Thanks for looking into a QNX port.

Elad Lahav wrote:

> There is still a stub that returns -1 and sets errno to
> ENOMEM, but the Emacs code doesn't check for that, and interprets the
> result as the address 0xffffffffffffffff.

Which part of the Emacs code is that? Is this the call in src/unexelf.c? If so, 
I can fix that.

> To overcome the problem, I wrote a naive implementation of sbrk() in a
> dynamically-linked library

Although that's clever, I'm hoping that we can port to QNX the same way we port 
to Cygwin, as Cygwin already uses a fake sbrk. (Eventually Emacs has got to stop 
using sbrk, but we don't have an adequate solution to that bigger problem yet.)

Does the attached patch work for you instead?

> +    CFLAGS="$CFLAGS -D__NO_EXT_QNX"

Could you fill us on on what __NO_EXT_QNX does? The symbol I see mentioned in 
public discussions is _QNX_SOURCE. What is the difference between those two 
symbols, and why is __NO_EXT_QNX preferable here? What happens if you leave it out?

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: qnx.diff --]
[-- Type: text/x-patch; name="qnx.diff", Size: 1714 bytes --]

diff --git a/configure.ac b/configure.ac
index 63324c2c7c..0e5ffb806e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -699,6 +699,12 @@ AC_DEFUN
     esac
   ;;
 
+  ## QNX Neutrino
+  *-nto-qnx* )
+    opsys=qnxnto
+    CFLAGS="$CFLAGS -D__NO_EXT_QNX"
+  ;;
+
   ## Intel 386 machines where we don't care about the manufacturer.
   i[3456]86-*-* )
     case "${canonical}" in
@@ -1507,6 +1513,8 @@ AC_DEFUN
 
   hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
 
+  qnxnto) LIBS_SYSTEM="-L/usr/lib -lsocket" ;;
+
   sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;;
 
   ## Motif needs -lgen.
@@ -2210,7 +2218,8 @@ AC_DEFUN
 case "$opsys" in
   ## darwin ld insists on the use of malloc routines in the System framework.
   darwin | mingw32 | nacl | sol2-10) ;;
-  cygwin) hybrid_malloc=yes
+  cygwin | qnxnto)
+	  hybrid_malloc=yes
           system_malloc= ;;
   *) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;;
 esac
@@ -4604,7 +4613,7 @@ AC_DEFUN
     AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
     ;;
 
-  gnu | openbsd )
+  gnu | openbsd | qnxnto )
     AC_DEFINE(FIRST_PTY_LETTER, ['p'])
     ;;
 
diff --git a/src/unexelf.c b/src/unexelf.c
index 1cdcfeb44e..200ddf4ae2 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -58,9 +58,12 @@ what you give them.   Help stamp out software-hoarding!  */
 #include <sys/types.h>
 #include <unistd.h>
 
-#if !defined (__NetBSD__) && !defined (__OpenBSD__)
+#ifdef __QNX__
+#include <sys/elf.h>
+#elif !defined __NetBSD__ && !defined __OpenBSD__
 #include <elf.h>
-#endif /* not __NetBSD__ and not __OpenBSD__ */
+#endif
+
 #include <sys/mman.h>
 #if defined (_SYSTYPE_SYSV)
 #include <sys/elf_mips.h>

  reply	other threads:[~2017-10-23  4:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-22 22:13 Emacs on QNX Elad Lahav
2017-10-23  4:51 ` Paul Eggert [this message]
2017-10-23 11:27   ` Elad Lahav
2017-10-24  1:52     ` Elad Lahav
2017-10-24 20:14       ` Paul Eggert
2017-10-25  2:27         ` Elad Lahav
2017-10-26  3:52           ` Paul Eggert
2017-11-09 17:17             ` Elad Lahav
2017-11-09 17:23               ` Eli Zaretskii
2017-11-30 17:43                 ` Elad Lahav
2017-11-30 23:41                   ` Paul Eggert
2017-12-01  2:06                     ` Elad Lahav
2017-12-01  3:37                       ` Paul Eggert
2017-12-01 11:55                         ` Elad Lahav
2017-12-11  0:25                     ` Elad Lahav
2017-11-09 17:30               ` Noam Postavsky
2017-11-09 17:33                 ` Elad Lahav

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=cef9679c-4c18-10cb-1623-c8e5902e9a13@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=Emacs-devel@gnu.org \
    --cc=elahav@blackberry.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).