git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/6] Add memory pool library

From
Erik Faye-Lund <kusmabite@googlemail.com>
Date
Jun 7, 2010, 14:00 UTC
Message-ID
<AANLkTimd_l0uKHTqgS211fv30hxd-k0pR55YoY4xCua1@mail.gmail.com>
In-Reply-To
<AANLkTimzuJXjX4OJUkmQtLwjGDgHBaZUHSGA0xUUi6kY@mail.gmail.com>
On Mon, Jun 7, 2010 at 3:28 PM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:
Show 5 quoted lines
>> Probably an ignorant question, but why?  I do not think the win32 mmap
>> emulation in git currently supports sysconf().
>
> I'm not sure why the pool capacity should be dependent on the page size.
>
My guess would be that it's a performance-thing.

Adding a win32-implementation of sysconf for this purpose isn't tricky, but perhaps it's a little bit overkill. Can't we just use some large power of two number? Hopefully, we could chose a size that is a multiple of the page-size on all systems...

Anyway, this is roughly what a Windows-implementation of sysconf would look like (not tested - only checked that it compiles):

diff --git a/compat/mingw.c b/compat/mingw.c
index f90a114..526f0f9 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1473,3 +1473,13 @@ struct dirent *mingw_readdir(DIR *dir)
 	return (struct dirent*)&dir->dd_dir;
 }
 #endif // !NO_MINGW_REPLACE_READDIR
+
+long mingw_sysconf(int name)
+{
+	SYSTEM_INFO si;
+	if (name != _SC_PAGESIZE)
+		return errno = EINVAL,
+		    error("sysconf emulation only supports _SC_PAGESIZE");
+	GetSystemInfo(&si);
+	return si.dwPageSize;
+}
diff --git a/compat/mingw.h b/compat/mingw.h
index 6c6cbda..db28b0d 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -322,3 +322,7 @@ struct dirent *mingw_readdir(DIR *dir);
  * Used by Pthread API implementation for Windows
  */
 extern int err_win_to_posix(DWORD winerr);
+
+#define _SC_PAGESIZE 0
+long mingw_sysconf(int name);
+#define sysconf mingw_sysconf
-- 
Erik "kusma" Faye-Lund
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 5 of 15 in “Merge David's SVN exporter”
  1. 0/6 Merge David's SVN exporterRamkumar Ramachandra, Jun 4, 2010
  2. 1/6 Add memory pool libraryRamkumar Ramachandra, Jun 4, 2010
  3. Jonathan NiederJun 4, 2010
  4. Ramkumar RamachandraJun 7, 2010
  5. Erik Faye-LundJun 7, 2010
  6. Ramkumar RamachandraJun 7, 2010
  7. 2/6 Add cpp macro implementation of treapsRamkumar Ramachandra, Jun 4, 2010
  8. 3/6 Add library for string-specific memory poolRamkumar Ramachandra, Jun 4, 2010
  9. 4/6 Add stream helper libraryRamkumar Ramachandra, Jun 4, 2010
  10. Jonathan NiederJun 4, 2010
  11. 5/6 Add infrastructure to write revisions in fast-export formatRamkumar Ramachandra, Jun 4, 2010
  12. Jonathan NiederJun 4, 2010
  13. Ramkumar RamachandraJun 7, 2010
  14. David Michael BarrJun 7, 2010
  15. 6/6 Add SVN dump parserRamkumar Ramachandra, Jun 4, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.