[PATCH maint resend] compat: add missing #include <sys/resource.h>

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

 



Date: Fri, 18 Mar 2011 15:23:52 -0500

Starting with commit c793430 (Limit file descriptors used by packs,
2011-02-28), git uses getrlimit to tell how many file descriptors it
can use.  Unfortunately it does not include the header declaring that
function, resulting in compilation errors:

 sha1_file.c: In function 'open_packed_git_1':
 sha1_file.c:718: error: storage size of 'lim' isn't known
 sha1_file.c:721: warning: implicit declaration of function 'getrlimit'
 sha1_file.c:721: error: 'RLIMIT_NOFILE' undeclared (first use in this function)
 sha1_file.c:718: warning: unused variable 'lim'

The standard header to include for this is <sys/resource.h> (which on
some systems itself requires declarations from <sys/types.h> or
<sys/time.h>).  Probably the problem was missed until now because in
current glibc sys/resource.h happens to be included by sys/wait.h.

MinGW does not provide sys/resource.h (and compat/mingw takes care of
providing getrlimit some other way), so add the missing #include to
the "#ifndef __MINGW32__" block in git-compat-util.h.

Reported-by: Stefan Sperling <stsp@xxxxxxxxx>
Tested-by: Stefan Sperling <stsp@xxxxxxxxx> [on OpenBSD]
Tested-by: Arnaud Lacombe <lacombar@xxxxxxxxx> [on FreeBSD 8]
Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
Oops, should have sent this as its own message before.  Thanks to
doug on irc for a ping.

 git-compat-util.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index bf947b1..79b5122 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -118,6 +118,7 @@
 #endif
 #ifndef __MINGW32__
 #include <sys/wait.h>
+#include <sys/resource.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <termios.h>
-- 
1.7.4.2

--
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]