tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* OSX + mmap + mansearch.c + documentation
@ 2014-08-09 11:51 Kristaps Dzonsons
  2014-08-09 15:04 ` Ingo Schwarze
  0 siblings, 1 reply; 3+ messages in thread
From: Kristaps Dzonsons @ 2014-08-09 11:51 UTC (permalink / raw)
  To: tech

Hi,

Small thing noticed in OSX:

% /usr/local/bin/apropos find
mmap: Invalid argument

According to the Mac OSX manpage for mmap(2), this is because:

[EINVAL]   flags does not include either MAP_PRIVATE or MAP_SHARED.

It's easy enough to add a mmap_flags variable as MAP_ANON | blah and 
ifdef it to do one or the other.  (I hesitate to say which, but am 
guessing MAP_PRIVATE since the page cache isn't (???) shared across 
processes.)

In general, the section scares me--I vaguely guess at what's happening, 
but have no idea why.  So more pertinently than the bit-field would be 
to document this section!  Ingo mentions the speed reduction in his talk 
(pg. 20, http://www.openbsd.org/papers/bsdcan14-mandoc.pdf), but not 
/why/ there's a speed reduction.

Best,

Kristaps
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: OSX + mmap + mansearch.c + documentation
  2014-08-09 11:51 OSX + mmap + mansearch.c + documentation Kristaps Dzonsons
@ 2014-08-09 15:04 ` Ingo Schwarze
  2014-08-10  8:26   ` Kristaps Dzonsons
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Schwarze @ 2014-08-09 15:04 UTC (permalink / raw)
  To: tech

Hi Kristaps,

Kristaps Dzonsons wrote on Sat, Aug 09, 2014 at 01:51:36PM +0200:

> Small thing noticed in OSX:
> 
> % /usr/local/bin/apropos find
> mmap: Invalid argument
> 
> According to the Mac OSX manpage for mmap(2), this is because:
> 
> [EINVAL]   flags does not include either MAP_PRIVATE or MAP_SHARED.

Fixed in rc3.

That release candidate contains another fix for an issue
reported by Thomas Klausner:  config.h was forgotten in
mansearch_const.c.

> It's easy enough to add a mmap_flags variable as MAP_ANON | blah and
> ifdef it to do one or the other.  (I hesitate to say which, but am
> guessing MAP_PRIVATE since the page cache isn't (???) shared across
> processes.)

Well, even on OpenBSD the manual says that either MAP_PRIVATE or
MAP_SHARED is required, it just doesn't seem to be enforced by the
implementation, so i simply added MAP_SHARED like in all
three other places where we use mmap(2), for minimum disruption
for the release.

Now i do wonder why we use MAP_SHARED and not MAP_PRIVATE.
But that's a question for after release, i have taken a note
in the TODO file.

> In general, the section scares me--I vaguely guess at what's
> happening, but have no idea why.

Unfortunately, at one point, i accidentally deleted my gprof(1)
logs, but off the top of my head, i'm quite sure the point was
that without SQLITE_CONFIG_PAGECACHE, apropos(1) spends
considerable extra time, that is, about 10-25% of the total
time it needs, in malloc(3) and free(3) called from within
sqlite3_*() functions.

> So more pertinently than the bit-field would be to document
> this section!  Ingo mentions the speed reduction in his talk
> (pg. 20, http://www.openbsd.org/papers/bsdcan14-mandoc.pdf),
> but not /why/ there's a speed reduction.

It scares you - you mean tedu@ might suspect exploit mitigation
countermeasures?  That might be worth investigating, too.
While espie@ holds the chief SQLite developer in high esteem,
deraadt@ hates the code quality.  Myself, i didn't form an
opinion on the SQLite code, yet.

But for this release, i'll keep the lid on that can of worms.

Yours,
  Ingo
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: OSX + mmap + mansearch.c + documentation
  2014-08-09 15:04 ` Ingo Schwarze
@ 2014-08-10  8:26   ` Kristaps Dzonsons
  0 siblings, 0 replies; 3+ messages in thread
From: Kristaps Dzonsons @ 2014-08-10  8:26 UTC (permalink / raw)
  To: tech

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

Ingo,

Enclosed is a patch to fix dependencies broken by this commit.  Ok?

> That release candidate contains another fix for an issue
> reported by Thomas Klausner:  config.h was forgotten in
> mansearch_const.c.

Best,

Kristaps

[-- Attachment #2: Makefile.depend.patch --]
[-- Type: text/plain, Size: 898 bytes --]

Index: Makefile.depend
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/Makefile.depend,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile.depend
--- Makefile.depend	5 Aug 2014 16:12:25 -0000	1.2
+++ Makefile.depend	10 Aug 2014 08:24:52 -0000
@@ -31,7 +31,7 @@ mandocdb.o: mandocdb.c config.h mdoc.h m
 manpage.o: manpage.c config.h manpath.h mansearch.h
 manpath.o: manpath.c config.h mandoc_aux.h manpath.h
 mansearch.o: mansearch.c config.h mandoc.h mandoc_aux.h manpath.h mansearch.h
-mansearch_const.o: mansearch_const.c manpath.h mansearch.h
+mansearch_const.o: mansearch_const.c config.h manpath.h mansearch.h
 mdoc.o: mdoc.c config.h mdoc.h mandoc.h mandoc_aux.h libmdoc.h libmandoc.h
 mdoc_argv.o: mdoc_argv.c config.h mdoc.h mandoc.h mandoc_aux.h libmdoc.h libmandoc.h
 mdoc_hash.o: mdoc_hash.c config.h mdoc.h libmdoc.h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-10  8:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-09 11:51 OSX + mmap + mansearch.c + documentation Kristaps Dzonsons
2014-08-09 15:04 ` Ingo Schwarze
2014-08-10  8:26   ` Kristaps Dzonsons

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 NNTP newsgroup(s).