diff --git a/src/lib/csu/Makefile b/src/lib/csu/Makefile new file mode 100644 index 0000000..defae41 --- /dev/null +++ b/src/lib/csu/Makefile @@ -0,0 +1,36 @@ +# $Id$ +# The System Makefile (C) 2002 The UbixOS Project + +# Include Global 'Source' Options +include ../../Makefile.inc +include ../Makefile.inc + +CFLAGS = -fno-builtin -Wno-uninitialized -O2 -fno-strict-aliasing -pipe -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls + +INCLUDES = -I../libc/include + +#Objects +OBJS = crtn.o crti.o crt1.o + +all: $(OBJS) + +# Compile the source files +.cc.o: + $(CXX) $(CFLAGS) -Wall -nostdlib -O $(INCLUDES) -c -o $@ $< + +.cc.s: + $(CXX) $(CFLAGS) -Wall -nostdlib -O $(INCLUDES) -S -o $@ $< + +.c.o: + $(CC) $(CFLAGS) -Wall -nostdlib -O $(INCLUDES) -c $< + +.c.s: + $(CC) $(CFLAGS) -Wall -nostdlib -O $(INCLUDES) -S -o $@ $< + +.S.o: + $(CC) $(CFLAGS) -Wall -nostdlib -c -o $@ $< + +# Clean up the junk +clean: + $(REMOVE) $(OBJS) + diff --git a/src/lib/csu/crt1.c b/src/lib/csu/crt1.c new file mode 100644 index 0000000..de72fb2 --- /dev/null +++ b/src/lib/csu/crt1.c @@ -0,0 +1,117 @@ +/* LINTLIBRARY */ +/*- + * Copyright 1996-1998 John D. Polstra. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef lint +#ifndef __GNUC__ +#error "GCC is needed to compile this file" +#endif +#endif /* lint */ + +#include + +#include "libc_private.h" +#include "crtbrand.c" + +extern int _DYNAMIC; +#pragma weak _DYNAMIC + +typedef void (*fptr)(void); + +extern void _fini(void); +extern void _init(void); +extern int main(int, char **, char **); +extern void _start(char *, ...); + +#ifdef GCRT +extern void _mcleanup(void); +extern void monstartup(void *, void *); +extern int eprol; +extern int etext; +#endif + +char **environ; +const char *__progname = ""; + +static __inline fptr +get_rtld_cleanup(void) +{ + fptr retval; + +#ifdef __GNUC__ + __asm__("movl %%edx,%0" : "=rm"(retval)); +#else + retval = (fptr)0; /* XXXX Fix this for other compilers */ +#endif + return(retval); +} + +/* The entry function. */ +void +_start(char *ap, ...) +{ + fptr cleanup; + int argc; + char **argv; + char **env; + const char *s; + +#ifdef __GNUC__ + __asm__("and $0xfffffff0,%esp"); +#endif + cleanup = get_rtld_cleanup(); + argv = ≈ + argc = *(long *)(void *)(argv - 1); + env = argv + argc + 1; + environ = env; + if (argc > 0 && argv[0] != NULL) { + __progname = argv[0]; + for (s = __progname; *s != '\0'; s++) + if (*s == '/') + __progname = s + 1; + } + if (&_DYNAMIC != NULL) + atexit(cleanup); + else + _init_tls(); + +#ifdef GCRT + atexit(_mcleanup); +#endif + atexit(_fini); +#ifdef GCRT + monstartup(&eprol, &etext); +#endif + _init(); + exit( main(argc, argv, env) ); +} + +#ifdef GCRT +__asm__(".text"); +__asm__("eprol:"); +__asm__(".previous"); +#endif + +__asm__(".ident\t\"$FreeBSD: src/lib/csu/i386-elf/crt1.c,v 1.14 2005/05/19 07:36:07 dfr Exp $\""); diff --git a/src/lib/csu/crtbrand.c b/src/lib/csu/crtbrand.c new file mode 100644 index 0000000..7e90144 --- /dev/null +++ b/src/lib/csu/crtbrand.c @@ -0,0 +1,52 @@ +/*- + * Copyright 2000 David E. O'Brien, John D. Polstra. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD: src/lib/csu/common/crtbrand.c,v 1.4 2003/10/17 15:43:13 peter Exp $"); + +#include + +#define ABI_VENDOR "FreeBSD" +#define ABI_SECTION ".note.ABI-tag" +#define ABI_NOTETYPE 1 + +/* + * Special ".note" entry specifying the ABI version. See + * http://www.netbsd.org/Documentation/kernel/elf-notes.html + * for more information. + */ +static const struct { + int32_t namesz; + int32_t descsz; + int32_t type; + char name[sizeof ABI_VENDOR]; + int32_t desc; +} abitag __attribute__ ((section (ABI_SECTION), aligned(4))) __unused = { + sizeof ABI_VENDOR, + sizeof(int32_t), + ABI_NOTETYPE, + ABI_VENDOR, + __FreeBSD_version +}; diff --git a/src/lib/csu/crti.S b/src/lib/csu/crti.S new file mode 100644 index 0000000..ff895cb --- /dev/null +++ b/src/lib/csu/crti.S @@ -0,0 +1,41 @@ +/*- + * Copyright 1996, 1997, 1998, 2000 John D. Polstra. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + .section .init,"ax",@progbits + .align 4 + .globl _init + .type _init,@function +_init: + sub $12,%esp /* re-align stack pointer */ + + .section .fini,"ax",@progbits + .align 4 + .globl _fini + .type _fini,@function +_fini: + sub $12,%esp /* re-align stack pointer */ + + .section .rodata +.ascii "$FreeBSD: src/lib/csu/i386-elf/crti.S,v 1.7 2005/05/19 07:31:06 dfr Exp $\0" diff --git a/src/lib/csu/crtn.S b/src/lib/csu/crtn.S new file mode 100644 index 0000000..8e820e3 --- /dev/null +++ b/src/lib/csu/crtn.S @@ -0,0 +1,35 @@ +/*- + * Copyright 1996, 1997, 1998, 2000 John D. Polstra. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + .section .init,"ax",@progbits + add $12,%esp + ret + + .section .fini,"ax",@progbits + add $12,%esp + ret + + .section .rodata +.ascii "$FreeBSD: src/lib/csu/i386-elf/crtn.S,v 1.6 2005/05/19 07:31:06 dfr Exp $\0" diff --git a/src/lib/libc/Makefile.inc b/src/lib/libc/Makefile.inc index 6e90f02..409ae4f 100644 --- a/src/lib/libc/Makefile.inc +++ b/src/lib/libc/Makefile.inc @@ -1,2 +1,2 @@ INCLUDES = -I../include -I../../../include.new -CFLAGS += -DPORTMAP -D__DBINTERFACE_PRIVATE -nostdinc +CFLAGS += -DPIC -DPORTMAP -D__DBINTERFACE_PRIVATE -nostdinc diff --git a/src/lib/libc/gen/getprogname.c b/src/lib/libc/gen/getprogname.c index 4be82e3..e029630 100644 --- a/src/lib/libc/gen/getprogname.c +++ b/src/lib/libc/gen/getprogname.c @@ -12,6 +12,8 @@ const char * _getprogname(void) { + /*HACK*/ + return("HACK"); return (__progname); } diff --git a/src/lib/libc/i386/Makefile.inc b/src/lib/libc/i386/Makefile.inc index 55ed355..ec4bcba 100755 --- a/src/lib/libc/i386/Makefile.inc +++ b/src/lib/libc/i386/Makefile.inc @@ -1,2 +1,2 @@ INCLUDES = -I../../include -I../../../../include.new -CFLAGS += -DPORTMAP -D__DBINTERFACE_PRIVATE -nostdinc +CFLAGS += -DPIC -DPORTMAP -D__DBINTERFACE_PRIVATE -nostdinc diff --git a/src/lib/libc/i386/string/Makefile b/src/lib/libc/i386/string/Makefile index 3a1f3e1..490c5ba 100644 --- a/src/lib/libc/i386/string/Makefile +++ b/src/lib/libc/i386/string/Makefile @@ -8,8 +8,8 @@ INCLUDES += -I../ -#Objects -OBJS = bcmp.o bcopy.o bzero.o ffs.o index.o memchr.o memcmp.o memcpy.o memmove.o memset.o rindex.o strcat.o strchr.o strcmp.o strcpy.o strlen.o strncmp.o strrchr.o swab.o wcschr.o wcscmp.o wcslen.o wmemchr.o +#Objects strlen.o +OBJS = bcmp.o bcopy.o bzero.o ffs.o index.o memchr.o memcmp.o memcpy.o memmove.o memset.o rindex.o strcat.o strchr.o strcmp.o strcpy.o strncmp.o strrchr.o swab.o wcschr.o wcscmp.o wcslen.o wmemchr.o all: $(OBJS) diff --git a/src/lib/libc/stdio/makebuf.c b/src/lib/libc/stdio/makebuf.c index a4c5c36..a76e9ba 100644 --- a/src/lib/libc/stdio/makebuf.c +++ b/src/lib/libc/stdio/makebuf.c @@ -96,7 +96,7 @@ int *couldbetty; { struct stat st; - +__sys_write(1,"swhatbuf"); if (fp->_file < 0 || _fstat(fp->_file, &st) < 0) { *couldbetty = 0; *bufsize = BUFSIZ; diff --git a/src/lib/libc/stdio/printf.c b/src/lib/libc/stdio/printf.c index 86452e2..d1c4d4f 100644 --- a/src/lib/libc/stdio/printf.c +++ b/src/lib/libc/stdio/printf.c @@ -1,4 +1,4 @@ -/*- +/* * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * @@ -34,11 +34,7 @@ * SUCH DAMAGE. */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)printf.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ #include -__FBSDID("$FreeBSD: src/lib/libc/stdio/printf.c,v 1.10 2002/09/06 11:23:55 tjr Exp $"); #include #include diff --git a/src/lib/libc/stdio/vfprintf.c b/src/lib/libc/stdio/vfprintf.c index 6518d16..b2b1286 100644 --- a/src/lib/libc/stdio/vfprintf.c +++ b/src/lib/libc/stdio/vfprintf.c @@ -649,8 +649,10 @@ decimal_point = localeconv()->decimal_point; #endif /* sorry, fprintf(read_only_file, "") returns EOF, not 0 */ +__sys_write(1,"A"); if (prepwrite(fp) != 0) return (EOF); +__sys_write(1,"B"); /* optimise fprintf(stderr) (and other unbuffered Unix files) */ if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) && diff --git a/src/lib/libc/stdio/wsetup.c b/src/lib/libc/stdio/wsetup.c index 7b120ff..2cdf557 100644 --- a/src/lib/libc/stdio/wsetup.c +++ b/src/lib/libc/stdio/wsetup.c @@ -57,7 +57,6 @@ /* make sure stdio is set up */ if (!__sdidinit) __sinit(); - /* * If we are not writing, we had better be reading and writing. */ @@ -76,6 +75,7 @@ } fp->_flags |= __SWR; } + __sys_write(1,"BBB"); /* * Make a buffer if necessary, then set _w. diff --git a/src/lib/libc/stdlib/getenv.c b/src/lib/libc/stdlib/getenv.c index aa15989..ba2694d 100644 --- a/src/lib/libc/stdlib/getenv.c +++ b/src/lib/libc/stdlib/getenv.c @@ -61,6 +61,9 @@ int len, i; const char *np; char **p, *cp; + /* TEMP */ + return(NULL); + if (name == NULL || environ == NULL) return (NULL); diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 05b238e..147425d 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c @@ -80,18 +80,6 @@ # define _MALLOC_UNLOCK() if (__isthreaded) _SPINUNLOCK(&thread_lock); #endif /* __FreeBSD__ */ -#if defined(__sparc__) && defined(sun) -# define malloc_pageshift 12U -# define malloc_minsize 16U -# define MAP_ANON (0) - static int fdzero; -# define MMAP_FD fdzero -# define INIT_MMAP() \ - { if ((fdzero = _open(_PATH_DEVZERO, O_RDWR, 0000)) == -1) \ - wrterror("open of /dev/zero"); } -# define MADV_FREE MADV_DONTNEED -#endif /* __sparc__ */ - /* Insert your combination here... */ #if defined(__FOOCPU__) && defined(__BAROS__) # define malloc_pageshift 12U @@ -274,8 +262,7 @@ /* Macro for mmap */ #define MMAP(size) \ - mmap(NULL, (size), PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, \ - MMAP_FD, (off_t)0); + mmap(NULL, (size), PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, MMAP_FD, (off_t)0); /* * Necessary function declarations @@ -334,9 +321,7 @@ return (NULL); if (brk(tail)) { -#ifdef MALLOC_EXTRA_SANITY wrterror("(ES): map_pages fails\n"); -#endif /* MALLOC_EXTRA_SANITY */ return (NULL); } @@ -464,8 +449,6 @@ } } } - - UTRACE(0, 0, 0); /* @@ -601,6 +584,7 @@ void *pp; int i, k, l; + __sys_write(1,"MAKE CHUNKS"); /* Allocate a new bucket */ pp = malloc_pages(malloc_pagesize); if (pp == NULL) @@ -728,20 +712,28 @@ if (suicide) abort(); - if ((size + malloc_pagesize) < size) /* Check for overflow */ - result = NULL; - else if ((size + malloc_pagesize) >= (uintptr_t)page_dir) - result = NULL; - else if (size <= malloc_maxsize) - result = malloc_bytes(size); - else - result = malloc_pages(size); + if ((size + malloc_pagesize) < size) { /* Check for overflow */ + __sys_write(1,"M3.1"); + result = NULL; + } + else if ((size + malloc_pagesize) >= (uintptr_t)page_dir) { + __sys_write(1,"M3.2"); + result = NULL; + } + else if (size <= malloc_maxsize) { + __sys_write(1,"M3.3"); + result = malloc_bytes(size); + } + else { + _sys_write(1,"M3.4"); + result = malloc_pages(size); + } - if (malloc_zero && result != NULL) - memset(result, 0, size); + if (malloc_zero && result != NULL) + memset(result, 0, size); - return (result); -} + return (result); + } /* * Change the size of an allocation. @@ -1114,21 +1106,32 @@ if (ptr == ZEROSIZEPTR) ptr = NULL; + if (malloc_sysv && !size) { - if (ptr != NULL) - ifree(ptr); - r = NULL; - } else if (!size) { - if (ptr != NULL) - ifree(ptr); - r = ZEROSIZEPTR; - } else if (ptr == NULL) { - r = imalloc(size); - err = (r == NULL); - } else { - r = irealloc(ptr, size); - err = (r == NULL); - } + __sys_write(1,"m1"); + if (ptr != NULL) + ifree(ptr); + r = NULL; + } + else if (!size) { + __sys_write(1,"m2"); + if (ptr != NULL) + ifree(ptr); + r = ZEROSIZEPTR; + } + else if (ptr == NULL) { + __sys_write(1,"m3"); + r = imalloc(size); + if (r == 0x0) + __sys_write(1,"m4"); + err = (r == NULL); + } + else { + __sys_write(1,"Here\n"); + r = irealloc(ptr, size); + err = (r == NULL); + } + UTRACE(ptr, size, r); malloc_active = 0; _MALLOC_UNLOCK(); diff --git a/src/lib/libc/string/Makefile b/src/lib/libc/string/Makefile index 9086e28..9d3723b 100644 --- a/src/lib/libc/string/Makefile +++ b/src/lib/libc/string/Makefile @@ -9,7 +9,7 @@ INCLUDES += -I../locale/ #Objects -OBJS = ffsl.o fls.o flsl.o memccpy.o memmem.o stpcpy.o strcasecmp.o strcasestr.o strcoll.o strcspn.o strdup.o strerror.o strlcat.o strlcpy.o strmode.o strncat.o strncpy.o strnstr.o strpbrk.o strsep.o strsignal.o strspn.o strstr.o strtok.o strxfrm.o wcscat.o wcscoll.o wcscpy.o wcscspn.o wcslcat.o wcslcpy.o wcsncat.o wcsncmp.o wcsncpy.o wcspbrk.o wcsrchr.o wcsspn.o wcsstr.o wcstok.o wcswidth.o wcsxfrm.o wmemcmp.o wmemcpy.o wmemmove.o wmemset.o +OBJS = strlen.o ffsl.o fls.o flsl.o memccpy.o memmem.o stpcpy.o strcasecmp.o strcasestr.o strcoll.o strcspn.o strdup.o strerror.o strlcat.o strlcpy.o strmode.o strncat.o strncpy.o strnstr.o strpbrk.o strsep.o strsignal.o strspn.o strstr.o strtok.o strxfrm.o wcscat.o wcscoll.o wcscpy.o wcscspn.o wcslcat.o wcslcpy.o wcsncat.o wcsncmp.o wcsncpy.o wcspbrk.o wcsrchr.o wcsspn.o wcsstr.o wcstok.o wcswidth.o wcsxfrm.o wmemcmp.o wmemcpy.o wmemmove.o wmemset.o all: $(OBJS) diff --git a/src/lib/libc/uthread/uthread_open.c b/src/lib/libc/uthread/uthread_open.c index 56e26b9..486c859 100644 --- a/src/lib/libc/uthread/uthread_open.c +++ b/src/lib/libc/uthread/uthread_open.c @@ -48,7 +48,6 @@ int fd; int mode = 0; va_list ap; - /* Check if the file is being created: */ if (flags & O_CREAT) { /* Get the creation mode: */ diff --git a/src/lib/libc/uthread/uthread_priority_queue.c b/src/lib/libc/uthread/uthread_priority_queue.c index 2481357..e1fde3c 100644 --- a/src/lib/libc/uthread/uthread_priority_queue.c +++ b/src/lib/libc/uthread/uthread_priority_queue.c @@ -96,9 +96,10 @@ ret = -1; /* Create the priority queue with (maxprio - minprio + 1) slots: */ - else if ((pq->pq_lists = - (pq_list_t *) malloc(sizeof(pq_list_t) * prioslots)) == NULL) - ret = -1; + else if ((pq->pq_lists = (pq_list_t *) malloc(sizeof(pq_list_t) * prioslots)) == NULL) { + __sys_write(1,"MALLOC FAILED"); + ret = -1; + } else { /* Remember the queue size: */