unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Manuel Giraud <manuel.giraud@univ-nantes.fr>
Cc: emacs-devel@gnu.org
Subject: Re: machine specific patch (OpenBSD)
Date: Tue, 19 Jul 2011 10:44:40 -0700	[thread overview]
Message-ID: <4E25C288.7030607@cs.ucla.edu> (raw)
In-Reply-To: <87oc0q8unp.fsf@univ-nantes.fr>

Thanks for looking into it.  I committed the following into the Emacs
trunk as bzr 105287.  It addresses all the issues I saw, except for
the MIPS port.  The files for that don't look right: they
define a bunch of symbols that Emacs no longer uses.  The only symbol
that is current is VIRT_ADDR_VARIES, so maybe we'll have to fold
that in somehow, but that probably belongs in s/openbsd.h anyway.
Anyway, perhaps if you could get the person who does the MIPS port into
the discussion, so that they can explain what goes wrong on MIPS without
that patch, we could fix the MIPS port too.

======

Port to OpenBSD.
See http://lists.gnu.org/archive/html/emacs-devel/2011-07/msg00688.html
and the surrounding thread.
* minibuf.c (read_minibuf_noninteractive): Rewrite to use getchar
rather than fgets, and retry after EINTR.  Otherwise, 'emacs
--batch -f byte-compile-file' fails on OpenBSD if an inactivity
timer goes off.
* s/openbsd.h (BROKEN_SIGIO): Define.
* unexelf.c (unexec) [__OpenBSD__]:
Don't update the .mdebug section of the Alpha COFF symbol table.
=== modified file 'src/minibuf.c'
--- src/minibuf.c	2011-06-24 21:25:22 +0000
+++ src/minibuf.c	2011-07-19 15:46:18 +0000
@@ -19,6 +19,7 @@


 #include <config.h>
+#include <errno.h>
 #include <stdio.h>
 #include <setjmp.h>

@@ -236,8 +237,9 @@
 			     int allow_props, int inherit_input_method)
 {
   ptrdiff_t size, len;
-  char *line, *s;
+  char *line;
   Lisp_Object val;
+  int c;

   fprintf (stdout, "%s", SDATA (prompt));
   fflush (stdout);
@@ -246,22 +248,30 @@
   size = 100;
   len = 0;
   line = (char *) xmalloc (size);
-  while ((s = fgets (line + len, size - len, stdin)) != NULL
-	 && (len = strlen (line),
-	     len == size - 1 && line[len - 1] != '\n'))
+
+  while ((c = getchar ()) != '\n')
     {
-      if (STRING_BYTES_BOUND / 2 < size)
-	memory_full (SIZE_MAX);
-      size *= 2;
-      line = (char *) xrealloc (line, size);
+      if (c < 0)
+	{
+	  if (errno != EINTR)
+	    break;
+	}
+      else
+	{
+	  if (len == size)
+	    {
+	      if (STRING_BYTES_BOUND / 2 < size)
+		memory_full (SIZE_MAX);
+	      size *= 2;
+	      line = (char *) xrealloc (line, size);
+	    }
+	  line[len++] = c;
+	}
     }

-  if (s)
+  if (len)
     {
-      char *nl = strchr (line, '\n');
-      if (nl)
-	*nl = '\0';
-      val = build_string (line);
+      val = make_string (line, len);
       xfree (line);
     }
   else

=== modified file 'src/s/openbsd.h'
--- src/s/openbsd.h	2011-01-15 23:16:57 +0000
+++ src/s/openbsd.h	2011-07-19 17:19:32 +0000
@@ -1,5 +1,9 @@
 /* System file for openbsd.  */

-/* The same as NetBSD.  Note there are differences in configure.  */
+/* Nearly the same as NetBSD.  Note there are differences in configure.  */
 #include "netbsd.h"

+/* The symbol SIGIO is defined, but the feature doesn't work in the
+   way Emacs needs it to.  See
+   <http://article.gmane.org/gmane.os.openbsd.ports/46831>.  */
+#define BROKEN_SIGIO

=== modified file 'src/unexelf.c'
--- src/unexelf.c	2011-06-13 05:55:57 +0000
+++ src/unexelf.c	2011-07-19 16:47:05 +0000
@@ -1053,7 +1053,7 @@
       memcpy (NEW_SECTION_H (nn).sh_offset + new_base, src,
 	      NEW_SECTION_H (nn).sh_size);

-#ifdef __alpha__
+#if defined __alpha__ && !defined __OpenBSD__
       /* Update Alpha COFF symbol table: */
       if (strcmp (old_section_names + OLD_SECTION_H (n).sh_name, ".mdebug")
 	  == 0)
@@ -1072,7 +1072,7 @@
 	  symhdr->cbRfdOffset += new_data2_size;
 	  symhdr->cbExtOffset += new_data2_size;
 	}
-#endif /* __alpha__ */
+#endif /* __alpha__ && !__OpenBSD__ */

 #if defined (_SYSTYPE_SYSV)
       if (NEW_SECTION_H (nn).sh_type == SHT_MIPS_DEBUG




  reply	other threads:[~2011-07-19 17:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-13 14:12 machine specific patch (OpenBSD) Manuel Giraud
2011-07-13 14:40 ` Dan Nicolaescu
2011-07-13 15:22   ` Manuel Giraud
2011-07-13 23:00     ` Paul Eggert
2011-07-19  9:52       ` Manuel Giraud
2011-07-19 17:44         ` Paul Eggert [this message]
2011-07-20 11:31           ` Manuel Giraud

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=4E25C288.7030607@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=manuel.giraud@univ-nantes.fr \
    /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).