unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18238: Fix for DOS build when using more accurate config[.h].in
@ 2014-08-10 16:47 Reuben Thomas
  2014-08-10 16:52 ` Andreas Schwab
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Reuben Thomas @ 2014-08-10 16:47 UTC (permalink / raw)
  To: 18238

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

DJGPP does actually have getrlimit. The special config[.h].in for MSDOS
lies and says it hasn't. However, this is a white lie, because getrlimit on
DJGPP doesn't support RLIMIT_AS/RLIMIT_DATA, which is what we want, so we
still want the workaround code. The following patch simply reverses the
order of a couple of tests in vm-limit.c so that being on MSDOS overrides
HAVE_GETRLIMIT.

Is it OK to install?

=== modified file 'src/vm-limit.c'
--- src/vm-limit.c    2014-07-11 10:09:51 +0000
+++ src/vm-limit.c    2014-08-10 16:44:24 +0000
@@ -71,7 +71,27 @@
 /* Number of bytes of writable memory we can expect to be able to get.  */
 static size_t lim_data;


-#ifdef HAVE_GETRLIMIT
+#ifdef MSDOS
+
+void
+get_lim_data (void)
+{
+  unsigned long totalram, freeram, totalswap, freeswap;
+
+  dos_memory_info (&totalram, &freeram, &totalswap, &freeswap);
+  lim_data = freeram;
+  /* Don't believe they will give us more that 0.5 GB.   */
+  if (lim_data > 512U * 1024U * 1024U)
+    lim_data = 512U * 1024U * 1024U;
+}
+
+unsigned long
+ret_lim_data (void)
+{
+  get_lim_data ();
+  return lim_data;
+}
+#elif defined HAVE_GETRLIMIT

 # ifndef RLIMIT_AS
 #  define RLIMIT_AS RLIMIT_DATA
@@ -101,26 +121,6 @@
   lim_data = reserved_heap_size;
 }

-#elif defined MSDOS
-
-void
-get_lim_data (void)
-{
-  unsigned long totalram, freeram, totalswap, freeswap;
-
-  dos_memory_info (&totalram, &freeram, &totalswap, &freeswap);
-  lim_data = freeram;
-  /* Don't believe they will give us more that 0.5 GB.   */
-  if (lim_data > 512U * 1024U * 1024U)
-    lim_data = 512U * 1024U * 1024U;
-}
-
-unsigned long
-ret_lim_data (void)
-{
-  get_lim_data ();
-  return lim_data;
-}
 #else
 # error "get_lim_data not implemented on this machine"
 #endif

-- 
http://rrt.sc3d.org

[-- Attachment #2: Type: text/html, Size: 2202 bytes --]

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

* bug#18238: Fix for DOS build when using more accurate config[.h].in
  2014-08-10 16:47 bug#18238: Fix for DOS build when using more accurate config[.h].in Reuben Thomas
@ 2014-08-10 16:52 ` Andreas Schwab
  2014-08-10 16:53   ` Reuben Thomas
  2014-08-10 17:59 ` Stefan Monnier
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Andreas Schwab @ 2014-08-10 16:52 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 18238

Reuben Thomas <rrt@sc3d.org> writes:

> +  /* Don't believe they will give us more that 0.5 GB.   */

s/that/than/

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





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

* bug#18238: Fix for DOS build when using more accurate config[.h].in
  2014-08-10 16:52 ` Andreas Schwab
@ 2014-08-10 16:53   ` Reuben Thomas
  0 siblings, 0 replies; 11+ messages in thread
From: Reuben Thomas @ 2014-08-10 16:53 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 18238

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

On 10 August 2014 17:52, Andreas Schwab <schwab@linux-m68k.org> wrote:

> Reuben Thomas <rrt@sc3d.org> writes:
>
> > +  /* Don't believe they will give us more that 0.5 GB.   */
>
> s/that/than/
>

Thanks, I guess I can fix such a trivial typo in the same commit, rather
than in a separate one?

