diff options
author | Andy Fiddaman <omnios@citrus-it.co.uk> | 2019-09-12 23:03:03 +0000 |
---|---|---|
committer | Andy Fiddaman <omnios@citrus-it.co.uk> | 2019-09-16 16:32:55 +0000 |
commit | e7b66456775e45577294dfd79cab910ecb886cf2 (patch) | |
tree | a6b1a182c6ad2ea3b05c306e3edd8d73897dc147 /usr/src/lib/libc | |
parent | acbbf6c3e48e6820369e27e9bd3724278b5ba825 (diff) | |
download | illumos-joyent-e7b66456775e45577294dfd79cab910ecb886cf2.tar.gz |
11680 want reallocf(3C)
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Matthias Scheler <matthias.scheler@wdc.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: John Levon <john.levon@joyent.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src/lib/libc')
-rw-r--r-- | usr/src/lib/libc/amd64/Makefile | 1 | ||||
-rw-r--r-- | usr/src/lib/libc/i386/Makefile.com | 1 | ||||
-rw-r--r-- | usr/src/lib/libc/port/gen/reallocf.c | 28 | ||||
-rw-r--r-- | usr/src/lib/libc/port/mapfile-vers | 6 | ||||
-rw-r--r-- | usr/src/lib/libc/sparc/Makefile.com | 1 | ||||
-rw-r--r-- | usr/src/lib/libc/sparcv9/Makefile.com | 1 |
6 files changed, 38 insertions, 0 deletions
diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile index d71aebf34a..9c21615994 100644 --- a/usr/src/lib/libc/amd64/Makefile +++ b/usr/src/lib/libc/amd64/Makefile @@ -517,6 +517,7 @@ PORTGEN= \ readdir.o \ readdir_r.o \ reallocarray.o \ + reallocf.o \ recallocarray.o \ realpath.o \ reboot.o \ diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com index 4eef3b98b7..3b5a07ec01 100644 --- a/usr/src/lib/libc/i386/Makefile.com +++ b/usr/src/lib/libc/i386/Makefile.com @@ -553,6 +553,7 @@ PORTGEN= \ readdir.o \ readdir_r.o \ reallocarray.o \ + reallocf.o \ recallocarray.o \ realpath.o \ reboot.o \ diff --git a/usr/src/lib/libc/port/gen/reallocf.c b/usr/src/lib/libc/port/gen/reallocf.c new file mode 100644 index 0000000000..43c8555811 --- /dev/null +++ b/usr/src/lib/libc/port/gen/reallocf.c @@ -0,0 +1,28 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2019 OmniOS Community Edition (OmniOSce) Association. + */ + +#include <stdlib.h> + +void * +reallocf(void *ptr, size_t size) +{ + void *nptr = realloc(ptr, size); + + /* If size is zero, realloc will have already freed ptr. */ + if (nptr == NULL && size != 0) + free(ptr); + + return (nptr); +} diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers index 38b5264042..e4cf0e299a 100644 --- a/usr/src/lib/libc/port/mapfile-vers +++ b/usr/src/lib/libc/port/mapfile-vers @@ -27,6 +27,7 @@ # Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. # Copyright (c) 2013 Gary Mills # Copyright 2014 Garrett D'Amore <garrett@damore.org> +# Copyright 2019 OmniOS Community Edition (OmniOSce) Association. # # @@ -77,6 +78,11 @@ $if _x86 && _ELF64 $add amd64 $endif +SYMBOL_VERSION ILLUMOS_0.30 { + protected: + reallocf; +} ILLUMOS_0.29; + SYMBOL_VERSION ILLUMOS_0.29 { protected: getrandom; diff --git a/usr/src/lib/libc/sparc/Makefile.com b/usr/src/lib/libc/sparc/Makefile.com index 8904d1d49a..e8c8405c42 100644 --- a/usr/src/lib/libc/sparc/Makefile.com +++ b/usr/src/lib/libc/sparc/Makefile.com @@ -580,6 +580,7 @@ PORTGEN= \ readdir.o \ readdir_r.o \ reallocarray.o \ + reallocf.o \ recallocarray.o \ realpath.o \ reboot.o \ diff --git a/usr/src/lib/libc/sparcv9/Makefile.com b/usr/src/lib/libc/sparcv9/Makefile.com index 4256560408..07e2878672 100644 --- a/usr/src/lib/libc/sparcv9/Makefile.com +++ b/usr/src/lib/libc/sparcv9/Makefile.com @@ -537,6 +537,7 @@ PORTGEN= \ readdir.o \ readdir_r.o \ reallocarray.o \ + reallocf.o \ recallocarray.o \ realpath.o \ reboot.o \ |