{"thread":{"id":"26746","subject":"[PATCH] Include headers for getrlimit() in sha1_file.c","startedAt":"2011-03-16T10:37:59Z","lastAt":"2011-04-03T19:27:32Z","messageCount":7,"participants":["Stefan Sperling","Jonathan Nieder","Arnaud Lacombe","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"163450","messageId":"1300271879-2050-1-git-send-email-stsp@stsp.name","threadId":"26746","inReplyTo":null,"subject":"[PATCH] Include headers for getrlimit() in sha1_file.c","fromName":"Stefan Sperling","fromEmail":"stsp@stsp.name","sentAt":"2011-03-16T10:37:59Z","receivedAt":"2011-03-16T10:37:59Z","isPatch":true,"sender":{"key":"stsp@elego.de","avatar":"https://avatars.githubusercontent.com/u/9281333?v=4"},"body":"Fixes compilation error on OpenBSD:\nsha1_file.c: In function 'open_packed_git_1':\nsha1_file.c:718: error: storage size of 'lim' isn't known\nsha1_file.c:721: warning: implicit declaration of function 'getrlimit'\nsha1_file.c:721: error: 'RLIMIT_NOFILE' undeclared (first use in this function)\nsha1_file.c:718: warning: unused variable 'lim'\n\nSigned-off-by: Stefan Sperling <stsp@stsp.name>\n---\n sha1_file.c |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/sha1_file.c b/sha1_file.c\nindex b4fcca8..f969b10 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -18,6 +18,10 @@\n #include \"pack-revindex.h\"\n #include \"sha1-lookup.h\"\n \n+#include <sys/types.h>\n+#include <sys/time.h>\n+#include <sys/resource.h>\n+\n #ifndef O_NOATIME\n #if defined(__linux__) && (defined(__i386__) || defined(__PPC__))\n #define O_NOATIME 01000000\n-- \n1.7.3.5\n"},{"id":"163669","messageId":"20110318202351.GA22696@elie","threadId":"26746","inReplyTo":"1300271879-2050-1-git-send-email-stsp@stsp.name","subject":"Re: [PATCH] Include headers for getrlimit() in sha1_file.c","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-03-18T20:23:52Z","receivedAt":"2011-03-18T20:23:52Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"(+cc: Shawn, Erik)\nHi Stefan,\n\nStefan Sperling wrote:\n\n> Fixes compilation error on OpenBSD:\n> sha1_file.c: In function 'open_packed_git_1':\n> sha1_file.c:718: error: storage size of 'lim' isn't known\n> sha1_file.c:721: warning: implicit declaration of function 'getrlimit'\n> sha1_file.c:721: error: 'RLIMIT_NOFILE' undeclared (first use in this function)\n> sha1_file.c:718: warning: unused variable 'lim'\n\nGood catch.\n\n> --- a/sha1_file.c\n> +++ b/sha1_file.c\n> @@ -18,6 +18,10 @@\n>  #include \"pack-revindex.h\"\n>  #include \"sha1-lookup.h\"\n>  \n> +#include <sys/types.h>\n> +#include <sys/time.h>\n> +#include <sys/resource.h>\n\nSystem headers like this tend to go in git-compat-util.h, so\nportability fixes having to do with compatibility replacements or\norder of inclusion only need to happen in one place.\n\nIn this case, afaict sys/resource.h is not available on mingw, meaning\nthe #include would probably go in the \"#ifndef __MINGW32__\" block.\nMaybe something like this (untested)?\n\n-- 8< --\nSubject: compat: add missing #include <sys/resource.h>\n\nStarting with commit c793430 (Limit file descriptors used by packs,\n2011-02-28), git uses getrlimit to tell how many file descriptors it\ncan use.  Unfortunately it does not include the header declaring that\nfunction, resulting in compilation errors on OpenBSD:\n\n sha1_file.c: In function 'open_packed_git_1':\n sha1_file.c:718: error: storage size of 'lim' isn't known\n sha1_file.c:721: warning: implicit declaration of function 'getrlimit'\n sha1_file.c:721: error: 'RLIMIT_NOFILE' undeclared (first use in this function)\n sha1_file.c:718: warning: unused variable 'lim'\n\nThe standard header to include for this is <sys/resource.h> (which on\nsome systems itself requires declarations from <sys/types.h> or\n<sys/time.h>).  Probably the problem was missed until now because in\ncurrent glibc sys/resource.h happens to be included by sys/wait.h.\n\nMinGW does not provide sys/resource.h (and compat/mingw takes care of\nproviding getrlimit some other way), so add the missing #include to\nthe \"#ifndef __MINGW32__\" block in git-compat-util.h.\n\nReported-by: Stefan Sperling <stsp@stsp.name>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n git-compat-util.h |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 49b50ee..40498b3 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -118,6 +118,7 @@\n #endif\n #ifndef __MINGW32__\n #include <sys/wait.h>\n+#include <sys/resource.h>\n #include <sys/socket.h>\n #include <sys/ioctl.h>\n #include <termios.h>\n-- \n1.7.4.1\n"},{"id":"163693","messageId":"AANLkTi=tJL8A9RyuoitSSUAWEF7+PZxxWZPcQdk00yj9@mail.gmail.com","threadId":"26746","inReplyTo":"20110318202351.GA22696@elie","subject":"Re: [PATCH] Include headers for getrlimit() in sha1_file.c","fromName":"Arnaud Lacombe","fromEmail":"lacombar@gmail.com","sentAt":"2011-03-19T00:22:24Z","receivedAt":"2011-03-19T00:22:24Z","isPatch":true,"sender":{"key":"lacombar@gmail.com","avatar":"https://gravatar.com/avatar/411d40b6ba69fff936664b1ff7cff65f3ca23f236700f0f0d0313b6b43abd344?d=mp&s=160"},"body":"Hi,\n\nOn Fri, Mar 18, 2011 at 4:23 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> (+cc: Shawn, Erik)\n> Hi Stefan,\n>\n> Stefan Sperling wrote:\n>\n>> Fixes compilation error on OpenBSD:\n>> sha1_file.c: In function 'open_packed_git_1':\n>> sha1_file.c:718: error: storage size of 'lim' isn't known\n>> sha1_file.c:721: warning: implicit declaration of function 'getrlimit'\n>> sha1_file.c:721: error: 'RLIMIT_NOFILE' undeclared (first use in this function)\n>> sha1_file.c:718: warning: unused variable 'lim'\n>\nThis also fix the build on FreeBSD 8 (did not test other version).\n\n - Arnaud\n\n> Good catch.\n>\n>> --- a/sha1_file.c\n>> +++ b/sha1_file.c\n>> @@ -18,6 +18,10 @@\n>>  #include \"pack-revindex.h\"\n>>  #include \"sha1-lookup.h\"\n>>\n>> +#include <sys/types.h>\n>> +#include <sys/time.h>\n>> +#include <sys/resource.h>\n>\n> System headers like this tend to go in git-compat-util.h, so\n> portability fixes having to do with compatibility replacements or\n> order of inclusion only need to happen in one place.\n>\n> In this case, afaict sys/resource.h is not available on mingw, meaning\n> the #include would probably go in the \"#ifndef __MINGW32__\" block.\n> Maybe something like this (untested)?\n>\n> -- 8< --\n> Subject: compat: add missing #include <sys/resource.h>\n>\n> Starting with commit c793430 (Limit file descriptors used by packs,\n> 2011-02-28), git uses getrlimit to tell how many file descriptors it\n> can use.  Unfortunately it does not include the header declaring that\n> function, resulting in compilation errors on OpenBSD:\n>\n>  sha1_file.c: In function 'open_packed_git_1':\n>  sha1_file.c:718: error: storage size of 'lim' isn't known\n>  sha1_file.c:721: warning: implicit declaration of function 'getrlimit'\n>  sha1_file.c:721: error: 'RLIMIT_NOFILE' undeclared (first use in this function)\n>  sha1_file.c:718: warning: unused variable 'lim'\n>\n> The standard header to include for this is <sys/resource.h> (which on\n> some systems itself requires declarations from <sys/types.h> or\n> <sys/time.h>).  Probably the problem was missed until now because in\n> current glibc sys/resource.h happens to be included by sys/wait.h.\n>\n> MinGW does not provide sys/resource.h (and compat/mingw takes care of\n> providing getrlimit some other way), so add the missing #include to\n> the \"#ifndef __MINGW32__\" block in git-compat-util.h.\n>\n> Reported-by: Stefan Sperling <stsp@stsp.name>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n>  git-compat-util.h |    1 +\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n>\n> diff --git a/git-compat-util.h b/git-compat-util.h\n> index 49b50ee..40498b3 100644\n> --- a/git-compat-util.h\n> +++ b/git-compat-util.h\n> @@ -118,6 +118,7 @@\n>  #endif\n>  #ifndef __MINGW32__\n>  #include <sys/wait.h>\n> +#include <sys/resource.h>\n>  #include <sys/socket.h>\n>  #include <sys/ioctl.h>\n>  #include <termios.h>\n> --\n> 1.7.4.1\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"163736","messageId":"20110319090927.GA521@jack.stsp.name","threadId":"26746","inReplyTo":"20110318202351.GA22696@elie","subject":"Re: [PATCH] Include headers for getrlimit() in sha1_file.c","fromName":"Stefan Sperling","fromEmail":"stsp@stsp.name","sentAt":"2011-03-19T09:09:27Z","receivedAt":"2011-03-19T09:09:27Z","isPatch":true,"sender":{"key":"stsp@elego.de","avatar":"https://avatars.githubusercontent.com/u/9281333?v=4"},"body":"On Fri, Mar 18, 2011 at 03:23:52PM -0500, Jonathan Nieder wrote:\n> diff --git a/git-compat-util.h b/git-compat-util.h\n> index 49b50ee..40498b3 100644\n> --- a/git-compat-util.h\n> +++ b/git-compat-util.h\n> @@ -118,6 +118,7 @@\n>  #endif\n>  #ifndef __MINGW32__\n>  #include <sys/wait.h>\n> +#include <sys/resource.h>\n>  #include <sys/socket.h>\n>  #include <sys/ioctl.h>\n>  #include <termios.h>\n\nWorks for me. Thanks.\n"},{"id":"164844","messageId":"20110331225909.GA21429@elie","threadId":"26746","inReplyTo":"20110318202351.GA22696@elie","subject":"[PATCH maint resend] compat: add missing #include <sys/resource.h>","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-03-31T22:59:09Z","receivedAt":"2011-03-31T22:59:09Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Date: Fri, 18 Mar 2011 15:23:52 -0500\n\nStarting with commit c793430 (Limit file descriptors used by packs,\n2011-02-28), git uses getrlimit to tell how many file descriptors it\ncan use.  Unfortunately it does not include the header declaring that\nfunction, resulting in compilation errors:\n\n sha1_file.c: In function 'open_packed_git_1':\n sha1_file.c:718: error: storage size of 'lim' isn't known\n sha1_file.c:721: warning: implicit declaration of function 'getrlimit'\n sha1_file.c:721: error: 'RLIMIT_NOFILE' undeclared (first use in this function)\n sha1_file.c:718: warning: unused variable 'lim'\n\nThe standard header to include for this is <sys/resource.h> (which on\nsome systems itself requires declarations from <sys/types.h> or\n<sys/time.h>).  Probably the problem was missed until now because in\ncurrent glibc sys/resource.h happens to be included by sys/wait.h.\n\nMinGW does not provide sys/resource.h (and compat/mingw takes care of\nproviding getrlimit some other way), so add the missing #include to\nthe \"#ifndef __MINGW32__\" block in git-compat-util.h.\n\nReported-by: Stefan Sperling <stsp@stsp.name>\nTested-by: Stefan Sperling <stsp@stsp.name> [on OpenBSD]\nTested-by: Arnaud Lacombe <lacombar@gmail.com> [on FreeBSD 8]\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nOops, should have sent this as its own message before.  Thanks to\ndoug on irc for a ping.\n\n git-compat-util.h |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex bf947b1..79b5122 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -118,6 +118,7 @@\n #endif\n #ifndef __MINGW32__\n #include <sys/wait.h>\n+#include <sys/resource.h>\n #include <sys/socket.h>\n #include <sys/ioctl.h>\n #include <termios.h>\n-- \n1.7.4.2\n"},{"id":"165075","messageId":"20110403191324.GE3830@elie","threadId":"26746","inReplyTo":"20110331225909.GA21429@elie","subject":"Re: [PATCH maint resend] compat: add missing #include <sys/resource.h>","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-04-03T19:13:25Z","receivedAt":"2011-04-03T19:13:25Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi Junio,\n\nJonathan Nieder wrote:\n\n> Date: Fri, 18 Mar 2011 15:23:52 -0500\n[...]\n>  sha1_file.c:721: error: 'RLIMIT_NOFILE' undeclared (first use in this function)\n[...]\n> Reported-by: Stefan Sperling <stsp@stsp.name>\n> Tested-by: Stefan Sperling <stsp@stsp.name> [on OpenBSD]\n> Tested-by: Arnaud Lacombe <lacombar@gmail.com> [on FreeBSD 8]\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n\nPing?  Would you like a shorter commit message, or was this just lost\nin the noise?\n"},{"id":"165078","messageId":"7vlizrb0ez.fsf@alter.siamese.dyndns.org","threadId":"26746","inReplyTo":"20110403191324.GE3830@elie","subject":"Re: [PATCH maint resend] compat: add missing #include <sys/resource.h>","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-03T19:27:32Z","receivedAt":"2011-04-03T19:27:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Ping?  Would you like a shorter commit message, or was this just lost\n> in the noise?\n\nNo, it was sitting in my to-be-applied box.  Thanks.\n"}]}