all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Wolfgang Jenkner <wjenkner@inode.at>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 19393@debbugs.gnu.org
Subject: bug#19393: 25.0.50; Emacs cannot determine coding system of ISO-8859 encoded files
Date: Wed, 14 Jan 2015 20:41:21 +0100	[thread overview]
Message-ID: <85oaq1gnc8.fsf@iznogoud.viz> (raw)
In-Reply-To: <87sigfpqmx.fsf@thinkpad-t440p.tsdh.org>

On Tue, Jan 13 2015, Wolfgang Jenkner wrote:

> Here's a simple change in src/buffer.c that reduces the time to six
> seconds or so, but only for newer versions of FreeBSD.
>
> It takes advantage of the MAP_EXCL flag for mmap(2), which has been
> recently added[1] and is also available in 10-STABLE and 10.1-RELEASE.

There remains the problem, though, that emacs on FreeBSD also uses
gmalloc and hence, IIUC, sbrk() for memory allocation, and at this point
I'm too ignorant about almost everything involved here to be confident
that mmap()ed pages can't overlap with the process (BSS) data segment
when MAP_EXCL | MAP_FIXED is among the flags.

Without the MAP_EXCL mmap flag they definitely can overlap, as the
following test program shows when it is _statically_ linked.

Here's the output when I run it:

r0 = 0x800663000
Cannot allocate memory
r2 = 0x800662000

-- >8 --
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/mman.h>
#include <errno.h>

int
main ()
{
	int n;
	void *r0, *r1, *r2;

	n = getpagesize();

	r0 = mmap(NULL, n, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);

	if (r0 == MAP_FAILED || brk(r0) != 0 || sbrk(0) != r0)
		return (1);
	
	fprintf(stderr, "r0 = %p\n", r0);

	errno = 0;
	r1 = mmap(r0 - n, n, PROT_READ | PROT_WRITE,
		  MAP_ANON | MAP_EXCL | MAP_FIXED, -1, 0);
	if (r1 == MAP_FAILED)
		perror(NULL);
	else
		fprintf(stderr, "r1 = %p\n", r1);

	errno = 0;
	r2 = mmap(r0 - n, n, PROT_READ | PROT_WRITE,
		  MAP_ANON | MAP_FIXED, -1, 0);
	if (r2 == MAP_FAILED)
		perror(NULL);
	else
		fprintf(stderr, "r2 = %p\n", r2);


	return (0);
}





  parent reply	other threads:[~2015-01-14 19:41 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16 15:21 bug#19393: 25.0.50; Emacs cannot determine coding system of ISO-8859 encoded files Tassilo Horn
2014-12-16 16:05 ` Eli Zaretskii
2014-12-16 16:20   ` Eli Zaretskii
2014-12-16 19:22     ` Tassilo Horn
2014-12-16 19:10   ` Tassilo Horn
2014-12-16 16:39 ` martin rudalics
2014-12-16 19:26   ` Tassilo Horn
2014-12-16 16:56 ` Andreas Schwab
2014-12-16 18:49 ` Wolfgang Jenkner
2014-12-16 19:36   ` Tassilo Horn
2014-12-17 14:22     ` Wolfgang Jenkner
2014-12-17 15:50       ` Eli Zaretskii
2014-12-17 16:02         ` Wolfgang Jenkner
2014-12-17 17:03           ` Eli Zaretskii
2014-12-18  1:47             ` Wolfgang Jenkner
2014-12-18 16:22               ` Eli Zaretskii
2014-12-18 16:36                 ` Wolfgang Jenkner
2014-12-18 17:34                   ` Eli Zaretskii
2014-12-20  3:21                     ` Wolfgang Jenkner
2014-12-20  7:27                       ` Eli Zaretskii
2015-01-13 14:06                         ` Wolfgang Jenkner
2015-01-13 16:25                           ` Eli Zaretskii
2015-01-13 17:12                             ` Wolfgang Jenkner
2015-01-13 17:31                               ` Eli Zaretskii
2015-01-14 19:41                           ` Wolfgang Jenkner [this message]
2015-01-15 13:38                             ` Wolfgang Jenkner
2015-01-15 16:08                               ` Stefan Monnier
2015-01-15 17:00                                 ` Wolfgang Jenkner
2020-09-07 21:30                           ` Lars Ingebrigtsen
2020-09-10  0:43                             ` Wolfgang Jenkner
2020-09-10 13:17                               ` Lars Ingebrigtsen
2014-12-17 15:12     ` Wolfgang Jenkner
2014-12-17 15:46       ` Tassilo Horn

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

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

  git send-email \
    --in-reply-to=85oaq1gnc8.fsf@iznogoud.viz \
    --to=wjenkner@inode.at \
    --cc=19393@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.