1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

Build system tweaks; fix use of brk(2)/sbrk(2) feature test

There is a feature test for brk(2)/sbrk(2), but it was not checked
for in one place in vmbest.c, causing libdll to fail to build on
FreeBSD aarch64 because the features/dll output{...}end block
failed to link. This commit allows libdll to build on that system,
though another mysterious build failure apparently remains.
https://github.com/ksh93/ksh/issues/154

src/lib/libast/include/vmalloc.h,
src/lib/libast/vmalloc/vmbest.c:
- Add missing '#if _mem_sbrk' directives to disable uses of sbrk(2)
  on systems that have removed this deprecated interface.

src/cmd/builtin/features/pty,
src/lib/libast/features/common,
src/lib/libast/features/float,
src/lib/libast/features/lib,
src/lib/libast/features/sfio,
src/lib/libast/features/sizeof:
- Add a fail clause to more 'tst - output{' blocks so they write an
  informative #error directive if they fail to compile and write
  required header identifiers. This should avoid much more obscure
  compile errors later on. (re: e20c0c6b)

.gitignore:
- Add pattern for emacs #backup# files.
This commit is contained in:
Martijn Dekker 2021-01-26 09:45:17 +00:00
parent 856a2bb253
commit e72543a9fa
9 changed files with 26 additions and 2 deletions

1
.gitignore vendored
View file

@ -57,3 +57,4 @@ bin/execrate
*.project
*.core
core
**/#*#

View file

@ -54,7 +54,9 @@ tst - output{
}
return 0;
}
}end
}end fail{
echo '#error The output block in src/cmd/builtin/features/pty failed to compile'
}end
extern _getpty char* (int*, int, mode_t, int)
extern openpty int (int*, int*, char*, struct termios*, struct winsize*)

View file

@ -352,6 +352,8 @@ tst - output{
printf("\n");
return 0;
}
}end fail{
echo '#error Output block #2 in src/lib/libast/features/common failed to compile'
}end
tst - -DN=1 - -DN=0 output{

View file

@ -894,6 +894,8 @@ tst - note{ missing floating point limits }end output{
return 0;
}
}end fail{
echo '#error Output block #1 in src/lib/libast/features/float failed to compile'
}end
tst - note{ double exponent bitfoolery }end output{
@ -928,6 +930,8 @@ tst - note{ double exponent bitfoolery }end output{
}
return 0;
}
}end fail{
echo '#error Output block #2 in src/lib/libast/features/float failed to compile'
}end
tst - note{ long double exponent bitfoolery }end output{
@ -962,6 +966,8 @@ tst - note{ long double exponent bitfoolery }end output{
}
return 0;
}
}end fail{
echo '#error Output block #3 in src/lib/libast/features/float failed to compile'
}end
tst - -DN=1 - -DN=2 note{ _ast_fltmax_t maximum integral type }end output{

View file

@ -699,6 +699,8 @@ tst - output{
return 0;
}
}end fail{
echo '#error The output block in src/lib/libast/features/lib failed to compile'
}end
tst no64 -D_LARGEFILE64_SOURCE note{ largefile 64 broken }end execute{

View file

@ -14,6 +14,8 @@ tst - note{ number of bits in pointer }end output{
printf("#define _ptr_bits %d\n", sizeof(char*) * 8);
return 0;
}
}end fail{
echo '#error The output block in src/lib/libast/features/sfio failed to compile'
}end
tst tmp_rmfail note{ open files cannot be removed }end execute{

View file

@ -10,4 +10,6 @@ tst - note{ sizeof(integral-type) }end output{
printf("#define _ast_sizeof_intmax_t %d\n", sizeof(_ast_intmax_t));
return 0;
}
}end fail{
echo '#error The output block in src/lib/libast/features/sizeof failed to compile'
}end

View file

@ -136,7 +136,9 @@ extern Vmethod_t* Vmprofile; /* profiling memory usage */
extern Vmdisc_t* Vmdcsystem; /* get memory from the OS */
extern Vmdisc_t* Vmdcheap; /* get memory from Vmheap */
#if _mem_sbrk
extern Vmdisc_t* Vmdcsbrk; /* like Vmdcsystem - legacy use */
#endif
extern Vmalloc_t _Vmheap; /* heap region - use with care! */
extern Vmalloc_t* Vmheap; /* = &_Vmheap - safe to use */

View file

@ -1265,10 +1265,13 @@ static Void_t* mmapmem(Void_t* caddr, size_t csize, size_t nsize, Mmdisc_t* mmdc
}
}
else if(nsize == 0)
{ Vmuchar_t *addr = (Vmuchar_t*)sbrk(0);
{
#if _mem_sbrk
Vmuchar_t *addr = (Vmuchar_t*)sbrk(0);
if(addr < (Vmuchar_t*)caddr ) /* in sbrk space */
return NIL(Void_t*);
else
#endif
{ (void)munmap(caddr, csize);
return caddr;
}
@ -1385,7 +1388,9 @@ __DEFINE__(Vmalloc_t*, Vmheap, &_Vmheap);
__DEFINE__(Vmalloc_t*, Vmregion, &_Vmheap);
__DEFINE__(Vmethod_t*, Vmbest, &_Vmbest);
__DEFINE__(Vmdisc_t*, Vmdcsystem, (Vmdisc_t*)(&_Vmdcsystem) );
#if _mem_sbrk
__DEFINE__(Vmdisc_t*, Vmdcsbrk, (Vmdisc_t*)(&_Vmdcsystem) );
#endif
#ifdef NoF
NoF(vmbest)