-- 
http://rrt.sc3d.org

[-- Attachment #2: Type: text/html, Size: 739 bytes --]

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

* bug#18238: Fix for DOS build when using more accurate config[.h].in
  2014-08-10 16:47 bug#18238: Fix for DOS build when using more accurate config[.h].in Reuben Thomas
  2014-08-10 16:52 ` Andreas Schwab
@ 2014-08-10 17:59 ` Stefan Monnier
  2014-08-10 18:05 ` Eli Zaretskii
  2021-10-22 19:02 ` Stefan Kangas
  3 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2014-08-10 17:59 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 18238

> -#ifdef HAVE_GETRLIMIT
> +#ifdef MSDOS

Please add a comment here with your explanation about how DJGPP does
have getrlimit but it's not good enough.


        Stefan





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

* bug#18238: Fix for DOS build when using more accurate config[.h].in
  2014-08-10 16:47 bug#18238: Fix for DOS build when using more accurate config[.h].in Reuben Thomas
  2014-08-10 16:52 ` Andreas Schwab
  2014-08-10 17:59 ` Stefan Monnier
@ 2014-08-10 18:05 ` Eli Zaretskii
  2014-08-10 18:20   ` Reuben Thomas
  2021-10-22 19:02 ` Stefan Kangas
  3 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2014-08-10 18:05 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 18238

> Date: Sun, 10 Aug 2014 17:47:11 +0100
> From: Reuben Thomas <rrt@sc3d.org>
> 
> DJGPP does actually have getrlimit. The special config[.h].in for MSDOS
> lies and says it hasn't. However, this is a white lie, because getrlimit on
> DJGPP doesn't support RLIMIT_AS/RLIMIT_DATA, which is what we want, so we
> still want the workaround code. The following patch simply reverses the
> order of a couple of tests in vm-limit.c so that being on MSDOS overrides
> HAVE_GETRLIMIT.
> 
> Is it OK to install?

I don't see why the suggested code is better than the existing one.
HAVE_GETRLIMIT means more than its name says, as you point out, so
DJGPP is correct in not defining one.





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

* bug#18238: Fix for DOS build when using more accurate config[.h].in
  2014-08-10 18:05 ` Eli Zaretskii
@ 2014-08-10 18:20   ` Reuben Thomas
  2014-08-10 18:28     ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Reuben Thomas @ 2014-08-10 18:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 18238

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

On 10 August 2014 19:05, Eli Zaretskii <eliz@gnu.org> wrote:

> > Date: Sun, 10 Aug 2014 17:47:11 +0100
> > From: Reuben Thomas <rrt@sc3d.org>
> >
> > DJGPP does actually have getrlimit. The special config[.h].in for MSDOS
> > lies and says it hasn't. However, this is a white lie, because getrlimit
> on
> > DJGPP doesn't support RLIMIT_AS/RLIMIT_DATA, which is what we want, so we
> > still want the workaround code. The following patch simply reverses the
> > order of a couple of tests in vm-limit.c so that being on MSDOS overrides
> > HAVE_GETRLIMIT.
> >
> > Is it OK to install?
>
> I don't see why the suggested code is better than the existing one.
> HAVE_GETRLIMIT means more than its name says, as you point out, so
> DJGPP is correct in not defining one.
>

I think I was unclear, sorry: DJGPP does define getrlimit. It is only the
MSDOS config.in that says it is not defined. If you run ./configure, then
it detects getrlimit, and defines HAVE_GETRLIMIT.

-- 
http://rrt.sc3d.org

[-- Attachment #2: Type: text/html, Size: 1557 bytes --]

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

* bug#18238: Fix for DOS build when using more accurate config[.h].in
  2014-08-10 18:20   ` Reuben Thomas
@ 2014-08-10 18:28     ` Eli Zaretskii
  2014-08-10 19:35       ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2014-08-10 18:28 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 18238

> Date: Sun, 10 Aug 2014 19:20:48 +0100
> From: Reuben Thomas <rrt@sc3d.org>
> Cc: 18238@debbugs.gnu.org
> 
> > I don't see why the suggested code is better than the existing one.
> > HAVE_GETRLIMIT means more than its name says, as you point out, so
> > DJGPP is correct in not defining one.
> >
> 
> I think I was unclear, sorry: DJGPP does define getrlimit. It is only the
> MSDOS config.in that says it is not defined. If you run ./configure, then
> it detects getrlimit, and defines HAVE_GETRLIMIT.

Then it's a bug in the configure test for getrlimit: it should not
only test for the existence of the function, but also for RLIMIT_AS
and RLIMIT_DATA it actually needs.





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

* bug#18238: Fix for DOS build when using more accurate config[.h].in
  2014-08-10 18:28     ` Eli Zaretskii
@ 2014-08-10 19:35       ` Eli Zaretskii
  0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2014-08-10 19:35 UTC (permalink / raw)
  To: rrt; +Cc: 18238

> Date: Sun, 10 Aug 2014 21:28:34 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 18238@debbugs.gnu.org
> 
> > Date: Sun, 10 Aug 2014 19:20:48 +0100
> > From: Reuben Thomas <rrt@sc3d.org>
> > Cc: 18238@debbugs.gnu.org
> > 
> > > I don't see why the suggested code is better than the existing one.
> > > HAVE_GETRLIMIT means more than its name says, as you point out, so
> > > DJGPP is correct in not defining one.
> > >
> > 
> > I think I was unclear, sorry: DJGPP does define getrlimit. It is only the
> > MSDOS config.in that says it is not defined. If you run ./configure, then
> > it detects getrlimit, and defines HAVE_GETRLIMIT.
> 
> Then it's a bug in the configure test for getrlimit: it should not
> only test for the existence of the function, but also for RLIMIT_AS
> and RLIMIT_DATA it actually needs.

Alternatively, you could leave the configure test alone, and instead
test for RLIMIT_* constants in the conditional, like this:

 #if defined HAVE_GETRLIMIT && defined RLIMIT_DATA && defined RLIMIT_AS
  ...

etc.  This is what emacs.c does with HAVE_SETRLIMIT.





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

* bug#18238: Fix for DOS build when using more accurate config[.h].in
  2014-08-10 16:47 bug#18238: Fix for DOS build when using more accurate config[.h].in Reuben Thomas
                   ` (2 preceding siblings ...)
  2014-08-10 18:05 ` Eli Zaretskii
@ 2021-10-22 19:02 ` Stefan Kangas
  2021-10-22 21:14   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-10-23  6:18   ` Eli Zaretskii
  3 siblings, 2 replies; 11+ messages in thread
From: Stefan Kangas @ 2021-10-22 19:02 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 18238

Reuben Thomas <rrt@sc3d.org> writes:

> DJGPP does actually have getrlimit. The special config[.h].in for MSDOS lies and says it hasn't. However, this is a white lie, because
> getrlimit on DJGPP doesn't support RLIMIT_AS/RLIMIT_DATA, which is what we want, so we still want the workaround code. The following
> patch simply reverses the order of a couple of tests in vm-limit.c so that being on MSDOS overrides HAVE_GETRLIMIT.
>
> Is it OK to install?

(That was in 2014.)

It seems like this patch was never installed.  Is it still relevant?

> === modified file 'src/vm-limit.c'
> --- src/vm-limit.c    2014-07-11 10:09:51 +0000
> +++ src/vm-limit.c    2014-08-10 16:44:24 +0000
> @@ -71,7 +71,27 @@
>  /* Number of bytes of writable memory we can expect to be able to get.  */
>  static size_t lim_data;
>
>
> -#ifdef HAVE_GETRLIMIT
> +#ifdef MSDOS
> +
> +void
> +get_lim_data (void)
> +{
> +  unsigned long totalram, freeram, totalswap, freeswap;
> +
> +  dos_memory_info (&totalram, &freeram, &totalswap, &freeswap);
> +  lim_data = freeram;
> +  /* Don't believe they will give us more that 0.5 GB.   */
> +  if (lim_data > 512U * 1024U * 1024U)
> +    lim_data = 512U * 1024U * 1024U;
> +}
> +
> +unsigned long
> +ret_lim_data (void)
> +{
> +  get_lim_data ();
> +  return lim_data;
> +}
> +#elif defined HAVE_GETRLIMIT
>
>  # ifndef RLIMIT_AS
>  #  define RLIMIT_AS RLIMIT_DATA
> @@ -101,26 +121,6 @@
>    lim_data = reserved_heap_size;
>  }
>
> -#elif defined MSDOS
> -
> -void
> -get_lim_data (void)
> -{
> -  unsigned long totalram, freeram, totalswap, freeswap;
> -
> -  dos_memory_info (&totalram, &freeram, &totalswap, &freeswap);
> -  lim_data = freeram;
> -  /* Don't believe they will give us more that 0.5 GB.   */
> -  if (lim_data > 512U * 1024U * 1024U)
> -    lim_data = 512U * 1024U * 1024U;
> -}
> -
> -unsigned long
> -ret_lim_data (void)
> -{
> -  get_lim_data ();
> -  return lim_data;
> -}
>  #else
>  # error "get_lim_data not implemented on this machine"
>  #endif





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

* bug#18238: Fix for DOS build when using more accurate config[.h].in
  2021-10-22 19:02 ` Stefan Kangas
@ 2021-10-22 21:14   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-10-23  6:18   ` Eli Zaretskii
  1 sibling, 0 replies; 11+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-10-22 21:14 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 18238

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

On Fri, 22 Oct 2021 at 20:02, Stefan Kangas <stefan@marxist.se> wrote:

>
> It seems like this patch was never installed.  Is it still relevant?
>

(This is Eli's call.)

-- 
https://rrt.sc3d.org

[-- Attachment #2: Type: text/html, Size: 740 bytes --]

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

* bug#18238: Fix for DOS build when using more accurate config[.h].in
  2021-10-22 19:02 ` Stefan Kangas
  2021-10-22 21:14   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-10-23  6:18   ` Eli Zaretskii
  1 sibling, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2021-10-23  6:18 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 18238, rrt

tags 18238 wontfix
close 18238
thanks

> From: Stefan Kangas <stefan@marxist.se>
> Date: Fri, 22 Oct 2021 15:02:17 -0400
> Cc: 18238@debbugs.gnu.org
> 
> Reuben Thomas <rrt@sc3d.org> writes:
> 
> > DJGPP does actually have getrlimit. The special config[.h].in for MSDOS lies and says it hasn't. However, this is a white lie, because
> > getrlimit on DJGPP doesn't support RLIMIT_AS/RLIMIT_DATA, which is what we want, so we still want the workaround code. The following
> > patch simply reverses the order of a couple of tests in vm-limit.c so that being on MSDOS overrides HAVE_GETRLIMIT.
> >
> > Is it OK to install?
> 
> (That was in 2014.)
> 
> It seems like this patch was never installed.  Is it still relevant?

It's as relevant as it was back then, but I see no reason to make a
change with no actual functionality changes, just so the world knows
that DJGPP does have (a limited version of) getrlimit.  So I'm closing
this bug (after fixing the typo pointed by Andreas).

Thanks.





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

end of thread, other threads:[~2021-10-23  6:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-10 16:47 bug#18238: Fix for DOS build when using more accurate config[.h].in Reuben Thomas
2014-08-10 16:52 ` Andreas Schwab
2014-08-10 16:53   ` Reuben Thomas
2014-08-10 17:59 ` Stefan Monnier
2014-08-10 18:05 ` Eli Zaretskii
2014-08-10 18:20   ` Reuben Thomas
2014-08-10 18:28     ` Eli Zaretskii
2014-08-10 19:35       ` Eli Zaretskii
2021-10-22 19:02 ` Stefan Kangas
2021-10-22 21:14   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-23  6:18   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).