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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 7, 2010 at 3:28 PM, Ramkumar Ramachandra <artagnon@xxxxxxxxx> wrote:
>> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]