aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-07-19 10:33:06 -0700
committerPaul Eggert2011-07-19 10:33:06 -0700
commit590bd46743151a55ba68a7d211f82b2485c57d3a (patch)
tree5aeae1bbd40336943ada352e2d9fee2d71067af4 /src
parentf41628b25314bf3ab1129306a6ff414650fea915 (diff)
downloademacs-590bd46743151a55ba68a7d211f82b2485c57d3a.tar.gz
emacs-590bd46743151a55ba68a7d211f82b2485c57d3a.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog13
-rw-r--r--src/minibuf.c36
-rw-r--r--src/s/openbsd.h6
-rw-r--r--src/unexelf.c4
4 files changed, 43 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ccb2d1dc907..e098e536efb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,16 @@
12011-07-19 Paul Eggert <eggert@cs.ucla.edu>
2
3 Port to OpenBSD.
4 See http://lists.gnu.org/archive/html/emacs-devel/2011-07/msg00688.html
5 and the surrounding thread.
6 * minibuf.c (read_minibuf_noninteractive): Rewrite to use getchar
7 rather than fgets, and retry after EINTR. Otherwise, 'emacs
8 --batch -f byte-compile-file' fails on OpenBSD if an inactivity
9 timer goes off.
10 * s/openbsd.h (BROKEN_SIGIO): Define.
11 * unexelf.c (unexec) [__OpenBSD__]:
12 Don't update the .mdebug section of the Alpha COFF symbol table.
13
12011-07-19 Lars Magne Ingebrigtsen <larsi@gnus.org> 142011-07-19 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 15
3 * lread.c (syms_of_lread): Clarify when `lexical-binding' is used 16 * lread.c (syms_of_lread): Clarify when `lexical-binding' is used
diff --git a/src/minibuf.c b/src/minibuf.c
index cf37c337be4..7e59cf157b5 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -19,6 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20 20
21#include <config.h> 21#include <config.h>
22#include <errno.h>
22#include <stdio.h> 23#include <stdio.h>
23#include <setjmp.h> 24#include <setjmp.h>
24 25
@@ -236,8 +237,9 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
236 int allow_props, int inherit_input_method) 237 int allow_props, int inherit_input_method)
237{ 238{
238 ptrdiff_t size, len; 239 ptrdiff_t size, len;
239 char *line, *s; 240 char *line;
240 Lisp_Object val; 241 Lisp_Object val;
242 int c;
241 243
242 fprintf (stdout, "%s", SDATA (prompt)); 244 fprintf (stdout, "%s", SDATA (prompt));
243 fflush (stdout); 245 fflush (stdout);
@@ -246,22 +248,30 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
246 size = 100; 248 size = 100;
247 len = 0; 249 len = 0;
248 line = (char *) xmalloc (size); 250 line = (char *) xmalloc (size);
249 while ((s = fgets (line + len, size - len, stdin)) != NULL 251
250 && (len = strlen (line), 252 while ((c = getchar ()) != '\n')
251 len == size - 1 && line[len - 1] != '\n'))
252 { 253 {
253 if (STRING_BYTES_BOUND / 2 < size) 254 if (c < 0)
254 memory_full (SIZE_MAX); 255 {
255 size *= 2; 256 if (errno != EINTR)
256 line = (char *) xrealloc (line, size); 257 break;
258 }
259 else
260 {
261 if (len == size)
262 {
263 if (STRING_BYTES_BOUND / 2 < size)
264 memory_full (SIZE_MAX);
265 size *= 2;
266 line = (char *) xrealloc (line, size);
267 }
268 line[len++] = c;
269 }
257 } 270 }
258 271
259 if (s) 272 if (len)
260 { 273 {
261 char *nl = strchr (line, '\n'); 274 val = make_string (line, len);
262 if (nl)
263 *nl = '\0';
264 val = build_string (line);
265 xfree (line); 275 xfree (line);
266 } 276 }
267 else 277 else
diff --git a/src/s/openbsd.h b/src/s/openbsd.h
index 175d61dc9c9..0a8bab2290f 100644
--- a/src/s/openbsd.h
+++ b/src/s/openbsd.h
@@ -1,5 +1,9 @@
1/* System file for openbsd. */ 1/* System file for openbsd. */
2 2
3/* The same as NetBSD. Note there are differences in configure. */ 3/* Nearly the same as NetBSD. Note there are differences in configure. */
4#include "netbsd.h" 4#include "netbsd.h"
5 5
6/* The symbol SIGIO is defined, but the feature doesn't work in the
7 way Emacs needs it to. See
8 <http://article.gmane.org/gmane.os.openbsd.ports/46831>. */
9#define BROKEN_SIGIO
diff --git a/src/unexelf.c b/src/unexelf.c
index 951e7c0eea6..a169ffcb5c8 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -1053,7 +1053,7 @@ temacs:
1053 memcpy (NEW_SECTION_H (nn).sh_offset + new_base, src, 1053 memcpy (NEW_SECTION_H (nn).sh_offset + new_base, src,
1054 NEW_SECTION_H (nn).sh_size); 1054 NEW_SECTION_H (nn).sh_size);
1055 1055
1056#ifdef __alpha__ 1056#if defined __alpha__ && !defined __OpenBSD__
1057 /* Update Alpha COFF symbol table: */ 1057 /* Update Alpha COFF symbol table: */
1058 if (strcmp (old_section_names + OLD_SECTION_H (n).sh_name, ".mdebug") 1058 if (strcmp (old_section_names + OLD_SECTION_H (n).sh_name, ".mdebug")
1059 == 0) 1059 == 0)
@@ -1072,7 +1072,7 @@ temacs:
1072 symhdr->cbRfdOffset += new_data2_size; 1072 symhdr->cbRfdOffset += new_data2_size;
1073 symhdr->cbExtOffset += new_data2_size; 1073 symhdr->cbExtOffset += new_data2_size;
1074 } 1074 }
1075#endif /* __alpha__ */ 1075#endif /* __alpha__ && !__OpenBSD__ */
1076 1076
1077#if defined (_SYSTYPE_SYSV) 1077#if defined (_SYSTYPE_SYSV)
1078 if (NEW_SECTION_H (nn).sh_type == SHT_MIPS_DEBUG 1078 if (NEW_SECTION_H (nn).sh_type == SHT_MIPS_DEBUG