[PATCH 1/5] newlib: use __reent_ptr_t for reentrancy context arguments

H. Peter Anvin hpa@zytor.com
Thu Dec 3 22:01:35 GMT 2026


Introduce __reent_ptr_t as a typedef for struct _reent * and use it in
reentrant function declarations, definitions, callbacks, and local
context variables throughout newlib and libgloss.

This is strictly a mechanical type substitution with no ABI or
behavior change.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 libgloss/aarch64/syscalls.c                  |   2 +-
 libgloss/arm/syscalls.c                      |   2 +-
 libgloss/epiphany/sbrk.c                     |   6 +-
 libgloss/m32r/eit.h                          |   2 +-
 libgloss/m32r/trapmon0.c                     |   2 +-
 libgloss/or1k/sbrk.c                         |   2 +-
 libgloss/or1k/syscalls.c                     |  32 +--
 newlib/README                                |   6 +
 newlib/libc/ctype/towctrans.c                |   2 +-
 newlib/libc/ctype/wctrans.c                  |   2 +-
 newlib/libc/ctype/wctype.c                   |   2 +-
 newlib/libc/iconv/ces/euc.c                  |   8 +-
 newlib/libc/iconv/ces/table-pcs.c            |   8 +-
 newlib/libc/iconv/ces/table.c                |  12 +-
 newlib/libc/iconv/ces/ucs-2.c                |   4 +-
 newlib/libc/iconv/ces/ucs-4.c                |   4 +-
 newlib/libc/iconv/ces/utf-16.c               |   6 +-
 newlib/libc/iconv/lib/aliasesi.c             |  12 +-
 newlib/libc/iconv/lib/conv.h                 |  12 +-
 newlib/libc/iconv/lib/iconv.c                |  12 +-
 newlib/libc/iconv/lib/iconvnls.c             |  12 +-
 newlib/libc/iconv/lib/nullconv.c             |   6 +-
 newlib/libc/iconv/lib/ucsconv.c              |   6 +-
 newlib/libc/iconv/lib/ucsconv.h              |  12 +-
 newlib/libc/include/envlock.h                |   4 +-
 newlib/libc/include/iconv.h                  |   6 +-
 newlib/libc/include/inttypes.h               |  11 +-
 newlib/libc/include/locale.h                 |  16 +-
 newlib/libc/include/malloc.h                 |  30 +--
 newlib/libc/include/reent.h                  |  52 ++---
 newlib/libc/include/signal.h                 |   7 +-
 newlib/libc/include/stdio.h                  | 210 +++++++++----------
 newlib/libc/include/stdlib.h                 |  86 ++++----
 newlib/libc/include/string.h                 |   6 +-
 newlib/libc/include/sys/_types.h             |   3 +
 newlib/libc/include/sys/iconvnls.h           |   8 +-
 newlib/libc/include/sys/reent.h              |  28 +--
 newlib/libc/include/time.h                   |   2 +-
 newlib/libc/include/wchar.h                  |  88 ++++----
 newlib/libc/locale/duplocale.c               |   2 +-
 newlib/libc/locale/freelocale.c              |   2 +-
 newlib/libc/locale/getlocalename_l.c         |   2 +-
 newlib/libc/locale/locale.c                  |   4 +-
 newlib/libc/locale/localeconv.c              |   2 +-
 newlib/libc/locale/newlocale.c               |   2 +-
 newlib/libc/locale/setlocale.h               |  12 +-
 newlib/libc/locale/uselocale.c               |   2 +-
 newlib/libc/machine/amdgcn/getreent.c        |   2 +-
 newlib/libc/machine/amdgcn/mlock.c           |   4 +-
 newlib/libc/machine/amdgcn/simt-malloc.c     |  24 +--
 newlib/libc/machine/msp430/tiny-printf.c     |   8 +-
 newlib/libc/machine/nvptx/callocr.c          |   2 +-
 newlib/libc/machine/nvptx/mallocr.c          |   4 +-
 newlib/libc/machine/nvptx/reallocr.c         |   2 +-
 newlib/libc/machine/powerpc/atosfix16.c      |   2 +-
 newlib/libc/machine/powerpc/atosfix32.c      |   2 +-
 newlib/libc/machine/powerpc/atosfix64.c      |   2 +-
 newlib/libc/machine/powerpc/atoufix16.c      |   2 +-
 newlib/libc/machine/powerpc/atoufix32.c      |   2 +-
 newlib/libc/machine/powerpc/atoufix64.c      |   2 +-
 newlib/libc/machine/powerpc/machine/malloc.h |   4 +-
 newlib/libc/machine/powerpc/machine/stdlib.h |  28 +--
 newlib/libc/machine/powerpc/simdldtoa.c      |   4 +-
 newlib/libc/machine/powerpc/strtosfix16.c    |   2 +-
 newlib/libc/machine/powerpc/strtosfix32.c    |   2 +-
 newlib/libc/machine/powerpc/strtosfix64.c    |   2 +-
 newlib/libc/machine/powerpc/strtoufix16.c    |   2 +-
 newlib/libc/machine/powerpc/strtoufix32.c    |   2 +-
 newlib/libc/machine/powerpc/strtoufix64.c    |   2 +-
 newlib/libc/machine/powerpc/ufix64toa.c      |   4 +-
 newlib/libc/machine/powerpc/vec_mallocr.c    |  10 +-
 newlib/libc/machine/powerpc/vfprintf.c       |  22 +-
 newlib/libc/machine/powerpc/vfscanf.c        |   4 +-
 newlib/libc/machine/spu/c99ppe.h             |   4 +-
 newlib/libc/machine/spu/fopen.c              |   2 +-
 newlib/libc/machine/spu/stdio.c              |   6 +-
 newlib/libc/machine/spu/tmpfile.c            |   2 +-
 newlib/libc/machine/xstormy16/callocr.c      |   2 +-
 newlib/libc/machine/xstormy16/freer.c        |   2 +-
 newlib/libc/machine/xstormy16/mallocr.c      |   2 +-
 newlib/libc/machine/xstormy16/reallocr.c     |   2 +-
 newlib/libc/reent/closer.c                   |   4 +-
 newlib/libc/reent/execr.c                    |  12 +-
 newlib/libc/reent/fcntlr.c                   |   4 +-
 newlib/libc/reent/fstat64r.c                 |   4 +-
 newlib/libc/reent/fstatr.c                   |   4 +-
 newlib/libc/reent/getentropyr.c              |   4 +-
 newlib/libc/reent/getreent.c                 |   2 +-
 newlib/libc/reent/gettimeofdayr.c            |   4 +-
 newlib/libc/reent/isattyr.c                  |   4 +-
 newlib/libc/reent/linkr.c                    |   4 +-
 newlib/libc/reent/lseek64r.c                 |   4 +-
 newlib/libc/reent/lseekr.c                   |   4 +-
 newlib/libc/reent/mkdirr.c                   |   4 +-
 newlib/libc/reent/open64r.c                  |   4 +-
 newlib/libc/reent/openr.c                    |   4 +-
 newlib/libc/reent/readr.c                    |   4 +-
 newlib/libc/reent/reent.c                    |   2 +-
 newlib/libc/reent/reent.tex                  |  10 +
 newlib/libc/reent/renamer.c                  |   4 +-
 newlib/libc/reent/sbrkr.c                    |   4 +-
 newlib/libc/reent/signalr.c                  |   8 +-
 newlib/libc/reent/stat64r.c                  |   4 +-
 newlib/libc/reent/statr.c                    |   4 +-
 newlib/libc/reent/timesr.c                   |   4 +-
 newlib/libc/reent/unlinkr.c                  |   4 +-
 newlib/libc/reent/writer.c                   |   4 +-
 newlib/libc/signal/raise.c                   |   2 +-
 newlib/libc/signal/signal.c                  |   8 +-
 newlib/libc/stdio/asiprintf.c                |   2 +-
 newlib/libc/stdio/asniprintf.c               |   4 +-
 newlib/libc/stdio/asnprintf.c                |   6 +-
 newlib/libc/stdio/asprintf.c                 |   4 +-
 newlib/libc/stdio/diprintf.c                 |   6 +-
 newlib/libc/stdio/dprintf.c                  |  10 +-
 newlib/libc/stdio/fclose.c                   |   4 +-
 newlib/libc/stdio/fcloseall.c                |   4 +-
 newlib/libc/stdio/fdopen.c                   |   4 +-
 newlib/libc/stdio/fflush.c                   |  10 +-
 newlib/libc/stdio/fgetc.c                    |   8 +-
 newlib/libc/stdio/fgetc_u.c                  |   4 +-
 newlib/libc/stdio/fgetpos.c                  |   4 +-
 newlib/libc/stdio/fgets.c                    |   6 +-
 newlib/libc/stdio/fgetwc.c                   |  14 +-
 newlib/libc/stdio/fgetwc_u.c                 |   4 +-
 newlib/libc/stdio/fgetws.c                   |   8 +-
 newlib/libc/stdio/findfp.c                   |  14 +-
 newlib/libc/stdio/fiprintf.c                 |   2 +-
 newlib/libc/stdio/fiscanf.c                  |   2 +-
 newlib/libc/stdio/flags.c                    |   2 +-
 newlib/libc/stdio/fmemopen.c                 |  12 +-
 newlib/libc/stdio/fopen.c                    |   4 +-
 newlib/libc/stdio/fopencookie.c              |  12 +-
 newlib/libc/stdio/fprintf.c                  |   4 +-
 newlib/libc/stdio/fpurge.c                   |   4 +-
 newlib/libc/stdio/fputc.c                    |   4 +-
 newlib/libc/stdio/fputc_u.c                  |   4 +-
 newlib/libc/stdio/fputs.c                    |   6 +-
 newlib/libc/stdio/fputwc.c                   |  14 +-
 newlib/libc/stdio/fputwc_u.c                 |   4 +-
 newlib/libc/stdio/fputws.c                   |   8 +-
 newlib/libc/stdio/fread.c                    |   8 +-
 newlib/libc/stdio/freopen.c                  |   4 +-
 newlib/libc/stdio/fscanf.c                   |   4 +-
 newlib/libc/stdio/fseek.c                    |   6 +-
 newlib/libc/stdio/fseeko.c                   |   8 +-
 newlib/libc/stdio/fsetpos.c                  |   4 +-
 newlib/libc/stdio/ftell.c                    |   6 +-
 newlib/libc/stdio/ftello.c                   |   6 +-
 newlib/libc/stdio/funopen.c                  |  12 +-
 newlib/libc/stdio/fvwrite.c                  |   2 +-
 newlib/libc/stdio/fvwrite.h                  |   4 +-
 newlib/libc/stdio/fwalk.c                    |   2 +-
 newlib/libc/stdio/fwide.c                    |   4 +-
 newlib/libc/stdio/fwprintf.c                 |   2 +-
 newlib/libc/stdio/fwrite.c                   |   6 +-
 newlib/libc/stdio/fwscanf.c                  |   2 +-
 newlib/libc/stdio/getc.c                     |   6 +-
 newlib/libc/stdio/getc_u.c                   |   2 +-
 newlib/libc/stdio/getchar.c                  |   6 +-
 newlib/libc/stdio/getchar_u.c                |   4 +-
 newlib/libc/stdio/gets.c                     |   4 +-
 newlib/libc/stdio/getwc.c                    |   2 +-
 newlib/libc/stdio/getwc_u.c                  |   2 +-
 newlib/libc/stdio/getwchar.c                 |   6 +-
 newlib/libc/stdio/getwchar_u.c               |   2 +-
 newlib/libc/stdio/iprintf.c                  |   4 +-
 newlib/libc/stdio/iscanf.c                   |   2 +-
 newlib/libc/stdio/local.h                    |  68 +++---
 newlib/libc/stdio/makebuf.c                  |   4 +-
 newlib/libc/stdio/mktemp.c                   |  26 +--
 newlib/libc/stdio/nano-vfprintf.c            |  32 +--
 newlib/libc/stdio/nano-vfprintf_float.c      |   8 +-
 newlib/libc/stdio/nano-vfprintf_i.c          |   8 +-
 newlib/libc/stdio/nano-vfprintf_local.h      |  14 +-
 newlib/libc/stdio/nano-vfscanf.c             |  28 +--
 newlib/libc/stdio/nano-vfscanf_float.c       |   2 +-
 newlib/libc/stdio/nano-vfscanf_i.c           |   6 +-
 newlib/libc/stdio/nano-vfscanf_local.h       |  10 +-
 newlib/libc/stdio/open_memstream.c           |  14 +-
 newlib/libc/stdio/perror.c                   |   4 +-
 newlib/libc/stdio/printf.c                   |   6 +-
 newlib/libc/stdio/putc.c                     |   6 +-
 newlib/libc/stdio/putc_u.c                   |   4 +-
 newlib/libc/stdio/putchar.c                  |   6 +-
 newlib/libc/stdio/putchar_u.c                |   2 +-
 newlib/libc/stdio/puts.c                     |   4 +-
 newlib/libc/stdio/putwc.c                    |   2 +-
 newlib/libc/stdio/putwc_u.c                  |   2 +-
 newlib/libc/stdio/putwchar.c                 |   6 +-
 newlib/libc/stdio/putwchar_u.c               |   2 +-
 newlib/libc/stdio/refill.c                   |   4 +-
 newlib/libc/stdio/remove.c                   |   4 +-
 newlib/libc/stdio/rewind.c                   |   4 +-
 newlib/libc/stdio/rget.c                     |   2 +-
 newlib/libc/stdio/scanf.c                    |   6 +-
 newlib/libc/stdio/setvbuf.c                  |   2 +-
 newlib/libc/stdio/sfputs_r.c                 |   2 +-
 newlib/libc/stdio/sfputws_r.c                |   2 +-
 newlib/libc/stdio/siprintf.c                 |  14 +-
 newlib/libc/stdio/siscanf.c                  |   8 +-
 newlib/libc/stdio/sniprintf.c                |   4 +-
 newlib/libc/stdio/snprintf.c                 |   6 +-
 newlib/libc/stdio/sprint_r.c                 |   2 +-
 newlib/libc/stdio/sprintf.c                  |  16 +-
 newlib/libc/stdio/sscanf.c                   |  10 +-
 newlib/libc/stdio/ssprint_r.c                |   4 +-
 newlib/libc/stdio/ssputs_r.c                 |   2 +-
 newlib/libc/stdio/ssputws_r.c                |   4 +-
 newlib/libc/stdio/sswprint_r.c               |   4 +-
 newlib/libc/stdio/stdio.c                    |  10 +-
 newlib/libc/stdio/swprint_r.c                |   2 +-
 newlib/libc/stdio/swprintf.c                 |  10 +-
 newlib/libc/stdio/swscanf.c                  |   8 +-
 newlib/libc/stdio/tmpfile.c                  |   4 +-
 newlib/libc/stdio/tmpnam.c                   |  10 +-
 newlib/libc/stdio/ungetc.c                   |   6 +-
 newlib/libc/stdio/ungetwc.c                  |   6 +-
 newlib/libc/stdio/vasiprintf.c               |   2 +-
 newlib/libc/stdio/vasniprintf.c              |   2 +-
 newlib/libc/stdio/vasnprintf.c               |   4 +-
 newlib/libc/stdio/vasprintf.c                |   4 +-
 newlib/libc/stdio/vdiprintf.c                |   2 +-
 newlib/libc/stdio/vdprintf.c                 |   4 +-
 newlib/libc/stdio/vfprintf.c                 |  38 ++--
 newlib/libc/stdio/vfscanf.c                  |  28 +--
 newlib/libc/stdio/vfwprintf.c                |  28 +--
 newlib/libc/stdio/vfwscanf.c                 |  20 +-
 newlib/libc/stdio/viprintf.c                 |  16 +-
 newlib/libc/stdio/viscanf.c                  |  10 +-
 newlib/libc/stdio/vprintf.c                  |   6 +-
 newlib/libc/stdio/vscanf.c                   |   6 +-
 newlib/libc/stdio/vsiprintf.c                |   2 +-
 newlib/libc/stdio/vsiscanf.c                 |   2 +-
 newlib/libc/stdio/vsniprintf.c               |   2 +-
 newlib/libc/stdio/vsnprintf.c                |   4 +-
 newlib/libc/stdio/vsprintf.c                 |   4 +-
 newlib/libc/stdio/vsscanf.c                  |   4 +-
 newlib/libc/stdio/vswprintf.c                |   2 +-
 newlib/libc/stdio/vswscanf.c                 |   2 +-
 newlib/libc/stdio/vwprintf.c                 |   4 +-
 newlib/libc/stdio/vwscanf.c                  |   4 +-
 newlib/libc/stdio/wbuf.c                     |   2 +-
 newlib/libc/stdio/wbufw.c                    |   2 +-
 newlib/libc/stdio/wprintf.c                  |   4 +-
 newlib/libc/stdio/wscanf.c                   |   4 +-
 newlib/libc/stdio/wsetup.c                   |   2 +-
 newlib/libc/stdio64/fdopen64.c               |   2 +-
 newlib/libc/stdio64/fgetpos64.c              |   4 +-
 newlib/libc/stdio64/fopen64.c                |   2 +-
 newlib/libc/stdio64/freopen64.c              |   4 +-
 newlib/libc/stdio64/fseeko64.c               |   6 +-
 newlib/libc/stdio64/fsetpos64.c              |   4 +-
 newlib/libc/stdio64/ftello64.c               |   4 +-
 newlib/libc/stdio64/stdio64.c                |   4 +-
 newlib/libc/stdio64/tmpfile64.c              |   2 +-
 newlib/libc/stdlib/__adjust.c                |   2 +-
 newlib/libc/stdlib/_mallocr.c                |  10 +-
 newlib/libc/stdlib/atoi.c                    |   6 +-
 newlib/libc/stdlib/atol.c                    |   2 +-
 newlib/libc/stdlib/atoll.c                   |   4 +-
 newlib/libc/stdlib/drand48.c                 |   2 +-
 newlib/libc/stdlib/dtoa.c                    |   2 +-
 newlib/libc/stdlib/ecvtbuf.c                 |  12 +-
 newlib/libc/stdlib/envlock.c                 |   8 +-
 newlib/libc/stdlib/erand48.c                 |   2 +-
 newlib/libc/stdlib/gdtoa-dmisc.c             |  12 +-
 newlib/libc/stdlib/gdtoa-gdtoa.c             |   6 +-
 newlib/libc/stdlib/gdtoa-gethex.c            |   4 +-
 newlib/libc/stdlib/gdtoa-ldtoa.c             |   4 +-
 newlib/libc/stdlib/gdtoa.h                   |   8 +-
 newlib/libc/stdlib/gdtoaimp.h                |   4 +-
 newlib/libc/stdlib/getenv_r.c                |   6 +-
 newlib/libc/stdlib/jrand48.c                 |   2 +-
 newlib/libc/stdlib/l64a.c                    |   2 +-
 newlib/libc/stdlib/lcong48.c                 |   2 +-
 newlib/libc/stdlib/ldtoa.c                   |   4 +-
 newlib/libc/stdlib/local.h                   |   6 +-
 newlib/libc/stdlib/lrand48.c                 |   2 +-
 newlib/libc/stdlib/mblen.c                   |   2 +-
 newlib/libc/stdlib/mblen_r.c                 |   4 +-
 newlib/libc/stdlib/mbrlen.c                  |   2 +-
 newlib/libc/stdlib/mbrtowc.c                 |   4 +-
 newlib/libc/stdlib/mbsnrtowcs.c              |   6 +-
 newlib/libc/stdlib/mbsrtowcs.c               |   2 +-
 newlib/libc/stdlib/mbstowcs_r.c              |   2 +-
 newlib/libc/stdlib/mbtowc.c                  |   2 +-
 newlib/libc/stdlib/mbtowc_r.c                | 100 ++++-----
 newlib/libc/stdlib/mlock.c                   |   8 +-
 newlib/libc/stdlib/mprec.c                   |  20 +-
 newlib/libc/stdlib/mprec.h                   |  30 +--
 newlib/libc/stdlib/mrand48.c                 |   2 +-
 newlib/libc/stdlib/mstats.c                  |   2 +-
 newlib/libc/stdlib/nano-mallocr.c            |   4 +-
 newlib/libc/stdlib/nrand48.c                 |   2 +-
 newlib/libc/stdlib/putenv_r.c                |   2 +-
 newlib/libc/stdlib/rand.c                    |   4 +-
 newlib/libc/stdlib/rand48.c                  |   2 +-
 newlib/libc/stdlib/rand48.h                  |   2 +-
 newlib/libc/stdlib/random.c                  |   4 +-
 newlib/libc/stdlib/reallocf.c                |   2 +-
 newlib/libc/stdlib/seed48.c                  |   2 +-
 newlib/libc/stdlib/setenv.c                  |   2 +-
 newlib/libc/stdlib/setenv_r.c                |   6 +-
 newlib/libc/stdlib/srand48.c                 |   2 +-
 newlib/libc/stdlib/std.h                     |   2 +-
 newlib/libc/stdlib/strtod.c                  |   4 +-
 newlib/libc/stdlib/strtodg.c                 |  10 +-
 newlib/libc/stdlib/strtoimax.c               |   4 +-
 newlib/libc/stdlib/strtol.c                  |   4 +-
 newlib/libc/stdlib/strtold.c                 |   4 +-
 newlib/libc/stdlib/strtoll.c                 |   4 +-
 newlib/libc/stdlib/strtorQ.c                 |   4 +-
 newlib/libc/stdlib/strtorx.c                 |   4 +-
 newlib/libc/stdlib/strtoul.c                 |   4 +-
 newlib/libc/stdlib/strtoull.c                |   4 +-
 newlib/libc/stdlib/strtoumax.c               |   4 +-
 newlib/libc/stdlib/system.c                  |   8 +-
 newlib/libc/stdlib/wcrtomb.c                 |   4 +-
 newlib/libc/stdlib/wcsnrtombs.c              |   8 +-
 newlib/libc/stdlib/wcsrtombs.c               |   2 +-
 newlib/libc/stdlib/wcstod.c                  |   6 +-
 newlib/libc/stdlib/wcstoimax.c               |   4 +-
 newlib/libc/stdlib/wcstol.c                  |   4 +-
 newlib/libc/stdlib/wcstoll.c                 |   4 +-
 newlib/libc/stdlib/wcstombs_r.c              |   2 +-
 newlib/libc/stdlib/wcstoul.c                 |   4 +-
 newlib/libc/stdlib/wcstoull.c                |   4 +-
 newlib/libc/stdlib/wcstoumax.c               |   4 +-
 newlib/libc/stdlib/wctob.c                   |   2 +-
 newlib/libc/stdlib/wctomb.c                  |   2 +-
 newlib/libc/stdlib/wctomb_r.c                | 100 ++++-----
 newlib/libc/string/strdup_r.c                |   2 +-
 newlib/libc/string/strerror.c                |   2 +-
 newlib/libc/string/strndup_r.c               |   2 +-
 newlib/libc/string/strsignal.c               |   2 +-
 newlib/libc/string/strtok.c                  |   2 +-
 newlib/libc/string/wcsdup.c                  |   4 +-
 newlib/libc/sys/arm/syscalls.c               |   2 +-
 newlib/libc/sys/atari/filemode.c             |   2 +-
 newlib/libc/sys/or1k/mlock.c                 |   4 +-
 newlib/libc/sys/rdos/rdoshelp.c              |   2 +-
 newlib/libc/sys/rtems/crt0.c                 |  50 ++---
 newlib/libc/syscalls/syssbrk.c               |   2 +-
 newlib/libc/time/asctime.c                   |   2 +-
 newlib/libc/time/gmtime.c                    |   2 +-
 newlib/libc/time/lcltime.c                   |   2 +-
 newlib/libc/time/local.h                     |   2 +-
 newlib/libc/time/strftime.c                  |   2 +-
 newlib/libc/time/tzset.c                     |   2 +-
 newlib/libc/time/tzset_r.c                   |   4 +-
 newlib/libc/unix/pread.c                     |   4 +-
 newlib/libc/unix/pwrite.c                    |   4 +-
 353 files changed, 1349 insertions(+), 1332 deletions(-)

diff --git a/libgloss/aarch64/syscalls.c b/libgloss/aarch64/syscalls.c
index 5b4071893e1c..3f03eb45cc44 100644
--- a/libgloss/aarch64/syscalls.c
+++ b/libgloss/aarch64/syscalls.c
@@ -120,7 +120,7 @@ register char * stack_ptr asm ("sp");
 
 
 /* following is copied from libc/stdio/local.h to check std streams */
-extern void __sinit (struct _reent *);
+extern void __sinit (__reent_ptr_t);
 #define CHECK_INIT(ptr) \
   do						\
     {						\
diff --git a/libgloss/arm/syscalls.c b/libgloss/arm/syscalls.c
index 710a741eee01..7e6bfb5b969a 100644
--- a/libgloss/arm/syscalls.c
+++ b/libgloss/arm/syscalls.c
@@ -85,7 +85,7 @@ register char * stack_ptr asm ("sp");
 
 
 /* following is copied from libc/stdio/local.h to check std streams */
-extern void   __sinit (struct _reent *);
+extern void   __sinit (__reent_ptr_t);
 #define CHECK_INIT(ptr) \
   do						\
     {						\
diff --git a/libgloss/epiphany/sbrk.c b/libgloss/epiphany/sbrk.c
index 4880c0f8cccb..e07459094fd3 100644
--- a/libgloss/epiphany/sbrk.c
+++ b/libgloss/epiphany/sbrk.c
@@ -97,7 +97,7 @@ _sbrk (int  incr)
 //caddr_t sbrk_loc asm ("sbrk_loc");
 //extern char  end;                    /* Defined by linker.  */
 //
-///*caddr_t _sbrk_r (struct _reent *, size_t) asm ("__sbrk_r");*/
+///*caddr_t _sbrk_r (__reent_ptr_t, size_t) asm ("__sbrk_r");*/
 //
 //
 ///* This symbol can be defined with the --defsym linker option.  */
@@ -107,7 +107,7 @@ _sbrk (int  incr)
 ///* FIXME: We need a semaphore here.  */
 //
 //caddr_t
-//_sbrk_r (struct _reent *r, size_t nbytes)
+//_sbrk_r (__reent_ptr_t r, size_t nbytes)
 //{
 //   extern char  end;			/* Defined by linker.  */
 //   static char *heap_end;		/* Previous end of heap or 0 if none */
@@ -138,7 +138,7 @@ _sbrk (int  incr)
 
 
 //caddr_t
-//_sbrk_r (struct _reent *r, size_t nbytes)
+//_sbrk_r (__reent_ptr_t r, size_t nbytes)
 //{
 //  caddr_t result;
 //
diff --git a/libgloss/m32r/eit.h b/libgloss/m32r/eit.h
index ef51c08feaa5..aa6df2e39748 100644
--- a/libgloss/m32r/eit.h
+++ b/libgloss/m32r/eit.h
@@ -7,7 +7,7 @@
 
 #include <reent.h>
 
-int __trap0 (int function, int p1, int p2, int p3, struct _reent *r);
+int __trap0 (int function, int p1, int p2, int p3, __reent_ptr_t r);
 
 #define TRAP0(f, p1, p2, p3) \
 __trap0 (f, (int) (p1), (int) (p2), (int) (p3), _REENT)
diff --git a/libgloss/m32r/trapmon0.c b/libgloss/m32r/trapmon0.c
index 20a2fcbfe55e..f8bf26c7fd1a 100644
--- a/libgloss/m32r/trapmon0.c
+++ b/libgloss/m32r/trapmon0.c
@@ -6,7 +6,7 @@
 #include <reent.h>
 #include "syscall.h"
 
-int __trap0 (int function, int p1, int p2, int p3, struct _reent *r)
+int __trap0 (int function, int p1, int p2, int p3, __reent_ptr_t r)
 {
   int rc = 0;
 
diff --git a/libgloss/or1k/sbrk.c b/libgloss/or1k/sbrk.c
index ca196d2282bf..44bd1a07a67c 100644
--- a/libgloss/or1k/sbrk.c
+++ b/libgloss/or1k/sbrk.c
@@ -24,7 +24,7 @@ uint32_t _or1k_heap_start = (uint32_t) &end;
 uint32_t _or1k_heap_end;
 
 void *
-_sbrk_r (struct _reent * reent, ptrdiff_t incr)
+_sbrk_r (__reent_ptr_t reent, ptrdiff_t incr)
 {
 	uint32_t	prev_heap_end;
 
diff --git a/libgloss/or1k/syscalls.c b/libgloss/or1k/syscalls.c
index 92bff497bc66..fcd4b681c772 100644
--- a/libgloss/or1k/syscalls.c
+++ b/libgloss/or1k/syscalls.c
@@ -28,7 +28,7 @@
 extern void _or1k_outbyte(char c);
 
 _ssize_t
-_write_r(struct _reent * reent, int fd, const void *buf, size_t nbytes)
+_write_r(__reent_ptr_t reent, int fd, const void *buf, size_t nbytes)
 {
 	int i;
 	char* b = (char*) buf;
@@ -50,14 +50,14 @@ _exit(int rc)
 }
 
 int
-_close_r(struct _reent *reent, int fildes)
+_close_r(__reent_ptr_t reent, int fildes)
 {
 	reent->_errno = ENOSYS;
 	return -1;
 }
 
 int
-_execve_r(struct _reent *reent, const char *name, char * const *argv,
+_execve_r(__reent_ptr_t reent, const char *name, char * const *argv,
 		char * const *env)
 {
 	reent->_errno = ENOSYS;
@@ -65,91 +65,91 @@ _execve_r(struct _reent *reent, const char *name, char * const *argv,
 }
 
 int
-_fork_r(struct _reent *reent)
+_fork_r(__reent_ptr_t reent)
 {
 	errno = ENOSYS;
 	return -1;
 }
 
 int
-_fstat_r(struct _reent *reent, int fildes, struct stat *st)
+_fstat_r(__reent_ptr_t reent, int fildes, struct stat *st)
 {
 	reent->_errno = ENOSYS;
 	return -1;
 }
 
 int
-_getpid_r(struct _reent *reent)
+_getpid_r(__reent_ptr_t reent)
 {
 	reent->_errno = ENOSYS;
 	return -1;
 }
 
 int
-_gettimeofday(struct _reent *reent, struct timeval  *ptimeval, void *ptimezone)
+_gettimeofday(__reent_ptr_t reent, struct timeval  *ptimeval, void *ptimezone)
 {
 	reent->_errno = ENOSYS;
 	return -1;
 }
 
 int
-_isatty_r(struct _reent *reent, int file)
+_isatty_r(__reent_ptr_t reent, int file)
 {
 	reent->_errno = ENOSYS;
 	return 0;
 }
 
 int
-_kill_r(struct _reent *reent, int pid, int sig)
+_kill_r(__reent_ptr_t reent, int pid, int sig)
 {
 	reent->_errno = ENOSYS;
 	return -1;
 }
 
 int
-_link_r(struct _reent *reent, const char *existing, const char *new)
+_link_r(__reent_ptr_t reent, const char *existing, const char *new)
 {
 	reent->_errno = ENOSYS;
 	return -1;
 }
 
 _off_t
-_lseek_r(struct _reent *reent, int file, _off_t ptr, int dir)
+_lseek_r(__reent_ptr_t reent, int file, _off_t ptr, int dir)
 {
 	errno = ENOSYS;
 	return -1;
 }
 
 int
-_open_r(struct _reent *reent, const char *file, int flags, int mode)
+_open_r(__reent_ptr_t reent, const char *file, int flags, int mode)
 {
 	reent->_errno = ENOSYS;
 	return -1;
 }
 
 _ssize_t
-_read_r(struct _reent *reent, int file, void *ptr, size_t len)
+_read_r(__reent_ptr_t reent, int file, void *ptr, size_t len)
 {
 	reent->_errno = ENOSYS;
 	return -1;
 }
 
 int
-_readlink_r(struct _reent *reent, const char *path, char *buf, size_t bufsize)
+_readlink_r(__reent_ptr_t reent, const char *path, char *buf, size_t bufsize)
 {
 	reent->_errno = ENOSYS;
 	return -1;
 }
 
 int
-_stat_r(struct _reent *reent, const char *path, struct stat *buf)
+_stat_r(__reent_ptr_t reent, const char *path, struct stat *buf)
 {
 	reent->_errno = EIO;
 	return -1;
 }
 
 int
-_unlink_r(struct _reent *reent, const char * path)
+_unlink_r(__reent_ptr_t reent, const char * path)
 {
 	reent->_errno = EIO;
 	return (-1);
diff --git a/newlib/README b/newlib/README
index 2f9ab13d1048..8872236503d9 100644
--- a/newlib/README
+++ b/newlib/README
@@ -310,6 +310,12 @@ One feature can be enabled by specifying `--enable-FEATURE=yes' or
      thread-local storage objects are provided for each member of the default
      struct _reent.  For statically linked executables only the objects
      required by the application are linked in.
+     Reentrant function arguments use __reent_ptr_t.  If the C compiler
+     supports zero-sized empty structures, this type is an empty structure
+     and no reentrancy pointer needs to be passed.  Otherwise it remains
+     struct _reent * and the thread-local argument is NULL.  Use _REENT
+     rather than a literal NULL when calling reentrant functions in this
+     configuration.  Libraries and callers must agree on this argument ABI.
      Disabled by default.
 
 `--disable-newlib-fvwrite-in-streamio'
diff --git a/newlib/libc/ctype/towctrans.c b/newlib/libc/ctype/towctrans.c
index 2cd34184e006..c2f8b703e4c3 100644
--- a/newlib/libc/ctype/towctrans.c
+++ b/newlib/libc/ctype/towctrans.c
@@ -76,7 +76,7 @@ No supporting OS subroutines are required.
 #include "local.h"
 
 wint_t
-_towctrans_r (struct _reent *r,
+_towctrans_r (__reent_ptr_t r,
 	wint_t c,
 	wctrans_t w)
 {
diff --git a/newlib/libc/ctype/wctrans.c b/newlib/libc/ctype/wctrans.c
index dbb103d38a66..21d4bb39e59a 100644
--- a/newlib/libc/ctype/wctrans.c
+++ b/newlib/libc/ctype/wctrans.c
@@ -75,7 +75,7 @@ No supporting OS subroutines are required.
 #include "local.h"
 
 wctrans_t
-_wctrans_r (struct _reent *r,
+_wctrans_r (__reent_ptr_t r,
 	const char *c)
 {
   if (!strcmp (c, "tolower"))
diff --git a/newlib/libc/ctype/wctype.c b/newlib/libc/ctype/wctype.c
index 8c7afc731934..259254d708d0 100644
--- a/newlib/libc/ctype/wctype.c
+++ b/newlib/libc/ctype/wctype.c
@@ -76,7 +76,7 @@ No supporting OS subroutines are required.
 #include "local.h"
 
 wctype_t
-_wctype_r (struct _reent *r,
+_wctype_r (__reent_ptr_t r,
 	const char *c)
 {
   switch (*c)
diff --git a/newlib/libc/iconv/ces/euc.c b/newlib/libc/iconv/ces/euc.c
index ebd7091b0781..38db5cd1d31e 100644
--- a/newlib/libc/iconv/ces/euc.c
+++ b/newlib/libc/iconv/ces/euc.c
@@ -101,7 +101,7 @@ static euc_cs_desc_t euc_kr_cs_desc [] =
 
 #if defined (ICONV_FROM_UCS_CES_EUC)
 static void *
-euc_from_ucs_init (struct _reent *rptr,
+euc_from_ucs_init (__reent_ptr_t rptr,
                           const char *encoding)
 {
   int i;
@@ -164,7 +164,7 @@ error1:
 }
 
 static size_t
-euc_from_ucs_close (struct _reent *rptr,
+euc_from_ucs_close (__reent_ptr_t rptr,
                            void *data)
 {
   int i;
@@ -258,7 +258,7 @@ euc_convert_from_ucs (void *data,
 
 #if defined (ICONV_TO_UCS_CES_EUC)
 static void *
-euc_to_ucs_init (struct _reent *rptr,
+euc_to_ucs_init (__reent_ptr_t rptr,
                         const char *encoding)
 {
   int i;
@@ -321,7 +321,7 @@ error1:
 }
 
 static size_t
-euc_to_ucs_close (struct _reent *rptr,
+euc_to_ucs_close (__reent_ptr_t rptr,
                          void *data)
 {
   int i;
diff --git a/newlib/libc/iconv/ces/table-pcs.c b/newlib/libc/iconv/ces/table-pcs.c
index 45cfe62670ec..8a8f641ceb17 100644
--- a/newlib/libc/iconv/ces/table-pcs.c
+++ b/newlib/libc/iconv/ces/table-pcs.c
@@ -64,14 +64,14 @@ table_pcs_convert_from_ucs (void *data,
 }
 
 static void *
-table_pcs_from_ucs_init (struct _reent *rptr,
+table_pcs_from_ucs_init (__reent_ptr_t rptr,
                                 const char *encoding)
 {
   return _iconv_from_ucs_ces_handlers_table.init (rptr, encoding);
 }
 
 static size_t
-table_pcs_from_ucs_close (struct _reent *rptr,
+table_pcs_from_ucs_close (__reent_ptr_t rptr,
                                  void *data)
 {
   return _iconv_from_ucs_ces_handlers_table.close (rptr, data);
@@ -108,14 +108,14 @@ table_pcs_convert_to_ucs (void *data,
 }
 
 static void *
-table_pcs_to_ucs_init (struct _reent *rptr,
+table_pcs_to_ucs_init (__reent_ptr_t rptr,
                               const char *encoding)
 {
   return _iconv_to_ucs_ces_handlers_table.init (rptr, encoding);
 }
 
 static size_t
-table_pcs_to_ucs_close (struct _reent *rptr,
+table_pcs_to_ucs_close (__reent_ptr_t rptr,
                                void *data)
 {
   return _iconv_to_ucs_ces_handlers_table.close (rptr, data);
diff --git a/newlib/libc/iconv/ces/table.c b/newlib/libc/iconv/ces/table.c
index c8ef218a1e93..64ee04b3e26d 100644
--- a/newlib/libc/iconv/ces/table.c
+++ b/newlib/libc/iconv/ces/table.c
@@ -67,14 +67,14 @@ find_code_speed_8bit (ucs2_t code, const unsigned char *tblp);
 
 #ifdef _ICONV_ENABLE_EXTERNAL_CCS
 static const iconv_ccs_desc_t *
-load_file (struct _reent *rptr, const char *name, int direction);
+load_file (__reent_ptr_t rptr, const char *name, int direction);
 #endif
 
 /*
  * Interface data and functions implementation.
  */
 static size_t
-table_close (struct _reent *rptr,
+table_close (__reent_ptr_t rptr,
                     void *data)
 {
   const iconv_ccs_desc_t *ccsp = (iconv_ccs_desc_t *)data;
@@ -88,7 +88,7 @@ table_close (struct _reent *rptr,
 
 #if defined (ICONV_FROM_UCS_CES_TABLE)
 static void *
-table_init_from_ucs (struct _reent *rptr,
+table_init_from_ucs (__reent_ptr_t rptr,
                             const char *encoding)
 {
   int i;
@@ -169,7 +169,7 @@ table_convert_from_ucs (void *data,
 
 #if defined (ICONV_TO_UCS_CES_TABLE)
 static void *
-table_init_to_ucs (struct _reent *rptr,
+table_init_to_ucs (__reent_ptr_t rptr,
                           const char *encoding)
 {
   int i;
@@ -437,7 +437,7 @@ find_code_size (ucs2_t code,
  *             iconv_ccs_desc_t object.
  *
  * PARAMETERS:
- *    struct _reent *rptr - reent structure of current thread/process.
+ *    __reent_ptr_t rptr - reent structure of current thread/process.
  *    const char *name - encoding name.
  *    int direction - conversion direction.
  *
@@ -451,7 +451,7 @@ find_code_size (ucs2_t code,
  *    iconv_ccs_desc_t * pointer is success, NULL if failure.
  */
 static const iconv_ccs_desc_t *
-load_file (struct _reent *rptr,
+load_file (__reent_ptr_t rptr,
                   const char *name,
                   int direction)
 {
diff --git a/newlib/libc/iconv/ces/ucs-2.c b/newlib/libc/iconv/ces/ucs-2.c
index 5e965b080fc9..04998a1f1ebd 100644
--- a/newlib/libc/iconv/ces/ucs-2.c
+++ b/newlib/libc/iconv/ces/ucs-2.c
@@ -50,7 +50,7 @@
 #define UCS_2LE "ucs_2le"
 
 static void *
-ucs_2_init (struct _reent *rptr,
+ucs_2_init (__reent_ptr_t rptr,
                    const char *encoding)
 {
   int *data;
@@ -67,7 +67,7 @@ ucs_2_init (struct _reent *rptr,
 }
 
 static size_t
-ucs_2_close (struct _reent *rptr,
+ucs_2_close (__reent_ptr_t rptr,
                     void *data)
 {
   _free_r (rptr, data);
diff --git a/newlib/libc/iconv/ces/ucs-4.c b/newlib/libc/iconv/ces/ucs-4.c
index 290cc71f8f8e..780bd3a72f78 100644
--- a/newlib/libc/iconv/ces/ucs-4.c
+++ b/newlib/libc/iconv/ces/ucs-4.c
@@ -51,7 +51,7 @@
 #define UCS_4LE "ucs_4le"
 
 static void *
-ucs_4_init (struct _reent *rptr,
+ucs_4_init (__reent_ptr_t rptr,
                    const char *encoding)
 {
   int *data;
@@ -68,7 +68,7 @@ ucs_4_init (struct _reent *rptr,
 }
 
 static size_t
-ucs_4_close (struct _reent *rptr,
+ucs_4_close (__reent_ptr_t rptr,
                     void *data)
 {
   _free_r(rptr, data);
diff --git a/newlib/libc/iconv/ces/utf-16.c b/newlib/libc/iconv/ces/utf-16.c
index a3491bb3c19d..5d3dea208f22 100644
--- a/newlib/libc/iconv/ces/utf-16.c
+++ b/newlib/libc/iconv/ces/utf-16.c
@@ -58,7 +58,7 @@
 #define UTF_16LE "utf_16le"
 
 static size_t
-utf_16_close (struct _reent *rptr,
+utf_16_close (__reent_ptr_t rptr,
                      void *data)
 {
   _free_r(rptr, data);
@@ -67,7 +67,7 @@ utf_16_close (struct _reent *rptr,
 
 #if defined (ICONV_FROM_UCS_CES_UTF_16)
 static void *
-utf_16_init_from_ucs (struct _reent *rptr,
+utf_16_init_from_ucs (__reent_ptr_t rptr,
                              const char *encoding)
 {
   int *data;
@@ -167,7 +167,7 @@ utf_16_convert_from_ucs (void *data,
 
 #if defined (ICONV_TO_UCS_CES_UTF_16)
 static void *
-utf_16_init_to_ucs (struct _reent *rptr,
+utf_16_init_to_ucs (__reent_ptr_t rptr,
                            const char *encoding)
 {
   int *data;
diff --git a/newlib/libc/iconv/lib/aliasesi.c b/newlib/libc/iconv/lib/aliasesi.c
index ef5ce4109282..7576fef7afda 100644
--- a/newlib/libc/iconv/lib/aliasesi.c
+++ b/newlib/libc/iconv/lib/aliasesi.c
@@ -37,7 +37,7 @@
  * canonical_form - canonize 'str'.
  *
  * PARAMETERS:
- *   struct _reent *rptr - reent structure of current thread/process.
+ *   __reent_ptr_t rptr - reent structure of current thread/process.
  *   const char *str    - string to canonize. 
  *
  * DESCRIPTION:
@@ -48,7 +48,7 @@
  *   Returns canonical form of 'str' if success, NULL if failure.
  */
 static const char *
-canonical_form (struct _reent *rptr,
+canonical_form (__reent_ptr_t rptr,
                        const char *str)
 {
   char *p, *p1;
@@ -71,7 +71,7 @@ canonical_form (struct _reent *rptr,
  * find_alias - find encoding name name by it's alias. 
  *
  * PARAMETERS:
- *   struct _reent *rptr - reent structure of current thread/process.
+ *   __reent_ptr_t rptr - reent structure of current thread/process.
  *   const char *alias  - alias by which "official" name should be found.
  *   const char *table  - aliases table.
  *   int len             - aliases table length.
@@ -92,7 +92,7 @@ canonical_form (struct _reent *rptr,
  *   and sets current thread's/process's errno.
  */
 static char *
-find_alias (struct _reent *rptr,
+find_alias (__reent_ptr_t rptr,
                    const char *alias,
                    const char *table,
                    int len)
@@ -133,7 +133,7 @@ search_again:
  * _iconv_resolve_encoding_name - resolves encoding's name by given alias. 
  *
  * PARAMETERS:
- *   struct _reent *rptr - reent structure of current thread/process.
+ *   __reent_ptr_t rptr - reent structure of current thread/process.
  *   const char *ca     - encoding alias to resolve.
  *
  * DESCRIPTION: 
@@ -145,7 +145,7 @@ search_again:
  *   and sets current thread's/process's errno.
  */
 char *
-_iconv_resolve_encoding_name (struct _reent *rptr,
+_iconv_resolve_encoding_name (__reent_ptr_t rptr,
                                      const char *ca)
 {
   char *p = (char *)ca;
diff --git a/newlib/libc/iconv/lib/conv.h b/newlib/libc/iconv/lib/conv.h
index 658ab9152174..d7d7a979570d 100644
--- a/newlib/libc/iconv/lib/conv.h
+++ b/newlib/libc/iconv/lib/conv.h
@@ -51,7 +51,7 @@ typedef struct
    * open - open and initialize conversion.
    *
    * PARAMETERS:
-   *   struct _reent *rptr - reent structure of current thread/process;
+   *   __reent_ptr_t rptr - reent structure of current thread/process;
    *   const char *to     - output encoding's normalized name;
    *   const char *from   - input encoding's normalized name.
    * 
@@ -63,7 +63,7 @@ typedef struct
    *   Pointer to conversion-specific data if success. In case of error
    *   returns NULL and sets current thread's/process's errno.
    */
-  void *(*open) (struct _reent *rptr,
+  void *(*open) (__reent_ptr_t rptr,
                           const char *to,
                           const char *from);
   
@@ -71,7 +71,7 @@ typedef struct
    * close - close conversion.
    *
    * PARAMETRS:
-   *   struct _reent *rptr - reent structure of current thread/process;
+   *   __reent_ptr_t rptr - reent structure of current thread/process;
    *   void *data      - conversion-specific data.
    *
    * DESCRIPTION:
@@ -81,13 +81,13 @@ typedef struct
    *   When successful, returns (size_t)0. In case of error, sets current
    *   thread's/process's errno and returns (size_t)-1 (same as iconv_open()).
    */
-  size_t (*close) (struct _reent *rptr,
+  size_t (*close) (__reent_ptr_t rptr,
                         void *data);
   
   /* convert - perform encoding conversion.
    *
    * PARAMETERS:
-   *   struct _reent *rptr - reent structure of current thread/process.
+   *   __reent_ptr_t rptr - reent structure of current thread/process.
    *   void *data      - conversion-specific data;
    *   const unsigned char **inbuf - input data buffer;
    *   size_t *inbytesleft          - input buffer's length;
@@ -114,7 +114,7 @@ typedef struct
    *   Reversible conversions are not counted. In case of error, sets current
    *   thread's/process's errno and returns (size_t)-1 (same as iconv()).
    */
-  size_t (*convert) (struct _reent *rptr,
+  size_t (*convert) (__reent_ptr_t rptr,
                            void *data,
                            const unsigned char **inbuf,
                            size_t *inbytesleft,
diff --git a/newlib/libc/iconv/lib/iconv.c b/newlib/libc/iconv/lib/iconv.c
index 458541cb9484..dd5c708414fb 100644
--- a/newlib/libc/iconv/lib/iconv.c
+++ b/newlib/libc/iconv/lib/iconv.c
@@ -50,10 +50,10 @@ SYNOPSIS
 		      char **restrict <[outbuf]>, 
                       size_t *restrict <[outbytesleft]>);
 
-	iconv_t _iconv_open_r (struct _reent *<[rptr]>, 
+	iconv_t _iconv_open_r (__reent_ptr_t <[rptr]>,
 			       const char *<[to]>, const char *<[from]>);
-	int _iconv_close_r (struct _reent *<[rptr]>, iconv_t <[cd]>);
-        size_t _iconv_r (struct _reent *<[rptr]>,
+	int _iconv_close_r (__reent_ptr_t <[rptr]>, iconv_t <[cd]>);
+        size_t _iconv_r (__reent_ptr_t <[rptr]>,
 			 iconv_t <[cd]>, const char **<[inbuf]>, 
 	                 size_t *<[inbytesleft]>, 
 		         char **<[outbuf]>, size_t *<[outbytesleft]>);
@@ -148,7 +148,7 @@ iconv_close (iconv_t cd)
 
 #ifndef _REENT_ONLY
 iconv_t
-_iconv_open_r (struct _reent *rptr,
+_iconv_open_r (__reent_ptr_t rptr,
                       const char *to,
                       const char *from)
 {
@@ -198,7 +198,7 @@ _iconv_open_r (struct _reent *rptr,
 
 
 size_t
-_iconv_r (struct _reent *rptr,
+_iconv_r (__reent_ptr_t rptr,
                  iconv_t cd,
                  const char **inbuf,
                  size_t *inbytesleft,
@@ -284,7 +284,7 @@ _iconv_r (struct _reent *rptr,
 
 
 int
-_iconv_close_r (struct _reent *rptr,
+_iconv_close_r (__reent_ptr_t rptr,
                        iconv_t cd)
 {
   int res;
diff --git a/newlib/libc/iconv/lib/iconvnls.c b/newlib/libc/iconv/lib/iconvnls.c
index 5d4b0a273cfb..22d2a0d289ea 100644
--- a/newlib/libc/iconv/lib/iconvnls.c
+++ b/newlib/libc/iconv/lib/iconvnls.c
@@ -45,7 +45,7 @@
  * _iconv_nls_construct_filename -- constructs full file name. 
  *
  * PARAMETERS:
- *   struct _reent *rptr - reent structure of current thread/process.  
+ *   __reent_ptr_t rptr - reent structure of current thread/process.
  *   const char *file   - the name of file.
  *   const char *dir    - the name of subdirectory;
  *   const char *ext    - file extension.
@@ -59,7 +59,7 @@
  *   and sets current thread's/process's errno.
  */
 const char *
-_iconv_nls_construct_filename (struct _reent *rptr,
+_iconv_nls_construct_filename (__reent_ptr_t rptr,
                                       const char *file,
                                       const char *dir,
                                       const char *ext)
@@ -163,7 +163,7 @@ _iconv_nls_is_stateful (iconv_t cd,
  *    Same as _iconv_r.
  */
 size_t
-_iconv_nls_conv (struct _reent *rptr,
+_iconv_nls_conv (__reent_ptr_t rptr,
                         iconv_t cd,
                         const char **inbuf,
                         size_t *inbytesleft,
@@ -253,7 +253,7 @@ _iconv_nls_set_state (iconv_t cd,
 
 /* Same as iconv_open() but don't perform name resolving */
 static iconv_t
-iconv_open1 (struct _reent *rptr,
+iconv_open1 (__reent_ptr_t rptr,
                      const char *to,
                      const char *from)
 {
@@ -293,7 +293,7 @@ iconv_open1 (struct _reent *rptr,
  * _iconv_nls_open - open iconv descriptors for NLS.
  *
  * PARAMETERS:
- *     struct _reent *rptr - process's reent structure;
+ *     __reent_ptr_t rptr - process's reent structure;
  *     const char *encoding - encoding name;
  *     iconv_t *tomb - wchar -> encoding iconv descriptor pointer;
  *     iconv_t *towc - encoding -> wchar iconv descriptor pointer;
@@ -309,7 +309,7 @@ iconv_open1 (struct _reent *rptr,
  *     If successful - return 0, else set errno and return -1.
  */
 int
-_iconv_nls_open (struct _reent *rptr,
+_iconv_nls_open (__reent_ptr_t rptr,
                         const char *encoding,
                         iconv_t *tomb,
                         iconv_t *towc,
diff --git a/newlib/libc/iconv/lib/nullconv.c b/newlib/libc/iconv/lib/nullconv.c
index cc4229181f56..40ee21f12e48 100644
--- a/newlib/libc/iconv/lib/nullconv.c
+++ b/newlib/libc/iconv/lib/nullconv.c
@@ -36,7 +36,7 @@ static int null_conversion_dummy_data;
 
 
 static void *
-null_conversion_open (struct _reent *rptr,
+null_conversion_open (__reent_ptr_t rptr,
                              const char *to,
                              const char *from)
 {
@@ -45,7 +45,7 @@ null_conversion_open (struct _reent *rptr,
 
 
 static size_t
-null_conversion_close (struct _reent *rptr,
+null_conversion_close (__reent_ptr_t rptr,
                               void *data)
 {
   return 0;
@@ -53,7 +53,7 @@ null_conversion_close (struct _reent *rptr,
 
 
 static size_t
-null_conversion_convert (struct _reent *rptr,
+null_conversion_convert (__reent_ptr_t rptr,
                      void *data,
                      const unsigned char **inbuf,
                      size_t *inbytesleft,
diff --git a/newlib/libc/iconv/lib/ucsconv.c b/newlib/libc/iconv/lib/ucsconv.c
index 502aa440a99b..65b331ff8f8e 100644
--- a/newlib/libc/iconv/lib/ucsconv.c
+++ b/newlib/libc/iconv/lib/ucsconv.c
@@ -45,7 +45,7 @@ find_encoding_name (const char *searchee,
  */
 
 static void *
-ucs_based_conversion_open (struct _reent *rptr,
+ucs_based_conversion_open (__reent_ptr_t rptr,
                                   const char *to,
                                   const char *from)
 {
@@ -122,7 +122,7 @@ error:
 
 
 static size_t
-ucs_based_conversion_close (struct _reent *rptr,
+ucs_based_conversion_close (__reent_ptr_t rptr,
                                    void *data)
 {
   iconv_ucs_conversion_t *uc;
@@ -142,7 +142,7 @@ ucs_based_conversion_close (struct _reent *rptr,
 
 
 static size_t
-ucs_based_conversion_convert (struct _reent *rptr,
+ucs_based_conversion_convert (__reent_ptr_t rptr,
                  void *data,
                  const unsigned char **inbuf,
                  size_t *inbytesleft,
diff --git a/newlib/libc/iconv/lib/ucsconv.h b/newlib/libc/iconv/lib/ucsconv.h
index 2c3d8c64729c..3dfd5e046fdf 100644
--- a/newlib/libc/iconv/lib/ucsconv.h
+++ b/newlib/libc/iconv/lib/ucsconv.h
@@ -56,7 +56,7 @@ typedef struct
    * init - initialize CES converter.
    *
    * PARAMETERS:
-   *   struct _reent *rptr   - reent structure of current thread/process;
+   *   __reent_ptr_t rptr   - reent structure of current thread/process;
    *   const char *encoding - encoding name.
    *
    * DESCRIPTION:
@@ -68,14 +68,14 @@ typedef struct
    *   Returns CES-specific data pointer if success. In case of error returns
    *   NULL and sets current thread's/process's errno.
    */
-  void *(*init) (struct _reent *rptr,
+  void *(*init) (__reent_ptr_t rptr,
                           const char *encoding);
 
   /*
    * close - close CES converter.
    *
    * PARAMETERS:
-   *   struct _reent *rptr - reent structure of current thread/process;
+   *   __reent_ptr_t rptr - reent structure of current thread/process;
    *   void *data      - CES converter-specific data.
    *
    * DESCRIPTION:
@@ -84,7 +84,7 @@ typedef struct
    *   Returns (size_t)0 if success. In case of error returns (size_t)-1 and
    *   sets current thread's/process's errno.
    */
-  size_t (*close) (struct _reent *rptr,
+  size_t (*close) (__reent_ptr_t rptr,
                         void *data);
 
   /*
@@ -172,11 +172,11 @@ typedef struct
 typedef struct
 {
   /* Same as in iconv_to_ucs_ces_handlers_t */
-  void *(*init) (struct _reent *rptr,
+  void *(*init) (__reent_ptr_t rptr,
                           const char *encoding);
 
   /* Same as in iconv_to_ucs_ces_handlers_t */
-  size_t (*close) (struct _reent *rptr,
+  size_t (*close) (__reent_ptr_t rptr,
                         void *data);
 
   /* Same as in iconv_to_ucs_ces_handlers_t */
diff --git a/newlib/libc/include/envlock.h b/newlib/libc/include/envlock.h
index 799cf7f9e73f..73ec0b4730db 100644
--- a/newlib/libc/include/envlock.h
+++ b/newlib/libc/include/envlock.h
@@ -9,7 +9,7 @@
 #define ENV_LOCK __env_lock(reent_ptr)
 #define ENV_UNLOCK __env_unlock(reent_ptr)
 
-void __env_lock (struct _reent *reent);
-void __env_unlock (struct _reent *reent);
+void __env_lock (__reent_ptr_t reent);
+void __env_unlock (__reent_ptr_t reent);
 
 #endif /* _INCLUDE_ENVLOCK_H_ */
diff --git a/newlib/libc/include/iconv.h b/newlib/libc/include/iconv.h
index 37feb882f1f7..0423f2561f0e 100644
--- a/newlib/libc/include/iconv.h
+++ b/newlib/libc/include/iconv.h
@@ -49,14 +49,14 @@ iconv_close (iconv_t);
 #endif
 
 iconv_t
-_iconv_open_r (struct _reent *, const char *, const char *);
+_iconv_open_r (__reent_ptr_t, const char *, const char *);
 
 size_t
-_iconv_r (struct _reent *, iconv_t, const char **,
+_iconv_r (__reent_ptr_t, iconv_t, const char **,
                   size_t *, char **, size_t *);
 
 int
-_iconv_close_r (struct _reent *, iconv_t);
+_iconv_close_r (__reent_ptr_t, iconv_t);
 
 _END_STD_C
 
diff --git a/newlib/libc/include/inttypes.h b/newlib/libc/include/inttypes.h
index 417ff224cb1f..6fca9f869f84 100644
--- a/newlib/libc/include/inttypes.h
+++ b/newlib/libc/include/inttypes.h
@@ -16,6 +16,7 @@
 #include <newlib.h>
 #include <sys/config.h>
 #include <sys/_intsup.h>
+#include <sys/_types.h>
 #include "_ansi.h"
 #include <stdint.h>
 #define __need_wchar_t
@@ -314,8 +315,6 @@ typedef struct {
   intmax_t	rem;
 } imaxdiv_t;
 
-struct _reent;
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -323,13 +322,13 @@ extern "C" {
 extern intmax_t  imaxabs(intmax_t);
 extern imaxdiv_t imaxdiv(intmax_t __numer, intmax_t __denomer);
 extern intmax_t  strtoimax(const char *__restrict, char **__restrict, int);
-extern intmax_t  _strtoimax_r(struct _reent *, const char *__restrict, char **__restrict, int);
+extern intmax_t  _strtoimax_r(__reent_ptr_t, const char *__restrict, char **__restrict, int);
 extern uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
-extern uintmax_t _strtoumax_r(struct _reent *, const char *__restrict, char **__restrict, int);
+extern uintmax_t _strtoumax_r(__reent_ptr_t, const char *__restrict, char **__restrict, int);
 extern intmax_t  wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
-extern intmax_t  _wcstoimax_r(struct _reent *, const wchar_t *__restrict, wchar_t **__restrict, int);
+extern intmax_t  _wcstoimax_r(__reent_ptr_t, const wchar_t *__restrict, wchar_t **__restrict, int);
 extern uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
-extern uintmax_t _wcstoumax_r(struct _reent *, const wchar_t *__restrict, wchar_t **__restrict, int);
+extern uintmax_t _wcstoumax_r(__reent_ptr_t, const wchar_t *__restrict, wchar_t **__restrict, int);
 
 #if __BSD_VISIBLE
 extern intmax_t  strtoimax_l(const char *__restrict, char **_restrict, int, locale_t);
diff --git a/newlib/libc/include/locale.h b/newlib/libc/include/locale.h
index 47b02e99adbb..d546f37dc214 100644
--- a/newlib/libc/include/locale.h
+++ b/newlib/libc/include/locale.h
@@ -9,6 +9,7 @@
 
 #include "_ansi.h"
 #include <sys/cdefs.h>
+#include <sys/_types.h>
 
 #define __need_NULL
 #include <stddef.h>
@@ -67,16 +68,15 @@ struct lconv
   char int_p_sign_posn;
 };
 
-struct _reent;
-char *_setlocale_r (struct _reent *, int, const char *);
-struct lconv *_localeconv_r (struct _reent *);
+char *_setlocale_r (__reent_ptr_t, int, const char *);
+struct lconv *_localeconv_r (__reent_ptr_t);
 
-struct __locale_t *_newlocale_r (struct _reent *, int, const char *,
+struct __locale_t *_newlocale_r (__reent_ptr_t, int, const char *,
 				 struct __locale_t *);
-void _freelocale_r (struct _reent *, struct __locale_t *);
-struct __locale_t *_duplocale_r (struct _reent *, struct __locale_t *);
-struct __locale_t *_uselocale_r (struct _reent *, struct __locale_t *);
-const char *_getlocalename_l_r (struct _reent *, int, struct __locale_t *);
+void _freelocale_r (__reent_ptr_t, struct __locale_t *);
+struct __locale_t *_duplocale_r (__reent_ptr_t, struct __locale_t *);
+struct __locale_t *_uselocale_r (__reent_ptr_t, struct __locale_t *);
+const char *_getlocalename_l_r (__reent_ptr_t, int, struct __locale_t *);
 
 #ifndef _REENT_ONLY
 
diff --git a/newlib/libc/include/malloc.h b/newlib/libc/include/malloc.h
index a9dc5bca6e73..05d6fce1240e 100644
--- a/newlib/libc/include/malloc.h
+++ b/newlib/libc/include/malloc.h
@@ -39,7 +39,7 @@ extern void *malloc (size_t);
 #undef _malloc_r
 #define _malloc_r(r, s) malloc (s)
 #else
-extern void *_malloc_r (struct _reent *, size_t);
+extern void *_malloc_r (__reent_ptr_t, size_t);
 #endif
 
 extern void free (void *);
@@ -47,7 +47,7 @@ extern void free (void *);
 #undef _free_r
 #define _free_r(r, p) free (p)
 #else
-extern void _free_r (struct _reent *, void *);
+extern void _free_r (__reent_ptr_t, void *);
 #endif
 
 extern void *realloc (void *, size_t);
@@ -55,7 +55,7 @@ extern void *realloc (void *, size_t);
 #undef _realloc_r
 #define _realloc_r(r, p, s) realloc (p, s)
 #else
-extern void *_realloc_r (struct _reent *, void *, size_t);
+extern void *_realloc_r (__reent_ptr_t, void *, size_t);
 #endif
 
 extern void *calloc (size_t, size_t);
@@ -63,7 +63,7 @@ extern void *calloc (size_t, size_t);
 #undef _calloc_r
 #define _calloc_r(r, s1, s2) calloc (s1, s2);
 #else
-extern void *_calloc_r (struct _reent *, size_t, size_t);
+extern void *_calloc_r (__reent_ptr_t, size_t, size_t);
 #endif
 
 extern void *memalign (size_t, size_t);
@@ -71,7 +71,7 @@ extern void *memalign (size_t, size_t);
 #undef _memalign_r
 #define _memalign_r(r, s1, s2) memalign (s1, s2);
 #else
-extern void *_memalign_r (struct _reent *, size_t, size_t);
+extern void *_memalign_r (__reent_ptr_t, size_t, size_t);
 #endif
 
 extern struct mallinfo mallinfo (void);
@@ -79,7 +79,7 @@ extern struct mallinfo mallinfo (void);
 #undef _mallinfo_r
 #define _mallinfo_r(r) mallinfo ()
 #else
-extern struct mallinfo _mallinfo_r (struct _reent *);
+extern struct mallinfo _mallinfo_r (__reent_ptr_t);
 #endif
 
 extern void malloc_stats (void);
@@ -87,7 +87,7 @@ extern void malloc_stats (void);
 #undef _malloc_stats_r
 #define _malloc_stats_r(r) malloc_stats ()
 #else
-extern void _malloc_stats_r (struct _reent *);
+extern void _malloc_stats_r (__reent_ptr_t);
 #endif
 
 extern int mallopt (int, int);
@@ -95,7 +95,7 @@ extern int mallopt (int, int);
 #undef _mallopt_r
 #define _mallopt_r(i1, i2) mallopt (i1, i2)
 #else
-extern int _mallopt_r (struct _reent *, int, int);
+extern int _mallopt_r (__reent_ptr_t, int, int);
 #endif
 
 extern size_t malloc_usable_size (void *);
@@ -103,7 +103,7 @@ extern size_t malloc_usable_size (void *);
 #undef _malloc_usable_size_r
 #define _malloc_usable_size_r(r, p) malloc_usable_size (p)
 #else
-extern size_t _malloc_usable_size_r (struct _reent *, void *);
+extern size_t _malloc_usable_size_r (__reent_ptr_t, void *);
 #endif
 
 /* These aren't too useful on an embedded system, but we define them
@@ -114,7 +114,7 @@ extern void *valloc (size_t);
 #undef _valloc_r
 #define _valloc_r(r, s) valloc (s)
 #else
-extern void *_valloc_r (struct _reent *, size_t);
+extern void *_valloc_r (__reent_ptr_t, size_t);
 #endif
 
 extern void *pvalloc (size_t);
@@ -122,7 +122,7 @@ extern void *pvalloc (size_t);
 #undef _pvalloc_r
 #define _pvalloc_r(r, s) pvalloc (s)
 #else
-extern void *_pvalloc_r (struct _reent *, size_t);
+extern void *_pvalloc_r (__reent_ptr_t, size_t);
 #endif
 
 extern int malloc_trim (size_t);
@@ -130,12 +130,12 @@ extern int malloc_trim (size_t);
 #undef _malloc_trim_r
 #define _malloc_trim_r(r, s) malloc_trim (s)
 #else
-extern int _malloc_trim_r (struct _reent *, size_t);
+extern int _malloc_trim_r (__reent_ptr_t, size_t);
 #endif
 
-extern void __malloc_lock(struct _reent *);
+extern void __malloc_lock(__reent_ptr_t);
 
-extern void __malloc_unlock(struct _reent *);
+extern void __malloc_unlock(__reent_ptr_t);
 
 /* A compatibility routine for an earlier version of the allocator.  */
 
@@ -144,7 +144,7 @@ extern void mstats (char *);
 #undef _mstats_r
 #define _mstats_r(r, p) mstats (p)
 #else
-extern void _mstats_r (struct _reent *, char *);
+extern void _mstats_r (__reent_ptr_t, char *);
 #endif
 
 /* SVID2/XPG mallopt options */
diff --git a/newlib/libc/include/reent.h b/newlib/libc/include/reent.h
index b1dd2a7c4573..1afc47b4e90b 100644
--- a/newlib/libc/include/reent.h
+++ b/newlib/libc/include/reent.h
@@ -137,30 +137,30 @@ struct timezone;
 #else
 /* Reentrant versions of system calls.  */
 
-extern int _close_r (struct _reent *, int);
-extern int _execve_r (struct _reent *, const char *, char *const *, char *const *);
-extern int _fcntl_r (struct _reent *, int, int, int);
-extern int _fork_r (struct _reent *);
-extern int _fstat_r (struct _reent *, int, struct stat *);
-extern int _getpid_r (struct _reent *);
-extern int _isatty_r (struct _reent *, int);
-extern int _kill_r (struct _reent *, int, int);
-extern int _link_r (struct _reent *, const char *, const char *);
-extern _off_t _lseek_r (struct _reent *, int, _off_t, int);
-extern int _mkdir_r (struct _reent *, const char *, int);
-extern int _open_r (struct _reent *, const char *, int, int);
-extern _ssize_t _read_r (struct _reent *, int, void *, size_t);
-extern int _rename_r (struct _reent *, const char *, const char *);
-extern void *_sbrk_r (struct _reent *, ptrdiff_t);
-extern int _stat_r (struct _reent *, const char *, struct stat *);
-extern _CLOCK_T_ _times_r (struct _reent *, struct tms *);
-extern int _unlink_r (struct _reent *, const char *);
-extern int _wait_r (struct _reent *, int *);
-extern _ssize_t _write_r (struct _reent *, int, const void *, size_t);
-extern int _getentropy_r (struct _reent *, void *, size_t);
+extern int _close_r (__reent_ptr_t, int);
+extern int _execve_r (__reent_ptr_t, const char *, char *const *, char *const *);
+extern int _fcntl_r (__reent_ptr_t, int, int, int);
+extern int _fork_r (__reent_ptr_t);
+extern int _fstat_r (__reent_ptr_t, int, struct stat *);
+extern int _getpid_r (__reent_ptr_t);
+extern int _isatty_r (__reent_ptr_t, int);
+extern int _kill_r (__reent_ptr_t, int, int);
+extern int _link_r (__reent_ptr_t, const char *, const char *);
+extern _off_t _lseek_r (__reent_ptr_t, int, _off_t, int);
+extern int _mkdir_r (__reent_ptr_t, const char *, int);
+extern int _open_r (__reent_ptr_t, const char *, int, int);
+extern _ssize_t _read_r (__reent_ptr_t, int, void *, size_t);
+extern int _rename_r (__reent_ptr_t, const char *, const char *);
+extern void *_sbrk_r (__reent_ptr_t, ptrdiff_t);
+extern int _stat_r (__reent_ptr_t, const char *, struct stat *);
+extern _CLOCK_T_ _times_r (__reent_ptr_t, struct tms *);
+extern int _unlink_r (__reent_ptr_t, const char *);
+extern int _wait_r (__reent_ptr_t, int *);
+extern _ssize_t _write_r (__reent_ptr_t, int, const void *, size_t);
+extern int _getentropy_r (__reent_ptr_t, void *, size_t);
 
 /* This one is not guaranteed to be available on all targets.  */
-extern int _gettimeofday_r (struct _reent *, struct timeval *__tp, void *__tzp);
+extern int _gettimeofday_r (__reent_ptr_t, struct timeval *__tp, void *__tzp);
 
 #ifdef __LARGE64_FILES
 
@@ -170,10 +170,10 @@ extern int _gettimeofday_r (struct _reent *, struct timeval *__tp, void *__tzp);
 #endif
 struct stat64;
 
-extern _off64_t _lseek64_r (struct _reent *, int, _off64_t, int);
-extern int _fstat64_r (struct _reent *, int, struct stat64 *);
-extern int _open64_r (struct _reent *, const char *, int, int);
-extern int _stat64_r (struct _reent *, const char *, struct stat64 *);
+extern _off64_t _lseek64_r (__reent_ptr_t, int, _off64_t, int);
+extern int _fstat64_r (__reent_ptr_t, int, struct stat64 *);
+extern int _open64_r (__reent_ptr_t, const char *, int, int);
+extern int _stat64_r (__reent_ptr_t, const char *, struct stat64 *);
 
 /* Don't pollute namespace if not building newlib. */
 #if defined (__CYGWIN__) && !defined (_LIBC)
diff --git a/newlib/libc/include/signal.h b/newlib/libc/include/signal.h
index 23a9863e6688..e81b06fe0e4d 100644
--- a/newlib/libc/include/signal.h
+++ b/newlib/libc/include/signal.h
@@ -3,6 +3,7 @@
 
 #include "_ansi.h"
 #include <sys/cdefs.h>
+#include <sys/_types.h>
 #include <sys/signal.h>
 
 _BEGIN_STD_C
@@ -19,10 +20,8 @@ typedef _sig_func_ptr sighandler_t;	/* glibc naming */
 #define SIG_IGN ((_sig_func_ptr)1)	/* Ignore action */
 #define SIG_ERR ((_sig_func_ptr)-1)	/* Error return */
 
-struct _reent;
-
-_sig_func_ptr _signal_r (struct _reent *, int, _sig_func_ptr);
-int	_raise_r (struct _reent *, int);
+_sig_func_ptr _signal_r (__reent_ptr_t, int, _sig_func_ptr);
+int	_raise_r (__reent_ptr_t, int);
 
 #ifndef _REENT_ONLY
 _sig_func_ptr signal (int, _sig_func_ptr);
diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h
index 77966578d802..640565b6d2b0 100644
--- a/newlib/libc/include/stdio.h
+++ b/newlib/libc/include/stdio.h
@@ -399,136 +399,136 @@ int	renameat2 (int, const char *, int, const char *, unsigned int);
  * Recursive versions of the above.
  */
 
-int	_asiprintf_r (struct _reent *, char **, const char *, ...)
+int	_asiprintf_r (__reent_ptr_t, char **, const char *, ...)
                _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
-char *	_asniprintf_r (struct _reent *, char *, size_t *, const char *, ...)
+char *	_asniprintf_r (__reent_ptr_t, char *, size_t *, const char *, ...)
                _ATTRIBUTE ((__format__ (__printf__, 4, 5)));
-char *	_asnprintf_r (struct _reent *, char *__restrict, size_t *__restrict, const char *__restrict, ...)
+char *	_asnprintf_r (__reent_ptr_t, char *__restrict, size_t *__restrict, const char *__restrict, ...)
                _ATTRIBUTE ((__format__ (__printf__, 4, 5)));
-int	_asprintf_r (struct _reent *, char **__restrict, const char *__restrict, ...)
+int	_asprintf_r (__reent_ptr_t, char **__restrict, const char *__restrict, ...)
                _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
-int	_diprintf_r (struct _reent *, int, const char *, ...)
+int	_diprintf_r (__reent_ptr_t, int, const char *, ...)
                _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
-int	_dprintf_r (struct _reent *, int, const char *__restrict, ...)
+int	_dprintf_r (__reent_ptr_t, int, const char *__restrict, ...)
                _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
-int	_fclose_r (struct _reent *, FILE *);
-int	_fcloseall_r (struct _reent *);
-FILE *	_fdopen_r (struct _reent *, int, const char *);
-int	_fflush_r (struct _reent *, FILE *);
-int	_fgetc_r (struct _reent *, FILE *);
-int	_fgetc_unlocked_r (struct _reent *, FILE *);
-char *  _fgets_r (struct _reent *, char *__restrict, int, FILE *__restrict);
-char *  _fgets_unlocked_r (struct _reent *, char *__restrict, int, FILE *__restrict);
+int	_fclose_r (__reent_ptr_t, FILE *);
+int	_fcloseall_r (__reent_ptr_t);
+FILE *	_fdopen_r (__reent_ptr_t, int, const char *);
+int	_fflush_r (__reent_ptr_t, FILE *);
+int	_fgetc_r (__reent_ptr_t, FILE *);
+int	_fgetc_unlocked_r (__reent_ptr_t, FILE *);
+char *  _fgets_r (__reent_ptr_t, char *__restrict, int, FILE *__restrict);
+char *  _fgets_unlocked_r (__reent_ptr_t, char *__restrict, int, FILE *__restrict);
 #ifdef _LIBC
-int	_fgetpos_r (struct _reent *, FILE *__restrict, _fpos_t *__restrict);
-int	_fsetpos_r (struct _reent *, FILE *, const _fpos_t *);
+int	_fgetpos_r (__reent_ptr_t, FILE *__restrict, _fpos_t *__restrict);
+int	_fsetpos_r (__reent_ptr_t, FILE *, const _fpos_t *);
 #else
-int	_fgetpos_r (struct _reent *, FILE *, fpos_t *);
-int	_fsetpos_r (struct _reent *, FILE *, const fpos_t *);
+int	_fgetpos_r (__reent_ptr_t, FILE *, fpos_t *);
+int	_fsetpos_r (__reent_ptr_t, FILE *, const fpos_t *);
 #endif
-int	_fiprintf_r (struct _reent *, FILE *, const char *, ...)
+int	_fiprintf_r (__reent_ptr_t, FILE *, const char *, ...)
                _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
-int	_fiscanf_r (struct _reent *, FILE *, const char *, ...)
+int	_fiscanf_r (__reent_ptr_t, FILE *, const char *, ...)
                _ATTRIBUTE ((__format__ (__scanf__, 3, 4)));
-FILE *	_fmemopen_r (struct _reent *, void *__restrict, size_t, const char *__restrict);
-FILE *	_fopen_r (struct _reent *, const char *__restrict, const char *__restrict);
-FILE *	_freopen_r (struct _reent *, const char *__restrict, const char *__restrict, FILE *__restrict);
-int	_fprintf_r (struct _reent *, FILE *__restrict, const char *__restrict, ...)
+FILE *	_fmemopen_r (__reent_ptr_t, void *__restrict, size_t, const char *__restrict);
+FILE *	_fopen_r (__reent_ptr_t, const char *__restrict, const char *__restrict);
+FILE *	_freopen_r (__reent_ptr_t, const char *__restrict, const char *__restrict, FILE *__restrict);
+int	_fprintf_r (__reent_ptr_t, FILE *__restrict, const char *__restrict, ...)
                _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
-int	_fpurge_r (struct _reent *, FILE *);
-int	_fputc_r (struct _reent *, int, FILE *);
-int	_fputc_unlocked_r (struct _reent *, int, FILE *);
-int	_fputs_r (struct _reent *, const char *__restrict, FILE *__restrict);
-int	_fputs_unlocked_r (struct _reent *, const char *__restrict, FILE *__restrict);
-size_t	_fread_r (struct _reent *, void *__restrict, size_t _size, size_t _n, FILE *__restrict);
-size_t	_fread_unlocked_r (struct _reent *, void *__restrict, size_t _size, size_t _n, FILE *__restrict);
-int	_fscanf_r (struct _reent *, FILE *__restrict, const char *__restrict, ...)
+int	_fpurge_r (__reent_ptr_t, FILE *);
+int	_fputc_r (__reent_ptr_t, int, FILE *);
+int	_fputc_unlocked_r (__reent_ptr_t, int, FILE *);
+int	_fputs_r (__reent_ptr_t, const char *__restrict, FILE *__restrict);
+int	_fputs_unlocked_r (__reent_ptr_t, const char *__restrict, FILE *__restrict);
+size_t	_fread_r (__reent_ptr_t, void *__restrict, size_t _size, size_t _n, FILE *__restrict);
+size_t	_fread_unlocked_r (__reent_ptr_t, void *__restrict, size_t _size, size_t _n, FILE *__restrict);
+int	_fscanf_r (__reent_ptr_t, FILE *__restrict, const char *__restrict, ...)
                _ATTRIBUTE ((__format__ (__scanf__, 3, 4)));
-int	_fseek_r (struct _reent *, FILE *, long, int);
-int	_fseeko_r (struct _reent *, FILE *, _off_t, int);
-long	_ftell_r (struct _reent *, FILE *);
-_off_t	_ftello_r (struct _reent *, FILE *);
-void	_rewind_r (struct _reent *, FILE *);
-size_t	_fwrite_r (struct _reent *, const void *__restrict, size_t _size, size_t _n, FILE *__restrict);
-size_t	_fwrite_unlocked_r (struct _reent *, const void *__restrict, size_t _size, size_t _n, FILE *__restrict);
-int	_getc_r (struct _reent *, FILE *);
-int	_getc_unlocked_r (struct _reent *, FILE *);
-int	_getchar_r (struct _reent *);
-int	_getchar_unlocked_r (struct _reent *);
-char *	_gets_r (struct _reent *, char *);
-int	_iprintf_r (struct _reent *, const char *, ...)
+int	_fseek_r (__reent_ptr_t, FILE *, long, int);
+int	_fseeko_r (__reent_ptr_t, FILE *, _off_t, int);
+long	_ftell_r (__reent_ptr_t, FILE *);
+_off_t	_ftello_r (__reent_ptr_t, FILE *);
+void	_rewind_r (__reent_ptr_t, FILE *);
+size_t	_fwrite_r (__reent_ptr_t, const void *__restrict, size_t _size, size_t _n, FILE *__restrict);
+size_t	_fwrite_unlocked_r (__reent_ptr_t, const void *__restrict, size_t _size, size_t _n, FILE *__restrict);
+int	_getc_r (__reent_ptr_t, FILE *);
+int	_getc_unlocked_r (__reent_ptr_t, FILE *);
+int	_getchar_r (__reent_ptr_t);
+int	_getchar_unlocked_r (__reent_ptr_t);
+char *	_gets_r (__reent_ptr_t, char *);
+int	_iprintf_r (__reent_ptr_t, const char *, ...)
                _ATTRIBUTE ((__format__ (__printf__, 2, 3)));
-int	_iscanf_r (struct _reent *, const char *, ...)
+int	_iscanf_r (__reent_ptr_t, const char *, ...)
                _ATTRIBUTE ((__format__ (__scanf__, 2, 3)));
-FILE *	_open_memstream_r (struct _reent *, char **, size_t *);
-void	_perror_r (struct _reent *, const char *);
-int	_printf_r (struct _reent *, const char *__restrict, ...)
+FILE *	_open_memstream_r (__reent_ptr_t, char **, size_t *);
+void	_perror_r (__reent_ptr_t, const char *);
+int	_printf_r (__reent_ptr_t, const char *__restrict, ...)
                _ATTRIBUTE ((__format__ (__printf__, 2, 3)));
-int	_putc_r (struct _reent *, int, FILE *);
-int	_putc_unlocked_r (struct _reent *, int, FILE *);
-int	_putchar_unlocked_r (struct _reent *, int);
-int	_putchar_r (struct _reent *, int);
-int	_puts_r (struct _reent *, const char *);
-int	_remove_r (struct _reent *, const char *);
-int	_rename_r (struct _reent *,
+int	_putc_r (__reent_ptr_t, int, FILE *);
+int	_putc_unlocked_r (__reent_ptr_t, int, FILE *);
+int	_putchar_unlocked_r (__reent_ptr_t, int);
+int	_putchar_r (__reent_ptr_t, int);
+int	_puts_r (__reent_ptr_t, const char *);
+int	_remove_r (__reent_ptr_t, const char *);
+int	_rename_r (__reent_ptr_t,
 			   const char *_old, const char *_new);
-int	_scanf_r (struct _reent *, const char *__restrict, ...)
+int	_scanf_r (__reent_ptr_t, const char *__restrict, ...)
                _ATTRIBUTE ((__format__ (__scanf__, 2, 3)));
-int	_siprintf_r (struct _reent *, char *, const char *, ...)
+int	_siprintf_r (__reent_ptr_t, char *, const char *, ...)
                _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
-int	_siscanf_r (struct _reent *, const char *, const char *, ...)
+int	_siscanf_r (__reent_ptr_t, const char *, const char *, ...)
                _ATTRIBUTE ((__format__ (__scanf__, 3, 4)));
-int	_sniprintf_r (struct _reent *, char *, size_t, const char *, ...)
+int	_sniprintf_r (__reent_ptr_t, char *, size_t, const char *, ...)
                _ATTRIBUTE ((__format__ (__printf__, 4, 5)));
-int	_snprintf_r (struct _reent *, char *__restrict, size_t, const char *__restrict, ...)
+int	_snprintf_r (__reent_ptr_t, char *__restrict, size_t, const char *__restrict, ...)
                _ATTRIBUTE ((__format__ (__printf__, 4, 5)));
-int	_sprintf_r (struct _reent *, char *__restrict, const char *__restrict, ...)
+int	_sprintf_r (__reent_ptr_t, char *__restrict, const char *__restrict, ...)
                _ATTRIBUTE ((__format__ (__printf__, 3, 4)));
-int	_sscanf_r (struct _reent *, const char *__restrict, const char *__restrict, ...)
+int	_sscanf_r (__reent_ptr_t, const char *__restrict, const char *__restrict, ...)
                _ATTRIBUTE ((__format__ (__scanf__, 3, 4)));
-char *	_tempnam_r (struct _reent *, const char *, const char *);
-FILE *	_tmpfile_r (struct _reent *);
-char *	_tmpnam_r (struct _reent *, char *);
-int	_ungetc_r (struct _reent *, int, FILE *);
-int	_vasiprintf_r (struct _reent *, char **, const char *, __VALIST)
+char *	_tempnam_r (__reent_ptr_t, const char *, const char *);
+FILE *	_tmpfile_r (__reent_ptr_t);
+char *	_tmpnam_r (__reent_ptr_t, char *);
+int	_ungetc_r (__reent_ptr_t, int, FILE *);
+int	_vasiprintf_r (__reent_ptr_t, char **, const char *, __VALIST)
                _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
-char *	_vasniprintf_r (struct _reent*, char *, size_t *, const char *, __VALIST)
+char *	_vasniprintf_r (__reent_ptr_t, char *, size_t *, const char *, __VALIST)
                _ATTRIBUTE ((__format__ (__printf__, 4, 0)));
-char *	_vasnprintf_r (struct _reent*, char *, size_t *, const char *, __VALIST)
+char *	_vasnprintf_r (__reent_ptr_t, char *, size_t *, const char *, __VALIST)
                _ATTRIBUTE ((__format__ (__printf__, 4, 0)));
-int	_vasprintf_r (struct _reent *, char **, const char *, __VALIST)
+int	_vasprintf_r (__reent_ptr_t, char **, const char *, __VALIST)
                _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
-int	_vdiprintf_r (struct _reent *, int, const char *, __VALIST)
+int	_vdiprintf_r (__reent_ptr_t, int, const char *, __VALIST)
                _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
-int	_vdprintf_r (struct _reent *, int, const char *__restrict, __VALIST)
+int	_vdprintf_r (__reent_ptr_t, int, const char *__restrict, __VALIST)
                _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
-int	_vfiprintf_r (struct _reent *, FILE *, const char *, __VALIST)
+int	_vfiprintf_r (__reent_ptr_t, FILE *, const char *, __VALIST)
                _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
-int	_vfiscanf_r (struct _reent *, FILE *, const char *, __VALIST)
+int	_vfiscanf_r (__reent_ptr_t, FILE *, const char *, __VALIST)
                _ATTRIBUTE ((__format__ (__scanf__, 3, 0)));
-int	_vfprintf_r (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST)
+int	_vfprintf_r (__reent_ptr_t, FILE *__restrict, const char *__restrict, __VALIST)
                _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
-int	_vfscanf_r (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST)
+int	_vfscanf_r (__reent_ptr_t, FILE *__restrict, const char *__restrict, __VALIST)
                _ATTRIBUTE ((__format__ (__scanf__, 3, 0)));
-int	_viprintf_r (struct _reent *, const char *, __VALIST)
+int	_viprintf_r (__reent_ptr_t, const char *, __VALIST)
                _ATTRIBUTE ((__format__ (__printf__, 2, 0)));
-int	_viscanf_r (struct _reent *, const char *, __VALIST)
+int	_viscanf_r (__reent_ptr_t, const char *, __VALIST)
                _ATTRIBUTE ((__format__ (__scanf__, 2, 0)));
-int	_vprintf_r (struct _reent *, const char *__restrict, __VALIST)
+int	_vprintf_r (__reent_ptr_t, const char *__restrict, __VALIST)
                _ATTRIBUTE ((__format__ (__printf__, 2, 0)));
-int	_vscanf_r (struct _reent *, const char *__restrict, __VALIST)
+int	_vscanf_r (__reent_ptr_t, const char *__restrict, __VALIST)
                _ATTRIBUTE ((__format__ (__scanf__, 2, 0)));
-int	_vsiprintf_r (struct _reent *, char *, const char *, __VALIST)
+int	_vsiprintf_r (__reent_ptr_t, char *, const char *, __VALIST)
                _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
-int	_vsiscanf_r (struct _reent *, const char *, const char *, __VALIST)
+int	_vsiscanf_r (__reent_ptr_t, const char *, const char *, __VALIST)
                _ATTRIBUTE ((__format__ (__scanf__, 3, 0)));
-int	_vsniprintf_r (struct _reent *, char *, size_t, const char *, __VALIST)
+int	_vsniprintf_r (__reent_ptr_t, char *, size_t, const char *, __VALIST)
                _ATTRIBUTE ((__format__ (__printf__, 4, 0)));
-int	_vsnprintf_r (struct _reent *, char *__restrict, size_t, const char *__restrict, __VALIST)
+int	_vsnprintf_r (__reent_ptr_t, char *__restrict, size_t, const char *__restrict, __VALIST)
                _ATTRIBUTE ((__format__ (__printf__, 4, 0)));
-int	_vsprintf_r (struct _reent *, char *__restrict, const char *__restrict, __VALIST)
+int	_vsprintf_r (__reent_ptr_t, char *__restrict, const char *__restrict, __VALIST)
                _ATTRIBUTE ((__format__ (__printf__, 3, 0)));
-int	_vsscanf_r (struct _reent *, const char *__restrict, const char *__restrict, __VALIST)
+int	_vsscanf_r (__reent_ptr_t, const char *__restrict, const char *__restrict, __VALIST)
                _ATTRIBUTE ((__format__ (__scanf__, 3, 0)));
 
 /* Other extensions.  */
@@ -565,14 +565,14 @@ int     fgetpos64 (FILE *, _fpos64_t *);
 int     fsetpos64 (FILE *, const _fpos64_t *);
 FILE *  tmpfile64 (void);
 
-FILE *	_fdopen64_r (struct _reent *, int, const char *);
-FILE *  _fopen64_r (struct _reent *,const char *, const char *);
-FILE *  _freopen64_r (struct _reent *, const char *, const char *, FILE *);
-_off64_t _ftello64_r (struct _reent *, FILE *);
-_off64_t _fseeko64_r (struct _reent *, FILE *, _off64_t, int);
-int     _fgetpos64_r (struct _reent *, FILE *, _fpos64_t *);
-int     _fsetpos64_r (struct _reent *, FILE *, const _fpos64_t *);
-FILE *  _tmpfile64_r (struct _reent *);
+FILE *	_fdopen64_r (__reent_ptr_t, int, const char *);
+FILE *  _fopen64_r (__reent_ptr_t,const char *, const char *);
+FILE *  _freopen64_r (__reent_ptr_t, const char *, const char *, FILE *);
+_off64_t _ftello64_r (__reent_ptr_t, FILE *);
+_off64_t _fseeko64_r (__reent_ptr_t, FILE *, _off64_t, int);
+int     _fgetpos64_r (__reent_ptr_t, FILE *, _fpos64_t *);
+int     _fsetpos64_r (__reent_ptr_t, FILE *, const _fpos64_t *);
+FILE *  _tmpfile64_r (__reent_ptr_t);
 #endif /* !__CYGWIN__ */
 #endif /* __LARGE64_FILES */
 
@@ -580,8 +580,8 @@ FILE *  _tmpfile64_r (struct _reent *);
  * Routines internal to the implementation.
  */
 
-int	__srget_r (struct _reent *, FILE *);
-int	__swbuf_r (struct _reent *, int, FILE *);
+int	__srget_r (__reent_ptr_t, FILE *);
+int	__swbuf_r (__reent_ptr_t, int, FILE *);
 
 /*
  * Stdio function-access interface.
@@ -596,7 +596,7 @@ FILE	*funopen (const void *__cookie,
 				 _READ_WRITE_BUFSIZE_TYPE __n),
 		_fpos64_t (*__seekfn)(void *__c, _fpos64_t __off, int __whence),
 		int (*__closefn)(void *__c));
-FILE	*_funopen_r (struct _reent *, const void *__cookie,
+FILE	*_funopen_r (__reent_ptr_t, const void *__cookie,
 		int (*__readfn)(void *__c, char *__buf,
 				_READ_WRITE_BUFSIZE_TYPE __n),
 		int (*__writefn)(void *__c, const char *__buf,
@@ -611,7 +611,7 @@ FILE	*funopen (const void *__cookie,
 				 _READ_WRITE_BUFSIZE_TYPE __n),
 		fpos_t (*__seekfn)(void *__cookie, fpos_t __off, int __whence),
 		int (*__closefn)(void *__cookie));
-FILE	*_funopen_r (struct _reent *, const void *__cookie,
+FILE	*_funopen_r (__reent_ptr_t, const void *__cookie,
 		int (*__readfn)(void *__cookie, char *__buf,
 				_READ_WRITE_BUFSIZE_TYPE __n),
 		int (*__writefn)(void *__cookie, const char *__buf,
@@ -646,7 +646,7 @@ typedef struct
 } cookie_io_functions_t;
 FILE *fopencookie (void *__cookie,
 		const char *__mode, cookie_io_functions_t __functions);
-FILE *_fopencookie_r (struct _reent *, void *__cookie,
+FILE *_fopencookie_r (__reent_ptr_t, void *__cookie,
 		const char *__mode, cookie_io_functions_t __functions);
 #endif /* __GNU_VISIBLE */
 
@@ -668,9 +668,9 @@ FILE *_fopencookie_r (struct _reent *, void *__cookie,
   compilers we're just stuck.  At the moment, this issue only
   affects the Cygwin target, so we'll most likely be using GCC. */
 
-_ELIDABLE_INLINE int __sgetc_r(struct _reent *__ptr, FILE *__p);
+_ELIDABLE_INLINE int __sgetc_r(__reent_ptr_t __ptr, FILE *__p);
 
-_ELIDABLE_INLINE int __sgetc_r(struct _reent *__ptr, FILE *__p)
+_ELIDABLE_INLINE int __sgetc_r(__reent_ptr_t __ptr, FILE *__p)
   {
     int __c = __sgetc_raw_r(__ptr, __p);
     if ((__p->_flags & __SCLE) && (__c == '\r'))
@@ -688,7 +688,7 @@ _ELIDABLE_INLINE int __sgetc_r(struct _reent *__ptr, FILE *__p)
 #endif
 
 #ifdef __GNUC__
-_ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
+_ELIDABLE_INLINE int __sputc_r(__reent_ptr_t _ptr, int _c, FILE *_p) {
 #ifdef __SCLE
 	if ((_p->_flags & __SCLE) && _c == '\n')
 	  __sputc_r (_ptr, '\r', _p);
@@ -745,7 +745,7 @@ _ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
 static __inline int
 _getchar_unlocked(void)
 {
-	struct _reent *_ptr;
+	__reent_ptr_t _ptr;
 
 	_ptr = _REENT;
 	return (__sgetc_r(_ptr, _stdin_r(_ptr)));
@@ -754,7 +754,7 @@ _getchar_unlocked(void)
 static __inline int
 _putchar_unlocked(int _c)
 {
-	struct _reent *_ptr;
+	__reent_ptr_t _ptr;
 
 	_ptr = _REENT;
 	return (__sputc_r(_ptr, _c, _stdout_r(_ptr)));
diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h
index 55b20fac9cd0..78e0987ce806 100644
--- a/newlib/libc/include/stdlib.h
+++ b/newlib/libc/include/stdlib.h
@@ -79,9 +79,9 @@ double	atof (const char *__nptr);
 float	atoff (const char *__nptr);
 #endif
 int	atoi (const char *__nptr);
-int	_atoi_r (struct _reent *, const char *__nptr);
+int	_atoi_r (__reent_ptr_t, const char *__nptr);
 long	atol (const char *__nptr);
-long	_atol_r (struct _reent *, const char *__nptr);
+long	_atol_r (__reent_ptr_t, const char *__nptr);
 void *	bsearch (const void *__key,
 		       const void *__base,
 		       size_t __nmemb,
@@ -93,12 +93,12 @@ div_t	div (int __numer, int __denom);
 void	exit (int __status) _ATTRIBUTE ((__noreturn__));
 void	free (void *) _NOTHROW;
 char *  getenv (const char *__string);
-char *	_getenv_r (struct _reent *, const char *__string);
+char *	_getenv_r (__reent_ptr_t, const char *__string);
 #if __GNU_VISIBLE
 char *  secure_getenv (const char *__string);
 #endif
 char *	_findenv (const char *, int *);
-char *	_findenv_r (struct _reent *, const char *, int *);
+char *	_findenv_r (__reent_ptr_t, const char *, int *);
 #if __POSIX_VISIBLE >= 200809
 extern char *suboptarg;			/* getsubopt(3) external variable */
 int	getsubopt (char **, char * const *, char **);
@@ -107,15 +107,15 @@ long	labs (long);
 ldiv_t	ldiv (long __numer, long __denom);
 void	*malloc(size_t) __malloc_like __result_use_check __alloc_size(1) _NOTHROW;
 int	mblen (const char *, size_t);
-int	_mblen_r (struct _reent *, const char *, size_t, _mbstate_t *);
+int	_mblen_r (__reent_ptr_t, const char *, size_t, _mbstate_t *);
 int	mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
-int	_mbtowc_r (struct _reent *, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *);
+int	_mbtowc_r (__reent_ptr_t, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *);
 int	wctomb (char *, wchar_t);
-int	_wctomb_r (struct _reent *, char *, wchar_t, _mbstate_t *);
+int	_wctomb_r (__reent_ptr_t, char *, wchar_t, _mbstate_t *);
 size_t	mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
-size_t	_mbstowcs_r (struct _reent *, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *);
+size_t	_mbstowcs_r (__reent_ptr_t, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *);
 size_t	wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
-size_t	_wcstombs_r (struct _reent *, char *__restrict, const wchar_t *__restrict, size_t, _mbstate_t *);
+size_t	_wcstombs_r (__reent_ptr_t, char *__restrict, const wchar_t *__restrict, size_t, _mbstate_t *);
 #ifndef _REENT_ONLY
 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
 char *	mkdtemp (char *);
@@ -134,12 +134,12 @@ int	mkstemps (char *, int);
 char *	mktemp (char *) _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead")));
 #endif
 #endif /* !_REENT_ONLY */
-char *	_mkdtemp_r (struct _reent *, char *);
-int	_mkostemp_r (struct _reent *, char *, int);
-int	_mkostemps_r (struct _reent *, char *, int, int);
-int	_mkstemp_r (struct _reent *, char *);
-int	_mkstemps_r (struct _reent *, char *, int);
-char *	_mktemp_r (struct _reent *, char *) _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead")));
+char *	_mkdtemp_r (__reent_ptr_t, char *);
+int	_mkostemp_r (__reent_ptr_t, char *, int);
+int	_mkostemps_r (__reent_ptr_t, char *, int, int);
+int	_mkstemp_r (__reent_ptr_t, char *);
+int	_mkstemps_r (__reent_ptr_t, char *, int);
+char *	_mktemp_r (__reent_ptr_t, char *) _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead")));
 void	qsort (void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar);
 int	rand (void);
 void	*realloc(void *, size_t) __result_use_check __alloc_size(2) _NOTHROW;
@@ -158,7 +158,7 @@ void	setkey (const char *__key);
 #endif
 void	srand (unsigned __seed);
 double	strtod (const char *__restrict __n, char **__restrict __end_PTR);
-double	_strtod_r (struct _reent *,const char *__restrict __n, char **__restrict __end_PTR);
+double	_strtod_r (__reent_ptr_t,const char *__restrict __n, char **__restrict __end_PTR);
 #if __ISO_C_VISIBLE >= 1999
 float	strtof (const char *__restrict __n, char **__restrict __end_PTR);
 #endif
@@ -169,9 +169,9 @@ float	strtof (const char *__restrict __n, char **__restrict __end_PTR);
 # endif
 #endif
 long	strtol (const char *__restrict __n, char **__restrict __end_PTR, int __base);
-long	_strtol_r (struct _reent *,const char *__restrict __n, char **__restrict __end_PTR, int __base);
+long	_strtol_r (__reent_ptr_t,const char *__restrict __n, char **__restrict __end_PTR, int __base);
 unsigned long strtoul (const char *__restrict __n, char **__restrict __end_PTR, int __base);
-unsigned long _strtoul_r (struct _reent *,const char *__restrict __n, char **__restrict __end_PTR, int __base);
+unsigned long _strtoul_r (__reent_ptr_t,const char *__restrict __n, char **__restrict __end_PTR, int __base);
 
 #if __GNU_VISIBLE
 double	strtod_l (const char *__restrict, char **__restrict, locale_t);
@@ -193,7 +193,7 @@ int	system (const char *__string);
 #if __SVID_VISIBLE || __XSI_VISIBLE >= 4
 long    a64l (const char *__input);
 char *  l64a (long __input);
-char *  _l64a_r (struct _reent *,long __input);
+char *  _l64a_r (__reent_ptr_t,long __input);
 #endif
 #if __MISC_VISIBLE
 int	on_exit (void (*__func)(int, void *),void *__arg);
@@ -204,12 +204,12 @@ void	_Exit (int __status) _ATTRIBUTE ((__noreturn__));
 #if __SVID_VISIBLE || __XSI_VISIBLE
 int	putenv (char *__string);
 #endif
-int	_putenv_r (struct _reent *, char *__string);
-void *	_reallocf_r (struct _reent *, void *, size_t);
+int	_putenv_r (__reent_ptr_t, char *__string);
+void *	_reallocf_r (__reent_ptr_t, void *, size_t);
 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
 int	setenv (const char *__string, const char *__value, int __overwrite);
 #endif
-int	_setenv_r (struct _reent *, const char *__string, const char *__value, int __overwrite);
+int	_setenv_r (__reent_ptr_t, const char *__string, const char *__value, int __overwrite);
 
 #if __XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112
 char *	gcvt (double,int,char *);
@@ -235,25 +235,25 @@ int	rand_r (unsigned *__seed);
 
 #if __SVID_VISIBLE || __XSI_VISIBLE
 double drand48 (void);
-double _drand48_r (struct _reent *);
+double _drand48_r (__reent_ptr_t);
 double erand48 (unsigned short [3]);
-double _erand48_r (struct _reent *, unsigned short [3]);
+double _erand48_r (__reent_ptr_t, unsigned short [3]);
 long   jrand48 (unsigned short [3]);
-long   _jrand48_r (struct _reent *, unsigned short [3]);
+long   _jrand48_r (__reent_ptr_t, unsigned short [3]);
 void  lcong48 (unsigned short [7]);
-void  _lcong48_r (struct _reent *, unsigned short [7]);
+void  _lcong48_r (__reent_ptr_t, unsigned short [7]);
 long   lrand48 (void);
-long   _lrand48_r (struct _reent *);
+long   _lrand48_r (__reent_ptr_t);
 long   mrand48 (void);
-long   _mrand48_r (struct _reent *);
+long   _mrand48_r (__reent_ptr_t);
 long   nrand48 (unsigned short [3]);
-long   _nrand48_r (struct _reent *, unsigned short [3]);
+long   _nrand48_r (__reent_ptr_t, unsigned short [3]);
 unsigned short *
        seed48 (unsigned short [3]);
 unsigned short *
-       _seed48_r (struct _reent *, unsigned short [3]);
+       _seed48_r (__reent_ptr_t, unsigned short [3]);
 void  srand48 (long);
-void  _srand48_r (struct _reent *, long);
+void  _srand48_r (__reent_ptr_t, long);
 #endif /* __SVID_VISIBLE || __XSI_VISIBLE */
 #if __SVID_VISIBLE || __XSI_VISIBLE >= 4 || __BSD_VISIBLE
 char *	initstate (unsigned, char *, size_t);
@@ -264,17 +264,17 @@ void	srandom (unsigned);
 #if __ISO_C_VISIBLE >= 1999
 long long atoll (const char *__nptr);
 #endif
-long long _atoll_r (struct _reent *, const char *__nptr);
+long long _atoll_r (__reent_ptr_t, const char *__nptr);
 #if __ISO_C_VISIBLE >= 1999
 long long llabs (long long);
 lldiv_t	lldiv (long long __numer, long long __denom);
 long long strtoll (const char *__restrict __n, char **__restrict __end_PTR, int __base);
 #endif
-long long _strtoll_r (struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base);
+long long _strtoll_r (__reent_ptr_t, const char *__restrict __n, char **__restrict __end_PTR, int __base);
 #if __ISO_C_VISIBLE >= 1999
 unsigned long long strtoull (const char *__restrict __n, char **__restrict __end_PTR, int __base);
 #endif
-unsigned long long _strtoull_r (struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base);
+unsigned long long _strtoull_r (__reent_ptr_t, const char *__restrict __n, char **__restrict __end_PTR, int __base);
 
 #ifndef __CYGWIN__
 #if __MISC_VISIBLE
@@ -283,7 +283,7 @@ void	cfree (void *);
 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
 int	unsetenv (const char *__string);
 #endif
-int	_unsetenv_r (struct _reent *, const char *__string);
+int	_unsetenv_r (__reent_ptr_t, const char *__string);
 #endif /* !__CYGWIN__ */
 
 #if __POSIX_VISIBLE >= 200112
@@ -291,15 +291,15 @@ int	posix_memalign (void **, size_t, size_t) __nonnull((1))
 	    __result_use_check;
 #endif
 
-char *	_dtoa_r (struct _reent *, double, int, int, int *, int*, char**);
+char *	_dtoa_r (__reent_ptr_t, double, int, int, int *, int*, char**);
 #ifndef __CYGWIN__
-void *	_malloc_r (struct _reent *, size_t) _NOTHROW;
-void *	_calloc_r (struct _reent *, size_t, size_t) _NOTHROW;
-void	_free_r (struct _reent *, void *) _NOTHROW;
-void *	_realloc_r (struct _reent *, void *, size_t) _NOTHROW;
-void	_mstats_r (struct _reent *, char *);
+void *	_malloc_r (__reent_ptr_t, size_t) _NOTHROW;
+void *	_calloc_r (__reent_ptr_t, size_t, size_t) _NOTHROW;
+void	_free_r (__reent_ptr_t, void *) _NOTHROW;
+void *	_realloc_r (__reent_ptr_t, void *, size_t) _NOTHROW;
+void	_mstats_r (__reent_ptr_t, char *);
 #endif
-int	_system_r (struct _reent *, const char *);
+int	_system_r (__reent_ptr_t, const char *);
 
 void	__eprintf (const char *, const char *, unsigned int, const char *);
 
@@ -321,7 +321,7 @@ void	__bsd_qsort_r (void *__base, size_t __nmemb, size_t __size, void *__thunk,
 
 /* On platforms where long double equals double.  */
 #ifdef _HAVE_LONG_DOUBLE
-extern long double _strtold_r (struct _reent *, const char *__restrict, char **__restrict);
+extern long double _strtold_r (__reent_ptr_t, const char *__restrict, char **__restrict);
 #if __ISO_C_VISIBLE >= 1999
 extern long double strtold (const char *__restrict, char **__restrict);
 #endif
diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h
index 3e66ec3dd74d..a2bdc18c8af0 100644
--- a/newlib/libc/include/string.h
+++ b/newlib/libc/include/string.h
@@ -85,11 +85,11 @@ char 	*strchrnul (const char *, int);
 #if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4
 char 	*strdup (const char *) __malloc_like __result_use_check;
 #endif
-char 	*_strdup_r (struct _reent *, const char *);
+char 	*_strdup_r (__reent_ptr_t, const char *);
 #if __POSIX_VISIBLE >= 200809
 char 	*strndup (const char *, size_t) __malloc_like __result_use_check;
 #endif
-char 	*_strndup_r (struct _reent *, const char *, size_t);
+char 	*_strndup_r (__reent_ptr_t, const char *, size_t);
 
 /* There are two common strerror_r variants.  If you request
    _GNU_SOURCE, you get the GNU version; otherwise you get the POSIX
@@ -111,7 +111,7 @@ int	__xpg_strerror_r (int, char *, size_t);
 #endif
 
 /* Reentrant version of strerror.  */
-char *	_strerror_r (struct _reent *, int, int, int *);
+char *	_strerror_r (__reent_ptr_t, int, int, int *);
 
 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 202405L
 size_t	strlcat (char *, const char *, size_t);
diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h
index d1112d5d102c..f8891f9cde99 100644
--- a/newlib/libc/include/sys/_types.h
+++ b/newlib/libc/include/sys/_types.h
@@ -26,6 +26,9 @@
 #include <sys/config.h>
 #include <machine/_types.h>
 
+struct _reent;
+typedef struct _reent *__reent_ptr_t;
+
 #ifndef __machine_blkcnt_t_defined
 typedef long __blkcnt_t;
 #endif
diff --git a/newlib/libc/include/sys/iconvnls.h b/newlib/libc/include/sys/iconvnls.h
index d4ee0b7c9149..2d28e55930f3 100644
--- a/newlib/libc/include/sys/iconvnls.h
+++ b/newlib/libc/include/sys/iconvnls.h
@@ -57,21 +57,21 @@ int
 _iconv_nls_get_mb_cur_max (iconv_t cd, int direction);
 
 size_t
-_iconv_nls_conv (struct _reent *rptr, iconv_t cd,
+_iconv_nls_conv (__reent_ptr_t rptr, iconv_t cd,
                         const char **inbuf, size_t *inbytesleft,
                         char **outbuf, size_t *outbytesleft);
 
 const char *
-_iconv_nls_construct_filename (struct _reent *rptr, const char *file,
+_iconv_nls_construct_filename (__reent_ptr_t rptr, const char *file,
                                       const char *dir, const char *ext);
 
 
 int
-_iconv_nls_open (struct _reent *rptr, const char *encoding,
+_iconv_nls_open (__reent_ptr_t rptr, const char *encoding,
                         iconv_t *towc, iconv_t *fromwc, int flag);
 
 char *
-_iconv_resolve_encoding_name (struct _reent *rptr, const char *ca);
+_iconv_resolve_encoding_name (__reent_ptr_t rptr, const char *ca);
 
 #endif /* __SYS_ICONVNLS_H__ */
 
diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index eafac960fd6c..764d96e4f344 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -166,13 +166,13 @@ struct __sFILE {
   /* operations */
   void *	_cookie;	/* cookie passed to io functions */
 
-  _READ_WRITE_RETURN_TYPE (*_read) (struct _reent *, void *,
+  _READ_WRITE_RETURN_TYPE (*_read) (__reent_ptr_t, void *,
 					   char *, _READ_WRITE_BUFSIZE_TYPE);
-  _READ_WRITE_RETURN_TYPE (*_write) (struct _reent *, void *,
+  _READ_WRITE_RETURN_TYPE (*_write) (__reent_ptr_t, void *,
 					    const char *,
 					    _READ_WRITE_BUFSIZE_TYPE);
-  _fpos_t (*_seek) (struct _reent *, void *, _fpos_t, int);
-  int (*_close) (struct _reent *, void *);
+  _fpos_t (*_seek) (__reent_ptr_t, void *, _fpos_t, int);
+  int (*_close) (__reent_ptr_t, void *);
 
   /* separate buffer for long sequences of ungetc() */
   struct __sbuf _ub;	/* ungetc buffer */
@@ -233,13 +233,13 @@ struct __sFILE64 {
   /* operations */
   void *	_cookie;	/* cookie passed to io functions */
 
-  _READ_WRITE_RETURN_TYPE (*_read) (struct _reent *, void *,
+  _READ_WRITE_RETURN_TYPE (*_read) (__reent_ptr_t, void *,
 					   char *, _READ_WRITE_BUFSIZE_TYPE);
-  _READ_WRITE_RETURN_TYPE (*_write) (struct _reent *, void *,
+  _READ_WRITE_RETURN_TYPE (*_write) (__reent_ptr_t, void *,
 					    const char *,
 					    _READ_WRITE_BUFSIZE_TYPE);
-  _fpos_t (*_seek) (struct _reent *, void *, _fpos_t, int);
-  int (*_close) (struct _reent *, void *);
+  _fpos_t (*_seek) (__reent_ptr_t, void *, _fpos_t, int);
+  int (*_close) (__reent_ptr_t, void *);
 
   /* separate buffer for long sequences of ungetc() */
   struct __sbuf _ub;	/* ungetc buffer */
@@ -258,7 +258,7 @@ struct __sFILE64 {
   int   _flags2;        /* for future use */
 
   _off64_t _offset;     /* current lseek offset */
-  _fpos64_t (*_seek64) (struct _reent *, void *, _fpos64_t, int);
+  _fpos64_t (*_seek64) (__reent_ptr_t, void *, _fpos64_t, int);
 
 #ifndef __SINGLE_THREAD__
   _flock_t _lock;	/* for thread-safety locking */
@@ -399,7 +399,7 @@ struct _reent
 
   struct _mprec *_mp;
 
-  void (*__cleanup) (struct _reent *);
+  void (*__cleanup) (__reent_ptr_t);
 
   int _gamma_signgam;
 
@@ -598,7 +598,7 @@ struct _reent
   int _reserved_0;
 #endif
 
-  void (*__cleanup) (struct _reent *);
+  void (*__cleanup) (__reent_ptr_t);
 
   /* used by mprec routines */
   struct _Bigint *_result;
@@ -850,7 +850,7 @@ extern _Thread_local char *_tls_cvtbuf;
 #define _REENT_CVTBUF(_ptr) (_tls_cvtbuf)
 extern _Thread_local int _tls_cvtlen;
 #define _REENT_CVTLEN(_ptr) (_tls_cvtlen)
-extern _Thread_local void (*_tls_cleanup)(struct _reent *);
+extern _Thread_local void (*_tls_cleanup)(__reent_ptr_t);
 #define _REENT_CLEANUP(_ptr) (_tls_cleanup)
 extern _Thread_local char _tls_emergency[_REENT_EMERGENCY_SIZE];
 #define _REENT_EMERGENCY(_ptr) (_tls_emergency)
@@ -927,9 +927,9 @@ extern struct _atexit __atexit0; /* one guaranteed table, required by ANSI */
 
 extern void (*__stdio_exit_handler) (void);
 
-void _reclaim_reent (struct _reent *);
+void _reclaim_reent (__reent_ptr_t);
 
-extern int _fwalk_sglue (struct _reent *, int (*)(struct _reent *, __FILE *),
+extern int _fwalk_sglue (__reent_ptr_t, int (*)(__reent_ptr_t, __FILE *),
 			 struct _glue *);
 
 #ifdef __cplusplus
diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h
index 58c5066edf38..75543b81dee2 100644
--- a/newlib/libc/include/time.h
+++ b/newlib/libc/include/time.h
@@ -105,7 +105,7 @@ char *strptime_l (const char *__restrict, const char *__restrict,
 #if __POSIX_VISIBLE
 void      tzset 	(void);
 #endif
-void      _tzset_r 	(struct _reent *);
+void      _tzset_r 	(__reent_ptr_t);
 
 /* getdate functions */
 
diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h
index 7c37427e6888..ee45166b8d3e 100644
--- a/newlib/libc/include/wchar.h
+++ b/newlib/libc/include/wchar.h
@@ -91,29 +91,29 @@ int	wctob (wint_t);
 size_t	mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
 size_t	mbrtowc (wchar_t *__restrict, const char *__restrict, size_t,
 						mbstate_t *__restrict);
-size_t	_mbrtowc_r (struct _reent *, wchar_t * , const char * , 
+size_t	_mbrtowc_r (__reent_ptr_t, wchar_t * , const char * ,
 			size_t, mbstate_t *);
 int	mbsinit (const mbstate_t *);
 #if __POSIX_VISIBLE >= 200809
 size_t	mbsnrtowcs (wchar_t *__restrict, const char **__restrict,
 				size_t, size_t, mbstate_t *__restrict);
 #endif
-size_t	_mbsnrtowcs_r (struct _reent *, wchar_t * , const char ** ,
+size_t	_mbsnrtowcs_r (__reent_ptr_t, wchar_t * , const char ** ,
 			size_t, size_t, mbstate_t *);
 size_t	mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t,
 				mbstate_t *__restrict);
-size_t	_mbsrtowcs_r (struct _reent *, wchar_t * , const char ** , size_t, mbstate_t *);
+size_t	_mbsrtowcs_r (__reent_ptr_t, wchar_t * , const char ** , size_t, mbstate_t *);
 size_t	wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
-size_t	_wcrtomb_r (struct _reent *, char * , wchar_t, mbstate_t *);
+size_t	_wcrtomb_r (__reent_ptr_t, char * , wchar_t, mbstate_t *);
 #if __POSIX_VISIBLE >= 200809
 size_t	wcsnrtombs (char *__restrict, const wchar_t **__restrict,
 				size_t, size_t, mbstate_t *__restrict);
 #endif
-size_t	_wcsnrtombs_r (struct _reent *, char * , const wchar_t ** , 
+size_t	_wcsnrtombs_r (__reent_ptr_t, char * , const wchar_t ** ,
 			size_t, size_t, mbstate_t *);
 size_t	wcsrtombs (char *__restrict, const wchar_t **__restrict,
 				size_t, mbstate_t *__restrict);
-size_t	_wcsrtombs_r (struct _reent *, char * , const wchar_t ** , 
+size_t	_wcsrtombs_r (__reent_ptr_t, char * , const wchar_t ** ,
 			size_t, mbstate_t *);
 #if __POSIX_VISIBLE >= 200809
 int	wcscasecmp (const wchar_t *, const wchar_t *);
@@ -128,7 +128,7 @@ wchar_t	*wcpcpy (wchar_t *__restrict,
 				 const wchar_t *__restrict);
 wchar_t	*wcsdup (const wchar_t *) __malloc_like __result_use_check;
 #endif
-wchar_t	*_wcsdup_r (struct _reent *, const wchar_t * );
+wchar_t	*_wcsdup_r (__reent_ptr_t, const wchar_t * );
 size_t	wcscspn (const wchar_t *, const wchar_t *);
 size_t  wcsftime (wchar_t *__restrict, size_t,
 				const wchar_t *__restrict, const struct tm *__restrict);
@@ -160,11 +160,11 @@ wchar_t	*wcsstr (const wchar_t *__restrict,
 wchar_t	*wcstok (wchar_t *__restrict, const wchar_t *__restrict,
 				 wchar_t **__restrict);
 double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
-double _wcstod_r (struct _reent *, const wchar_t *, wchar_t **);
+double _wcstod_r (__reent_ptr_t, const wchar_t *, wchar_t **);
 #if __ISO_C_VISIBLE >= 1999
 float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
 #endif
-float _wcstof_r (struct _reent *, const wchar_t *, wchar_t **);
+float _wcstof_r (__reent_ptr_t, const wchar_t *, wchar_t **);
 #if __XSI_VISIBLE
 int	wcswidth (const wchar_t *, size_t);
 #endif
@@ -203,10 +203,10 @@ unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict,
 unsigned long long wcstoull (const wchar_t *__restrict,
 						   wchar_t **__restrict, int);
 #endif
-long    _wcstol_r (struct _reent *, const wchar_t *, wchar_t **, int);
-long long _wcstoll_r (struct _reent *, const wchar_t *, wchar_t **, int);
-unsigned long _wcstoul_r (struct _reent *, const wchar_t *, wchar_t **, int);
-unsigned long long _wcstoull_r (struct _reent *, const wchar_t *, wchar_t **, int);
+long    _wcstol_r (__reent_ptr_t, const wchar_t *, wchar_t **, int);
+long long _wcstoll_r (__reent_ptr_t, const wchar_t *, wchar_t **, int);
+unsigned long _wcstoul_r (__reent_ptr_t, const wchar_t *, wchar_t **, int);
+unsigned long long _wcstoull_r (__reent_ptr_t, const wchar_t *, wchar_t **, int);
 #if __ISO_C_VISIBLE >= 1999
 long double wcstold (const wchar_t *, wchar_t **);
 #endif
@@ -237,24 +237,24 @@ wint_t putwc (wchar_t, __FILE *);
 wint_t putwchar (wchar_t);
 wint_t ungetwc (wint_t wc, __FILE *);
 
-wint_t _fgetwc_r (struct _reent *, __FILE *);
-wint_t _fgetwc_unlocked_r (struct _reent *, __FILE *);
-wchar_t *_fgetws_r (struct _reent *, wchar_t *, int, __FILE *);
-wchar_t *_fgetws_unlocked_r (struct _reent *, wchar_t *, int, __FILE *);
-wint_t _fputwc_r (struct _reent *, wchar_t, __FILE *);
-wint_t _fputwc_unlocked_r (struct _reent *, wchar_t, __FILE *);
-int _fputws_r (struct _reent *, const wchar_t *, __FILE *);
-int _fputws_unlocked_r (struct _reent *, const wchar_t *, __FILE *);
-int _fwide_r (struct _reent *, __FILE *, int);
-wint_t _getwc_r (struct _reent *, __FILE *);
-wint_t _getwc_unlocked_r (struct _reent *, __FILE *);
-wint_t _getwchar_r (struct _reent *);
-wint_t _getwchar_unlocked_r (struct _reent *);
-wint_t _putwc_r (struct _reent *, wchar_t, __FILE *);
-wint_t _putwc_unlocked_r (struct _reent *, wchar_t, __FILE *);
-wint_t _putwchar_r (struct _reent *, wchar_t);
-wint_t _putwchar_unlocked_r (struct _reent *, wchar_t);
-wint_t _ungetwc_r (struct _reent *, wint_t wc, __FILE *);
+wint_t _fgetwc_r (__reent_ptr_t, __FILE *);
+wint_t _fgetwc_unlocked_r (__reent_ptr_t, __FILE *);
+wchar_t *_fgetws_r (__reent_ptr_t, wchar_t *, int, __FILE *);
+wchar_t *_fgetws_unlocked_r (__reent_ptr_t, wchar_t *, int, __FILE *);
+wint_t _fputwc_r (__reent_ptr_t, wchar_t, __FILE *);
+wint_t _fputwc_unlocked_r (__reent_ptr_t, wchar_t, __FILE *);
+int _fputws_r (__reent_ptr_t, const wchar_t *, __FILE *);
+int _fputws_unlocked_r (__reent_ptr_t, const wchar_t *, __FILE *);
+int _fwide_r (__reent_ptr_t, __FILE *, int);
+wint_t _getwc_r (__reent_ptr_t, __FILE *);
+wint_t _getwc_unlocked_r (__reent_ptr_t, __FILE *);
+wint_t _getwchar_r (__reent_ptr_t);
+wint_t _getwchar_unlocked_r (__reent_ptr_t);
+wint_t _putwc_r (__reent_ptr_t, wchar_t, __FILE *);
+wint_t _putwc_unlocked_r (__reent_ptr_t, wchar_t, __FILE *);
+wint_t _putwchar_r (__reent_ptr_t, wchar_t);
+wint_t _putwchar_unlocked_r (__reent_ptr_t, wchar_t);
+wint_t _ungetwc_r (__reent_ptr_t, wint_t wc, __FILE *);
 
 #if __GNU_VISIBLE
 wint_t fgetwc_unlocked (__FILE *);
@@ -270,7 +270,7 @@ wint_t putwchar_unlocked (wchar_t);
 #if __POSIX_VISIBLE >= 200809
 __FILE *open_wmemstream (wchar_t **, size_t *);
 #endif
-__FILE *_open_wmemstream_r (struct _reent *, wchar_t **, size_t *);
+__FILE *_open_wmemstream_r (__reent_ptr_t, wchar_t **, size_t *);
 
 #ifndef __VALIST
 #ifdef __GNUC__
@@ -292,12 +292,12 @@ int	vwprintf (const wchar_t *__restrict, __VALIST);
 int	wprintf (const wchar_t *__restrict, ...);
 #endif
 
-int	_fwprintf_r (struct _reent *, __FILE *, const wchar_t *, ...);
-int	_swprintf_r (struct _reent *, wchar_t *, size_t, const wchar_t *, ...);
-int	_vfwprintf_r (struct _reent *, __FILE *, const wchar_t *, __VALIST);
-int	_vswprintf_r (struct _reent *, wchar_t *, size_t, const wchar_t *, __VALIST);
-int	_vwprintf_r (struct _reent *, const wchar_t *, __VALIST);
-int	_wprintf_r (struct _reent *, const wchar_t *, ...);
+int	_fwprintf_r (__reent_ptr_t, __FILE *, const wchar_t *, ...);
+int	_swprintf_r (__reent_ptr_t, wchar_t *, size_t, const wchar_t *, ...);
+int	_vfwprintf_r (__reent_ptr_t, __FILE *, const wchar_t *, __VALIST);
+int	_vswprintf_r (__reent_ptr_t, wchar_t *, size_t, const wchar_t *, __VALIST);
+int	_vwprintf_r (__reent_ptr_t, const wchar_t *, __VALIST);
+int	_wprintf_r (__reent_ptr_t, const wchar_t *, ...);
 
 #if __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE >= 500
 int	fwscanf (__FILE *__restrict, const wchar_t *__restrict, ...);
@@ -311,12 +311,12 @@ int	vwscanf (const wchar_t *__restrict, __VALIST);
 int	wscanf (const wchar_t *__restrict, ...);
 #endif
 
-int	_fwscanf_r (struct _reent *, __FILE *, const wchar_t *, ...);
-int	_swscanf_r (struct _reent *, const wchar_t *, const wchar_t *, ...);
-int	_vfwscanf_r (struct _reent *, __FILE *, const wchar_t *, __VALIST);
-int	_vswscanf_r (struct _reent *, const wchar_t *, const wchar_t *, __VALIST);
-int	_vwscanf_r (struct _reent *, const wchar_t *, __VALIST);
-int	_wscanf_r (struct _reent *, const wchar_t *, ...);
+int	_fwscanf_r (__reent_ptr_t, __FILE *, const wchar_t *, ...);
+int	_swscanf_r (__reent_ptr_t, const wchar_t *, const wchar_t *, ...);
+int	_vfwscanf_r (__reent_ptr_t, __FILE *, const wchar_t *, __VALIST);
+int	_vswscanf_r (__reent_ptr_t, const wchar_t *, const wchar_t *, __VALIST);
+int	_vwscanf_r (__reent_ptr_t, const wchar_t *, __VALIST);
+int	_wscanf_r (__reent_ptr_t, const wchar_t *, ...);
 
 #define getwc(fp)	fgetwc(fp)
 #define putwc(wc,fp)	fputwc((wc), (fp))
diff --git a/newlib/libc/locale/duplocale.c b/newlib/libc/locale/duplocale.c
index d3e7d782e4fb..9d5858181811 100644
--- a/newlib/libc/locale/duplocale.c
+++ b/newlib/libc/locale/duplocale.c
@@ -40,7 +40,7 @@ PORTABILITY
 #include "setlocale.h"
 
 struct __locale_t *
-_duplocale_r (struct _reent *p, struct __locale_t *locobj)
+_duplocale_r (__reent_ptr_t p, struct __locale_t *locobj)
 {
   struct __locale_t tmp_locale, *new_locale;
   int i;
diff --git a/newlib/libc/locale/freelocale.c b/newlib/libc/locale/freelocale.c
index f5d55f5e2acc..6843f0e12210 100644
--- a/newlib/libc/locale/freelocale.c
+++ b/newlib/libc/locale/freelocale.c
@@ -38,7 +38,7 @@ PORTABILITY
 #include "setlocale.h"
 
 void
-_freelocale_r (struct _reent *p, struct __locale_t *locobj)
+_freelocale_r (__reent_ptr_t p, struct __locale_t *locobj)
 {
   /* Nothing to do on !_MB_CAPABLE targets. */
 #ifdef _MB_CAPABLE
diff --git a/newlib/libc/locale/getlocalename_l.c b/newlib/libc/locale/getlocalename_l.c
index 7ad4331b4bc2..a696b54f19e2 100644
--- a/newlib/libc/locale/getlocalename_l.c
+++ b/newlib/libc/locale/getlocalename_l.c
@@ -51,7 +51,7 @@ PORTABILITY
 #include "setlocale.h"
 
 const char *
-_getlocalename_l_r (struct _reent *ptr, int category, struct __locale_t *locobj)
+_getlocalename_l_r (__reent_ptr_t ptr, int category, struct __locale_t *locobj)
 {
   if (category < LC_ALL || category > LC_MESSAGES)
     return NULL;
diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c
index 9e950a570c62..202f12f3e0a5 100644
--- a/newlib/libc/locale/locale.c
+++ b/newlib/libc/locale/locale.c
@@ -297,7 +297,7 @@ struct __locale_t __global_locale =
 };
 
 char *
-_setlocale_r (struct _reent *p,
+_setlocale_r (__reent_ptr_t p,
        int category,
        const char *locale)
 {
@@ -974,7 +974,7 @@ restart:
 }
 
 const char *
-__get_locale_env (struct _reent *p, int category)
+__get_locale_env (__reent_ptr_t p, int category)
 {
   const char *env;
 
diff --git a/newlib/libc/locale/localeconv.c b/newlib/libc/locale/localeconv.c
index 5f34a785fa25..768e6f5b9d57 100644
--- a/newlib/libc/locale/localeconv.c
+++ b/newlib/libc/locale/localeconv.c
@@ -51,7 +51,7 @@ __localeconv_l (struct __locale_t *locale)
 }
 
 struct lconv *
-_localeconv_r (struct _reent *data)
+_localeconv_r (__reent_ptr_t data)
 {
   /* Note that we always fall back to the global locale, even in case
      of specifying a reent.  Otherwise a call to _localeconv_r would just
diff --git a/newlib/libc/locale/newlocale.c b/newlib/libc/locale/newlocale.c
index 92f9e0a9c4e4..0817b52e1bdb 100644
--- a/newlib/libc/locale/newlocale.c
+++ b/newlib/libc/locale/newlocale.c
@@ -83,7 +83,7 @@ PORTABILITY
 			 | LC_NUMERIC_MASK | LC_TIME_MASK | LC_MESSAGES_MASK)
 
 struct __locale_t *
-_newlocale_r (struct _reent *p, int category_mask, const char *locale,
+_newlocale_r (__reent_ptr_t p, int category_mask, const char *locale,
 	      struct __locale_t *base)
 {
 #ifndef _MB_CAPABLE
diff --git a/newlib/libc/locale/setlocale.h b/newlib/libc/locale/setlocale.h
index 572b198b5a73..a14eec7c1543 100644
--- a/newlib/libc/locale/setlocale.h
+++ b/newlib/libc/locale/setlocale.h
@@ -47,7 +47,7 @@ __BEGIN_DECLS
 struct lc_collate_T
 {
   wchar_t	 win_locale[ENCODING_LEN + 1];
-  int	       (*mbtowc) (struct _reent *, wchar_t *, const char *, size_t,
+  int	       (*mbtowc) (__reent_ptr_t, wchar_t *, const char *, size_t,
 			  mbstate_t *);
   char		 codeset[ENCODING_LEN + 1];
 };
@@ -187,9 +187,9 @@ struct __locale_t
   char			 locale_string[_LC_LAST
 				       * (ENCODING_LEN + 1/*"/"*/ + 1)];
 #endif
-  int			(*wctomb) (struct _reent *, char *, wchar_t,
+  int			(*wctomb) (__reent_ptr_t, char *, wchar_t,
 				   mbstate_t *);
-  int			(*mbtowc) (struct _reent *, wchar_t *,
+  int			(*mbtowc) (__reent_ptr_t, wchar_t *,
 				   const char *, size_t, mbstate_t *);
   int			 cjk_lang;
   char			*ctype_ptr;
@@ -206,12 +206,12 @@ struct __locale_t
 #ifdef _MB_CAPABLE
 char *__currentlocale (struct __locale_t *, char *);
 extern char *__loadlocale (struct __locale_t *, int, char *);
-extern const char *__get_locale_env(struct _reent *, int);
+extern const char *__get_locale_env(__reent_ptr_t, int);
 #endif /* _MB_CAPABLE */
 
 extern struct lconv *__localeconv_l (struct __locale_t *locale);
 
-extern size_t _wcsnrtombs_l (struct _reent *, char *, const wchar_t **,
+extern size_t _wcsnrtombs_l (__reent_ptr_t, char *, const wchar_t **,
 			     size_t, size_t, mbstate_t *, struct __locale_t *);
 
 /* In POSIX terms the global locale is the process-wide locale.  Use this
@@ -225,7 +225,7 @@ __get_global_locale ()
 
 /* Per REENT locale.  This is newlib-internal. */
 _ELIDABLE_INLINE struct __locale_t *
-__get_locale_r (struct _reent *r)
+__get_locale_r (__reent_ptr_t r)
 {
 #ifdef __HAVE_LOCALE_INFO__
   return _REENT_LOCALE(r);
diff --git a/newlib/libc/locale/uselocale.c b/newlib/libc/locale/uselocale.c
index 799fb724a0bf..19320ccd7dfc 100644
--- a/newlib/libc/locale/uselocale.c
+++ b/newlib/libc/locale/uselocale.c
@@ -56,7 +56,7 @@ PORTABILITY
 #include "setlocale.h"
 
 struct __locale_t *
-_uselocale_r (struct _reent *p, struct __locale_t *newloc)
+_uselocale_r (__reent_ptr_t p, struct __locale_t *newloc)
 {
   struct __locale_t *current_locale;
 
diff --git a/newlib/libc/machine/amdgcn/getreent.c b/newlib/libc/machine/amdgcn/getreent.c
index ef731f649cdb..084e9dcaab4f 100644
--- a/newlib/libc/machine/amdgcn/getreent.c
+++ b/newlib/libc/machine/amdgcn/getreent.c
@@ -26,7 +26,7 @@ typedef struct hsa_kernel_dispatch_packet_s {
   hsa_signal_t completion_signal;
 } hsa_kernel_dispatch_packet_t;
 
-struct _reent *
+__reent_ptr_t
 __getreent (void)
 {
   /* Place the reent data at the top of the stack allocation.  */
diff --git a/newlib/libc/machine/amdgcn/mlock.c b/newlib/libc/machine/amdgcn/mlock.c
index 3e3d8e7bcf41..eddbb4e4ebfc 100644
--- a/newlib/libc/machine/amdgcn/mlock.c
+++ b/newlib/libc/machine/amdgcn/mlock.c
@@ -69,7 +69,7 @@ sbrk (ptrdiff_t nbytes)
 }
 
 void
-__malloc_lock (struct _reent *reent)
+__malloc_lock (__reent_ptr_t reent)
 {
   void *id = reent;
 
@@ -104,7 +104,7 @@ __malloc_lock (struct _reent *reent)
 }
 
 void
-__malloc_unlock (struct _reent *reent)
+__malloc_unlock (__reent_ptr_t reent)
 {
   void *id = reent;
 
diff --git a/newlib/libc/machine/amdgcn/simt-malloc.c b/newlib/libc/machine/amdgcn/simt-malloc.c
index d9a74dfa6422..ebe675344cad 100644
--- a/newlib/libc/machine/amdgcn/simt-malloc.c
+++ b/newlib/libc/machine/amdgcn/simt-malloc.c
@@ -100,7 +100,7 @@
   while (0)
 
 void *
-_malloc_r (struct _reent *r, size_t n)
+_malloc_r (__reent_ptr_t r, size_t n)
 {
   void *ret = NULL;
   ONE_LANE_AT_A_TIME (ret = __simt_dl_malloc_r (r, n));
@@ -108,13 +108,13 @@ _malloc_r (struct _reent *r, size_t n)
 }
 
 void
-_free_r (struct _reent *r, void *p)
+_free_r (__reent_ptr_t r, void *p)
 {
   ONE_LANE_AT_A_TIME (__simt_dl_free_r (r, p));
 }
 
 void *
-_realloc_r (struct _reent *r, void *p, size_t n)
+_realloc_r (__reent_ptr_t r, void *p, size_t n)
 {
   void *ret = NULL;
   ONE_LANE_AT_A_TIME (ret = __simt_dl_realloc_r (r, p, n));
@@ -122,7 +122,7 @@ _realloc_r (struct _reent *r, void *p, size_t n)
 }
 
 void *
-_calloc_r (struct _reent *r, size_t n, size_t s)
+_calloc_r (__reent_ptr_t r, size_t n, size_t s)
 {
   void *ret = NULL;
   ONE_LANE_AT_A_TIME (ret = __simt_dl_calloc_r (r, n, s));
@@ -130,7 +130,7 @@ _calloc_r (struct _reent *r, size_t n, size_t s)
 }
 
 void *
-_memalign_r (struct _reent *r, size_t a, size_t n)
+_memalign_r (__reent_ptr_t r, size_t a, size_t n)
 {
   void *ret = NULL;
   ONE_LANE_AT_A_TIME (ret = __simt_dl_memalign_r (r, a, n));
@@ -138,7 +138,7 @@ _memalign_r (struct _reent *r, size_t a, size_t n)
 }
 
 void *
-_valloc_r (struct _reent *r, size_t n)
+_valloc_r (__reent_ptr_t r, size_t n)
 {
   void *ret = NULL;
   ONE_LANE_AT_A_TIME (ret = __simt_dl_valloc_r (r, n));
@@ -146,7 +146,7 @@ _valloc_r (struct _reent *r, size_t n)
 }
 
 void *
-_pvalloc_r (struct _reent *r, size_t n)
+_pvalloc_r (__reent_ptr_t r, size_t n)
 {
   void *ret = NULL;
   ONE_LANE_AT_A_TIME (ret = __simt_dl_pvalloc_r (r, n));
@@ -154,7 +154,7 @@ _pvalloc_r (struct _reent *r, size_t n)
 }
 
 struct mallinfo
-_mallinfo_r (struct _reent *r)
+_mallinfo_r (__reent_ptr_t r)
 {
   struct mallinfo ret = { 0 };
   ONE_LANE_AT_A_TIME (ret = __simt_dl_mallinfo_r (r));
@@ -162,7 +162,7 @@ _mallinfo_r (struct _reent *r)
 }
 
 int
-_mallopt_r (struct _reent *r, int p, int v)
+_mallopt_r (__reent_ptr_t r, int p, int v)
 {
   int ret = 0;
   ONE_LANE_AT_A_TIME (ret = __simt_dl_mallopt_r (r, p, v));
@@ -170,13 +170,13 @@ _mallopt_r (struct _reent *r, int p, int v)
 }
 
 void
-_malloc_stats_r (struct _reent *r)
+_malloc_stats_r (__reent_ptr_t r)
 {
   ONE_LANE_AT_A_TIME (__simt_dl_malloc_stats_r (r));
 }
 
 int
-_malloc_trim_r (struct _reent *r, size_t pad)
+_malloc_trim_r (__reent_ptr_t r, size_t pad)
 {
   int ret = 0;
   ONE_LANE_AT_A_TIME (ret = __simt_dl_malloc_trim_r (r, pad));
@@ -184,7 +184,7 @@ _malloc_trim_r (struct _reent *r, size_t pad)
 }
 
 size_t
-_malloc_usable_size_r (struct _reent *r, void *p)
+_malloc_usable_size_r (__reent_ptr_t r, void *p)
 {
   size_t ret = 0;
   ONE_LANE_AT_A_TIME (ret = __simt_dl_malloc_usable_size_r (r, p));
diff --git a/newlib/libc/machine/msp430/tiny-printf.c b/newlib/libc/machine/msp430/tiny-printf.c
index b5ad5284c0ad..95e1b61b836d 100644
--- a/newlib/libc/machine/msp430/tiny-printf.c
+++ b/newlib/libc/machine/msp430/tiny-printf.c
@@ -85,7 +85,7 @@ static char *rcsid = "$Id$";
    it is sent to <<write>>, but <<write>> does its own buffering so we won't
    lose chars when buf is larger than sizeof(CIOBUF).  */
 int
-__tiny__sfputs_r (struct _reent *ptr,
+__tiny__sfputs_r (__reent_ptr_t ptr,
        FILE *fp,
        const char *buf,
        size_t len)
@@ -101,7 +101,7 @@ __tiny__sfputs_r (struct _reent *ptr,
      being sent to <<write>> via <<__tiny__sfputs_r>>.
    Basically, format the string as normal, and send it to write.  */
 int
-__tiny_vfprintf_r (struct _reent *data,
+__tiny_vfprintf_r (__reent_ptr_t data,
        FILE * fp,
        const char *fmt0,
        va_list ap)
@@ -114,7 +114,7 @@ __tiny_vfprintf_r (struct _reent *data,
   va_list ap_copy;
 
   /* Output function pointer.  */
-  int (*pfunc)(struct _reent *, FILE *, const char *, size_t len);
+  int (*pfunc)(__reent_ptr_t, FILE *, const char *, size_t len);
 
   pfunc = __tiny__sfputs_r;
 
@@ -262,7 +262,7 @@ __wrap_printf (const char *__restrict fmt, ...)
 {
   int ret;
   va_list ap;
-  struct _reent *ptr = _REENT;
+  __reent_ptr_t ptr = _REENT;
 
   va_start (ap, fmt);
   ret = __tiny_vfprintf_r (ptr, _stdout_r (ptr), fmt, ap);
diff --git a/newlib/libc/machine/nvptx/callocr.c b/newlib/libc/machine/nvptx/callocr.c
index fa10f532e7c3..43b5f085ffa9 100644
--- a/newlib/libc/machine/nvptx/callocr.c
+++ b/newlib/libc/machine/nvptx/callocr.c
@@ -16,7 +16,7 @@
 #include <stdlib.h>
 
 void *
-_calloc_r (struct _reent *ptr, size_t size, size_t len)
+_calloc_r (__reent_ptr_t ptr, size_t size, size_t len)
 {
   return calloc (size, len);
 }
diff --git a/newlib/libc/machine/nvptx/mallocr.c b/newlib/libc/machine/nvptx/mallocr.c
index bef89de02eca..cf7f0fe9dcb1 100644
--- a/newlib/libc/machine/nvptx/mallocr.c
+++ b/newlib/libc/machine/nvptx/mallocr.c
@@ -15,12 +15,12 @@
 
 #include <stdlib.h>
 
-void *_malloc_r (struct _reent *r, size_t n)
+void *_malloc_r (__reent_ptr_t r, size_t n)
 {
   return malloc (n);
 }
 
-void _free_r (struct _reent *r, void *p)
+void _free_r (__reent_ptr_t r, void *p)
 {
   free (p);
 }
diff --git a/newlib/libc/machine/nvptx/reallocr.c b/newlib/libc/machine/nvptx/reallocr.c
index e942f069c34f..294ce1dbcff8 100644
--- a/newlib/libc/machine/nvptx/reallocr.c
+++ b/newlib/libc/machine/nvptx/reallocr.c
@@ -15,7 +15,7 @@
 
 #include <stdlib.h>
 
-void *_realloc_r (struct _reent *r, void *p, size_t n) _NOTHROW
+void *_realloc_r (__reent_ptr_t r, void *p, size_t n) _NOTHROW
 {
   return realloc (p, n);
 }
diff --git a/newlib/libc/machine/powerpc/atosfix16.c b/newlib/libc/machine/powerpc/atosfix16.c
index b069d71d1cd4..be62215d321a 100644
--- a/newlib/libc/machine/powerpc/atosfix16.c
+++ b/newlib/libc/machine/powerpc/atosfix16.c
@@ -62,7 +62,7 @@ PORTABILITY
 #include <_ansi.h>
 
 __int16_t
-_atosfix16_r (struct _reent *reent,
+_atosfix16_r (__reent_ptr_t reent,
 	const char *s)
 {
   return _strtosfix16_r (reent, s, NULL);
diff --git a/newlib/libc/machine/powerpc/atosfix32.c b/newlib/libc/machine/powerpc/atosfix32.c
index e1915b25a5b6..8c59acc60c85 100644
--- a/newlib/libc/machine/powerpc/atosfix32.c
+++ b/newlib/libc/machine/powerpc/atosfix32.c
@@ -8,7 +8,7 @@
 #include <_ansi.h>
 
 __int32_t
-_atosfix32_r (struct _reent *reent,
+_atosfix32_r (__reent_ptr_t reent,
 	const char *s)
 {
   return _strtosfix32_r (reent, s, NULL);
diff --git a/newlib/libc/machine/powerpc/atosfix64.c b/newlib/libc/machine/powerpc/atosfix64.c
index 5340b1ee2a6d..44a1a3fd64c6 100644
--- a/newlib/libc/machine/powerpc/atosfix64.c
+++ b/newlib/libc/machine/powerpc/atosfix64.c
@@ -8,7 +8,7 @@
 #include <_ansi.h>
 
 __int64_t
-_atosfix64_r (struct _reent *reent,
+_atosfix64_r (__reent_ptr_t reent,
 	const char *s)
 {
   return _strtosfix64_r (reent, s, NULL);
diff --git a/newlib/libc/machine/powerpc/atoufix16.c b/newlib/libc/machine/powerpc/atoufix16.c
index 4cc8338620e5..c3562ef3f745 100644
--- a/newlib/libc/machine/powerpc/atoufix16.c
+++ b/newlib/libc/machine/powerpc/atoufix16.c
@@ -62,7 +62,7 @@ PORTABILITY
 #include <_ansi.h>
 
 __uint16_t
-_atoufix16_r (struct _reent *reent,
+_atoufix16_r (__reent_ptr_t reent,
 	const char *s)
 {
   return _strtoufix16_r (reent, s, NULL);
diff --git a/newlib/libc/machine/powerpc/atoufix32.c b/newlib/libc/machine/powerpc/atoufix32.c
index aa2333af617d..eae53caaca64 100644
--- a/newlib/libc/machine/powerpc/atoufix32.c
+++ b/newlib/libc/machine/powerpc/atoufix32.c
@@ -8,7 +8,7 @@
 #include <_ansi.h>
 
 __uint32_t
-_atoufix32_r (struct _reent *reent,
+_atoufix32_r (__reent_ptr_t reent,
 	const char *s)
 {
   return _strtoufix32_r (reent, s, NULL);
diff --git a/newlib/libc/machine/powerpc/atoufix64.c b/newlib/libc/machine/powerpc/atoufix64.c
index cf9517e9535d..fba02218eb41 100644
--- a/newlib/libc/machine/powerpc/atoufix64.c
+++ b/newlib/libc/machine/powerpc/atoufix64.c
@@ -8,7 +8,7 @@
 #include <_ansi.h>
 
 __uint64_t
-_atoufix64_r (struct _reent *reent,
+_atoufix64_r (__reent_ptr_t reent,
 	const char *s)
 {
   return _strtoufix64_r (reent, s, NULL);
diff --git a/newlib/libc/machine/powerpc/machine/malloc.h b/newlib/libc/machine/powerpc/machine/malloc.h
index 32fbb268b6cc..751e51131bcd 100644
--- a/newlib/libc/machine/powerpc/machine/malloc.h
+++ b/newlib/libc/machine/powerpc/machine/malloc.h
@@ -4,13 +4,13 @@
 # if defined(__ALTIVEC__)
 
 void *vec_calloc (size_t __nmemb, size_t __size);
-void *_vec_calloc_r (struct _reent *, size_t __nmemb, size_t __size);
+void *_vec_calloc_r (__reent_ptr_t, size_t __nmemb, size_t __size);
 void   vec_free (void *);
 #define _vec_freer _freer
 void *vec_malloc (size_t __size);
 #define _vec_mallocr _memalign_r
 void *vec_realloc (void *__r, size_t __size);
-void *_vec_realloc_r (struct _reent *, void *__r, size_t __size);
+void *_vec_realloc_r (__reent_ptr_t, void *__r, size_t __size);
 
 # endif /* __ALTIVEC__ */
 
diff --git a/newlib/libc/machine/powerpc/machine/stdlib.h b/newlib/libc/machine/powerpc/machine/stdlib.h
index 2db801092e6c..3036386b3606 100644
--- a/newlib/libc/machine/powerpc/machine/stdlib.h
+++ b/newlib/libc/machine/powerpc/machine/stdlib.h
@@ -6,13 +6,13 @@
 # if defined(__ALTIVEC__)
 
 void *vec_calloc (size_t __nmemb, size_t __size);
-void *_vec_calloc_r (struct _reent *, size_t __nmemb, size_t __size);
+void *_vec_calloc_r (__reent_ptr_t, size_t __nmemb, size_t __size);
 void   vec_free (void *);
 #define _vec_freer _freer
 void *vec_malloc (size_t __size);
 #define _vec_mallocr _memalign_r
 void *vec_realloc (void *__r, size_t __size);
-void *_vec_realloc_r (struct _reent *, void *__r, size_t __size);
+void *_vec_realloc_r (__reent_ptr_t, void *__r, size_t __size);
 
 # endif /* __ALTIVEC__ */
 
@@ -25,37 +25,37 @@ void *_vec_realloc_r (struct _reent *, void *__r, size_t __size);
 extern "C" {
 #endif
 __int16_t   atosfix16 (const char *__str);
-__int16_t   _atosfix16_r (struct _reent *, const char *__str);
+__int16_t   _atosfix16_r (__reent_ptr_t, const char *__str);
 __int32_t   atosfix32 (const char *__str);
-__int32_t   _atosfix32_r (struct _reent *, const char *__str);
+__int32_t   _atosfix32_r (__reent_ptr_t, const char *__str);
 __int64_t   atosfix64 (const char *__str);
-__int64_t   _atosfix64_r (struct _reent *, const char *__str);
+__int64_t   _atosfix64_r (__reent_ptr_t, const char *__str);
 
 __uint16_t atoufix16 (const char *__str);
-__uint16_t _atoufix16_r (struct _reent *, const char *__str);
+__uint16_t _atoufix16_r (__reent_ptr_t, const char *__str);
 __uint32_t atoufix32 (const char *__str);
-__uint32_t _atoufix32_r (struct _reent *, const char *__str);
+__uint32_t _atoufix32_r (__reent_ptr_t, const char *__str);
 __uint64_t atoufix64 (const char *__str);
-__uint64_t _atoufix64_r (struct _reent *, const char *__str);
+__uint64_t _atoufix64_r (__reent_ptr_t, const char *__str);
 
 __int16_t   strtosfix16 (const char *__str, char **__endptr);
-__int16_t   _strtosfix16_r (struct _reent *, const char *__str, 
+__int16_t   _strtosfix16_r (__reent_ptr_t, const char *__str,
                  char **__endptr);
 __int32_t   strtosfix32 (const char *__str, char **__endptr);
-__int32_t   _strtosfix32_r (struct _reent *, const char *__str, 
+__int32_t   _strtosfix32_r (__reent_ptr_t, const char *__str,
                  char **__endptr);
 __int64_t   strtosfix64 (const char *__str, char **__endptr);
-__int64_t   _strtosfix64_r (struct _reent *, const char *__str, 
+__int64_t   _strtosfix64_r (__reent_ptr_t, const char *__str,
                  char **__endptr);
 
 __uint16_t strtoufix16 (const char *__str, char **__endptr);
-__uint16_t _strtoufix16_r (struct _reent *, const char *__str, 
+__uint16_t _strtoufix16_r (__reent_ptr_t, const char *__str,
                  char **__endptr);
 __uint32_t strtoufix32 (const char *__str, char **__endptr);
-__uint32_t _strtoufix32_r (struct _reent *, const char *__str, 
+__uint32_t _strtoufix32_r (__reent_ptr_t, const char *__str,
                  char **__endptr);
 __uint64_t strtoufix64 (const char *__str, char **__endptr);
-__uint64_t _strtoufix64_r (struct _reent *, const char *__str, 
+__uint64_t _strtoufix64_r (__reent_ptr_t, const char *__str,
                  char **__endptr);
 #ifdef __cplusplus
 }
diff --git a/newlib/libc/machine/powerpc/simdldtoa.c b/newlib/libc/machine/powerpc/simdldtoa.c
index 9a90e64e2ac2..b7a6d632dab8 100644
--- a/newlib/libc/machine/powerpc/simdldtoa.c
+++ b/newlib/libc/machine/powerpc/simdldtoa.c
@@ -15,7 +15,7 @@
 /* These are the externally visible entries. */
 /* linux name:  long double _IO_strtold (char *, char **); */
 void _simdstrtold (char *, char **, LONG_DOUBLE_UNION *);
-char * _simdldtoa_r (struct _reent *, LONG_DOUBLE_UNION *, int, int, int *, int *, char **);
+char * _simdldtoa_r (__reent_ptr_t, LONG_DOUBLE_UNION *, int, int, int *, int *, char **);
 
  /* Number of 16 bit words in external x type format */
  #define NE 10
@@ -2700,7 +2700,7 @@ if (fmt == 'E')
 /* This routine will not return more than NDEC+1 digits. */
 
 char *
-_simdldtoa_r (struct _reent *ptr, LONG_DOUBLE_UNION *d, int mode, int ndigits, int *decpt, 
+_simdldtoa_r (__reent_ptr_t ptr, LONG_DOUBLE_UNION *d, int mode, int ndigits, int *decpt,
           int *sign, char **rve)
 {
 unsigned short e[NI];
diff --git a/newlib/libc/machine/powerpc/strtosfix16.c b/newlib/libc/machine/powerpc/strtosfix16.c
index 5475de88e63c..32470b5404ec 100644
--- a/newlib/libc/machine/powerpc/strtosfix16.c
+++ b/newlib/libc/machine/powerpc/strtosfix16.c
@@ -92,7 +92,7 @@ PORTABILITY
  * Ignores `locale' stuff.
  */
 __int16_t
-_strtosfix16_r (struct _reent *rptr,
+_strtosfix16_r (__reent_ptr_t rptr,
 	const char *nptr,
 	char **endptr)
 {
diff --git a/newlib/libc/machine/powerpc/strtosfix32.c b/newlib/libc/machine/powerpc/strtosfix32.c
index 6941be5d5c73..4aad7e975b7d 100644
--- a/newlib/libc/machine/powerpc/strtosfix32.c
+++ b/newlib/libc/machine/powerpc/strtosfix32.c
@@ -13,7 +13,7 @@
  * Ignores `locale' stuff.
  */
 __int32_t
-_strtosfix32_r (struct _reent *rptr,
+_strtosfix32_r (__reent_ptr_t rptr,
 	const char *nptr,
 	char **endptr)
 {
diff --git a/newlib/libc/machine/powerpc/strtosfix64.c b/newlib/libc/machine/powerpc/strtosfix64.c
index 9da3ffaee210..8d224b5a473a 100644
--- a/newlib/libc/machine/powerpc/strtosfix64.c
+++ b/newlib/libc/machine/powerpc/strtosfix64.c
@@ -13,7 +13,7 @@
  * Ignores `locale' stuff.
  */
 __int64_t
-_strtosfix64_r (struct _reent *rptr,
+_strtosfix64_r (__reent_ptr_t rptr,
 	const char *nptr,
 	char **endptr)
 {
diff --git a/newlib/libc/machine/powerpc/strtoufix16.c b/newlib/libc/machine/powerpc/strtoufix16.c
index 415652dd2e78..d69d94b7f987 100644
--- a/newlib/libc/machine/powerpc/strtoufix16.c
+++ b/newlib/libc/machine/powerpc/strtoufix16.c
@@ -91,7 +91,7 @@ PORTABILITY
  * Ignores `locale' stuff.
  */
 __uint16_t
-_strtoufix16_r (struct _reent *rptr,
+_strtoufix16_r (__reent_ptr_t rptr,
 	const char *nptr,
 	char **endptr)
 {
diff --git a/newlib/libc/machine/powerpc/strtoufix32.c b/newlib/libc/machine/powerpc/strtoufix32.c
index 4340c711f69f..24c1b560bcf3 100644
--- a/newlib/libc/machine/powerpc/strtoufix32.c
+++ b/newlib/libc/machine/powerpc/strtoufix32.c
@@ -13,7 +13,7 @@
  * Ignores `locale' stuff.
  */
 __uint32_t
-_strtoufix32_r (struct _reent *rptr,
+_strtoufix32_r (__reent_ptr_t rptr,
 	const char *nptr,
 	char **endptr)
 {
diff --git a/newlib/libc/machine/powerpc/strtoufix64.c b/newlib/libc/machine/powerpc/strtoufix64.c
index 205706856806..08692e90d295 100644
--- a/newlib/libc/machine/powerpc/strtoufix64.c
+++ b/newlib/libc/machine/powerpc/strtoufix64.c
@@ -13,7 +13,7 @@
  * Ignores `locale' stuff.
  */
 __uint64_t
-_strtoufix64_r (struct _reent *rptr,
+_strtoufix64_r (__reent_ptr_t rptr,
 	const char *nptr,
 	char **endptr)
 {
diff --git a/newlib/libc/machine/powerpc/ufix64toa.c b/newlib/libc/machine/powerpc/ufix64toa.c
index c829b9b33e3e..c51e859ec5d2 100644
--- a/newlib/libc/machine/powerpc/ufix64toa.c
+++ b/newlib/libc/machine/powerpc/ufix64toa.c
@@ -15,7 +15,7 @@
 #include <reent.h>
 #include "fix64.h"
 
-extern char *_simdldtoa_r (struct _reent *, LONG_DOUBLE_UNION *, int,
+extern char *_simdldtoa_r (__reent_ptr_t, LONG_DOUBLE_UNION *, int,
 			       int, int *, int *, char **);
 
 /*
@@ -25,7 +25,7 @@ extern char *_simdldtoa_r (struct _reent *, LONG_DOUBLE_UNION *, int,
  */
 
 char *
-_ufix64toa_r (struct _reent *rptr,
+_ufix64toa_r (__reent_ptr_t rptr,
 	__uint64_t value,
 	int mode,
 	int ndigits,
diff --git a/newlib/libc/machine/powerpc/vec_mallocr.c b/newlib/libc/machine/powerpc/vec_mallocr.c
index c375c8be2dd8..9fcb49b2963a 100644
--- a/newlib/libc/machine/powerpc/vec_mallocr.c
+++ b/newlib/libc/machine/powerpc/vec_mallocr.c
@@ -56,20 +56,20 @@ extern "C" {
 #endif
 
 #if __STD_C
-extern void __malloc_lock(struct _reent *);
-extern void __malloc_unlock(struct _reent *);
+extern void __malloc_lock(__reent_ptr_t);
+extern void __malloc_unlock(__reent_ptr_t);
 #else
 extern void __malloc_lock();
 extern void __malloc_unlock();
 #endif
 
 #if __STD_C
-#define RARG struct _reent *reent_ptr,
-#define RONEARG struct _reent *reent_ptr
+#define RARG __reent_ptr_t reent_ptr,
+#define RONEARG __reent_ptr_t reent_ptr
 #else
 #define RARG reent_ptr
 #define RONEARG reent_ptr
-#define RDECL struct _reent *reent_ptr;
+#define RDECL __reent_ptr_t reent_ptr;
 #endif
 
 #define RCALL reent_ptr,
diff --git a/newlib/libc/machine/powerpc/vfprintf.c b/newlib/libc/machine/powerpc/vfprintf.c
index a8af4c370385..2e675a975b5a 100644
--- a/newlib/libc/machine/powerpc/vfprintf.c
+++ b/newlib/libc/machine/powerpc/vfprintf.c
@@ -153,7 +153,7 @@ typedef union
  */
 static int
 __sprint_r(rptr, fp, uio)
-	struct _reent *rptr;
+	__reent_ptr_t rptr;
 	FILE *fp;
 	register struct __suio *uio;
 {
@@ -176,7 +176,7 @@ __sprint_r(rptr, fp, uio)
  */
 static int
 __sbprintf_r(rptr, fp, fmt, ap)
-	struct _reent *rptr;
+	__reent_ptr_t rptr;
 	register FILE *fp;
 	const char *fmt;
 	va_list ap;
@@ -215,16 +215,16 @@ __sbprintf_r(rptr, fp, fmt, ap)
 #define	DEFPREC		6
 
 #ifdef _NO_LONGDBL
-static char *cvt (struct _reent *, double, int, int, char *, int *, int, int *);
+static char *cvt (__reent_ptr_t, double, int, int, char *, int *, int, int *);
 #else
-static char *cvt (struct _reent *, _LONG_DOUBLE, int, int, char *, int *, int, int *);
+static char *cvt (__reent_ptr_t, _LONG_DOUBLE, int, int, char *, int *, int, int *);
 extern int  _ldcheck (_LONG_DOUBLE *);
 #endif
 
 static int exponent (char *, int, int);
 
 #ifdef __SPE__
-static char *cvt_ufix64 (struct _reent *, unsigned long long, int,  int *, int *);
+static char *cvt_ufix64 (__reent_ptr_t, unsigned long long, int,  int *, int *);
 #endif /* __SPE__ */
 
 #else /* no FLOATING_POINT */
@@ -272,7 +272,7 @@ VFPRINTF (FILE * fp,
 }
 
 int 
-_VFPRINTF_R (struct _reent *data,
+_VFPRINTF_R (__reent_ptr_t data,
 	FILE * fp,
 	const char *fmt0,
 	va_list ap)
@@ -1237,10 +1237,10 @@ error:
 #ifdef FLOATING_POINT
 
 #ifdef _NO_LONGDBL
-extern char *_dtoa_r (struct _reent *, double, int,
+extern char *_dtoa_r (__reent_ptr_t, double, int,
 			      int, int *, int *, char **);
 #else
-extern char *_ldtoa_r (struct _reent *, _LONG_DOUBLE, int,
+extern char *_ldtoa_r (__reent_ptr_t, _LONG_DOUBLE, int,
 			      int, int *, int *, char **);
 #undef word0
 #define word0(x) ldword0(x)
@@ -1248,7 +1248,7 @@ extern char *_ldtoa_r (struct _reent *, _LONG_DOUBLE, int,
 
 static char *
 cvt(data, value, ndigits, flags, sign, decpt, ch, length)
-	struct _reent *data;
+	__reent_ptr_t data;
 #ifdef _NO_LONGDBL
 	double value;
 #else
@@ -1348,11 +1348,11 @@ exponent(p0, exp, fmtch)
 #endif /* FLOATING_POINT */
 
 #ifdef __SPE__
-extern char *_ufix64toa_r (struct _reent *, unsigned long long, int,
+extern char *_ufix64toa_r (__reent_ptr_t, unsigned long long, int,
 			           int, int *, int *, char **);
 static char *
 cvt_ufix64 (data, value, ndigits, decpt, length)
-	struct _reent *data;
+	__reent_ptr_t data;
 	unsigned long long value;
 	int ndigits, *decpt, *length;
 {
diff --git a/newlib/libc/machine/powerpc/vfscanf.c b/newlib/libc/machine/powerpc/vfscanf.c
index ccd290f99439..9250b65d0f2c 100644
--- a/newlib/libc/machine/powerpc/vfscanf.c
+++ b/newlib/libc/machine/powerpc/vfscanf.c
@@ -198,7 +198,7 @@ __svfscanf (fp, fmt0, ap)
 #endif /* !_REENT_ONLY */
 
 int
-_vfscanf_r (struct _reent *data,
+_vfscanf_r (__reent_ptr_t data,
     register FILE *__restrict fp,
     const char *__restrict fmt,
     va_list ap)
@@ -209,7 +209,7 @@ _vfscanf_r (struct _reent *data,
 
 int
 __svfscanf_r (rptr, fp, fmt0, ap)
-     struct _reent *rptr;
+     __reent_ptr_t rptr;
      register FILE *fp;
      char const *fmt0;
      va_list ap;
diff --git a/newlib/libc/machine/spu/c99ppe.h b/newlib/libc/machine/spu/c99ppe.h
index 6e03d2cb9bdd..b2ba7cd6220e 100644
--- a/newlib/libc/machine/spu/c99ppe.h
+++ b/newlib/libc/machine/spu/c99ppe.h
@@ -99,8 +99,8 @@ struct spe_reg128{
   unsigned int slot[4];
 };
 
-void __sinit (struct _reent *);
-FILE  *__sfp (struct _reent *);
+void __sinit (__reent_ptr_t);
+FILE  *__sfp (__reent_ptr_t);
 #define __sfp_free(fp) ( (fp)->_fp = 0 )
 
 #define CHECK_INIT(ptr) \
diff --git a/newlib/libc/machine/spu/fopen.c b/newlib/libc/machine/spu/fopen.c
index 13ecdad1e858..870cdac3c172 100644
--- a/newlib/libc/machine/spu/fopen.c
+++ b/newlib/libc/machine/spu/fopen.c
@@ -51,7 +51,7 @@ fopen (const char *__restrict file,
   int ret;
   c99_fopen_t args;
   FILE *fp;
-  struct _reent *ptr = _REENT;
+  __reent_ptr_t ptr = _REENT;
 
   CHECK_INIT(ptr);
 
diff --git a/newlib/libc/machine/spu/stdio.c b/newlib/libc/machine/spu/stdio.c
index fd45b0014343..52356ff02085 100644
--- a/newlib/libc/machine/spu/stdio.c
+++ b/newlib/libc/machine/spu/stdio.c
@@ -39,7 +39,7 @@ Author: Kazunori Asayama <asayama@sm.sony.co.jp>
 static FILE __fp[SPE_FOPEN_MAX];
 
 FILE *
-__sfp (struct _reent *d)
+__sfp (__reent_ptr_t d)
 {
   int i;
   for (i = 0; i < SPE_FOPEN_MAX; i++) {
@@ -52,7 +52,7 @@ __sfp (struct _reent *d)
 }
 
 static void
-__cleanup (struct _reent *s)
+__cleanup (__reent_ptr_t s)
 {
   int i;
   for (i = 0; i < SPE_FOPEN_MAX; i++) {
@@ -63,7 +63,7 @@ __cleanup (struct _reent *s)
 }
 
 void
-__sinit (struct _reent *s)
+__sinit (__reent_ptr_t s)
 {
   _REENT_CLEANUP(s) = __cleanup;
 
diff --git a/newlib/libc/machine/spu/tmpfile.c b/newlib/libc/machine/spu/tmpfile.c
index e926cbc48b35..3b54a12d7465 100644
--- a/newlib/libc/machine/spu/tmpfile.c
+++ b/newlib/libc/machine/spu/tmpfile.c
@@ -41,7 +41,7 @@ tmpfile (void)
 {
   int ret;
   FILE* fp;
-  struct _reent *ptr = _REENT;
+  __reent_ptr_t ptr = _REENT;
 
   CHECK_INIT(ptr);
 
diff --git a/newlib/libc/machine/xstormy16/callocr.c b/newlib/libc/machine/xstormy16/callocr.c
index 3e5053c67650..4086573414d8 100644
--- a/newlib/libc/machine/xstormy16/callocr.c
+++ b/newlib/libc/machine/xstormy16/callocr.c
@@ -1,7 +1,7 @@
 #include <malloc.h>
 
 void *
-_calloc_r (struct _reent *r, size_t a, size_t b)
+_calloc_r (__reent_ptr_t r, size_t a, size_t b)
 {
   return calloc (a, b);
 }
diff --git a/newlib/libc/machine/xstormy16/freer.c b/newlib/libc/machine/xstormy16/freer.c
index f79ef55495af..a5eaaa0a5a41 100644
--- a/newlib/libc/machine/xstormy16/freer.c
+++ b/newlib/libc/machine/xstormy16/freer.c
@@ -1,7 +1,7 @@
 #include <malloc.h>
 
 void
-_free_r (struct _reent *r, void *x)
+_free_r (__reent_ptr_t r, void *x)
 {
   free (x);
 }
diff --git a/newlib/libc/machine/xstormy16/mallocr.c b/newlib/libc/machine/xstormy16/mallocr.c
index d54df0bdf115..4afa8addf272 100644
--- a/newlib/libc/machine/xstormy16/mallocr.c
+++ b/newlib/libc/machine/xstormy16/mallocr.c
@@ -1,7 +1,7 @@
 #include <malloc.h>
 
 void *
-_malloc_r (struct _reent *r, size_t sz)
+_malloc_r (__reent_ptr_t r, size_t sz)
 {
   return malloc (sz);
 }
diff --git a/newlib/libc/machine/xstormy16/reallocr.c b/newlib/libc/machine/xstormy16/reallocr.c
index 2bf538557b06..aaa0144a012c 100644
--- a/newlib/libc/machine/xstormy16/reallocr.c
+++ b/newlib/libc/machine/xstormy16/reallocr.c
@@ -1,7 +1,7 @@
 #include <malloc.h>
 
 void *
-_realloc_r (struct _reent *r, void *x, size_t sz)
+_realloc_r (__reent_ptr_t r, void *x, size_t sz)
 {
   return realloc (x, sz);
 }
diff --git a/newlib/libc/reent/closer.c b/newlib/libc/reent/closer.c
index eabe64f0183b..426170aeab26 100644
--- a/newlib/libc/reent/closer.c
+++ b/newlib/libc/reent/closer.c
@@ -28,7 +28,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _close_r(struct _reent *<[ptr]>, int <[fd]>);
+	int _close_r(__reent_ptr_t <[ptr]>, int <[fd]>);
 
 DESCRIPTION
 	This is a reentrant version of <<close>>.  It
@@ -37,7 +37,7 @@ DESCRIPTION
 */
 
 int
-_close_r (struct _reent *ptr, int fd)
+_close_r (__reent_ptr_t ptr, int fd)
 {
   int ret;
 
diff --git a/newlib/libc/reent/execr.c b/newlib/libc/reent/execr.c
index 541fb862428f..a1b59638f9cc 100644
--- a/newlib/libc/reent/execr.c
+++ b/newlib/libc/reent/execr.c
@@ -35,7 +35,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _execve_r(struct _reent *<[ptr]>, const char *<[name]>,
+	int _execve_r(__reent_ptr_t <[ptr]>, const char *<[name]>,
                       char *const <[argv]>[], char *const <[env]>[]);
 
 DESCRIPTION
@@ -45,7 +45,7 @@ DESCRIPTION
 */
 
 int
-_execve_r (struct _reent *ptr,
+_execve_r (__reent_ptr_t ptr,
      const char *name,
      char *const argv[],
      char *const env[])
@@ -69,7 +69,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _fork_r(struct _reent *<[ptr]>);
+	int _fork_r(__reent_ptr_t <[ptr]>);
 
 DESCRIPTION
 	This is a reentrant version of <<fork>>.  It
@@ -80,7 +80,7 @@ DESCRIPTION
 #ifndef NO_FORK
 
 int
-_fork_r (struct _reent *ptr)
+_fork_r (__reent_ptr_t ptr)
 {
   int ret;
 
@@ -102,7 +102,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _wait_r(struct _reent *<[ptr]>, int *<[status]>);
+	int _wait_r(__reent_ptr_t <[ptr]>, int *<[status]>);
 
 DESCRIPTION
 	This is a reentrant version of <<wait>>.  It
@@ -111,7 +111,7 @@ DESCRIPTION
 */
 
 int
-_wait_r (struct _reent *ptr,
+_wait_r (__reent_ptr_t ptr,
      int *status)
 {
   int ret;
diff --git a/newlib/libc/reent/fcntlr.c b/newlib/libc/reent/fcntlr.c
index f60aa091c7a3..2d4856ef4f4b 100644
--- a/newlib/libc/reent/fcntlr.c
+++ b/newlib/libc/reent/fcntlr.c
@@ -30,7 +30,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _fcntl_r(struct _reent *<[ptr]>,
+	int _fcntl_r(__reent_ptr_t <[ptr]>,
 		     int <[fd]>, int <[cmd]>, <[arg]>);
 
 DESCRIPTION
@@ -40,7 +40,7 @@ DESCRIPTION
 */
 
 int
-_fcntl_r (struct _reent *ptr,
+_fcntl_r (__reent_ptr_t ptr,
      int fd,
      int cmd,
      int arg)
diff --git a/newlib/libc/reent/fstat64r.c b/newlib/libc/reent/fstat64r.c
index bbb855b899ca..64a9db6517d2 100644
--- a/newlib/libc/reent/fstat64r.c
+++ b/newlib/libc/reent/fstat64r.c
@@ -36,7 +36,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _fstat64_r(struct _reent *<[ptr]>,
+	int _fstat64_r(__reent_ptr_t <[ptr]>,
 		       int <[fd]>, struct stat64 *<[pstat]>);
 
 DESCRIPTION
@@ -47,7 +47,7 @@ DESCRIPTION
 */
 
 int
-_fstat64_r (struct _reent *ptr,
+_fstat64_r (__reent_ptr_t ptr,
      int fd,
      struct stat64 *pstat)
 {
diff --git a/newlib/libc/reent/fstatr.c b/newlib/libc/reent/fstatr.c
index 1521c3336b31..578f1a4ddc40 100644
--- a/newlib/libc/reent/fstatr.c
+++ b/newlib/libc/reent/fstatr.c
@@ -34,7 +34,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _fstat_r(struct _reent *<[ptr]>,
+	int _fstat_r(__reent_ptr_t <[ptr]>,
 		     int <[fd]>, struct stat *<[pstat]>);
 
 DESCRIPTION
@@ -44,7 +44,7 @@ DESCRIPTION
 */
 
 int
-_fstat_r (struct _reent *ptr, int fd, struct stat *pstat)
+_fstat_r (__reent_ptr_t ptr, int fd, struct stat *pstat)
 {
   int ret;
 
diff --git a/newlib/libc/reent/getentropyr.c b/newlib/libc/reent/getentropyr.c
index e3f85e41b398..71b56f996c99 100644
--- a/newlib/libc/reent/getentropyr.c
+++ b/newlib/libc/reent/getentropyr.c
@@ -28,7 +28,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _getentropy_r(struct _reent *<[ptr]>,
+	int _getentropy_r(__reent_ptr_t <[ptr]>,
 		          void *<[buf]>, size_t <[buflen]>);
 
 DESCRIPTION
@@ -38,7 +38,7 @@ DESCRIPTION
 */
 
 int
-_getentropy_r (struct _reent *ptr,
+_getentropy_r (__reent_ptr_t ptr,
      void *buf,
      size_t buflen)
 {
diff --git a/newlib/libc/reent/getreent.c b/newlib/libc/reent/getreent.c
index 86bb04fb9414..dd246143542a 100644
--- a/newlib/libc/reent/getreent.c
+++ b/newlib/libc/reent/getreent.c
@@ -15,7 +15,7 @@ int _dummy_getreent;
 #undef __getreent
 #endif
 
-struct _reent *
+__reent_ptr_t
 __getreent (void)
 {
   return _impure_ptr;
diff --git a/newlib/libc/reent/gettimeofdayr.c b/newlib/libc/reent/gettimeofdayr.c
index aa60e5e3ac72..17d5ec17ecc9 100644
--- a/newlib/libc/reent/gettimeofdayr.c
+++ b/newlib/libc/reent/gettimeofdayr.c
@@ -38,7 +38,7 @@ INDEX
 SYNOPSIS
 	#include <reent.h>
 	#include <time.h>
-	int _gettimeofday_r(struct _reent *<[ptr]>,
+	int _gettimeofday_r(__reent_ptr_t <[ptr]>,
 		struct timeval *<[ptimeval]>,
 		void *<[ptimezone]>);
 
@@ -52,7 +52,7 @@ DESCRIPTION
 */
 
 int
-_gettimeofday_r (struct _reent *ptr,
+_gettimeofday_r (__reent_ptr_t ptr,
      struct timeval *ptimeval,
      void *ptimezone)
 {
diff --git a/newlib/libc/reent/isattyr.c b/newlib/libc/reent/isattyr.c
index bbc7f4c9bdbd..9165318bf569 100644
--- a/newlib/libc/reent/isattyr.c
+++ b/newlib/libc/reent/isattyr.c
@@ -32,7 +32,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _isatty_r(struct _reent *<[ptr]>,
+	int _isatty_r(__reent_ptr_t <[ptr]>,
 		     int <[fd]>);
 
 DESCRIPTION
@@ -42,7 +42,7 @@ DESCRIPTION
 */
 
 int
-_isatty_r (struct _reent *ptr, int fd)
+_isatty_r (__reent_ptr_t ptr, int fd)
 {
   int ret;
 
diff --git a/newlib/libc/reent/linkr.c b/newlib/libc/reent/linkr.c
index 169b6eeecd8b..c78c87614c0b 100644
--- a/newlib/libc/reent/linkr.c
+++ b/newlib/libc/reent/linkr.c
@@ -33,7 +33,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _link_r(struct _reent *<[ptr]>,
+	int _link_r(__reent_ptr_t <[ptr]>,
 		    const char *<[old]>, const char *<[new]>);
 
 DESCRIPTION
@@ -43,7 +43,7 @@ DESCRIPTION
 */
 
 int
-_link_r (struct _reent *ptr,
+_link_r (__reent_ptr_t ptr,
      const char *old,
      const char *new)
 {
diff --git a/newlib/libc/reent/lseek64r.c b/newlib/libc/reent/lseek64r.c
index c9afd01df4ea..0cfc587d29fb 100644
--- a/newlib/libc/reent/lseek64r.c
+++ b/newlib/libc/reent/lseek64r.c
@@ -30,7 +30,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	off64_t _lseek64_r(struct _reent *<[ptr]>,
+	off64_t _lseek64_r(__reent_ptr_t <[ptr]>,
 		           int <[fd]>, off64_t <[pos]>, int <[whence]>);
 
 DESCRIPTION
@@ -41,7 +41,7 @@ DESCRIPTION
 */
 
 _off64_t
-_lseek64_r (struct _reent *ptr,
+_lseek64_r (__reent_ptr_t ptr,
      int fd,
      _off64_t pos,
      int whence)
diff --git a/newlib/libc/reent/lseekr.c b/newlib/libc/reent/lseekr.c
index 77e66b8e1eee..c913801b4e7b 100644
--- a/newlib/libc/reent/lseekr.c
+++ b/newlib/libc/reent/lseekr.c
@@ -28,7 +28,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	off_t _lseek_r(struct _reent *<[ptr]>,
+	off_t _lseek_r(__reent_ptr_t <[ptr]>,
 		       int <[fd]>, off_t <[pos]>, int <[whence]>);
 
 DESCRIPTION
@@ -38,7 +38,7 @@ DESCRIPTION
 */
 
 _off_t
-_lseek_r (struct _reent *ptr,
+_lseek_r (__reent_ptr_t ptr,
      int fd,
      _off_t pos,
      int whence)
diff --git a/newlib/libc/reent/mkdirr.c b/newlib/libc/reent/mkdirr.c
index cf66a24d32a8..6aa6bffa1eb4 100644
--- a/newlib/libc/reent/mkdirr.c
+++ b/newlib/libc/reent/mkdirr.c
@@ -28,7 +28,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _mkdir_r(struct _reent *<[ptr]>,
+	int _mkdir_r(__reent_ptr_t <[ptr]>,
 		     const char *<[path]>, int <[mode]>);
 
 DESCRIPTION
@@ -40,7 +40,7 @@ DESCRIPTION
 #include <sys/stat.h>
 
 int
-_mkdir_r (struct _reent *ptr,
+_mkdir_r (__reent_ptr_t ptr,
      const char *path,
      int mode)
 {
diff --git a/newlib/libc/reent/open64r.c b/newlib/libc/reent/open64r.c
index fe288d083ed4..9752c59fefa7 100644
--- a/newlib/libc/reent/open64r.c
+++ b/newlib/libc/reent/open64r.c
@@ -31,7 +31,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _open64_r(struct _reent *<[ptr]>,
+	int _open64_r(__reent_ptr_t <[ptr]>,
   		      const char *<[file]>, int <[flags]>, int <[mode]>);
 
 DESCRIPTION
@@ -43,7 +43,7 @@ DESCRIPTION
 
 int
 _open64_r (ptr, file, flags, mode)
-     struct _reent *ptr;
+     __reent_ptr_t ptr;
      const char *file;
      int flags;
      int mode;
diff --git a/newlib/libc/reent/openr.c b/newlib/libc/reent/openr.c
index 824315438e85..35f2ca2fe599 100644
--- a/newlib/libc/reent/openr.c
+++ b/newlib/libc/reent/openr.c
@@ -29,7 +29,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _open_r(struct _reent *<[ptr]>,
+	int _open_r(__reent_ptr_t <[ptr]>,
 		    const char *<[file]>, int <[flags]>, int <[mode]>);
 
 DESCRIPTION
@@ -39,7 +39,7 @@ DESCRIPTION
 */
 
 int
-_open_r (struct _reent *ptr,
+_open_r (__reent_ptr_t ptr,
      const char *file,
      int flags,
      int mode)
diff --git a/newlib/libc/reent/readr.c b/newlib/libc/reent/readr.c
index b2ae300d32f6..e64dcc036136 100644
--- a/newlib/libc/reent/readr.c
+++ b/newlib/libc/reent/readr.c
@@ -28,7 +28,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	_ssize_t _read_r(struct _reent *<[ptr]>,
+	_ssize_t _read_r(__reent_ptr_t <[ptr]>,
 		         int <[fd]>, void *<[buf]>, size_t <[cnt]>);
 
 DESCRIPTION
@@ -38,7 +38,7 @@ DESCRIPTION
 */
 
 _ssize_t
-_read_r (struct _reent *ptr,
+_read_r (__reent_ptr_t ptr,
      int fd,
      void *buf,
      size_t cnt)
diff --git a/newlib/libc/reent/reent.c b/newlib/libc/reent/reent.c
index 74503fa59291..73a95756d57b 100644
--- a/newlib/libc/reent/reent.c
+++ b/newlib/libc/reent/reent.c
@@ -28,7 +28,7 @@ int errno;
 #endif
 
 void
-_reclaim_reent (struct _reent *ptr)
+_reclaim_reent (__reent_ptr_t ptr)
 {
 #ifndef _REENT_THREAD_LOCAL
   if (ptr != _impure_ptr)
diff --git a/newlib/libc/reent/reent.tex b/newlib/libc/reent/reent.tex
index 881c572c61a0..f5de9b2e885e 100644
--- a/newlib/libc/reent/reent.tex
+++ b/newlib/libc/reent/reent.tex
@@ -23,6 +23,16 @@ has a different name, normally formed by prepending @samp{_} and
 appending @samp{_r}, and takes a pointer to the particular reentrancy
 structure to use.
 
+The argument type is @code{__reent_ptr_t}, normally a typedef for
+@code{struct _reent *}.  With @code{_REENT_THREAD_LOCAL}, state is instead
+stored in dedicated thread-local objects.  If the configured C compiler
+supports zero-sized empty structures, @code{__reent_ptr_t} is such a
+structure, allowing the unused argument to be omitted by the calling
+convention.  Otherwise the type remains a pointer.  Use @code{_REENT} for
+the current context in either configuration, rather than passing a literal
+@code{NULL}.  All callers and platform implementations of reentrant
+functions must use the same configured argument type.
+
 For example, the function @code{fopen} takes two arguments, @var{file}
 and @var{mode}, and uses the global reentrancy structure.  The function
 @code{_fopen_r} takes the arguments, @var{struct_reent}, which is a
diff --git a/newlib/libc/reent/renamer.c b/newlib/libc/reent/renamer.c
index 7e1e111a8d20..a34709f888f8 100644
--- a/newlib/libc/reent/renamer.c
+++ b/newlib/libc/reent/renamer.c
@@ -30,7 +30,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _rename_r(struct _reent *<[ptr]>,
+	int _rename_r(__reent_ptr_t <[ptr]>,
 		const char *<[old]>, const char *<[new]>);
 
 DESCRIPTION
@@ -40,7 +40,7 @@ DESCRIPTION
 */
 
 int
-_rename_r (struct _reent *ptr,
+_rename_r (__reent_ptr_t ptr,
      const char *old,
      const char *new)
 {
diff --git a/newlib/libc/reent/sbrkr.c b/newlib/libc/reent/sbrkr.c
index ec948fe6bf0e..faa7a2aeca4b 100644
--- a/newlib/libc/reent/sbrkr.c
+++ b/newlib/libc/reent/sbrkr.c
@@ -32,7 +32,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	void *_sbrk_r(struct _reent *<[ptr]>, ptrdiff_t <[incr]>);
+	void *_sbrk_r(__reent_ptr_t <[ptr]>, ptrdiff_t <[incr]>);
 
 DESCRIPTION
 	This is a reentrant version of <<sbrk>>.  It
@@ -41,7 +41,7 @@ DESCRIPTION
 */
 
 void *
-_sbrk_r (struct _reent *ptr,
+_sbrk_r (__reent_ptr_t ptr,
      ptrdiff_t incr)
 {
   char *ret;
diff --git a/newlib/libc/reent/signalr.c b/newlib/libc/reent/signalr.c
index e4945102fcd1..b15800584850 100644
--- a/newlib/libc/reent/signalr.c
+++ b/newlib/libc/reent/signalr.c
@@ -34,7 +34,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _kill_r(struct _reent *<[ptr]>, int <[pid]>, int <[sig]>);
+	int _kill_r(__reent_ptr_t <[ptr]>, int <[pid]>, int <[sig]>);
 
 DESCRIPTION
 	This is a reentrant version of <<kill>>.  It
@@ -43,7 +43,7 @@ DESCRIPTION
 */
 
 int
-_kill_r (struct _reent *ptr,
+_kill_r (__reent_ptr_t ptr,
      int pid,
      int sig)
 {
@@ -65,7 +65,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _getpid_r(struct _reent *<[ptr]>);
+	int _getpid_r(__reent_ptr_t <[ptr]>);
 
 DESCRIPTION
 	This is a reentrant version of <<getpid>>.  It
@@ -77,7 +77,7 @@ DESCRIPTION
 */
 
 int
-_getpid_r (struct _reent *ptr)
+_getpid_r (__reent_ptr_t ptr)
 {
   int ret;
   ret = _getpid ();
diff --git a/newlib/libc/reent/stat64r.c b/newlib/libc/reent/stat64r.c
index 160d08e33212..7ec3ecc30806 100644
--- a/newlib/libc/reent/stat64r.c
+++ b/newlib/libc/reent/stat64r.c
@@ -35,7 +35,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _stat64_r(struct _reent *<[ptr]>,
+	int _stat64_r(__reent_ptr_t <[ptr]>,
 		    const char *<[file]>, struct stat64 *<[pstat]>);
 
 DESCRIPTION
@@ -45,7 +45,7 @@ DESCRIPTION
 */
 
 int
-_stat64_r (struct _reent *ptr,
+_stat64_r (__reent_ptr_t ptr,
      const char *file,
      struct stat64 *pstat)
 {
diff --git a/newlib/libc/reent/statr.c b/newlib/libc/reent/statr.c
index 99453e789af0..02298f22fbb4 100644
--- a/newlib/libc/reent/statr.c
+++ b/newlib/libc/reent/statr.c
@@ -35,7 +35,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _stat_r(struct _reent *<[ptr]>,
+	int _stat_r(__reent_ptr_t <[ptr]>,
 		    const char *<[file]>, struct stat *<[pstat]>);
 
 DESCRIPTION
@@ -45,7 +45,7 @@ DESCRIPTION
 */
 
 int
-_stat_r (struct _reent *ptr,
+_stat_r (__reent_ptr_t ptr,
      const char *file,
      struct stat *pstat)
 {
diff --git a/newlib/libc/reent/timesr.c b/newlib/libc/reent/timesr.c
index bb890035a319..99d8c1901293 100644
--- a/newlib/libc/reent/timesr.c
+++ b/newlib/libc/reent/timesr.c
@@ -35,7 +35,7 @@ INDEX
 SYNOPSIS
 	#include <reent.h>
 	#include <sys/times.h>
-	clock_t _times_r(struct _reent *<[ptr]>, struct tms *<[ptms]>);
+	clock_t _times_r(__reent_ptr_t <[ptr]>, struct tms *<[ptms]>);
 
 DESCRIPTION
 	This is a reentrant version of <<times>>.  It
@@ -44,7 +44,7 @@ DESCRIPTION
 */
 
 clock_t
-_times_r (struct _reent *ptr,
+_times_r (__reent_ptr_t ptr,
      struct tms *ptms)
 {
   clock_t ret;
diff --git a/newlib/libc/reent/unlinkr.c b/newlib/libc/reent/unlinkr.c
index 495e65b02f33..476af24685a7 100644
--- a/newlib/libc/reent/unlinkr.c
+++ b/newlib/libc/reent/unlinkr.c
@@ -29,7 +29,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	int _unlink_r(struct _reent *<[ptr]>, const char *<[file]>);
+	int _unlink_r(__reent_ptr_t <[ptr]>, const char *<[file]>);
 
 DESCRIPTION
 	This is a reentrant version of <<unlink>>.  It
@@ -38,7 +38,7 @@ DESCRIPTION
 */
 
 int
-_unlink_r (struct _reent *ptr,
+_unlink_r (__reent_ptr_t ptr,
      const char *file)
 {
   int ret;
diff --git a/newlib/libc/reent/writer.c b/newlib/libc/reent/writer.c
index ac2217c57856..77028a5a8811 100644
--- a/newlib/libc/reent/writer.c
+++ b/newlib/libc/reent/writer.c
@@ -28,7 +28,7 @@ INDEX
 
 SYNOPSIS
 	#include <reent.h>
-	_ssize_t _write_r(struct _reent *<[ptr]>,
+	_ssize_t _write_r(__reent_ptr_t <[ptr]>,
 		          int <[fd]>, const void *<[buf]>, size_t <[cnt]>);
 
 DESCRIPTION
@@ -38,7 +38,7 @@ DESCRIPTION
 */
 
 _ssize_t
-_write_r (struct _reent *ptr,
+_write_r (__reent_ptr_t ptr,
      int fd,
      const void *buf,
      size_t cnt)
diff --git a/newlib/libc/signal/raise.c b/newlib/libc/signal/raise.c
index c678c6e2d20b..65493e22e6b6 100644
--- a/newlib/libc/signal/raise.c
+++ b/newlib/libc/signal/raise.c
@@ -60,7 +60,7 @@ raise (int sig)
 #endif
 
 int
-_raise_r (struct _reent *reent,
+_raise_r (__reent_ptr_t reent,
 	int sig)
 {
   return _kill_r (reent, _getpid_r (reent), sig);
diff --git a/newlib/libc/signal/signal.c b/newlib/libc/signal/signal.c
index 77d78f04a3b7..2c9c1273d781 100644
--- a/newlib/libc/signal/signal.c
+++ b/newlib/libc/signal/signal.c
@@ -93,7 +93,7 @@ _Thread_local void (**_tls_sig_func)(int);
 #endif
 
 int
-_init_signal_r (struct _reent *ptr)
+_init_signal_r (__reent_ptr_t ptr)
 {
   int i;
 
@@ -111,7 +111,7 @@ _init_signal_r (struct _reent *ptr)
 }
 
 _sig_func_ptr
-_signal_r (struct _reent *ptr,
+_signal_r (__reent_ptr_t ptr,
 	int sig,
 	_sig_func_ptr func)
 {
@@ -133,7 +133,7 @@ _signal_r (struct _reent *ptr,
 }
 
 int 
-_raise_r (struct _reent *ptr,
+_raise_r (__reent_ptr_t ptr,
      int sig)
 {
   _sig_func_ptr func;
@@ -167,7 +167,7 @@ _raise_r (struct _reent *ptr,
 }
 
 int
-__sigtramp_r (struct _reent *ptr,
+__sigtramp_r (__reent_ptr_t ptr,
      int sig)
 {
   _sig_func_ptr func;
diff --git a/newlib/libc/stdio/asiprintf.c b/newlib/libc/stdio/asiprintf.c
index dedb7fbfabce..cae50ab6d77b 100644
--- a/newlib/libc/stdio/asiprintf.c
+++ b/newlib/libc/stdio/asiprintf.c
@@ -25,7 +25,7 @@
 #include "local.h"
 
 int
-_asiprintf_r (struct _reent *ptr,
+_asiprintf_r (__reent_ptr_t ptr,
        char **strp,
        const char *fmt, ...)
 {
diff --git a/newlib/libc/stdio/asniprintf.c b/newlib/libc/stdio/asniprintf.c
index e930c8d69f64..b1e61cd60b47 100644
--- a/newlib/libc/stdio/asniprintf.c
+++ b/newlib/libc/stdio/asniprintf.c
@@ -14,7 +14,7 @@
 #include "local.h"
 
 char *
-_asniprintf_r (struct _reent *ptr,
+_asniprintf_r (__reent_ptr_t ptr,
        char *buf,
        size_t *lenp,
        const char *fmt, ...)
@@ -69,7 +69,7 @@ asniprintf (char *buf,
   va_list ap;
   FILE f;
   size_t len = *lenp;
-  struct _reent *ptr = _REENT;
+  __reent_ptr_t ptr = _REENT;
 
   if (buf && len)
     {
diff --git a/newlib/libc/stdio/asnprintf.c b/newlib/libc/stdio/asnprintf.c
index 4c9ad586020a..cacd444bb70f 100644
--- a/newlib/libc/stdio/asnprintf.c
+++ b/newlib/libc/stdio/asnprintf.c
@@ -14,7 +14,7 @@
 #include "local.h"
 
 char *
-_asnprintf_r (struct _reent *__restrict ptr,
+_asnprintf_r (__reent_ptr_t __restrict ptr,
        char *buf,
        size_t *lenp,
        const char *__restrict fmt, ...)
@@ -60,7 +60,7 @@ _asnprintf_r (struct _reent *__restrict ptr,
 
 #ifdef _NANO_FORMATTED_IO
 char *
-_asniprintf_r (struct _reent *, char *, size_t *, const char *, ...)
+_asniprintf_r (__reent_ptr_t, char *, size_t *, const char *, ...)
        _ATTRIBUTE ((__alias__("_asnprintf_r")));
 #endif
 
@@ -75,7 +75,7 @@ asnprintf (char *__restrict buf,
   va_list ap;
   FILE f;
   size_t len = *lenp;
-  struct _reent *ptr = _REENT;
+  __reent_ptr_t ptr = _REENT;
 
   if (buf && len)
     {
diff --git a/newlib/libc/stdio/asprintf.c b/newlib/libc/stdio/asprintf.c
index 511d0e0f3f4a..5a9b0405a25f 100644
--- a/newlib/libc/stdio/asprintf.c
+++ b/newlib/libc/stdio/asprintf.c
@@ -25,7 +25,7 @@
 #include "local.h"
 
 int
-_asprintf_r (struct _reent *ptr,
+_asprintf_r (__reent_ptr_t ptr,
        char **__restrict strp,
        const char *__restrict fmt, ...)
 {
@@ -52,7 +52,7 @@ _asprintf_r (struct _reent *ptr,
 
 #ifdef _NANO_FORMATTED_IO
 int
-_asiprintf_r (struct _reent *, char **, const char *, ...)
+_asiprintf_r (__reent_ptr_t, char **, const char *, ...)
        _ATTRIBUTE ((__alias__("_asprintf_r")));
 #endif
 
diff --git a/newlib/libc/stdio/diprintf.c b/newlib/libc/stdio/diprintf.c
index 8ac58354a81c..ff006b1194ea 100644
--- a/newlib/libc/stdio/diprintf.c
+++ b/newlib/libc/stdio/diprintf.c
@@ -21,9 +21,9 @@ SYNOPSIS
 	#include <stdarg.h>
 	int diprintf(int <[fd]>, const char *<[format]>, ...);
 	int vdiprintf(int <[fd]>, const char *<[format]>, va_list <[ap]>);
-	int _diprintf_r(struct _reent *<[ptr]>, int <[fd]>,
+	int _diprintf_r(__reent_ptr_t <[ptr]>, int <[fd]>,
 			const char *<[format]>, ...);
-	int _vdiprintf_r(struct _reent *<[ptr]>, int <[fd]>,
+	int _vdiprintf_r(__reent_ptr_t <[ptr]>, int <[fd]>,
 			const char *<[format]>, va_list <[ap]>);
 
 DESCRIPTION
@@ -49,7 +49,7 @@ Supporting OS subroutines required: <<sbrk>>, <<write>>.
 #include <stdarg.h>
 
 int
-_diprintf_r (struct _reent *ptr,
+_diprintf_r (__reent_ptr_t ptr,
        int fd,
        const char *format, ...)
 {
diff --git a/newlib/libc/stdio/dprintf.c b/newlib/libc/stdio/dprintf.c
index ae9f86d18ab4..7b46c84c61d5 100644
--- a/newlib/libc/stdio/dprintf.c
+++ b/newlib/libc/stdio/dprintf.c
@@ -22,9 +22,9 @@ SYNOPSIS
 	int dprintf(int <[fd]>, const char *restrict <[format]>, ...);
 	int vdprintf(int <[fd]>, const char *restrict <[format]>,
 			va_list <[ap]>);
-	int _dprintf_r(struct _reent *<[ptr]>, int <[fd]>,
+	int _dprintf_r(__reent_ptr_t <[ptr]>, int <[fd]>,
 			const char *restrict <[format]>, ...);
-	int _vdprintf_r(struct _reent *<[ptr]>, int <[fd]>,
+	int _vdprintf_r(__reent_ptr_t <[ptr]>, int <[fd]>,
 			const char *restrict <[format]>, va_list <[ap]>);
 
 DESCRIPTION
@@ -53,7 +53,7 @@ Supporting OS subroutines required: <<sbrk>>, <<write>>.
 #include "local.h"
 
 int
-_dprintf_r (struct _reent *ptr,
+_dprintf_r (__reent_ptr_t ptr,
        int fd,
        const char *__restrict format, ...)
 {
@@ -68,7 +68,7 @@ _dprintf_r (struct _reent *ptr,
 
 #ifdef _NANO_FORMATTED_IO
 int
-_diprintf_r (struct _reent *, int, const char *, ...)
+_diprintf_r (__reent_ptr_t, int, const char *, ...)
        _ATTRIBUTE ((__alias__("_dprintf_r")));
 #endif
 
@@ -80,7 +80,7 @@ dprintf (int fd,
 {
   va_list ap;
   int n;
-  struct _reent *ptr = _REENT;
+  __reent_ptr_t ptr = _REENT;
 
   _REENT_SMALL_CHECK_INIT (ptr);
   va_start (ap, format);
diff --git a/newlib/libc/stdio/fclose.c b/newlib/libc/stdio/fclose.c
index 4c81cbf4b7f5..29eb015f8323 100644
--- a/newlib/libc/stdio/fclose.c
+++ b/newlib/libc/stdio/fclose.c
@@ -27,7 +27,7 @@ INDEX
 SYNOPSIS
 	#include <stdio.h>
 	int fclose(FILE *<[fp]>);
-	int _fclose_r(struct _reent *<[reent]>, FILE *<[fp]>);
+	int _fclose_r(__reent_ptr_t <[reent]>, FILE *<[fp]>);
 
 DESCRIPTION
 If the file or stream identified by <[fp]> is open, <<fclose>> closes
@@ -56,7 +56,7 @@ Required OS subroutines: <<close>>, <<fstat>>, <<isatty>>, <<lseek>>,
 #include "local.h"
 
 int
-_fclose_r (struct _reent *rptr,
+_fclose_r (__reent_ptr_t rptr,
       register FILE * fp)
 {
   int r;
diff --git a/newlib/libc/stdio/fcloseall.c b/newlib/libc/stdio/fcloseall.c
index e840af27c36f..85524a5fba18 100644
--- a/newlib/libc/stdio/fcloseall.c
+++ b/newlib/libc/stdio/fcloseall.c
@@ -27,7 +27,7 @@ INDEX
 SYNOPSIS
 	#include <stdio.h>
 	int fcloseall(void);
-	int _fcloseall_r (struct _reent *<[ptr]>);
+	int _fcloseall_r (__reent_ptr_t <[ptr]>);
 
 DESCRIPTION
 <<fcloseall>> closes all files in the current reentrancy struct's domain.
@@ -57,7 +57,7 @@ Required OS subroutines: <<close>>, <<fstat>>, <<isatty>>, <<lseek>>,
 #include "local.h"
 
 int
-_fcloseall_r (struct _reent *ptr)
+_fcloseall_r (__reent_ptr_t ptr)
 {
   /* There are no thread-specific FILE objects */
   return 0;
diff --git a/newlib/libc/stdio/fdopen.c b/newlib/libc/stdio/fdopen.c
index 3481154d15a8..f45a8883bd2a 100644
--- a/newlib/libc/stdio/fdopen.c
+++ b/newlib/libc/stdio/fdopen.c
@@ -27,7 +27,7 @@ INDEX
 SYNOPSIS
 	#include <stdio.h>
 	FILE *fdopen(int <[fd]>, const char *<[mode]>);
-	FILE *_fdopen_r(struct _reent *<[reent]>,
+	FILE *_fdopen_r(__reent_ptr_t <[reent]>,
                         int <[fd]>, const char *<[mode]>);
 
 DESCRIPTION
@@ -53,7 +53,7 @@ PORTABILITY
 #include <_syslist.h>
 
 FILE *
-_fdopen_r (struct _reent *ptr,
+_fdopen_r (__reent_ptr_t ptr,
        int fd,
        const char *mode)
 {
diff --git a/newlib/libc/stdio/fflush.c b/newlib/libc/stdio/fflush.c
index d51e90153790..b7e85526be7f 100644
--- a/newlib/libc/stdio/fflush.c
+++ b/newlib/libc/stdio/fflush.c
@@ -37,11 +37,11 @@ SYNOPSIS
 	int fflush_unlocked(FILE *<[fp]>);
 
 	#include <stdio.h>
-	int _fflush_r(struct _reent *<[reent]>, FILE *<[fp]>);
+	int _fflush_r(__reent_ptr_t <[reent]>, FILE *<[fp]>);
 
 	#define _BSD_SOURCE
 	#include <stdio.h>
-	int _fflush_unlocked_r(struct _reent *<[reent]>, FILE *<[fp]>);
+	int _fflush_unlocked_r(__reent_ptr_t <[reent]>, FILE *<[fp]>);
 
 DESCRIPTION
 The <<stdio>> output functions can buffer output before delivering it
@@ -100,7 +100,7 @@ No supporting OS subroutines are required.
 /* Core function which does not lock file pointer.  This gets called
    directly from __srefill. */
 int
-__sflush_r (struct _reent *ptr,
+__sflush_r (__reent_ptr_t ptr,
        register FILE * fp)
 {
   register unsigned char *p;
@@ -238,7 +238,7 @@ __sflush_r (struct _reent *ptr,
    and we don't want to move the underlying file pointer unless we're
    writing. */
 int
-__sflushw_r (struct _reent *ptr,
+__sflushw_r (__reent_ptr_t ptr,
        register FILE *fp)
 {
   return (fp->_flags & __SWR) ?  __sflush_r (ptr, fp) : 0;
@@ -248,7 +248,7 @@ __sflushw_r (struct _reent *ptr,
 #endif /* __IMPL_UNLOCKED__ */
 
 int
-_fflush_r (struct _reent *ptr,
+_fflush_r (__reent_ptr_t ptr,
        register FILE * fp)
 {
   int ret;
diff --git a/newlib/libc/stdio/fgetc.c b/newlib/libc/stdio/fgetc.c
index 21a6a9da5c3f..13ba9b9cd4da 100644
--- a/newlib/libc/stdio/fgetc.c
+++ b/newlib/libc/stdio/fgetc.c
@@ -37,11 +37,11 @@ SYNOPSIS
 	int fgetc_unlocked(FILE *<[fp]>);
 
 	#include <stdio.h>
-	int _fgetc_r(struct _reent *<[ptr]>, FILE *<[fp]>);
+	int _fgetc_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>);
 
 	#define _BSD_SOURCE
 	#include <stdio.h>
-	int _fgetc_unlocked_r(struct _reent *<[ptr]>, FILE *<[fp]>);
+	int _fgetc_unlocked_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>);
 
 DESCRIPTION
 Use <<fgetc>> to get the next single character from the file or stream
@@ -85,7 +85,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
 #include "local.h"
 
 int
-_fgetc_r (struct _reent * ptr,
+_fgetc_r (__reent_ptr_t ptr,
        FILE * fp)
 {
   int result;
@@ -103,7 +103,7 @@ fgetc (FILE * fp)
 {
 #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
   int result;
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   CHECK_INIT(reent, fp);
   _newlib_flockfile_start (fp);
diff --git a/newlib/libc/stdio/fgetc_u.c b/newlib/libc/stdio/fgetc_u.c
index 9a5719c293ba..836852d3a953 100644
--- a/newlib/libc/stdio/fgetc_u.c
+++ b/newlib/libc/stdio/fgetc_u.c
@@ -29,7 +29,7 @@
 #include "local.h"
 
 int
-_fgetc_unlocked_r (struct _reent * ptr,
+_fgetc_unlocked_r (__reent_ptr_t ptr,
        FILE * fp)
 {
   CHECK_INIT(ptr, fp);
@@ -42,7 +42,7 @@ int
 fgetc_unlocked (FILE * fp)
 {
 #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   CHECK_INIT(reent, fp);
   return __sgetc_r (reent, fp);
diff --git a/newlib/libc/stdio/fgetpos.c b/newlib/libc/stdio/fgetpos.c
index ba92730a3471..ad24fc5ba4bd 100644
--- a/newlib/libc/stdio/fgetpos.c
+++ b/newlib/libc/stdio/fgetpos.c
@@ -27,7 +27,7 @@ INDEX
 SYNOPSIS
 	#include <stdio.h>
 	int fgetpos(FILE *restrict <[fp]>, fpos_t *restrict <[pos]>);
-	int _fgetpos_r(struct _reent *<[ptr]>, FILE *restrict <[fp]>, fpos_t *restrict <[pos]>);
+	int _fgetpos_r(__reent_ptr_t <[ptr]>, FILE *restrict <[fp]>, fpos_t *restrict <[pos]>);
 
 DESCRIPTION
 Objects of type <<FILE>> can have a ``position'' that records how much
@@ -65,7 +65,7 @@ No supporting OS subroutines are required.
 #include <stdio.h>
 
 int
-_fgetpos_r (struct _reent * ptr,
+_fgetpos_r (__reent_ptr_t ptr,
        FILE *__restrict fp,
        _fpos_t *__restrict pos)
 {
diff --git a/newlib/libc/stdio/fgets.c b/newlib/libc/stdio/fgets.c
index 96a44a765901..0adf4e78b1cf 100644
--- a/newlib/libc/stdio/fgets.c
+++ b/newlib/libc/stdio/fgets.c
@@ -37,10 +37,10 @@ SYNOPSIS
 	char *fgets_unlocked(char *restrict <[buf]>, int <[n]>, FILE *restrict <[fp]>);
 
         #include <stdio.h>
-	char *_fgets_r(struct _reent *<[ptr]>, char *restrict <[buf]>, int <[n]>, FILE *restrict <[fp]>);
+	char *_fgets_r(__reent_ptr_t <[ptr]>, char *restrict <[buf]>, int <[n]>, FILE *restrict <[fp]>);
 
         #include <stdio.h>
-	char *_fgets_unlocked_r(struct _reent *<[ptr]>, char *restrict <[buf]>, int <[n]>, FILE *restrict <[fp]>);
+	char *_fgets_unlocked_r(__reent_ptr_t <[ptr]>, char *restrict <[buf]>, int <[n]>, FILE *restrict <[fp]>);
 
 DESCRIPTION
 	Reads at most <[n-1]> characters from <[fp]> until a newline
@@ -94,7 +94,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
  */
 
 char *
-_fgets_r (struct _reent * ptr,
+_fgets_r (__reent_ptr_t ptr,
        char *__restrict buf,
        int n,
        FILE *__restrict fp)
diff --git a/newlib/libc/stdio/fgetwc.c b/newlib/libc/stdio/fgetwc.c
index 38e2db89772e..d223e802a786 100644
--- a/newlib/libc/stdio/fgetwc.c
+++ b/newlib/libc/stdio/fgetwc.c
@@ -57,11 +57,11 @@ SYNOPSIS
 
 	#include <stdio.h>
 	#include <wchar.h>
-	wint_t _fgetwc_r(struct _reent *<[ptr]>, FILE *<[fp]>);
+	wint_t _fgetwc_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>);
 
 	#include <stdio.h>
 	#include <wchar.h>
-	wint_t _fgetwc_unlocked_r(struct _reent *<[ptr]>, FILE *<[fp]>);
+	wint_t _fgetwc_unlocked_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>);
 
 	#include <stdio.h>
 	#include <wchar.h>
@@ -74,11 +74,11 @@ SYNOPSIS
 
 	#include <stdio.h>
 	#include <wchar.h>
-	wint_t _getwc_r(struct _reent *<[ptr]>, FILE *<[fp]>);
+	wint_t _getwc_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>);
 
 	#include <stdio.h>
 	#include <wchar.h>
-	wint_t _getwc_unlocked_r(struct _reent *<[ptr]>, FILE *<[fp]>);
+	wint_t _getwc_unlocked_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>);
 
 DESCRIPTION
 Use <<fgetwc>> to get the next wide character from the file or stream
@@ -125,7 +125,7 @@ PORTABILITY
 #include "local.h"
 
 wint_t
-__fgetwc (struct _reent *ptr,
+__fgetwc (__reent_ptr_t ptr,
 	register FILE *fp)
 {
   wchar_t wc;
@@ -171,7 +171,7 @@ __fgetwc (struct _reent *ptr,
 }
 
 wint_t
-_fgetwc_r (struct _reent *ptr,
+_fgetwc_r (__reent_ptr_t ptr,
 	register FILE *fp)
 {
   wint_t r;
@@ -188,7 +188,7 @@ _fgetwc_r (struct _reent *ptr,
 wint_t
 fgetwc (FILE *fp)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   CHECK_INIT(reent, fp);
   return _fgetwc_r (reent, fp);
diff --git a/newlib/libc/stdio/fgetwc_u.c b/newlib/libc/stdio/fgetwc_u.c
index 007f9c8445d5..4beeae68ffa3 100644
--- a/newlib/libc/stdio/fgetwc_u.c
+++ b/newlib/libc/stdio/fgetwc_u.c
@@ -30,7 +30,7 @@
 #include "local.h"
 
 wint_t
-_fgetwc_unlocked_r (struct _reent *ptr,
+_fgetwc_unlocked_r (__reent_ptr_t ptr,
 	register FILE *fp)
 {
   if (ORIENT(fp, 1) != 1)
@@ -41,7 +41,7 @@ _fgetwc_unlocked_r (struct _reent *ptr,
 wint_t
 fgetwc_unlocked (FILE *fp)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   CHECK_INIT(reent, fp);
   return _fgetwc_unlocked_r (reent, fp);
diff --git a/newlib/libc/stdio/fgetws.c b/newlib/libc/stdio/fgetws.c
index 3b7fa9516561..342c7c7aa727 100644
--- a/newlib/libc/stdio/fgetws.c
+++ b/newlib/libc/stdio/fgetws.c
@@ -48,11 +48,11 @@ SYNOPSIS
                         FILE *__restrict <[fp]>);
 
 	#include <wchar.h>
-	wchar_t *_fgetws_r(struct _reent *<[ptr]>, wchar_t *<[ws]>,
+	wchar_t *_fgetws_r(__reent_ptr_t <[ptr]>, wchar_t *<[ws]>,
                            int <[n]>, FILE *<[fp]>);
 
 	#include <wchar.h>
-	wchar_t *_fgetws_unlocked_r(struct _reent *<[ptr]>, wchar_t *<[ws]>,
+	wchar_t *_fgetws_unlocked_r(__reent_ptr_t <[ptr]>, wchar_t *<[ws]>,
                            int <[n]>, FILE *<[fp]>);
 
 DESCRIPTION
@@ -99,7 +99,7 @@ PORTABILITY
 #endif
 
 wchar_t *
-_fgetws_r (struct _reent *ptr,
+_fgetws_r (__reent_ptr_t ptr,
 	wchar_t * ws,
 	int n,
 	FILE * fp)
@@ -176,7 +176,7 @@ fgetws (wchar_t *__restrict ws,
 	int n,
 	FILE *__restrict fp)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   CHECK_INIT (reent, fp);
   return _fgetws_r (reent, ws, n, fp);
diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c
index 2cc549537f1b..e3dfeb8de0f3 100644
--- a/newlib/libc/stdio/findfp.c
+++ b/newlib/libc/stdio/findfp.c
@@ -36,7 +36,7 @@ struct _glue __sglue = {NULL, 3, &__sf[0]};
 _Thread_local __FILE *_tls_stdin = &__sf[0];
 _Thread_local __FILE *_tls_stdout = &__sf[1];
 _Thread_local __FILE *_tls_stderr = &__sf[2];
-_Thread_local void (*_tls_cleanup)(struct _reent *);
+_Thread_local void (*_tls_cleanup)(__reent_ptr_t);
 #endif
 
 #ifdef _STDIO_BSD_SEMANTICS
@@ -134,7 +134,7 @@ struct glue_with_file {
 };
 
 static struct _glue *
-sfmoreglue (struct _reent *d, int n)
+sfmoreglue (__reent_ptr_t d, int n)
 {
   struct glue_with_file *g;
 
@@ -171,7 +171,7 @@ global_stdio_init (void)
  */
 
 FILE *
-__sfp (struct _reent *d)
+__sfp (__reent_ptr_t d)
 {
   FILE *fp;
   int n;
@@ -227,7 +227,7 @@ found:
  */
 
 static void
-cleanup_stdio (struct _reent *ptr)
+cleanup_stdio (__reent_ptr_t ptr)
 {
   if (_REENT_STDIN(ptr) != &__sf[0])
     CLEANUP_FILE (ptr, _REENT_STDIN(ptr));
@@ -242,7 +242,7 @@ cleanup_stdio (struct _reent *ptr)
  */
 
 void
-__sinit (struct _reent *s)
+__sinit (__reent_ptr_t s)
 {
   __sfp_lock_acquire ();
 
@@ -277,7 +277,7 @@ __sfp_lock_release (void)
 
 /* Walkable file locking routine.  */
 static int
-__fp_lock (struct _reent * ptr __unused, FILE * fp)
+__fp_lock (__reent_ptr_t ptr __unused, FILE * fp)
 {
   if (!(fp->_flags2 & __SNLK))
     _flockfile (fp);
@@ -287,7 +287,7 @@ __fp_lock (struct _reent * ptr __unused, FILE * fp)
 
 /* Walkable file unlocking routine.  */
 static int
-__fp_unlock (struct _reent * ptr __unused, FILE * fp)
+__fp_unlock (__reent_ptr_t ptr __unused, FILE * fp)
 {
   if (!(fp->_flags2 & __SNLK))
     _funlockfile (fp);
diff --git a/newlib/libc/stdio/fiprintf.c b/newlib/libc/stdio/fiprintf.c
index 8829eb891cad..96f3983e77fe 100644
--- a/newlib/libc/stdio/fiprintf.c
+++ b/newlib/libc/stdio/fiprintf.c
@@ -22,7 +22,7 @@
 #include <stdarg.h>
 
 int
-_fiprintf_r (struct _reent *ptr,
+_fiprintf_r (__reent_ptr_t ptr,
        FILE * fp,
        const char *fmt, ...)
 {
diff --git a/newlib/libc/stdio/fiscanf.c b/newlib/libc/stdio/fiscanf.c
index a1c8361a99ea..2d0bb936f938 100644
--- a/newlib/libc/stdio/fiscanf.c
+++ b/newlib/libc/stdio/fiscanf.c
@@ -38,7 +38,7 @@ fiscanf(FILE *fp, const char *fmt, ...)
 #endif /* !_REENT_ONLY */
 
 int
-_fiscanf_r(struct _reent *ptr, FILE *fp, const char *fmt, ...)
+_fiscanf_r(__reent_ptr_t ptr, FILE *fp, const char *fmt, ...)
 {
   int ret;
   va_list ap;
diff --git a/newlib/libc/stdio/flags.c b/newlib/libc/stdio/flags.c
index 7f3b15e2f311..9cdb9b2bcaa5 100644
--- a/newlib/libc/stdio/flags.c
+++ b/newlib/libc/stdio/flags.c
@@ -30,7 +30,7 @@
  */
 
 int
-__sflags (struct _reent *ptr,
+__sflags (__reent_ptr_t ptr,
        register char *mode,
        int *optr)
 {
diff --git a/newlib/libc/stdio/fmemopen.c b/newlib/libc/stdio/fmemopen.c
index 886ba7efe039..f2e304682251 100644
--- a/newlib/libc/stdio/fmemopen.c
+++ b/newlib/libc/stdio/fmemopen.c
@@ -83,7 +83,7 @@ typedef struct fmemcookie {
 /* Read up to non-zero N bytes into BUF from stream described by
    COOKIE; return number of bytes read (0 on EOF).  */
 static _READ_WRITE_RETURN_TYPE
-fmemreader (struct _reent *ptr,
+fmemreader (__reent_ptr_t ptr,
        void *cookie,
        char *buf,
        _READ_WRITE_BUFSIZE_TYPE n)
@@ -102,7 +102,7 @@ fmemreader (struct _reent *ptr,
 /* Write up to non-zero N bytes of BUF into the stream described by COOKIE,
    returning the number of bytes written or EOF on failure.  */
 static _READ_WRITE_RETURN_TYPE
-fmemwriter (struct _reent *ptr,
+fmemwriter (__reent_ptr_t ptr,
        void *cookie,
        const char *buf,
        _READ_WRITE_BUFSIZE_TYPE n)
@@ -157,7 +157,7 @@ fmemwriter (struct _reent *ptr,
 /* Seek to position POS relative to WHENCE within stream described by
    COOKIE; return resulting position or fail with EOF.  */
 static _fpos_t
-fmemseeker (struct _reent *ptr,
+fmemseeker (__reent_ptr_t ptr,
        void *cookie,
        _fpos_t pos,
        int whence)
@@ -211,7 +211,7 @@ fmemseeker (struct _reent *ptr,
    COOKIE; return resulting position or fail with EOF.  */
 #ifdef __LARGE64_FILES
 static _fpos64_t
-fmemseeker64 (struct _reent *ptr,
+fmemseeker64 (__reent_ptr_t ptr,
        void *cookie,
        _fpos64_t pos,
        int whence)
@@ -252,7 +252,7 @@ fmemseeker64 (struct _reent *ptr,
 
 /* Reclaim resources used by stream described by COOKIE.  */
 static int
-fmemcloser (struct _reent *ptr,
+fmemcloser (__reent_ptr_t ptr,
        void *cookie)
 {
   fmemcookie *c = (fmemcookie *) cookie;
@@ -263,7 +263,7 @@ fmemcloser (struct _reent *ptr,
 /* Open a memstream around buffer BUF of SIZE bytes, using MODE.
    Return the new stream, or fail with NULL.  */
 FILE *
-_fmemopen_r (struct _reent *ptr,
+_fmemopen_r (__reent_ptr_t ptr,
        void *__restrict buf,
        size_t size,
        const char *__restrict mode)
diff --git a/newlib/libc/stdio/fopen.c b/newlib/libc/stdio/fopen.c
index 8239fd6b61c9..c023c62d87c9 100644
--- a/newlib/libc/stdio/fopen.c
+++ b/newlib/libc/stdio/fopen.c
@@ -28,7 +28,7 @@ SYNOPSIS
 	#include <stdio.h>
 	FILE *fopen(const char *<[file]>, const char *<[mode]>);
 
-	FILE *_fopen_r(struct _reent *<[reent]>, 
+	FILE *_fopen_r(__reent_ptr_t <[reent]>,
                        const char *<[file]>, const char *<[mode]>);
 
 DESCRIPTION
@@ -111,7 +111,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #include "local.h"
 
 FILE *
-_fopen_r (struct _reent *ptr,
+_fopen_r (__reent_ptr_t ptr,
        const char *__restrict file,
        const char *__restrict mode)
 {
diff --git a/newlib/libc/stdio/fopencookie.c b/newlib/libc/stdio/fopencookie.c
index ab406a866aea..75f854783a17 100644
--- a/newlib/libc/stdio/fopencookie.c
+++ b/newlib/libc/stdio/fopencookie.c
@@ -98,7 +98,7 @@ typedef struct fccookie {
 } fccookie;
 
 static _READ_WRITE_RETURN_TYPE
-fcreader (struct _reent *ptr,
+fcreader (__reent_ptr_t ptr,
        void *cookie,
        char *buf,
        _READ_WRITE_BUFSIZE_TYPE n)
@@ -112,7 +112,7 @@ fcreader (struct _reent *ptr,
 }
 
 static _READ_WRITE_RETURN_TYPE
-fcwriter (struct _reent *ptr,
+fcwriter (__reent_ptr_t ptr,
        void *cookie,
        const char *buf,
        _READ_WRITE_BUFSIZE_TYPE n)
@@ -134,7 +134,7 @@ fcwriter (struct _reent *ptr,
 }
 
 static _fpos_t
-fcseeker (struct _reent *ptr,
+fcseeker (__reent_ptr_t ptr,
        void *cookie,
        _fpos_t pos,
        int whence)
@@ -161,7 +161,7 @@ fcseeker (struct _reent *ptr,
 
 #ifdef __LARGE64_FILES
 static _fpos64_t
-fcseeker64 (struct _reent *ptr,
+fcseeker64 (__reent_ptr_t ptr,
        void *cookie,
        _fpos64_t pos,
        int whence)
@@ -176,7 +176,7 @@ fcseeker64 (struct _reent *ptr,
 #endif /* __LARGE64_FILES */
 
 static int
-fccloser (struct _reent *ptr,
+fccloser (__reent_ptr_t ptr,
        void *cookie)
 {
   int result = 0;
@@ -192,7 +192,7 @@ fccloser (struct _reent *ptr,
 }
 
 FILE *
-_fopencookie_r (struct _reent *ptr,
+_fopencookie_r (__reent_ptr_t ptr,
        void *cookie,
        const char *mode,
        cookie_io_functions_t functions)
diff --git a/newlib/libc/stdio/fprintf.c b/newlib/libc/stdio/fprintf.c
index b6c0ea8c0262..016b3b7d7404 100644
--- a/newlib/libc/stdio/fprintf.c
+++ b/newlib/libc/stdio/fprintf.c
@@ -22,7 +22,7 @@
 #include <stdarg.h>
 
 int
-_fprintf_r (struct _reent *ptr,
+_fprintf_r (__reent_ptr_t ptr,
        FILE *__restrict fp,
        const char *__restrict fmt, ...)
 {
@@ -37,7 +37,7 @@ _fprintf_r (struct _reent *ptr,
 
 #ifdef _NANO_FORMATTED_IO
 int
-_fiprintf_r (struct _reent *, FILE *, const char *, ...)
+_fiprintf_r (__reent_ptr_t, FILE *, const char *, ...)
        _ATTRIBUTE ((__alias__("_fprintf_r")));
 #endif
 
diff --git a/newlib/libc/stdio/fpurge.c b/newlib/libc/stdio/fpurge.c
index 93ac0e2a9ce7..27bafd4df1b7 100644
--- a/newlib/libc/stdio/fpurge.c
+++ b/newlib/libc/stdio/fpurge.c
@@ -18,7 +18,7 @@ SYNOPSIS
 	#include <stdio.h>
 	int fpurge(FILE *<[fp]>);
 
-	int _fpurge_r(struct _reent *<[reent]>, FILE *<[fp]>);
+	int _fpurge_r(__reent_ptr_t <[reent]>, FILE *<[fp]>);
 
 	#include <stdio.h>
 	#include <stdio_ext.h>
@@ -60,7 +60,7 @@ No supporting OS subroutines are required.
 /* Discard I/O from a single file.  */
 
 int
-_fpurge_r (struct _reent *ptr,
+_fpurge_r (__reent_ptr_t ptr,
        register FILE * fp)
 {
   int t;
diff --git a/newlib/libc/stdio/fputc.c b/newlib/libc/stdio/fputc.c
index 5dfa9c06e213..ab5ffcd158a6 100644
--- a/newlib/libc/stdio/fputc.c
+++ b/newlib/libc/stdio/fputc.c
@@ -87,7 +87,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
 #include "local.h"
 
 int
-_fputc_r (struct _reent *ptr,
+_fputc_r (__reent_ptr_t ptr,
        int ch,
        FILE * file)
 {
@@ -106,7 +106,7 @@ fputc (int ch,
 {
 #if !defined(__OPTIMIZE_SIZE__) && !defined(PREFER_SIZE_OVER_SPEED)
   int result;
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   CHECK_INIT(reent, file);
    _newlib_flockfile_start (file);
diff --git a/newlib/libc/stdio/fputc_u.c b/newlib/libc/stdio/fputc_u.c
index 9e16069bc97c..b729e88b2e25 100644
--- a/newlib/libc/stdio/fputc_u.c
+++ b/newlib/libc/stdio/fputc_u.c
@@ -29,7 +29,7 @@
 #include "local.h"
 
 int
-_fputc_unlocked_r (struct _reent *ptr,
+_fputc_unlocked_r (__reent_ptr_t ptr,
        int ch,
        FILE * file)
 {
@@ -43,7 +43,7 @@ fputc_unlocked (int ch,
        FILE * file)
 {
 #if !defined(__OPTIMIZE_SIZE__) && !defined(PREFER_SIZE_OVER_SPEED)
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   CHECK_INIT(reent, file);
   return _putc_unlocked_r (reent, ch, file);
diff --git a/newlib/libc/stdio/fputs.c b/newlib/libc/stdio/fputs.c
index 7437949433d4..2f5d39526484 100644
--- a/newlib/libc/stdio/fputs.c
+++ b/newlib/libc/stdio/fputs.c
@@ -37,10 +37,10 @@ SYNOPSIS
 	int fputs_unlocked(const char *restrict <[s]>, FILE *restrict <[fp]>);
 
 	#include <stdio.h>
-	int _fputs_r(struct _reent *<[ptr]>, const char *restrict <[s]>, FILE *restrict <[fp]>);
+	int _fputs_r(__reent_ptr_t <[ptr]>, const char *restrict <[s]>, FILE *restrict <[fp]>);
 
 	#include <stdio.h>
-	int _fputs_unlocked_r(struct _reent *<[ptr]>, const char *restrict <[s]>, FILE *restrict <[fp]>);
+	int _fputs_unlocked_r(__reent_ptr_t <[ptr]>, const char *restrict <[s]>, FILE *restrict <[fp]>);
 
 DESCRIPTION
 <<fputs>> writes the string at <[s]> (but without the trailing null)
@@ -86,7 +86,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
  * Write the given string to the given file.
  */
 int
-_fputs_r (struct _reent * ptr,
+_fputs_r (__reent_ptr_t ptr,
        char const *__restrict s,
        FILE *__restrict fp)
 {
diff --git a/newlib/libc/stdio/fputwc.c b/newlib/libc/stdio/fputwc.c
index e2aadefd53de..542c72c0c96f 100644
--- a/newlib/libc/stdio/fputwc.c
+++ b/newlib/libc/stdio/fputwc.c
@@ -57,11 +57,11 @@ SYNOPSIS
 
 	#include <stdio.h>
 	#include <wchar.h>
-	wint_t _fputwc_r(struct _reent *<[ptr]>, wchar_t <[wc]>, FILE *<[fp]>);
+	wint_t _fputwc_r(__reent_ptr_t <[ptr]>, wchar_t <[wc]>, FILE *<[fp]>);
 
 	#include <stdio.h>
 	#include <wchar.h>
-	wint_t _fputwc_unlocked_r(struct _reent *<[ptr]>, wchar_t <[wc]>, FILE *<[fp]>);
+	wint_t _fputwc_unlocked_r(__reent_ptr_t <[ptr]>, wchar_t <[wc]>, FILE *<[fp]>);
 
 	#include <stdio.h>
 	#include <wchar.h>
@@ -74,11 +74,11 @@ SYNOPSIS
 
 	#include <stdio.h>
 	#include <wchar.h>
-	wint_t _putwc_r(struct _reent *<[ptr]>, wchar_t <[wc]>, FILE *<[fp]>);
+	wint_t _putwc_r(__reent_ptr_t <[ptr]>, wchar_t <[wc]>, FILE *<[fp]>);
 
 	#include <stdio.h>
 	#include <wchar.h>
-	wint_t _putwc_unlocked_r(struct _reent *<[ptr]>, wchar_t <[wc]>, FILE *<[fp]>);
+	wint_t _putwc_unlocked_r(__reent_ptr_t <[ptr]>, wchar_t <[wc]>, FILE *<[fp]>);
 
 DESCRIPTION
 <<fputwc>> writes the wide character argument <[wc]> to the file or
@@ -128,7 +128,7 @@ PORTABILITY
 #include "local.h"
 
 wint_t
-__fputwc (struct _reent *ptr,
+__fputwc (__reent_ptr_t ptr,
 	wchar_t wc,
 	FILE *fp)
 {
@@ -162,7 +162,7 @@ __fputwc (struct _reent *ptr,
 }
 
 wint_t
-_fputwc_r (struct _reent *ptr,
+_fputwc_r (__reent_ptr_t ptr,
 	wchar_t wc,
 	FILE *fp)
 {
@@ -178,7 +178,7 @@ wint_t
 fputwc (wchar_t wc,
 	FILE *fp)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   CHECK_INIT(reent, fp);
   wint_t r;
diff --git a/newlib/libc/stdio/fputwc_u.c b/newlib/libc/stdio/fputwc_u.c
index f54bcf30f735..a6adab4ecb0b 100644
--- a/newlib/libc/stdio/fputwc_u.c
+++ b/newlib/libc/stdio/fputwc_u.c
@@ -30,7 +30,7 @@
 #include "local.h"
 
 wint_t
-_fputwc_unlocked_r (struct _reent *ptr,
+_fputwc_unlocked_r (__reent_ptr_t ptr,
 	wchar_t wc,
 	FILE *fp)
 {
@@ -41,7 +41,7 @@ wint_t
 fputwc_unlocked (wchar_t wc,
 	FILE *fp)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   CHECK_INIT(reent, fp);
   return __fputwc(reent, wc, fp);
diff --git a/newlib/libc/stdio/fputws.c b/newlib/libc/stdio/fputws.c
index f9fe4a4b324f..af13006733a5 100644
--- a/newlib/libc/stdio/fputws.c
+++ b/newlib/libc/stdio/fputws.c
@@ -46,11 +46,11 @@ SYNOPSIS
 	int fputws_unlocked(const wchar_t *__restrict <[ws]>, FILE *__restrict <[fp]>);
 
 	#include <wchar.h>
-	int _fputws_r(struct _reent *<[ptr]>, const wchar_t *<[ws]>,
+	int _fputws_r(__reent_ptr_t <[ptr]>, const wchar_t *<[ws]>,
                       FILE *<[fp]>);
 
 	#include <wchar.h>
-	int _fputws_unlocked_r(struct _reent *<[ptr]>, const wchar_t *<[ws]>,
+	int _fputws_unlocked_r(__reent_ptr_t <[ptr]>, const wchar_t *<[ws]>,
                                FILE *<[fp]>);
 
 DESCRIPTION
@@ -94,7 +94,7 @@ PORTABILITY
 #endif
 
 int
-_fputws_r (struct _reent *ptr,
+_fputws_r (__reent_ptr_t ptr,
 	const wchar_t *ws,
 	FILE *fp)
 {
@@ -160,7 +160,7 @@ int
 fputws (const wchar_t *__restrict ws,
 	FILE *__restrict fp)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   CHECK_INIT (reent, fp);
   return _fputws_r (reent, ws, fp);
diff --git a/newlib/libc/stdio/fread.c b/newlib/libc/stdio/fread.c
index 8664dc3e5ee2..ca294074da06 100644
--- a/newlib/libc/stdio/fread.c
+++ b/newlib/libc/stdio/fread.c
@@ -39,11 +39,11 @@ SYNOPSIS
 		     FILE *restrict <[fp]>);
 
 	#include <stdio.h>
-	size_t _fread_r(struct _reent *<[ptr]>, void *restrict <[buf]>,
+	size_t _fread_r(__reent_ptr_t <[ptr]>, void *restrict <[buf]>,
 	                size_t <[size]>, size_t <[count]>, FILE *restrict <[fp]>);
 
 	#include <stdio.h>
-	size_t _fread_unlocked_r(struct _reent *<[ptr]>, void *restrict <[buf]>,
+	size_t _fread_unlocked_r(__reent_ptr_t <[ptr]>, void *restrict <[buf]>,
 	                size_t <[size]>, size_t <[count]>, FILE *restrict <[fp]>);
 
 DESCRIPTION
@@ -93,7 +93,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
 
 #ifdef __SCLE
 static size_t
-crlf_r (struct _reent * ptr,
+crlf_r (__reent_ptr_t ptr,
        FILE * fp,
        char * buf,
        size_t count,
@@ -141,7 +141,7 @@ crlf_r (struct _reent * ptr,
 #endif
 
 size_t
-_fread_r (struct _reent * ptr,
+_fread_r (__reent_ptr_t ptr,
        void *__restrict buf,
        size_t size,
        size_t count,
diff --git a/newlib/libc/stdio/freopen.c b/newlib/libc/stdio/freopen.c
index f0da9a159380..f1af546bb937 100644
--- a/newlib/libc/stdio/freopen.c
+++ b/newlib/libc/stdio/freopen.c
@@ -28,7 +28,7 @@ SYNOPSIS
 	#include <stdio.h>
 	FILE *freopen(const char *restrict <[file]>, const char *restrict <[mode]>,
 		      FILE *restrict <[fp]>);
-	FILE *_freopen_r(struct _reent *<[ptr]>, const char *restrict <[file]>,
+	FILE *_freopen_r(__reent_ptr_t <[ptr]>, const char *restrict <[file]>,
 		      const char *restrict <[mode]>, FILE *restrict <[fp]>);
 
 DESCRIPTION
@@ -75,7 +75,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
  */
 
 FILE *
-_freopen_r (struct _reent *ptr,
+_freopen_r (__reent_ptr_t ptr,
        const char *__restrict file,
        const char *__restrict mode,
        register FILE *__restrict fp)
diff --git a/newlib/libc/stdio/fscanf.c b/newlib/libc/stdio/fscanf.c
index 40964d2c224d..a60a97ca3147 100644
--- a/newlib/libc/stdio/fscanf.c
+++ b/newlib/libc/stdio/fscanf.c
@@ -44,7 +44,7 @@ fiscanf (FILE *, const char *, ...)
 #endif /* !_REENT_ONLY */
 
 int
-_fscanf_r(struct _reent *ptr, FILE *__restrict fp, const char *__restrict fmt, ...)
+_fscanf_r(__reent_ptr_t ptr, FILE *__restrict fp, const char *__restrict fmt, ...)
 {
   int ret;
   va_list ap;
@@ -57,6 +57,6 @@ _fscanf_r(struct _reent *ptr, FILE *__restrict fp, const char *__restrict fmt, .
 
 #ifdef _NANO_FORMATTED_IO
 int
-_fiscanf_r (struct _reent *, FILE *, const char *, ...)
+_fiscanf_r (__reent_ptr_t, FILE *, const char *, ...)
        _ATTRIBUTE ((__alias__("_fscanf_r")));
 #endif
diff --git a/newlib/libc/stdio/fseek.c b/newlib/libc/stdio/fseek.c
index e9278af8d283..dcb4d066b516 100644
--- a/newlib/libc/stdio/fseek.c
+++ b/newlib/libc/stdio/fseek.c
@@ -32,9 +32,9 @@ SYNOPSIS
 	#include <stdio.h>
 	int fseek(FILE *<[fp]>, long <[offset]>, int <[whence]>);
 	int fseeko(FILE *<[fp]>, off_t <[offset]>, int <[whence]>);
-	int _fseek_r(struct _reent *<[ptr]>, FILE *<[fp]>,
+	int _fseek_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>,
 	             long <[offset]>, int <[whence]>);
-	int _fseeko_r(struct _reent *<[ptr]>, FILE *<[fp]>,
+	int _fseeko_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>,
 	             off_t <[offset]>, int <[whence]>);
 
 DESCRIPTION
@@ -81,7 +81,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
 #include "local.h"
 
 int
-_fseek_r (struct _reent *ptr,
+_fseek_r (__reent_ptr_t ptr,
        register FILE *fp,
        long offset,
        int whence)
diff --git a/newlib/libc/stdio/fseeko.c b/newlib/libc/stdio/fseeko.c
index 6fcc8ef0672c..5c1ed94baa15 100644
--- a/newlib/libc/stdio/fseeko.c
+++ b/newlib/libc/stdio/fseeko.c
@@ -32,9 +32,9 @@ SYNOPSIS
 	#include <stdio.h>
 	int fseek(FILE *<[fp]>, long <[offset]>, int <[whence]>)
 	int fseeko(FILE *<[fp]>, off_t <[offset]>, int <[whence]>)
-	int _fseek_r(struct _reent *<[ptr]>, FILE *<[fp]>,
+	int _fseek_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>,
 	             long <[offset]>, int <[whence]>)
-	int _fseeko_r(struct _reent *<[ptr]>, FILE *<[fp]>,
+	int _fseeko_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>,
 	             off_t <[offset]>, int <[whence]>)
 
 DESCRIPTION
@@ -93,12 +93,12 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
  */
 
 int
-_fseeko_r (struct _reent *ptr,
+_fseeko_r (__reent_ptr_t ptr,
        register FILE *fp,
        _off_t offset,
        int whence)
 {
-  _fpos_t (*seekfn) (struct _reent *, void *, _fpos_t, int);
+  _fpos_t (*seekfn) (__reent_ptr_t, void *, _fpos_t, int);
   _fpos_t target;
   _fpos_t curoff = 0;
   size_t n;
diff --git a/newlib/libc/stdio/fsetpos.c b/newlib/libc/stdio/fsetpos.c
index 6258600d4e60..a4cb20748fe1 100644
--- a/newlib/libc/stdio/fsetpos.c
+++ b/newlib/libc/stdio/fsetpos.c
@@ -27,7 +27,7 @@ INDEX
 SYNOPSIS
 	#include <stdio.h>
 	int fsetpos(FILE *<[fp]>, const fpos_t *<[pos]>);
-	int _fsetpos_r(struct _reent *<[ptr]>, FILE *<[fp]>,
+	int _fsetpos_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>,
 	               const fpos_t *<[pos]>);
 
 DESCRIPTION
@@ -59,7 +59,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
 #include <stdio.h>
 
 int
-_fsetpos_r (struct _reent * ptr,
+_fsetpos_r (__reent_ptr_t ptr,
        FILE * iop,
        const _fpos_t * pos)
 {
diff --git a/newlib/libc/stdio/ftell.c b/newlib/libc/stdio/ftell.c
index f68b3afcc331..2630d5d5d758 100644
--- a/newlib/libc/stdio/ftell.c
+++ b/newlib/libc/stdio/ftell.c
@@ -32,8 +32,8 @@ SYNOPSIS
 	#include <stdio.h>
 	long ftell(FILE *<[fp]>);
 	off_t ftello(FILE *<[fp]>);
-	long _ftell_r(struct _reent *<[ptr]>, FILE *<[fp]>);
-	off_t _ftello_r(struct _reent *<[ptr]>, FILE *<[fp]>);
+	long _ftell_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>);
+	off_t _ftello_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>);
 
 DESCRIPTION
 Objects of type <<FILE>> can have a ``position'' that records how much
@@ -83,7 +83,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #include "local.h"
 
 long
-_ftell_r (struct _reent *ptr,
+_ftell_r (__reent_ptr_t ptr,
        register FILE * fp)
 {
   _fpos_t pos;
diff --git a/newlib/libc/stdio/ftello.c b/newlib/libc/stdio/ftello.c
index d62d48a89beb..7bdf6e8a1e03 100644
--- a/newlib/libc/stdio/ftello.c
+++ b/newlib/libc/stdio/ftello.c
@@ -32,8 +32,8 @@ SYNOPSIS
 	#include <stdio.h>
 	long ftell(FILE *<[fp]>);
 	off_t ftello(FILE *<[fp]>);
-	long _ftell_r(struct _reent *<[ptr]>, FILE *<[fp]>);
-	off_t _ftello_r(struct _reent *<[ptr]>, FILE *<[fp]>);
+	long _ftell_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>);
+	off_t _ftello_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>);
 
 DESCRIPTION
 Objects of type <<FILE>> can have a ``position'' that records how much
@@ -83,7 +83,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #include "local.h"
 
 _off_t
-_ftello_r (struct _reent * ptr,
+_ftello_r (__reent_ptr_t ptr,
        register FILE * fp)
 {
   _fpos_t pos;
diff --git a/newlib/libc/stdio/funopen.c b/newlib/libc/stdio/funopen.c
index 4ed50196ea20..a7075317aadd 100644
--- a/newlib/libc/stdio/funopen.c
+++ b/newlib/libc/stdio/funopen.c
@@ -104,7 +104,7 @@ typedef struct funcookie {
 } funcookie;
 
 static _READ_WRITE_RETURN_TYPE
-funreader (struct _reent *ptr,
+funreader (__reent_ptr_t ptr,
        void *cookie,
        char *buf,
        _READ_WRITE_BUFSIZE_TYPE n)
@@ -118,7 +118,7 @@ funreader (struct _reent *ptr,
 }
 
 static _READ_WRITE_RETURN_TYPE
-funwriter (struct _reent *ptr,
+funwriter (__reent_ptr_t ptr,
        void *cookie,
        const char *buf,
        _READ_WRITE_BUFSIZE_TYPE n)
@@ -132,7 +132,7 @@ funwriter (struct _reent *ptr,
 }
 
 static _fpos_t
-funseeker (struct _reent *ptr,
+funseeker (__reent_ptr_t ptr,
        void *cookie,
        _fpos_t off,
        int whence)
@@ -159,7 +159,7 @@ funseeker (struct _reent *ptr,
 
 #ifdef __LARGE64_FILES
 static _fpos64_t
-funseeker64 (struct _reent *ptr,
+funseeker64 (__reent_ptr_t ptr,
        void *cookie,
        _fpos64_t off,
        int whence)
@@ -174,7 +174,7 @@ funseeker64 (struct _reent *ptr,
 #endif /* __LARGE64_FILES */
 
 static int
-funcloser (struct _reent *ptr,
+funcloser (__reent_ptr_t ptr,
        void *cookie)
 {
   int result = 0;
@@ -190,7 +190,7 @@ funcloser (struct _reent *ptr,
 }
 
 FILE *
-_funopen_r (struct _reent *ptr,
+_funopen_r (__reent_ptr_t ptr,
        const void *cookie,
        funread readfn,
        funwrite writefn,
diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c
index add48ba99c41..de356302f444 100644
--- a/newlib/libc/stdio/fvwrite.c
+++ b/newlib/libc/stdio/fvwrite.c
@@ -48,7 +48,7 @@
  */
 
 int
-__sfvwrite_r (struct _reent *ptr,
+__sfvwrite_r (__reent_ptr_t ptr,
        register FILE *fp,
        register struct __suio *uio)
 {
diff --git a/newlib/libc/stdio/fvwrite.h b/newlib/libc/stdio/fvwrite.h
index 767174b6c51f..0d70b30071ff 100644
--- a/newlib/libc/stdio/fvwrite.h
+++ b/newlib/libc/stdio/fvwrite.h
@@ -32,5 +32,5 @@ struct __suio {
 };
 
 
-extern int __sfvwrite_r (struct _reent *, FILE *, struct __suio *);
-extern int __swsetup_r (struct _reent *, FILE *);
+extern int __sfvwrite_r (__reent_ptr_t, FILE *, struct __suio *);
+extern int __swsetup_r (__reent_ptr_t, FILE *);
diff --git a/newlib/libc/stdio/fwalk.c b/newlib/libc/stdio/fwalk.c
index b1284c6ea670..d61ccd53fd83 100644
--- a/newlib/libc/stdio/fwalk.c
+++ b/newlib/libc/stdio/fwalk.c
@@ -27,7 +27,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #include <errno.h>
 
 int
-_fwalk_sglue (struct _reent *ptr, int (*func) (struct _reent *, FILE *),
+_fwalk_sglue (__reent_ptr_t ptr, int (*func) (__reent_ptr_t, FILE *),
     struct _glue *g)
 {
   FILE *fp;
diff --git a/newlib/libc/stdio/fwide.c b/newlib/libc/stdio/fwide.c
index 1d2430468116..d16e45a7d60e 100644
--- a/newlib/libc/stdio/fwide.c
+++ b/newlib/libc/stdio/fwide.c
@@ -11,7 +11,7 @@ SYNOPSIS
 	#include <wchar.h>
 	int fwide(FILE *<[fp]>, int <[mode]>);
 
-	int _fwide_r(struct _reent *<[ptr]>, FILE *<[fp]>, int <[mode]>);
+	int _fwide_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>, int <[mode]>);
 
 DESCRIPTION
 When <[mode]> is zero, the <<fwide>> function determines the current
@@ -48,7 +48,7 @@ C99, POSIX.1-2001.
 #include "local.h"
 
 int
-_fwide_r (struct _reent *ptr,
+_fwide_r (__reent_ptr_t ptr,
 	FILE *fp,
 	int mode)
 {
diff --git a/newlib/libc/stdio/fwprintf.c b/newlib/libc/stdio/fwprintf.c
index e57866420fc5..d834811ad3de 100644
--- a/newlib/libc/stdio/fwprintf.c
+++ b/newlib/libc/stdio/fwprintf.c
@@ -23,7 +23,7 @@
 #include <stdarg.h>
 
 int
-_fwprintf_r (struct _reent *ptr,
+_fwprintf_r (__reent_ptr_t ptr,
        FILE *fp,
        const wchar_t *fmt, ...)
 {
diff --git a/newlib/libc/stdio/fwrite.c b/newlib/libc/stdio/fwrite.c
index 9241ea2cd997..17336702c794 100644
--- a/newlib/libc/stdio/fwrite.c
+++ b/newlib/libc/stdio/fwrite.c
@@ -39,11 +39,11 @@ SYNOPSIS
 		      size_t <[count]>, FILE *restrict <[fp]>);
 
 	#include <stdio.h>
-	size_t _fwrite_r(struct _reent *<[ptr]>, const void *restrict <[buf]>, size_t <[size]>,
+	size_t _fwrite_r(__reent_ptr_t <[ptr]>, const void *restrict <[buf]>, size_t <[size]>,
 		      size_t <[count]>, FILE *restrict <[fp]>);
 
 	#include <stdio.h>
-	size_t _fwrite_unlocked_r(struct _reent *<[ptr]>, const void *restrict <[buf]>, size_t <[size]>,
+	size_t _fwrite_unlocked_r(__reent_ptr_t <[ptr]>, const void *restrict <[buf]>, size_t <[size]>,
 		      size_t <[count]>, FILE *restrict <[fp]>);
 
 DESCRIPTION
@@ -108,7 +108,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
  */
 
 size_t
-_fwrite_r (struct _reent * ptr,
+_fwrite_r (__reent_ptr_t ptr,
        const void *__restrict buf,
        size_t size,
        size_t count,
diff --git a/newlib/libc/stdio/fwscanf.c b/newlib/libc/stdio/fwscanf.c
index 59a96dd9fef8..9dc35a47a1dc 100644
--- a/newlib/libc/stdio/fwscanf.c
+++ b/newlib/libc/stdio/fwscanf.c
@@ -40,7 +40,7 @@ fwscanf (FILE *__restrict fp, const wchar_t *__restrict fmt, ...)
 #endif /* !_REENT_ONLY */
 
 int
-_fwscanf_r (struct _reent *ptr, FILE *fp, const wchar_t *fmt, ...)
+_fwscanf_r (__reent_ptr_t ptr, FILE *fp, const wchar_t *fmt, ...)
 {
   int ret;
   va_list ap;
diff --git a/newlib/libc/stdio/getc.c b/newlib/libc/stdio/getc.c
index c8781320e603..be94b3b5ad1f 100644
--- a/newlib/libc/stdio/getc.c
+++ b/newlib/libc/stdio/getc.c
@@ -29,7 +29,7 @@ SYNOPSIS
 	int getc(FILE *<[fp]>);
 
 	#include <stdio.h>
-	int _getc_r(struct _reent *<[ptr]>, FILE *<[fp]>);
+	int _getc_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>);
 
 DESCRIPTION
 <<getc>> is a macro, defined in <<stdio.h>>.  You can use <<getc>>
@@ -76,7 +76,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #undef getc
 
 int
-_getc_r (struct _reent *ptr,
+_getc_r (__reent_ptr_t ptr,
        register FILE *fp)
 {
   int result;
@@ -93,7 +93,7 @@ int
 getc (register FILE *fp)
 {
   int result;
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   CHECK_INIT (reent, fp);
   _newlib_flockfile_start (fp);
diff --git a/newlib/libc/stdio/getc_u.c b/newlib/libc/stdio/getc_u.c
index 8bbbb4e7540d..33d052593b86 100644
--- a/newlib/libc/stdio/getc_u.c
+++ b/newlib/libc/stdio/getc_u.c
@@ -69,7 +69,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #undef getc_unlocked
 
 int
-_getc_unlocked_r (struct _reent *ptr,
+_getc_unlocked_r (__reent_ptr_t ptr,
        register FILE *fp)
 {
   /* CHECK_INIT is called (eventually) by __srefill_r.  */
diff --git a/newlib/libc/stdio/getchar.c b/newlib/libc/stdio/getchar.c
index e6b18f047b8f..d8c6b394c4f5 100644
--- a/newlib/libc/stdio/getchar.c
+++ b/newlib/libc/stdio/getchar.c
@@ -28,7 +28,7 @@ SYNOPSIS
 	#include <stdio.h>
 	int getchar(void);
 
-	int _getchar_r(struct _reent *<[reent]>);
+	int _getchar_r(__reent_ptr_t <[reent]>);
 
 DESCRIPTION
 <<getchar>> is a macro, defined in <<stdio.h>>.  You can use <<getchar>>
@@ -72,7 +72,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #undef getchar
 
 int
-_getchar_r (struct _reent *reent)
+_getchar_r (__reent_ptr_t reent)
 {
   _REENT_SMALL_CHECK_INIT (reent);
   return _getc_r (reent, _stdin_r (reent));
@@ -83,7 +83,7 @@ _getchar_r (struct _reent *reent)
 int
 getchar (void)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   /* CHECK_INIT is called (eventually) by __srefill_r.  */
   _REENT_SMALL_CHECK_INIT (reent);
diff --git a/newlib/libc/stdio/getchar_u.c b/newlib/libc/stdio/getchar_u.c
index f4ba0f96bdc7..65d4296a91c9 100644
--- a/newlib/libc/stdio/getchar_u.c
+++ b/newlib/libc/stdio/getchar_u.c
@@ -29,7 +29,7 @@ SYNOPSIS
 	int getchar_unlocked(void);
 
 	#include <stdio.h>
-	int _getchar_unlocked_r(struct _reent *<[ptr]>);
+	int _getchar_unlocked_r(__reent_ptr_t <[ptr]>);
 
 DESCRIPTION
 <<getchar_unlocked>> is a non-thread-safe version of <<getchar>>
@@ -70,7 +70,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #undef getchar_unlocked
 
 int
-_getchar_unlocked_r (struct _reent *ptr)
+_getchar_unlocked_r (__reent_ptr_t ptr)
 {
   return _getc_unlocked_r (ptr, _stdin_r (ptr));
 }
diff --git a/newlib/libc/stdio/gets.c b/newlib/libc/stdio/gets.c
index 82bfc570995d..c2fed62bd6e1 100644
--- a/newlib/libc/stdio/gets.c
+++ b/newlib/libc/stdio/gets.c
@@ -29,7 +29,7 @@ SYNOPSIS
 
 	char *gets(char *<[buf]>);
 
-	char *_gets_r(struct _reent *<[reent]>, char *<[buf]>);
+	char *_gets_r(__reent_ptr_t <[reent]>, char *<[buf]>);
 
 DESCRIPTION
 	Reads characters from standard input until a newline is found.
@@ -63,7 +63,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
 #include "local.h"
 
 char *
-_gets_r (struct _reent *ptr,
+_gets_r (__reent_ptr_t ptr,
        char *buf)
 {
   register int c;
diff --git a/newlib/libc/stdio/getwc.c b/newlib/libc/stdio/getwc.c
index 15b3974553b9..a00d2c2c4b4e 100644
--- a/newlib/libc/stdio/getwc.c
+++ b/newlib/libc/stdio/getwc.c
@@ -33,7 +33,7 @@
 #undef getwc
 
 wint_t
-_getwc_r (struct _reent *ptr,
+_getwc_r (__reent_ptr_t ptr,
 	FILE *fp)
 {
   return _fgetwc_r (ptr, fp);
diff --git a/newlib/libc/stdio/getwc_u.c b/newlib/libc/stdio/getwc_u.c
index 366ab0f368bc..9abc468dfeb1 100644
--- a/newlib/libc/stdio/getwc_u.c
+++ b/newlib/libc/stdio/getwc_u.c
@@ -34,7 +34,7 @@
 #undef getwc_unlocked
 
 wint_t
-_getwc_unlocked_r (struct _reent *ptr,
+_getwc_unlocked_r (__reent_ptr_t ptr,
 	FILE *fp)
 {
   return _fgetwc_unlocked_r (ptr, fp);
diff --git a/newlib/libc/stdio/getwchar.c b/newlib/libc/stdio/getwchar.c
index 1485392415ff..2e1c1454c0eb 100644
--- a/newlib/libc/stdio/getwchar.c
+++ b/newlib/libc/stdio/getwchar.c
@@ -46,10 +46,10 @@ SYNOPSIS
 	wint_t getwchar_unlocked(void);
 
 	#include <wchar.h>
-	wint_t _getwchar_r(struct _reent *<[reent]>);
+	wint_t _getwchar_r(__reent_ptr_t <[reent]>);
 
 	#include <wchar.h>
-	wint_t _getwchar_unlocked_r(struct _reent *<[reent]>);
+	wint_t _getwchar_unlocked_r(__reent_ptr_t <[reent]>);
 
 DESCRIPTION
 <<getwchar>> function or macro is the wide character equivalent of
@@ -93,7 +93,7 @@ PORTABILITY
 #undef getwchar
 
 wint_t
-_getwchar_r (struct _reent *ptr)
+_getwchar_r (__reent_ptr_t ptr)
 {
   return _fgetwc_r (ptr, stdin);
 }
diff --git a/newlib/libc/stdio/getwchar_u.c b/newlib/libc/stdio/getwchar_u.c
index c1f8d2da5ee4..28c6196523bb 100644
--- a/newlib/libc/stdio/getwchar_u.c
+++ b/newlib/libc/stdio/getwchar_u.c
@@ -34,7 +34,7 @@
 #undef getwchar_unlocked
 
 wint_t
-_getwchar_unlocked_r (struct _reent *ptr)
+_getwchar_unlocked_r (__reent_ptr_t ptr)
 {
   return _fgetwc_unlocked_r (ptr, stdin);
 }
diff --git a/newlib/libc/stdio/iprintf.c b/newlib/libc/stdio/iprintf.c
index 7e32eda807ee..6389f82bd9e7 100644
--- a/newlib/libc/stdio/iprintf.c
+++ b/newlib/libc/stdio/iprintf.c
@@ -29,7 +29,7 @@ iprintf (const char *fmt, ...)
 {
   int ret;
   va_list ap;
-  struct _reent *ptr = _REENT;
+  __reent_ptr_t ptr = _REENT;
 
   _REENT_SMALL_CHECK_INIT (ptr);
   va_start (ap, fmt);
@@ -41,7 +41,7 @@ iprintf (const char *fmt, ...)
 #endif /* ! _REENT_ONLY */
 
 int
-_iprintf_r (struct _reent *ptr,
+_iprintf_r (__reent_ptr_t ptr,
        const char *fmt, ...)
 {
   int ret;
diff --git a/newlib/libc/stdio/iscanf.c b/newlib/libc/stdio/iscanf.c
index 35c3899806c0..65b1b2413a08 100644
--- a/newlib/libc/stdio/iscanf.c
+++ b/newlib/libc/stdio/iscanf.c
@@ -39,7 +39,7 @@ iscanf(const char *fmt, ...)
 #endif /* !_REENT_ONLY */
 
 int
-_iscanf_r(struct _reent *ptr, const char *fmt, ...)
+_iscanf_r(__reent_ptr_t ptr, const char *fmt, ...)
 {
   int ret;
   va_list ap;
diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h
index 63c0618f1baf..36aeac92103c 100644
--- a/newlib/libc/stdio/local.h
+++ b/newlib/libc/stdio/local.h
@@ -140,53 +140,53 @@
 
 #endif /* __SINGLE_THREAD__ || __IMPL_UNLOCKED__ */
 
-extern wint_t __fgetwc (struct _reent *, FILE *);
-extern wint_t __fputwc (struct _reent *, wchar_t, FILE *);
+extern wint_t __fgetwc (__reent_ptr_t, FILE *);
+extern wint_t __fputwc (__reent_ptr_t, wchar_t, FILE *);
 extern u_char *__sccl (char *, u_char *fmt);
-extern int    __svfscanf_r (struct _reent *,FILE *, const char *,va_list);
-extern int    __ssvfscanf_r (struct _reent *,FILE *, const char *,va_list);
-extern int    __svfiscanf_r (struct _reent *,FILE *, const char *,va_list);
-extern int    __ssvfiscanf_r (struct _reent *,FILE *, const char *,va_list);
-extern int    __svfwscanf_r (struct _reent *,FILE *, const wchar_t *,va_list);
-extern int    __ssvfwscanf_r (struct _reent *,FILE *, const wchar_t *,va_list);
-extern int    __svfiwscanf_r (struct _reent *,FILE *, const wchar_t *,va_list);
-extern int    __ssvfiwscanf_r (struct _reent *,FILE *, const wchar_t *,va_list);
-int	      _svfprintf_r (struct _reent *, FILE *, const char *, 
+extern int    __svfscanf_r (__reent_ptr_t,FILE *, const char *,va_list);
+extern int    __ssvfscanf_r (__reent_ptr_t,FILE *, const char *,va_list);
+extern int    __svfiscanf_r (__reent_ptr_t,FILE *, const char *,va_list);
+extern int    __ssvfiscanf_r (__reent_ptr_t,FILE *, const char *,va_list);
+extern int    __svfwscanf_r (__reent_ptr_t,FILE *, const wchar_t *,va_list);
+extern int    __ssvfwscanf_r (__reent_ptr_t,FILE *, const wchar_t *,va_list);
+extern int    __svfiwscanf_r (__reent_ptr_t,FILE *, const wchar_t *,va_list);
+extern int    __ssvfiwscanf_r (__reent_ptr_t,FILE *, const wchar_t *,va_list);
+int	      _svfprintf_r (__reent_ptr_t, FILE *, const char *,
 				  va_list)
                			_ATTRIBUTE ((__format__ (__printf__, 3, 0)));
-int	      _svfiprintf_r (struct _reent *, FILE *, const char *, 
+int	      _svfiprintf_r (__reent_ptr_t, FILE *, const char *,
 				  va_list)
                			_ATTRIBUTE ((__format__ (__printf__, 3, 0)));
-int	      _svfwprintf_r (struct _reent *, FILE *, const wchar_t *, 
+int	      _svfwprintf_r (__reent_ptr_t, FILE *, const wchar_t *,
 				  va_list);
-int	      _svfiwprintf_r (struct _reent *, FILE *, const wchar_t *, 
+int	      _svfiwprintf_r (__reent_ptr_t, FILE *, const wchar_t *,
 				  va_list);
-extern FILE  *__sfp (struct _reent *);
-extern int    __sflags (struct _reent *,const char*, int*);
-extern int    __sflush_r (struct _reent *,FILE *);
+extern FILE  *__sfp (__reent_ptr_t);
+extern int    __sflags (__reent_ptr_t,const char*, int*);
+extern int    __sflush_r (__reent_ptr_t,FILE *);
 #ifdef _STDIO_BSD_SEMANTICS
-extern int    __sflushw_r (struct _reent *,FILE *);
+extern int    __sflushw_r (__reent_ptr_t,FILE *);
 #endif
-extern int    __srefill_r (struct _reent *,FILE *);
-extern _READ_WRITE_RETURN_TYPE __sread (struct _reent *, void *, char *,
+extern int    __srefill_r (__reent_ptr_t,FILE *);
+extern _READ_WRITE_RETURN_TYPE __sread (__reent_ptr_t, void *, char *,
 					       _READ_WRITE_BUFSIZE_TYPE);
-extern _READ_WRITE_RETURN_TYPE __seofread (struct _reent *, void *,
+extern _READ_WRITE_RETURN_TYPE __seofread (__reent_ptr_t, void *,
 						  char *,
 						  _READ_WRITE_BUFSIZE_TYPE);
-extern _READ_WRITE_RETURN_TYPE __swrite (struct _reent *, void *,
+extern _READ_WRITE_RETURN_TYPE __swrite (__reent_ptr_t, void *,
 						const char *,
 						_READ_WRITE_BUFSIZE_TYPE);
-extern _fpos_t __sseek (struct _reent *, void *, _fpos_t, int);
-extern int    __sclose (struct _reent *, void *);
+extern _fpos_t __sseek (__reent_ptr_t, void *, _fpos_t, int);
+extern int    __sclose (__reent_ptr_t, void *);
 extern int    __stextmode (int);
-extern void   __sinit (struct _reent *);
-extern void   __smakebuf_r (struct _reent *, FILE *);
-extern int    __swhatbuf_r (struct _reent *, FILE *, size_t *, int *);
-extern int __submore (struct _reent *, FILE *);
+extern void   __sinit (__reent_ptr_t);
+extern void   __smakebuf_r (__reent_ptr_t, FILE *);
+extern int    __swhatbuf_r (__reent_ptr_t, FILE *, size_t *, int *);
+extern int __submore (__reent_ptr_t, FILE *);
 
 #ifdef __LARGE64_FILES
-extern _fpos64_t __sseek64 (struct _reent *, void *, _fpos64_t, int);
-extern _READ_WRITE_RETURN_TYPE __swrite64 (struct _reent *, void *,
+extern _fpos64_t __sseek64 (__reent_ptr_t, void *, _fpos64_t, int);
+extern _READ_WRITE_RETURN_TYPE __swrite64 (__reent_ptr_t, void *,
 						  const char *,
 						  _READ_WRITE_BUFSIZE_TYPE);
 #endif
@@ -196,7 +196,7 @@ extern _READ_WRITE_RETURN_TYPE __swrite64 (struct _reent *, void *,
 #define CHECK_INIT(ptr, fp) \
   do								\
     {								\
-      struct _reent *_check_init_ptr = (ptr);			\
+      __reent_ptr_t _check_init_ptr = (ptr);			\
       if (!_REENT_IS_NULL(_check_init_ptr) &&			\
 	  !_REENT_CLEANUP(_check_init_ptr))			\
 	__sinit (_check_init_ptr);				\
@@ -253,9 +253,9 @@ extern _READ_WRITE_RETURN_TYPE __swrite64 (struct _reent *, void *,
 
 /* Same thing as the functions in stdio.h, but these are to be called
    from inside the wide-char functions. */
-int	__swbufw_r (struct _reent *, int, FILE *);
+int	__swbufw_r (__reent_ptr_t, int, FILE *);
 #ifdef __GNUC__
-_ELIDABLE_INLINE int __swputc_r(struct _reent *_ptr, int _c, FILE *_p) {
+_ELIDABLE_INLINE int __swputc_r(__reent_ptr_t _ptr, int _c, FILE *_p) {
 #ifdef __SCLE
 	if ((_p->_flags & __SCLE) && _c == '\n')
 	  __swputc_r (_ptr, '\r', _p);
@@ -286,7 +286,7 @@ _ELIDABLE_INLINE int __swputc_r(struct _reent *_ptr, int _c, FILE *_p) {
 
 /* WARNING: _dcvt is defined in the stdlib directory, not here!  */
 
-char *_dcvt (struct _reent *, char *, double, int, int, char, int);
+char *_dcvt (__reent_ptr_t, char *, double, int, int, char, int);
 char *_sicvt (char *, short, char);
 char *_icvt (char *, int, char);
 char *_licvt (char *, long, char);
diff --git a/newlib/libc/stdio/makebuf.c b/newlib/libc/stdio/makebuf.c
index b9c75bbf8024..f622a4547664 100644
--- a/newlib/libc/stdio/makebuf.c
+++ b/newlib/libc/stdio/makebuf.c
@@ -35,7 +35,7 @@
  */
 
 void
-__smakebuf_r (struct _reent *ptr,
+__smakebuf_r (__reent_ptr_t ptr,
        register FILE *fp)
 {
   register void *p;
@@ -74,7 +74,7 @@ __smakebuf_r (struct _reent *ptr,
  * Internal routine to determine `proper' buffering for a file.
  */
 int
-__swhatbuf_r (struct _reent *ptr,
+__swhatbuf_r (__reent_ptr_t ptr,
 	FILE *fp,
 	size_t *bufsize,
 	int *couldbetty)
diff --git a/newlib/libc/stdio/mktemp.c b/newlib/libc/stdio/mktemp.c
index 265968198c35..ae07642cd0f8 100644
--- a/newlib/libc/stdio/mktemp.c
+++ b/newlib/libc/stdio/mktemp.c
@@ -60,13 +60,13 @@ SYNOPSIS
 	int mkostemp(char *<[path]>, int <[flags]>);
 	int mkostemps(char *<[path]>, int <[suffixlen]>, int <[flags]>);
 
-	char *_mktemp_r(struct _reent *<[reent]>, char *<[path]>);
-	char *_mkdtemp_r(struct _reent *<[reent]>, char *<[path]>);
-	int *_mkstemp_r(struct _reent *<[reent]>, char *<[path]>);
-	int *_mkstemps_r(struct _reent *<[reent]>, char *<[path]>, int <[len]>);
-	int *_mkostemp_r(struct _reent *<[reent]>, char *<[path]>,
+	char *_mktemp_r(__reent_ptr_t <[reent]>, char *<[path]>);
+	char *_mkdtemp_r(__reent_ptr_t <[reent]>, char *<[path]>);
+	int *_mkstemp_r(__reent_ptr_t <[reent]>, char *<[path]>);
+	int *_mkstemps_r(__reent_ptr_t <[reent]>, char *<[path]>, int <[len]>);
+	int *_mkostemp_r(__reent_ptr_t <[reent]>, char *<[path]>,
 			 int <[flags]>);
-	int *_mkostemps_r(struct _reent *<[reent]>, char *<[path]>, int <[len]>,
+	int *_mkostemps_r(__reent_ptr_t <[reent]>, char *<[path]>, int <[len]>,
 			  int <[flags]>);
 
 DESCRIPTION
@@ -138,7 +138,7 @@ Supporting OS subroutines required: <<getpid>>, <<mkdir>>, <<open>>, <<stat>>.
 #include <ctype.h>
 
 static int
-_gettemp (struct _reent *ptr,
+_gettemp (__reent_ptr_t ptr,
        char *path,
        register int *doopen,
        int domkdir,
@@ -261,7 +261,7 @@ _gettemp (struct _reent *ptr,
 #endif
 
 int
-_mkstemp_r (struct _reent *ptr,
+_mkstemp_r (__reent_ptr_t ptr,
        char *path)
 {
   int fd;
@@ -271,14 +271,14 @@ _mkstemp_r (struct _reent *ptr,
 
 #if !defined _ELIX_LEVEL || _ELIX_LEVEL >= 4
 char *
-_mkdtemp_r (struct _reent *ptr,
+_mkdtemp_r (__reent_ptr_t ptr,
        char *path)
 {
   return (_gettemp (ptr, path, (int *) NULL, 1, 0, 0) ? path : NULL);
 }
 
 int
-_mkstemps_r (struct _reent *ptr,
+_mkstemps_r (__reent_ptr_t ptr,
        char *path,
        int len)
 {
@@ -288,7 +288,7 @@ _mkstemps_r (struct _reent *ptr,
 }
 
 int
-_mkostemp_r (struct _reent *ptr,
+_mkostemp_r (__reent_ptr_t ptr,
        char *path,
        int flags)
 {
@@ -298,7 +298,7 @@ _mkostemp_r (struct _reent *ptr,
 }
 
 int
-_mkostemps_r (struct _reent *ptr,
+_mkostemps_r (__reent_ptr_t ptr,
        char *path,
        int len,
        int flags)
@@ -310,7 +310,7 @@ _mkostemps_r (struct _reent *ptr,
 #endif /* _ELIX_LEVEL */
 
 char *
-_mktemp_r (struct _reent *ptr,
+_mktemp_r (__reent_ptr_t ptr,
        char *path)
 {
   return (_gettemp (ptr, path, (int *) NULL, 0, 0, 0) ? path : (char *) NULL);
diff --git a/newlib/libc/stdio/nano-vfprintf.c b/newlib/libc/stdio/nano-vfprintf.c
index bdcc9b218a47..79e171fc72c6 100644
--- a/newlib/libc/stdio/nano-vfprintf.c
+++ b/newlib/libc/stdio/nano-vfprintf.c
@@ -99,17 +99,17 @@ SYNOPSIS
 	char *vasnprintf(char *<[str]>, size_t *<[size]>, const char *<[fmt]>,
                          va_list <[list]>);
 
-	int _vprintf_r(struct _reent *<[reent]>, const char *<[fmt]>,
+	int _vprintf_r(__reent_ptr_t <[reent]>, const char *<[fmt]>,
                         va_list <[list]>);
-	int _vfprintf_r(struct _reent *<[reent]>, FILE *<[fp]>,
+	int _vfprintf_r(__reent_ptr_t <[reent]>, FILE *<[fp]>,
                         const char *<[fmt]>, va_list <[list]>);
-	int _vsprintf_r(struct _reent *<[reent]>, char *<[str]>,
+	int _vsprintf_r(__reent_ptr_t <[reent]>, char *<[str]>,
                         const char *<[fmt]>, va_list <[list]>);
-	int _vasprintf_r(struct _reent *<[reent]>, char **<[str]>,
+	int _vasprintf_r(__reent_ptr_t <[reent]>, char **<[str]>,
                          const char *<[fmt]>, va_list <[list]>);
-	int _vsnprintf_r(struct _reent *<[reent]>, char *<[str]>,
+	int _vsnprintf_r(__reent_ptr_t <[reent]>, char *<[str]>,
                          size_t <[size]>, const char *<[fmt]>, va_list <[list]>);
-	char *_vasnprintf_r(struct _reent *<[reent]>, char *<[str]>,
+	char *_vasnprintf_r(__reent_ptr_t <[reent]>, char *<[str]>,
                             size_t *<[size]>, const char *<[fmt]>, va_list <[list]>);
 
 DESCRIPTION
@@ -172,7 +172,7 @@ static char *rcsid = "$Id$";
    and vfwprintf.  */
 #ifdef STRING_ONLY
 int
-__ssputs_r (struct _reent *ptr,
+__ssputs_r (__reent_ptr_t ptr,
        FILE *fp,
        const char *buf,
        size_t len)
@@ -242,7 +242,7 @@ err:
    char output, but __ssprint_r cannot be discarded because it is used
    by a serial of functions like svfwprintf for wide char output.  */
 int
-__ssprint_r (struct _reent *ptr,
+__ssprint_r (__reent_ptr_t ptr,
        FILE *fp,
        register struct __suio *uio)
 {
@@ -345,7 +345,7 @@ err:
 /* Flush out all the vectors defined by the given uio,
    then reset it so that it can be reused.  */
 int
-__sprint_r (struct _reent *ptr,
+__sprint_r (__reent_ptr_t ptr,
        FILE *fp,
        register struct __suio *uio)
 {
@@ -389,7 +389,7 @@ out:
 }
 
 _NOINLINE_STATIC int
-__sfputc_r (struct _reent *ptr,
+__sfputc_r (__reent_ptr_t ptr,
        int c,
        FILE *fp)
 {
@@ -400,7 +400,7 @@ __sfputc_r (struct _reent *ptr,
 }
 
 int
-__sfputs_r (struct _reent *ptr,
+__sfputs_r (__reent_ptr_t ptr,
        FILE *fp,
        const char *buf,
        size_t len)
@@ -433,7 +433,7 @@ __sfputs_r (struct _reent *ptr,
 }
 #endif /* STRING_ONLY.  */
 
-int _VFPRINTF_R (struct _reent *, FILE *, const char *, va_list);
+int _VFPRINTF_R (__reent_ptr_t, FILE *, const char *, va_list);
 
 #ifndef STRING_ONLY
 int
@@ -465,7 +465,7 @@ vfiprintf (FILE *, const char *, __VALIST)
 #endif
 
 int
-_VFPRINTF_R (struct _reent *data,
+_VFPRINTF_R (__reent_ptr_t data,
        FILE * fp,
        const char *fmt0,
        va_list ap)
@@ -478,7 +478,7 @@ _VFPRINTF_R (struct _reent *data,
   va_list ap_copy;
 
   /* Output function pointer.  */
-  int (*pfunc)(struct _reent *, FILE *, const char *, size_t len);
+  int (*pfunc)(__reent_ptr_t, FILE *, const char *, size_t len);
 
   pfunc = __SPRINT;
 
@@ -653,10 +653,10 @@ error:
 
 #ifdef STRING_ONLY
 int
-_svfiprintf_r (struct _reent *, FILE *, const char *, __VALIST)
+_svfiprintf_r (__reent_ptr_t, FILE *, const char *, __VALIST)
        _ATTRIBUTE ((__alias__("_svfprintf_r")));
 #else
 int
-_vfiprintf_r (struct _reent *, FILE *, const char *, __VALIST)
+_vfiprintf_r (__reent_ptr_t, FILE *, const char *, __VALIST)
        _ATTRIBUTE ((__alias__("_vfprintf_r")));
 #endif
diff --git a/newlib/libc/stdio/nano-vfprintf_float.c b/newlib/libc/stdio/nano-vfprintf_float.c
index 524f67a31383..b297533ea721 100644
--- a/newlib/libc/stdio/nano-vfprintf_float.c
+++ b/newlib/libc/stdio/nano-vfprintf_float.c
@@ -49,7 +49,7 @@
 #include "vfieeefp.h"
 #include "nano-vfprintf_local.h"
 
-char *__cvt (struct _reent *data, _PRINTF_FLOAT_TYPE value, int ndigits,
+char *__cvt (__reent_ptr_t data, _PRINTF_FLOAT_TYPE value, int ndigits,
 	     int flags, char *sign, int *decpt, int ch, int *length,
 	     char *buf);
 
@@ -65,7 +65,7 @@ int __exponent (char *p0, int exp, int fmtch);
    [aAeEfFgG]; if it is [aA], then the return string lives in BUF,
    otherwise the return value shares the mprec reentrant storage.  */
 char *
-__cvt (struct _reent *data, _PRINTF_FLOAT_TYPE value, int ndigits, int flags,
+__cvt (__reent_ptr_t data, _PRINTF_FLOAT_TYPE value, int ndigits, int flags,
        char *sign, int *decpt, int ch, int *length, char *buf)
 {
   int mode, dsgn;
@@ -162,10 +162,10 @@ __exponent (char *p0, int exp, int fmtch)
 
 /* Decode and print floating point number specified by "eEfgG".  */
 int
-_printf_float (struct _reent *data,
+_printf_float (__reent_ptr_t data,
 	       struct _prt_data_t *pdata,
 	       FILE * fp,
-	       int (*pfunc) (struct _reent *, FILE *, const char *,
+	       int (*pfunc) (__reent_ptr_t, FILE *, const char *,
 			     size_t len), va_list * ap)
 {
 #define _fpvalue (pdata->_double_)
diff --git a/newlib/libc/stdio/nano-vfprintf_i.c b/newlib/libc/stdio/nano-vfprintf_i.c
index f7da9525122d..e464505fad33 100644
--- a/newlib/libc/stdio/nano-vfprintf_i.c
+++ b/newlib/libc/stdio/nano-vfprintf_i.c
@@ -46,11 +46,11 @@
 
 /* Decode and print non-floating point data.  */
 int
-_printf_common (struct _reent *data,
+_printf_common (__reent_ptr_t data,
 		struct _prt_data_t *pdata,
 		int *realsz,
 		FILE *fp,
-		int (*pfunc)(struct _reent *, FILE *,
+		int (*pfunc)(__reent_ptr_t, FILE *,
 			     const char *, size_t len))
 {
   int n;
@@ -105,8 +105,8 @@ error:
   return -1;
 }
 int
-_printf_i (struct _reent *data, struct _prt_data_t *pdata, FILE *fp,
-	   int (*pfunc)(struct _reent *, FILE *, const char *, size_t len),
+_printf_i (__reent_ptr_t data, struct _prt_data_t *pdata, FILE *fp,
+	   int (*pfunc)(__reent_ptr_t, FILE *, const char *, size_t len),
 	   va_list *ap)
 {
   /* Field size expanded by dprec.  */
diff --git a/newlib/libc/stdio/nano-vfprintf_local.h b/newlib/libc/stdio/nano-vfprintf_local.h
index 15ddce08e960..b1b21f60407a 100644
--- a/newlib/libc/stdio/nano-vfprintf_local.h
+++ b/newlib/libc/stdio/nano-vfprintf_local.h
@@ -88,7 +88,7 @@
 # define MAXEXPLEN		7
 # define DEFPREC		6
 
-extern char *_dtoa_r (struct _reent *, double, int,
+extern char *_dtoa_r (__reent_ptr_t, double, int,
 			      int, int *, int *, char **);
 
 # define _DTOA_R _dtoa_r
@@ -210,25 +210,25 @@ struct _prt_data_t
 };
 
 extern int
-_printf_common (struct _reent *data,
+_printf_common (__reent_ptr_t data,
 		struct _prt_data_t *pdata,
 		int *realsz,
 		FILE *fp,
-		int (*pfunc)(struct _reent *, FILE *,
+		int (*pfunc)(__reent_ptr_t, FILE *,
 			     const char *, size_t len));
 
 extern int
-_printf_i (struct _reent *data, struct _prt_data_t *pdata, FILE *fp,
-	   int (*pfunc)(struct _reent *, FILE *, const char *, size_t len),
+_printf_i (__reent_ptr_t data, struct _prt_data_t *pdata, FILE *fp,
+	   int (*pfunc)(__reent_ptr_t, FILE *, const char *, size_t len),
 	   va_list *ap);
 
 /* Make _printf_float weak symbol, so it won't be linked in if target program
    does not need it.  */
 extern int
-_printf_float (struct _reent *data,
+_printf_float (__reent_ptr_t data,
 	       struct _prt_data_t *pdata,
 	       FILE *fp,
-	       int (*pfunc)(struct _reent *, FILE *,
+	       int (*pfunc)(__reent_ptr_t, FILE *,
 			    const char *, size_t len),
 	       va_list *ap) _ATTRIBUTE((__weak__));
 #endif
diff --git a/newlib/libc/stdio/nano-vfscanf.c b/newlib/libc/stdio/nano-vfscanf.c
index 57d25b82aa92..209ac8a6a18f 100644
--- a/newlib/libc/stdio/nano-vfscanf.c
+++ b/newlib/libc/stdio/nano-vfscanf.c
@@ -67,11 +67,11 @@ SYNOPSIS
 	int vfscanf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
 	int vsscanf(const char *<[str]>, const char *<[fmt]>, va_list <[list]>);
 
-	int _vscanf_r(struct _reent *<[reent]>, const char *<[fmt]>,
+	int _vscanf_r(__reent_ptr_t <[reent]>, const char *<[fmt]>,
                        va_list <[list]>);
-	int _vfscanf_r(struct _reent *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
+	int _vfscanf_r(__reent_ptr_t <[reent]>, FILE *<[fp]>, const char *<[fmt]>,
                        va_list <[list]>);
-	int _vsscanf_r(struct _reent *<[reent]>, const char *<[str]>,
+	int _vsscanf_r(__reent_ptr_t <[reent]>, const char *<[str]>,
                        const char *<[fmt]>, va_list <[list]>);
 
 DESCRIPTION
@@ -158,7 +158,7 @@ __SVFSCANF (register FILE *fp,
 #endif
 
 int
-_VFSCANF_R (struct _reent *data,
+_VFSCANF_R (__reent_ptr_t data,
        register FILE *fp,
        const char *fmt,
        va_list ap)
@@ -168,7 +168,7 @@ _VFSCANF_R (struct _reent *data,
 }
 
 int
-_vfiscanf_r (struct _reent *, FILE *, const char *, __VALIST)
+_vfiscanf_r (__reent_ptr_t, FILE *, const char *, __VALIST)
        _ATTRIBUTE ((__alias__("_vfscanf_r")));
 #endif /* !STRING_ONLY.  */
 
@@ -177,7 +177,7 @@ _vfiscanf_r (struct _reent *, FILE *, const char *, __VALIST)
    regular ungetc which will drag in file I/O items we don't need.
    So, we create our own trimmed-down version.  */
 int
-_sungetc_r (struct _reent *data,
+_sungetc_r (__reent_ptr_t data,
 	int c,
 	register FILE *fp)
 {
@@ -225,7 +225,7 @@ _sungetc_r (struct _reent *data,
 
 /* String only version of __srefill_r for sscanf family.  */
 int
-__ssrefill_r (struct _reent * ptr,
+__ssrefill_r (__reent_ptr_t ptr,
        register FILE * fp)
 {
   /* Our only hope of further input is the ungetc buffer.
@@ -248,13 +248,13 @@ __ssrefill_r (struct _reent * ptr,
 }
 
 #else
-int _sungetc_r (struct _reent *, int, register FILE *);
-int __ssrefill_r (struct _reent *, register FILE *);
-size_t _sfread_r (struct _reent *, void *buf, size_t, size_t, FILE *);
+int _sungetc_r (__reent_ptr_t, int, register FILE *);
+int __ssrefill_r (__reent_ptr_t, register FILE *);
+size_t _sfread_r (__reent_ptr_t, void *buf, size_t, size_t, FILE *);
 #endif /* !STRING_ONLY.  */
 
 int
-__SVFSCANF_R (struct _reent *rptr,
+__SVFSCANF_R (__reent_ptr_t rptr,
        register FILE *fp,
        char const *fmt0,
        va_list ap)
@@ -269,7 +269,7 @@ __SVFSCANF_R (struct _reent *rptr,
   char *cp;
 
   struct _scan_data_t scan_data;
-  int (*scan_func)(struct _reent*, struct _scan_data_t*, FILE *, va_list *);
+  int (*scan_func)(__reent_ptr_t, struct _scan_data_t*, FILE *, va_list *);
 
   _newlib_flockfile_start (fp);
 
@@ -455,11 +455,11 @@ all_done:
 
 #ifdef STRING_ONLY
 int
-__ssvfiscanf_r (struct _reent *, FILE *, const char *, __VALIST)
+__ssvfiscanf_r (__reent_ptr_t, FILE *, const char *, __VALIST)
        _ATTRIBUTE ((__alias__("__ssvfscanf_r")));
 #else
 int
-__svfiscanf_r (struct _reent *, FILE *, const char *, __VALIST)
+__svfiscanf_r (__reent_ptr_t, FILE *, const char *, __VALIST)
        _ATTRIBUTE ((__alias__("__svfscanf_r")));
 #endif
 
diff --git a/newlib/libc/stdio/nano-vfscanf_float.c b/newlib/libc/stdio/nano-vfscanf_float.c
index 056046f5b20e..4db1e228e1c1 100644
--- a/newlib/libc/stdio/nano-vfscanf_float.c
+++ b/newlib/libc/stdio/nano-vfscanf_float.c
@@ -34,7 +34,7 @@
 
 #ifdef FLOATING_POINT
 int
-_scanf_float (struct _reent *rptr,
+_scanf_float (__reent_ptr_t rptr,
 	      struct _scan_data_t *pdata,
 	      FILE *fp, va_list *ap)
 {
diff --git a/newlib/libc/stdio/nano-vfscanf_i.c b/newlib/libc/stdio/nano-vfscanf_i.c
index fc8011717d65..3fb17cd90f39 100644
--- a/newlib/libc/stdio/nano-vfscanf_i.c
+++ b/newlib/libc/stdio/nano-vfscanf_i.c
@@ -45,7 +45,7 @@
 #include "nano-vfscanf_local.h"
 
 int
-_scanf_chars (struct _reent *rptr,
+_scanf_chars (__reent_ptr_t rptr,
 	      struct _scan_data_t *pdata,
 	      FILE *fp, va_list *ap)
 {
@@ -91,11 +91,11 @@ _scanf_chars (struct _reent *rptr,
   return 0;
 }
 int
-_scanf_i (struct _reent *rptr,
+_scanf_i (__reent_ptr_t rptr,
 	  struct _scan_data_t *pdata,
 	  FILE *fp, va_list *ap)
 {
-#define CCFN_PARAMS	(struct _reent *, const char *, char **, int)
+#define CCFN_PARAMS	(__reent_ptr_t, const char *, char **, int)
   /* Conversion function (strtol/strtoul).  */
   u_long (*ccfn)CCFN_PARAMS=0;
   char *p;
diff --git a/newlib/libc/stdio/nano-vfscanf_local.h b/newlib/libc/stdio/nano-vfscanf_local.h
index d696ec0ccc28..119ad097a332 100644
--- a/newlib/libc/stdio/nano-vfscanf_local.h
+++ b/newlib/libc/stdio/nano-vfscanf_local.h
@@ -155,23 +155,23 @@ struct _scan_data_t
   int code;             /* Current conversion specifier.  */
   char buf[BUF];        /* Internal buffer for scan.  */
   /* Internal buffer for scan.  */
-  int (*pfn_ungetc)(struct _reent*, int, FILE*);
+  int (*pfn_ungetc)(__reent_ptr_t, int, FILE*);
   /* Internal buffer for scan.  */
-  int (*pfn_refill)(struct _reent*, FILE*);
+  int (*pfn_refill)(__reent_ptr_t, FILE*);
 };
 
 extern int
-_scanf_chars (struct _reent *rptr,
+_scanf_chars (__reent_ptr_t rptr,
 	      struct _scan_data_t *pdata,
 	      FILE *fp, va_list *ap);
 extern int
-_scanf_i (struct _reent *rptr,
+_scanf_i (__reent_ptr_t rptr,
 	  struct _scan_data_t *pdata,
 	  FILE *fp, va_list *ap);
 /* Make _scanf_float weak symbol, so it won't be linked in if target program
    does not need it.  */
 extern int
-_scanf_float (struct _reent *rptr,
+_scanf_float (__reent_ptr_t rptr,
 	      struct _scan_data_t *pdata,
 	      FILE *fp, va_list *ap) _ATTRIBUTE((__weak__));
 
diff --git a/newlib/libc/stdio/open_memstream.c b/newlib/libc/stdio/open_memstream.c
index 97b13b7bfc10..033f962ceddf 100644
--- a/newlib/libc/stdio/open_memstream.c
+++ b/newlib/libc/stdio/open_memstream.c
@@ -93,7 +93,7 @@ typedef struct memstream {
 /* Write up to non-zero N bytes of BUF into the stream described by COOKIE,
    returning the number of bytes written or EOF on failure.  */
 static _READ_WRITE_RETURN_TYPE
-memwriter (struct _reent *ptr,
+memwriter (__reent_ptr_t ptr,
        void *cookie,
        const char *buf,
        _READ_WRITE_BUFSIZE_TYPE n)
@@ -146,7 +146,7 @@ memwriter (struct _reent *ptr,
 /* Seek to position POS relative to WHENCE within stream described by
    COOKIE; return resulting position or fail with EOF.  */
 static _fpos_t
-memseeker (struct _reent *ptr,
+memseeker (__reent_ptr_t ptr,
        void *cookie,
        _fpos_t pos,
        int whence)
@@ -213,7 +213,7 @@ memseeker (struct _reent *ptr,
    COOKIE; return resulting position or fail with EOF.  */
 #ifdef __LARGE64_FILES
 static _fpos64_t
-memseeker64 (struct _reent *ptr,
+memseeker64 (__reent_ptr_t ptr,
        void *cookie,
        _fpos64_t pos,
        int whence)
@@ -272,7 +272,7 @@ memseeker64 (struct _reent *ptr,
 
 /* Reclaim resources used by stream described by COOKIE.  */
 static int
-memcloser (struct _reent *ptr,
+memcloser (__reent_ptr_t ptr,
        void *cookie)
 {
   memstream *c = (memstream *) cookie;
@@ -291,7 +291,7 @@ memcloser (struct _reent *ptr,
 /* Open a memstream that tracks a dynamic buffer in BUF and SIZE.
    Return the new stream, or fail with NULL.  */
 static FILE *
-internal_open_memstream_r (struct _reent *ptr,
+internal_open_memstream_r (__reent_ptr_t ptr,
        char **buf,
        size_t *size,
        int wide)
@@ -373,7 +373,7 @@ internal_open_memstream_r (struct _reent *ptr,
 }
 
 FILE *
-_open_memstream_r (struct _reent *ptr,
+_open_memstream_r (__reent_ptr_t ptr,
        char **buf,
        size_t *size)
 {
@@ -381,7 +381,7 @@ _open_memstream_r (struct _reent *ptr,
 }
 
 FILE *
-_open_wmemstream_r (struct _reent *ptr,
+_open_wmemstream_r (__reent_ptr_t ptr,
        wchar_t **buf,
        size_t *size)
 {
diff --git a/newlib/libc/stdio/perror.c b/newlib/libc/stdio/perror.c
index 2033a6f2f6d8..d59552e52590 100644
--- a/newlib/libc/stdio/perror.c
+++ b/newlib/libc/stdio/perror.c
@@ -28,7 +28,7 @@ SYNOPSIS
 	#include <stdio.h>
 	void perror(char *<[prefix]>);
 
-	void _perror_r(struct _reent *<[reent]>, char *<[prefix]>);
+	void _perror_r(__reent_ptr_t <[reent]>, char *<[prefix]>);
 
 DESCRIPTION
 Use <<perror>> to print (on standard error) an error message
@@ -73,7 +73,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
 }
 
 void
-_perror_r (struct _reent *ptr,
+_perror_r (__reent_ptr_t ptr,
        const char *s)
 {
   char *error;
diff --git a/newlib/libc/stdio/printf.c b/newlib/libc/stdio/printf.c
index 3a0716418663..74384d499a47 100644
--- a/newlib/libc/stdio/printf.c
+++ b/newlib/libc/stdio/printf.c
@@ -23,7 +23,7 @@
 #include "local.h"
 
 int
-_printf_r (struct _reent *ptr,
+_printf_r (__reent_ptr_t ptr,
        const char *__restrict fmt, ...)
 {
   int ret;
@@ -38,7 +38,7 @@ _printf_r (struct _reent *ptr,
 
 #ifdef _NANO_FORMATTED_IO
 int
-_iprintf_r (struct _reent *, const char *, ...)
+_iprintf_r (__reent_ptr_t, const char *, ...)
        _ATTRIBUTE ((__alias__("_printf_r")));
 #endif
 
@@ -49,7 +49,7 @@ printf (const char *__restrict fmt, ...)
 {
   int ret;
   va_list ap;
-  struct _reent *ptr = _REENT;
+  __reent_ptr_t ptr = _REENT;
 
   _REENT_SMALL_CHECK_INIT (ptr);
   va_start (ap, fmt);
diff --git a/newlib/libc/stdio/putc.c b/newlib/libc/stdio/putc.c
index 6a410e216df0..65a4007a318c 100644
--- a/newlib/libc/stdio/putc.c
+++ b/newlib/libc/stdio/putc.c
@@ -29,7 +29,7 @@ SYNOPSIS
 	int putc(int <[ch]>, FILE *<[fp]>);
 
 	#include <stdio.h>
-	int _putc_r(struct _reent *<[ptr]>, int <[ch]>, FILE *<[fp]>);
+	int _putc_r(__reent_ptr_t <[ptr]>, int <[ch]>, FILE *<[fp]>);
 
 DESCRIPTION
 <<putc>> is a macro, defined in <<stdio.h>>.  <<putc>>
@@ -78,7 +78,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #undef putc
 
 int
-_putc_r (struct _reent *ptr,
+_putc_r (__reent_ptr_t ptr,
        int c,
        register FILE *fp)
 {
@@ -97,7 +97,7 @@ putc (int c,
 {
 #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
   int result;
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   CHECK_INIT (reent, fp);
   _newlib_flockfile_start (fp);
diff --git a/newlib/libc/stdio/putc_u.c b/newlib/libc/stdio/putc_u.c
index 3bb53e5ce1ab..3e8a16f32153 100644
--- a/newlib/libc/stdio/putc_u.c
+++ b/newlib/libc/stdio/putc_u.c
@@ -29,7 +29,7 @@ SYNOPSIS
 	int putc_unlocked(int <[ch]>, FILE *<[fp]>);
 
 	#include <stdio.h>
-	int _putc_unlocked_r(struct _reent *<[ptr]>, int <[ch]>, FILE *<[fp]>);
+	int _putc_unlocked_r(__reent_ptr_t <[ptr]>, int <[ch]>, FILE *<[fp]>);
 
 DESCRIPTION
 <<putc_unlocked>> is a non-thread-safe version of <<putc>> declared in
@@ -70,7 +70,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #undef putc_unlocked
 
 int
-_putc_unlocked_r (struct _reent *ptr,
+_putc_unlocked_r (__reent_ptr_t ptr,
        int c,
        register FILE *fp)
 {
diff --git a/newlib/libc/stdio/putchar.c b/newlib/libc/stdio/putchar.c
index 6e1b1f12c8b5..a067d6eb4573 100644
--- a/newlib/libc/stdio/putchar.c
+++ b/newlib/libc/stdio/putchar.c
@@ -28,7 +28,7 @@ SYNOPSIS
 	#include <stdio.h>
 	int putchar(int <[ch]>);
 
-	int _putchar_r(struct _reent *<[reent]>, int <[ch]>);
+	int _putchar_r(__reent_ptr_t <[reent]>, int <[ch]>);
 
 DESCRIPTION
 <<putchar>> is a macro, defined in <<stdio.h>>.  <<putchar>>
@@ -67,7 +67,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #undef putchar
 
 int
-_putchar_r (struct _reent *ptr,
+_putchar_r (__reent_ptr_t ptr,
        int c)
 {
   _REENT_SMALL_CHECK_INIT (ptr);
@@ -79,7 +79,7 @@ _putchar_r (struct _reent *ptr,
 int
 putchar (int c)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   _REENT_SMALL_CHECK_INIT (reent);
   return _putc_r (reent, c, _stdout_r (reent));
diff --git a/newlib/libc/stdio/putchar_u.c b/newlib/libc/stdio/putchar_u.c
index 029243542b8f..c00ddd951d2f 100644
--- a/newlib/libc/stdio/putchar_u.c
+++ b/newlib/libc/stdio/putchar_u.c
@@ -61,7 +61,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #undef putchar_unlocked
 
 int
-_putchar_unlocked_r (struct _reent *ptr,
+_putchar_unlocked_r (__reent_ptr_t ptr,
        int c)
 {
   return putc_unlocked (c, _stdout_r (ptr));
diff --git a/newlib/libc/stdio/puts.c b/newlib/libc/stdio/puts.c
index d24022b4b36a..bdda15c8647e 100644
--- a/newlib/libc/stdio/puts.c
+++ b/newlib/libc/stdio/puts.c
@@ -28,7 +28,7 @@ SYNOPSIS
 	#include <stdio.h>
 	int puts(const char *<[s]>);
 
-	int _puts_r(struct _reent *<[reent]>, const char *<[s]>);
+	int _puts_r(__reent_ptr_t <[reent]>, const char *<[s]>);
 
 DESCRIPTION
 <<puts>> writes the string at <[s]> (followed by a newline, instead of
@@ -65,7 +65,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
  */
 
 int
-_puts_r (struct _reent *ptr,
+_puts_r (__reent_ptr_t ptr,
        const char * s)
 {
 #ifdef _FVWRITE_IN_STREAMIO
diff --git a/newlib/libc/stdio/putwc.c b/newlib/libc/stdio/putwc.c
index a6c3100d7083..a0b937016b76 100644
--- a/newlib/libc/stdio/putwc.c
+++ b/newlib/libc/stdio/putwc.c
@@ -33,7 +33,7 @@
 #undef putwc
 
 wint_t
-_putwc_r (struct _reent *ptr,
+_putwc_r (__reent_ptr_t ptr,
 	wchar_t wc,
 	FILE *fp)
 {
diff --git a/newlib/libc/stdio/putwc_u.c b/newlib/libc/stdio/putwc_u.c
index 0ec11f04e246..31b9e745cefd 100644
--- a/newlib/libc/stdio/putwc_u.c
+++ b/newlib/libc/stdio/putwc_u.c
@@ -34,7 +34,7 @@
 #undef putwc_unlocked
 
 wint_t
-_putwc_unlocked_r (struct _reent *ptr,
+_putwc_unlocked_r (__reent_ptr_t ptr,
 	wchar_t wc,
 	FILE *fp)
 {
diff --git a/newlib/libc/stdio/putwchar.c b/newlib/libc/stdio/putwchar.c
index 238cb5016888..86bb94560385 100644
--- a/newlib/libc/stdio/putwchar.c
+++ b/newlib/libc/stdio/putwchar.c
@@ -45,10 +45,10 @@ SYNOPSIS
 	wint_t putwchar_unlocked(wchar_t <[wc]>);
 
 	#include <wchar.h>
-	wint_t _putwchar_r(struct _reent *<[reent]>, wchar_t <[wc]>);
+	wint_t _putwchar_r(__reent_ptr_t <[reent]>, wchar_t <[wc]>);
 
 	#include <wchar.h>
-	wint_t _putwchar_unlocked_r(struct _reent *<[reent]>, wchar_t <[wc]>);
+	wint_t _putwchar_unlocked_r(__reent_ptr_t <[reent]>, wchar_t <[wc]>);
 
 DESCRIPTION
 The <<putwchar>> function or macro is the wide-character equivalent of
@@ -87,7 +87,7 @@ PORTABILITY
 #undef putwchar
 
 wint_t
-_putwchar_r (struct _reent *ptr,
+_putwchar_r (__reent_ptr_t ptr,
 	wchar_t wc)
 {
   return _fputwc_r (ptr, wc, stdout);
diff --git a/newlib/libc/stdio/putwchar_u.c b/newlib/libc/stdio/putwchar_u.c
index a5e6a57da8cc..e519de663605 100644
--- a/newlib/libc/stdio/putwchar_u.c
+++ b/newlib/libc/stdio/putwchar_u.c
@@ -34,7 +34,7 @@
 #undef putwchar_unlocked
 
 wint_t
-_putwchar_unlocked_r (struct _reent *ptr,
+_putwchar_unlocked_r (__reent_ptr_t ptr,
 	wchar_t wc)
 {
   return _fputwc_unlocked_r (ptr, wc, stdout);
diff --git a/newlib/libc/stdio/refill.c b/newlib/libc/stdio/refill.c
index cd71ed1529ba..6c949e3da871 100644
--- a/newlib/libc/stdio/refill.c
+++ b/newlib/libc/stdio/refill.c
@@ -23,7 +23,7 @@
 #include "local.h"
 
 static int
-lflush (struct _reent * ptr __unused, FILE *fp)
+lflush (__reent_ptr_t ptr __unused, FILE *fp)
 {
   if ((fp->_flags & (__SLBF | __SWR)) == (__SLBF | __SWR))
     return _fflush_r (_REENT, fp);
@@ -36,7 +36,7 @@ lflush (struct _reent * ptr __unused, FILE *fp)
  */
 
 int
-__srefill_r (struct _reent * ptr,
+__srefill_r (__reent_ptr_t ptr,
        register FILE * fp)
 {
   /* make sure stdio is set up */
diff --git a/newlib/libc/stdio/remove.c b/newlib/libc/stdio/remove.c
index d8dfdbd82a44..c347e754e5d4 100644
--- a/newlib/libc/stdio/remove.c
+++ b/newlib/libc/stdio/remove.c
@@ -28,7 +28,7 @@ SYNOPSIS
 	#include <stdio.h>
 	int remove(char *<[filename]>);
 
-	int _remove_r(struct _reent *<[reent]>, char *<[filename]>);
+	int _remove_r(__reent_ptr_t <[reent]>, char *<[filename]>);
 
 DESCRIPTION
 Use <<remove>> to dissolve the association between a particular
@@ -59,7 +59,7 @@ Supporting OS subroutine required: <<unlink>>.
 #include <stdio.h>
 
 int
-_remove_r (struct _reent *ptr,
+_remove_r (__reent_ptr_t ptr,
        const char *filename)
 {
   if (_unlink_r (ptr, filename) == -1)
diff --git a/newlib/libc/stdio/rewind.c b/newlib/libc/stdio/rewind.c
index aafac0c2ad3c..529f01ecb983 100644
--- a/newlib/libc/stdio/rewind.c
+++ b/newlib/libc/stdio/rewind.c
@@ -27,7 +27,7 @@ INDEX
 SYNOPSIS
 	#include <stdio.h>
 	void rewind(FILE *<[fp]>);
-	void _rewind_r(struct _reent *<[ptr]>, FILE *<[fp]>);
+	void _rewind_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>);
 
 DESCRIPTION
 <<rewind>> returns the file position indicator (if any) for the file
@@ -52,7 +52,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #include <stdio.h>
 
 void
-_rewind_r (struct _reent * ptr,
+_rewind_r (__reent_ptr_t ptr,
        register FILE * fp)
 {
   (void) _fseek_r (ptr, fp, 0L, SEEK_SET);
diff --git a/newlib/libc/stdio/rget.c b/newlib/libc/stdio/rget.c
index 38e8b5dd1959..e0b71f2f8f79 100644
--- a/newlib/libc/stdio/rget.c
+++ b/newlib/libc/stdio/rget.c
@@ -32,7 +32,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
  */
 
 int
-__srget_r (struct _reent *ptr,
+__srget_r (__reent_ptr_t ptr,
        register FILE *fp)
 {
   /* Ensure that any fake std stream is resolved before
diff --git a/newlib/libc/stdio/scanf.c b/newlib/libc/stdio/scanf.c
index a9d23b988b2e..195ea3f7958f 100644
--- a/newlib/libc/stdio/scanf.c
+++ b/newlib/libc/stdio/scanf.c
@@ -28,7 +28,7 @@ scanf(const char *__restrict fmt, ...)
 {
   int ret;
   va_list ap;
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   _REENT_SMALL_CHECK_INIT (reent);
   va_start (ap, fmt);
@@ -46,7 +46,7 @@ iscanf (const char *, ...)
 #endif /* !_REENT_ONLY */
 
 int
-_scanf_r(struct _reent *ptr, const char *__restrict fmt, ...)
+_scanf_r(__reent_ptr_t ptr, const char *__restrict fmt, ...)
 {
   int ret;
   va_list ap;
@@ -60,6 +60,6 @@ _scanf_r(struct _reent *ptr, const char *__restrict fmt, ...)
 
 #ifdef _NANO_FORMATTED_IO
 int
-_iscanf_r (struct _reent *, const char *, ...)
+_iscanf_r (__reent_ptr_t, const char *, ...)
        _ATTRIBUTE ((__alias__("_scanf_r")));
 #endif
diff --git a/newlib/libc/stdio/setvbuf.c b/newlib/libc/stdio/setvbuf.c
index e27ea086c14c..b408eb44ae14 100644
--- a/newlib/libc/stdio/setvbuf.c
+++ b/newlib/libc/stdio/setvbuf.c
@@ -94,7 +94,7 @@ setvbuf (register FILE * fp,
        register size_t size)
 {
   int ret = 0;
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
   size_t iosize;
   int ttyflag;
 
diff --git a/newlib/libc/stdio/sfputs_r.c b/newlib/libc/stdio/sfputs_r.c
index 8e5fc067f344..abea06579912 100644
--- a/newlib/libc/stdio/sfputs_r.c
+++ b/newlib/libc/stdio/sfputs_r.c
@@ -6,7 +6,7 @@
 #include <stdio.h>
 
 int
-__sfputs_r (struct _reent *ptr,
+__sfputs_r (__reent_ptr_t ptr,
        FILE *fp,
        const char *buf,
        size_t len)
diff --git a/newlib/libc/stdio/sfputws_r.c b/newlib/libc/stdio/sfputws_r.c
index 94b04348ed6e..b0ce6dabdf0b 100644
--- a/newlib/libc/stdio/sfputws_r.c
+++ b/newlib/libc/stdio/sfputws_r.c
@@ -7,7 +7,7 @@
 #include <wchar.h>
 
 int
-__sfputws_r (struct _reent *ptr,
+__sfputws_r (__reent_ptr_t ptr,
        FILE *fp,
        const wchar_t *buf,
        size_t len)
diff --git a/newlib/libc/stdio/siprintf.c b/newlib/libc/stdio/siprintf.c
index b337925979bb..ae39536524b1 100644
--- a/newlib/libc/stdio/siprintf.c
+++ b/newlib/libc/stdio/siprintf.c
@@ -56,16 +56,16 @@ SYNOPSIS
         char *asniprintf(char *<[str]>, size_t *<[size]>, 
 			const char *<[format]>, ...);
 
-        int _iprintf_r(struct _reent *<[ptr]>, const char *<[format]>, ...);
-        int _fiprintf_r(struct _reent *<[ptr]>, FILE *<[fd]>,
+        int _iprintf_r(__reent_ptr_t <[ptr]>, const char *<[format]>, ...);
+        int _fiprintf_r(__reent_ptr_t <[ptr]>, FILE *<[fd]>,
                         const char *<[format]>, ...);
-        int _siprintf_r(struct _reent *<[ptr]>, char *<[str]>,
+        int _siprintf_r(__reent_ptr_t <[ptr]>, char *<[str]>,
                         const char *<[format]>, ...);
-        int _sniprintf_r(struct _reent *<[ptr]>, char *<[str]>, size_t <[size]>,
+        int _sniprintf_r(__reent_ptr_t <[ptr]>, char *<[str]>, size_t <[size]>,
                          const char *<[format]>, ...);
-        int _asiprintf_r(struct _reent *<[ptr]>, char **<[strp]>,
+        int _asiprintf_r(__reent_ptr_t <[ptr]>, char **<[strp]>,
                          const char *<[format]>, ...);
-        char *_asniprintf_r(struct _reent *<[ptr]>, char *<[str]>,
+        char *_asniprintf_r(__reent_ptr_t <[ptr]>, char *<[str]>,
                             size_t *<[size]>, const char *<[format]>, ...);
 
 DESCRIPTION
@@ -99,7 +99,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
 #include "local.h"
 
 int
-_siprintf_r (struct _reent *ptr,
+_siprintf_r (__reent_ptr_t ptr,
        char *str,
        const char *fmt, ...)
 {
diff --git a/newlib/libc/stdio/siscanf.c b/newlib/libc/stdio/siscanf.c
index 4c1363d0a766..dedc6c5059ab 100644
--- a/newlib/libc/stdio/siscanf.c
+++ b/newlib/libc/stdio/siscanf.c
@@ -39,10 +39,10 @@ SYNOPSIS
         int fiscanf(FILE *<[fd]>, const char *<[format]>, ...);
         int siscanf(const char *<[str]>, const char *<[format]>, ...);
 
-        int _iscanf_r(struct _reent *<[ptr]>, const char *<[format]>, ...);
-        int _fiscanf_r(struct _reent *<[ptr]>, FILE *<[fd]>, 
+        int _iscanf_r(__reent_ptr_t <[ptr]>, const char *<[format]>, ...);
+        int _fiscanf_r(__reent_ptr_t <[ptr]>, FILE *<[fd]>,
                        const char *<[format]>, ...);
-        int _siscanf_r(struct _reent *<[ptr]>, const char *<[str]>,
+        int _siscanf_r(__reent_ptr_t <[ptr]>, const char *<[str]>,
                    const char *<[format]>, ...);
 
 DESCRIPTION
@@ -106,7 +106,7 @@ siscanf (const char *str,
 #endif /* !_REENT_ONLY */
 
 int 
-_siscanf_r (struct _reent *ptr,
+_siscanf_r (__reent_ptr_t ptr,
        const char *str,
        const char *fmt, ...)
 {
diff --git a/newlib/libc/stdio/sniprintf.c b/newlib/libc/stdio/sniprintf.c
index 852713f1ffb8..fce640e3965b 100644
--- a/newlib/libc/stdio/sniprintf.c
+++ b/newlib/libc/stdio/sniprintf.c
@@ -27,7 +27,7 @@
 #include "local.h"
 
 int
-_sniprintf_r (struct _reent *ptr,
+_sniprintf_r (__reent_ptr_t ptr,
 	char *str,
 	size_t size,
 	const char *fmt, ...)
@@ -66,7 +66,7 @@ sniprintf (char *str,
   int ret;
   va_list ap;
   FILE f;
-  struct _reent *ptr = _REENT;
+  __reent_ptr_t ptr = _REENT;
 
   if (size > INT_MAX)
     {
diff --git a/newlib/libc/stdio/snprintf.c b/newlib/libc/stdio/snprintf.c
index b6130b998393..f3a591858839 100644
--- a/newlib/libc/stdio/snprintf.c
+++ b/newlib/libc/stdio/snprintf.c
@@ -26,7 +26,7 @@
 #include "local.h"
 
 int
-_snprintf_r (struct _reent *ptr,
+_snprintf_r (__reent_ptr_t ptr,
        char *__restrict str,
        size_t size,
        const char *__restrict fmt, ...)
@@ -57,7 +57,7 @@ _snprintf_r (struct _reent *ptr,
 
 #ifdef _NANO_FORMATTED_IO
 int
-_sniprintf_r (struct _reent *, char *, size_t, const char *, ...)
+_sniprintf_r (__reent_ptr_t, char *, size_t, const char *, ...)
        _ATTRIBUTE ((__alias__("_snprintf_r")));
 #endif
 
@@ -71,7 +71,7 @@ snprintf (char *__restrict str,
   int ret;
   va_list ap;
   FILE f;
-  struct _reent *ptr = _REENT;
+  __reent_ptr_t ptr = _REENT;
 
   if (size > INT_MAX)
     {
diff --git a/newlib/libc/stdio/sprint_r.c b/newlib/libc/stdio/sprint_r.c
index 81c7b7f23659..3fbeb8ec496e 100644
--- a/newlib/libc/stdio/sprint_r.c
+++ b/newlib/libc/stdio/sprint_r.c
@@ -11,7 +11,7 @@
  * then reset it so that it can be reused.
  */
 int
-__sprint_r (struct _reent *ptr,
+__sprint_r (__reent_ptr_t ptr,
        FILE *fp,
        register struct __suio *uio)
 {
diff --git a/newlib/libc/stdio/sprintf.c b/newlib/libc/stdio/sprintf.c
index 92cae46189df..b45b85e937a1 100644
--- a/newlib/libc/stdio/sprintf.c
+++ b/newlib/libc/stdio/sprintf.c
@@ -56,16 +56,16 @@ SYNOPSIS
         char *asnprintf(char *restrict <[str]>, size_t *restrict <[size]>, const char *restrict <[format]>,
                         ...);
 
-        int _printf_r(struct _reent *<[ptr]>, const char *restrict <[format]>, ...);
-        int _fprintf_r(struct _reent *<[ptr]>, FILE *restrict <[fd]>,
+        int _printf_r(__reent_ptr_t <[ptr]>, const char *restrict <[format]>, ...);
+        int _fprintf_r(__reent_ptr_t <[ptr]>, FILE *restrict <[fd]>,
                        const char *restrict <[format]>, ...);
-        int _sprintf_r(struct _reent *<[ptr]>, char *restrict <[str]>,
+        int _sprintf_r(__reent_ptr_t <[ptr]>, char *restrict <[str]>,
                        const char *restrict <[format]>, ...);
-        int _snprintf_r(struct _reent *<[ptr]>, char *restrict <[str]>, size_t <[size]>,
+        int _snprintf_r(__reent_ptr_t <[ptr]>, char *restrict <[str]>, size_t <[size]>,
                         const char *restrict <[format]>, ...);
-        int _asprintf_r(struct _reent *<[ptr]>, char **restrict <[strp]>,
+        int _asprintf_r(__reent_ptr_t <[ptr]>, char **restrict <[strp]>,
                         const char *restrict <[format]>, ...);
-        char *_asnprintf_r(struct _reent *<[ptr]>, char *restrict <[str]>,
+        char *_asnprintf_r(__reent_ptr_t <[ptr]>, char *restrict <[str]>,
                            size_t *restrict <[size]>, const char *restrict <[format]>, ...);
 
 DESCRIPTION
@@ -575,7 +575,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
 #include "local.h"
 
 int
-_sprintf_r (struct _reent *ptr,
+_sprintf_r (__reent_ptr_t ptr,
        char *__restrict str,
        const char *__restrict fmt, ...)
 {
@@ -597,7 +597,7 @@ _sprintf_r (struct _reent *ptr,
 
 #ifdef _NANO_FORMATTED_IO
 int
-_siprintf_r (struct _reent *, char *, const char *, ...)
+_siprintf_r (__reent_ptr_t, char *, const char *, ...)
        _ATTRIBUTE ((__alias__("_sprintf_r")));
 #endif
 
diff --git a/newlib/libc/stdio/sscanf.c b/newlib/libc/stdio/sscanf.c
index 52145fc46c20..a9383d558435 100644
--- a/newlib/libc/stdio/sscanf.c
+++ b/newlib/libc/stdio/sscanf.c
@@ -39,10 +39,10 @@ SYNOPSIS
         int fscanf(FILE *restrict <[fd]>, const char *restrict <[format]>, ...);
         int sscanf(const char *restrict <[str]>, const char *restrict <[format]>, ...);
 
-        int _scanf_r(struct _reent *<[ptr]>, const char *restrict <[format]>, ...);
-        int _fscanf_r(struct _reent *<[ptr]>, FILE *restrict <[fd]>, 
+        int _scanf_r(__reent_ptr_t <[ptr]>, const char *restrict <[format]>, ...);
+        int _fscanf_r(__reent_ptr_t <[ptr]>, FILE *restrict <[fd]>,
                       const char *restrict <[format]>, ...);
-        int _sscanf_r(struct _reent *<[ptr]>, const char *restrict <[str]>,
+        int _sscanf_r(__reent_ptr_t <[ptr]>, const char *restrict <[str]>,
                       const char *restrict <[format]>, ...);
 
 DESCRIPTION
@@ -451,7 +451,7 @@ siscanf (const char *, const char *, ...)
 #endif /* !_REENT_ONLY */
 
 int 
-_sscanf_r (struct _reent *ptr,
+_sscanf_r (__reent_ptr_t ptr,
        const char *__restrict str,
        const char *__restrict fmt, ...)
 {
@@ -475,6 +475,6 @@ _sscanf_r (struct _reent *ptr,
 
 #ifdef _NANO_FORMATTED_IO
 int
-_siscanf_r (struct _reent *, const char *, const char *, ...)
+_siscanf_r (__reent_ptr_t, const char *, const char *, ...)
        _ATTRIBUTE ((__alias__("_sscanf_r")));
 #endif
diff --git a/newlib/libc/stdio/ssprint_r.c b/newlib/libc/stdio/ssprint_r.c
index eedbd6a9390e..815bca179df1 100644
--- a/newlib/libc/stdio/ssprint_r.c
+++ b/newlib/libc/stdio/ssprint_r.c
@@ -6,11 +6,11 @@
 #include <stdio.h>
 #include "fvwrite.h"
 
-extern int __ssputs_r (struct _reent *ptr, FILE *fp, const char *buf,
+extern int __ssputs_r (__reent_ptr_t ptr, FILE *fp, const char *buf,
 		       size_t len);
 
 int
-__ssprint_r (struct _reent *ptr,
+__ssprint_r (__reent_ptr_t ptr,
 	FILE *fp,
 	register struct __suio *uio)
 {
diff --git a/newlib/libc/stdio/ssputs_r.c b/newlib/libc/stdio/ssputs_r.c
index abd18ef4bfd7..cc6ac860596f 100644
--- a/newlib/libc/stdio/ssputs_r.c
+++ b/newlib/libc/stdio/ssputs_r.c
@@ -7,7 +7,7 @@
 #include <errno.h>
 
 int
-__ssputs_r (struct _reent *ptr,
+__ssputs_r (__reent_ptr_t ptr,
 	FILE *fp,
 	const char *buf,
 	size_t len)
diff --git a/newlib/libc/stdio/ssputws_r.c b/newlib/libc/stdio/ssputws_r.c
index 07ceba800eb1..1b54adbd9a2a 100644
--- a/newlib/libc/stdio/ssputws_r.c
+++ b/newlib/libc/stdio/ssputws_r.c
@@ -6,11 +6,11 @@
 #include <stdio.h>
 #include <wchar.h>
 
-extern int __ssputs_r (struct _reent *ptr, FILE *fp, const char *buf,
+extern int __ssputs_r (__reent_ptr_t ptr, FILE *fp, const char *buf,
 		       size_t len);
 
 int
-__ssputws_r (struct _reent *ptr,
+__ssputws_r (__reent_ptr_t ptr,
 	FILE *fp,
 	const wchar_t *buf,
 	size_t len)
diff --git a/newlib/libc/stdio/sswprint_r.c b/newlib/libc/stdio/sswprint_r.c
index 963e31df38b0..f25d4971399b 100644
--- a/newlib/libc/stdio/sswprint_r.c
+++ b/newlib/libc/stdio/sswprint_r.c
@@ -7,11 +7,11 @@
 #include <wchar.h>
 #include "fvwrite.h"
 
-extern int __ssputs_r (struct _reent *ptr, FILE *fp, const char *buf,
+extern int __ssputs_r (__reent_ptr_t ptr, FILE *fp, const char *buf,
 		       size_t len);
 
 int
-__sswprint_r (struct _reent *ptr,
+__sswprint_r (__reent_ptr_t ptr,
 	FILE *fp,
 	register struct __suio *uio)
 {
diff --git a/newlib/libc/stdio/stdio.c b/newlib/libc/stdio/stdio.c
index e3abdb0cef9e..26b6182e45e8 100644
--- a/newlib/libc/stdio/stdio.c
+++ b/newlib/libc/stdio/stdio.c
@@ -30,7 +30,7 @@
  */
 
 _READ_WRITE_RETURN_TYPE
-__sread (struct _reent *ptr,
+__sread (__reent_ptr_t ptr,
        void *cookie,
        char *buf,
        _READ_WRITE_BUFSIZE_TYPE n)
@@ -62,7 +62,7 @@ __sread (struct _reent *ptr,
 
 /* Dummy function used in sscanf/swscanf. */
 _READ_WRITE_RETURN_TYPE
-__seofread (struct _reent *_ptr,
+__seofread (__reent_ptr_t _ptr,
        void *cookie,
        char *buf,
        _READ_WRITE_BUFSIZE_TYPE len)
@@ -71,7 +71,7 @@ __seofread (struct _reent *_ptr,
 }
 
 _READ_WRITE_RETURN_TYPE
-__swrite (struct _reent *ptr,
+__swrite (__reent_ptr_t ptr,
        void *cookie,
        char const *buf,
        _READ_WRITE_BUFSIZE_TYPE n)
@@ -102,7 +102,7 @@ __swrite (struct _reent *ptr,
 }
 
 _fpos_t
-__sseek (struct _reent *ptr,
+__sseek (__reent_ptr_t ptr,
        void *cookie,
        _fpos_t offset,
        int whence)
@@ -122,7 +122,7 @@ __sseek (struct _reent *ptr,
 }
 
 int
-__sclose (struct _reent *ptr,
+__sclose (__reent_ptr_t ptr,
        void *cookie)
 {
   FILE *fp = (FILE *) cookie;
diff --git a/newlib/libc/stdio/swprint_r.c b/newlib/libc/stdio/swprint_r.c
index e4be0c839a25..5cb6eece305e 100644
--- a/newlib/libc/stdio/swprint_r.c
+++ b/newlib/libc/stdio/swprint_r.c
@@ -12,7 +12,7 @@
  * then reset it so that it can be reused.
  */
 int
-__swprint_r (struct _reent *ptr,
+__swprint_r (__reent_ptr_t ptr,
        FILE *fp,
        register struct __suio *uio)
 {
diff --git a/newlib/libc/stdio/swprintf.c b/newlib/libc/stdio/swprintf.c
index e590b522ced8..8e306df35353 100644
--- a/newlib/libc/stdio/swprintf.c
+++ b/newlib/libc/stdio/swprintf.c
@@ -41,10 +41,10 @@ SYNOPSIS
         int swprintf(wchar_t *__restrict <[str]>, size_t <[size]>,
                      const wchar_t *__restrict <[format]>, ...);
 
-        int _wprintf_r(struct _reent *<[ptr]>, const wchar_t *<[format]>, ...);
-        int _fwprintf_r(struct _reent *<[ptr]>, FILE *<[fd]>,
+        int _wprintf_r(__reent_ptr_t <[ptr]>, const wchar_t *<[format]>, ...);
+        int _fwprintf_r(__reent_ptr_t <[ptr]>, FILE *<[fd]>,
                         const wchar_t *<[format]>, ...);
-        int _swprintf_r(struct _reent *<[ptr]>, wchar_t *<[str]>,
+        int _swprintf_r(__reent_ptr_t <[ptr]>, wchar_t *<[str]>,
                         size_t <[size]>, const wchar_t *<[format]>, ...);
 
 DESCRIPTION
@@ -553,7 +553,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
  * a variable set to _REENT.  */
 
 int
-_swprintf_r (struct _reent *ptr,
+_swprintf_r (__reent_ptr_t ptr,
        wchar_t *str,
        size_t size,
        const wchar_t *fmt, ...)
@@ -601,7 +601,7 @@ swprintf (wchar_t *__restrict str,
   int ret;
   va_list ap;
   FILE f;
-  struct _reent *ptr = _REENT;
+  __reent_ptr_t ptr = _REENT;
 
   if (size > INT_MAX / sizeof (wchar_t))
     {
diff --git a/newlib/libc/stdio/swscanf.c b/newlib/libc/stdio/swscanf.c
index 0ef4d0ebde18..bf6d05d4830f 100644
--- a/newlib/libc/stdio/swscanf.c
+++ b/newlib/libc/stdio/swscanf.c
@@ -41,10 +41,10 @@ SYNOPSIS
         int swscanf(const wchar_t *__restrict <[str]>, 
                     const wchar_t *__restrict <[format]>, ...);
 
-        int _wscanf_r(struct _reent *<[ptr]>, const wchar_t *<[format]>, ...);
-        int _fwscanf_r(struct _reent *<[ptr]>, FILE *<[fd]>, 
+        int _wscanf_r(__reent_ptr_t <[ptr]>, const wchar_t *<[format]>, ...);
+        int _fwscanf_r(__reent_ptr_t <[ptr]>, FILE *<[fd]>,
                       const wchar_t *<[format]>, ...);
-        int _swscanf_r(struct _reent *<[ptr]>, const wchar_t *<[str]>,
+        int _swscanf_r(__reent_ptr_t <[ptr]>, const wchar_t *<[str]>,
                       const wchar_t *<[format]>, ...);
 
 DESCRIPTION
@@ -440,7 +440,7 @@ swscanf (const wchar_t *__restrict str, const wchar_t *__restrict fmt, ...)
 #endif /* !_REENT_ONLY */
 
 int 
-_swscanf_r (struct _reent *ptr, const wchar_t *str, const wchar_t *fmt, ...)
+_swscanf_r (__reent_ptr_t ptr, const wchar_t *str, const wchar_t *fmt, ...)
 {
   int ret;
   va_list ap;
diff --git a/newlib/libc/stdio/tmpfile.c b/newlib/libc/stdio/tmpfile.c
index 5fe6e3bf1de2..89578cd1e40e 100644
--- a/newlib/libc/stdio/tmpfile.c
+++ b/newlib/libc/stdio/tmpfile.c
@@ -11,7 +11,7 @@ SYNOPSIS
 	#include <stdio.h>
 	FILE *tmpfile(void);
 
-	FILE *_tmpfile_r(struct _reent *<[reent]>);
+	FILE *_tmpfile_r(__reent_ptr_t <[reent]>);
 
 DESCRIPTION
 Create a temporary file (a file which will be deleted automatically),
@@ -50,7 +50,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<getpid>>,
 #endif
 
 FILE *
-_tmpfile_r (struct _reent *ptr)
+_tmpfile_r (__reent_ptr_t ptr)
 {
   FILE *fp;
   int e;
diff --git a/newlib/libc/stdio/tmpnam.c b/newlib/libc/stdio/tmpnam.c
index dc04cf3f6cd4..2846479aa845 100644
--- a/newlib/libc/stdio/tmpnam.c
+++ b/newlib/libc/stdio/tmpnam.c
@@ -19,8 +19,8 @@ SYNOPSIS
 	#include <stdio.h>
 	char *tmpnam(char *<[s]>);
 	char *tempnam(char *<[dir]>, char *<[pfx]>);
-	char *_tmpnam_r(struct _reent *<[reent]>, char *<[s]>);
-	char *_tempnam_r(struct _reent *<[reent]>, char *<[dir]>, char *<[pfx]>);
+	char *_tmpnam_r(__reent_ptr_t <[reent]>, char *<[s]>);
+	char *_tempnam_r(__reent_ptr_t <[reent]>, char *<[dir]>, char *<[pfx]>);
 
 DESCRIPTION
 Use either of these functions to generate a name for a temporary file.
@@ -91,7 +91,7 @@ _Thread_local char _tls_emergency[_REENT_EMERGENCY_SIZE];
    another one.  Return nonzero if successful, otherwise zero.  */
 
 static int
-worker (struct _reent *ptr,
+worker (__reent_ptr_t ptr,
        char *result,
        const char *part1,
        const char *part2,
@@ -122,7 +122,7 @@ worker (struct _reent *ptr,
 }
 
 char *
-_tmpnam_r (struct _reent *p,
+_tmpnam_r (__reent_ptr_t p,
        char *s)
 {
   char *result;
@@ -150,7 +150,7 @@ _tmpnam_r (struct _reent *p,
 }
 
 char *
-_tempnam_r (struct _reent *p,
+_tempnam_r (__reent_ptr_t p,
        const char *dir,
        const char *pfx)
 {
diff --git a/newlib/libc/stdio/ungetc.c b/newlib/libc/stdio/ungetc.c
index 8b10c8218616..adced652c23c 100644
--- a/newlib/libc/stdio/ungetc.c
+++ b/newlib/libc/stdio/ungetc.c
@@ -27,7 +27,7 @@ SYNOPSIS
 	#include <stdio.h>
 	int ungetc(int <[c]>, FILE *<[stream]>);
 
-	int _ungetc_r(struct _reent *<[reent]>, int <[c]>, FILE *<[stream]>);
+	int _ungetc_r(__reent_ptr_t <[reent]>, int <[c]>, FILE *<[stream]>);
 
 DESCRIPTION
 <<ungetc>> is used to return bytes back to <[stream]> to be read again.
@@ -77,7 +77,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 
 /*static*/
 int
-__submore (struct _reent *rptr,
+__submore (__reent_ptr_t rptr,
        register FILE *fp)
 {
   register int i;
@@ -110,7 +110,7 @@ __submore (struct _reent *rptr,
 }
 
 int
-_ungetc_r (struct _reent *rptr,
+_ungetc_r (__reent_ptr_t rptr,
        int c,
        register FILE *fp)
 {
diff --git a/newlib/libc/stdio/ungetwc.c b/newlib/libc/stdio/ungetwc.c
index a04ca3467d61..4db0b922ebe9 100644
--- a/newlib/libc/stdio/ungetwc.c
+++ b/newlib/libc/stdio/ungetwc.c
@@ -38,7 +38,7 @@ SYNOPSIS
         #include <wchar.h>
         wint_t ungetwc(wint_t <[wc]>, FILE *<[stream]>);
 
-        wint_t _ungetwc_r(struct _reent *<[reent]>, wint_t <[wc]>, FILE *<[stream]>);
+        wint_t _ungetwc_r(__reent_ptr_t <[reent]>, wint_t <[wc]>, FILE *<[stream]>);
 
 DESCRIPTION
 <<ungetwc>> is used to return wide characters back to <[stream]> to be
@@ -74,7 +74,7 @@ C99
 #include "local.h"
 
 wint_t
-_ungetwc_r (struct _reent *ptr,
+_ungetwc_r (__reent_ptr_t ptr,
 	wint_t wc,
 	register FILE *fp)
 {
@@ -108,7 +108,7 @@ wint_t
 ungetwc (wint_t wc,
 	FILE *fp)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   CHECK_INIT (reent, fp);
   return _ungetwc_r (reent, wc, fp);
diff --git a/newlib/libc/stdio/vasiprintf.c b/newlib/libc/stdio/vasiprintf.c
index d9c11eaf503f..53b1668957d6 100644
--- a/newlib/libc/stdio/vasiprintf.c
+++ b/newlib/libc/stdio/vasiprintf.c
@@ -41,7 +41,7 @@ vasiprintf (char **strp,
 #endif /* !_REENT_ONLY */
 
 int
-_vasiprintf_r (struct _reent *ptr,
+_vasiprintf_r (__reent_ptr_t ptr,
        char **strp,
        const char *fmt,
        va_list ap)
diff --git a/newlib/libc/stdio/vasniprintf.c b/newlib/libc/stdio/vasniprintf.c
index c85ca06e8c1a..c4292aa9a4a8 100644
--- a/newlib/libc/stdio/vasniprintf.c
+++ b/newlib/libc/stdio/vasniprintf.c
@@ -14,7 +14,7 @@
 #include "local.h"
 
 char *
-_vasniprintf_r (struct _reent *ptr,
+_vasniprintf_r (__reent_ptr_t ptr,
        char *buf,
        size_t *lenp,
        const char *fmt,
diff --git a/newlib/libc/stdio/vasnprintf.c b/newlib/libc/stdio/vasnprintf.c
index 02f55caa9a95..965202851791 100644
--- a/newlib/libc/stdio/vasnprintf.c
+++ b/newlib/libc/stdio/vasnprintf.c
@@ -14,7 +14,7 @@
 #include "local.h"
 
 char *
-_vasnprintf_r (struct _reent *ptr,
+_vasnprintf_r (__reent_ptr_t ptr,
        char *buf,
        size_t *lenp,
        const char *fmt,
@@ -58,7 +58,7 @@ _vasnprintf_r (struct _reent *ptr,
 
 #ifdef _NANO_FORMATTED_IO
 char *
-_vasniprintf_r (struct _reent*, char *, size_t *,
+_vasniprintf_r (__reent_ptr_t, char *, size_t *,
 			const char *, __VALIST)
        _ATTRIBUTE ((__alias__("_vasnprintf_r")));
 #endif
diff --git a/newlib/libc/stdio/vasprintf.c b/newlib/libc/stdio/vasprintf.c
index b466936bd94b..fd025d5029c5 100644
--- a/newlib/libc/stdio/vasprintf.c
+++ b/newlib/libc/stdio/vasprintf.c
@@ -47,7 +47,7 @@ vasiprintf (char **, const char *, __VALIST)
 #endif /* !_REENT_ONLY */
 
 int
-_vasprintf_r (struct _reent *ptr,
+_vasprintf_r (__reent_ptr_t ptr,
        char **strp,
        const char *fmt,
        va_list ap)
@@ -71,6 +71,6 @@ _vasprintf_r (struct _reent *ptr,
 
 #ifdef _NANO_FORMATTED_IO
 int
-_vasiprintf_r (struct _reent *, char **, const char *, __VALIST)
+_vasiprintf_r (__reent_ptr_t, char **, const char *, __VALIST)
        _ATTRIBUTE ((__alias__("_vasprintf_r")));
 #endif
diff --git a/newlib/libc/stdio/vdiprintf.c b/newlib/libc/stdio/vdiprintf.c
index 22a71b326299..22d110e2e6a7 100644
--- a/newlib/libc/stdio/vdiprintf.c
+++ b/newlib/libc/stdio/vdiprintf.c
@@ -13,7 +13,7 @@
 #include "local.h"
 
 int
-_vdiprintf_r (struct _reent *ptr,
+_vdiprintf_r (__reent_ptr_t ptr,
        int fd,
        const char *format,
        va_list ap)
diff --git a/newlib/libc/stdio/vdprintf.c b/newlib/libc/stdio/vdprintf.c
index d22463e49fa8..29dcb298998a 100644
--- a/newlib/libc/stdio/vdprintf.c
+++ b/newlib/libc/stdio/vdprintf.c
@@ -13,7 +13,7 @@
 #include "local.h"
 
 int
-_vdprintf_r (struct _reent *ptr,
+_vdprintf_r (__reent_ptr_t ptr,
        int fd,
        const char *__restrict format,
        va_list ap)
@@ -34,7 +34,7 @@ _vdprintf_r (struct _reent *ptr,
 
 #ifdef _NANO_FORMATTED_IO
 int
-_vdiprintf_r (struct _reent *, int, const char *, __VALIST)
+_vdiprintf_r (__reent_ptr_t, int, const char *, __VALIST)
        _ATTRIBUTE ((__alias__("_vdprintf_r")));
 #endif
 
diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c
index feb1fab56063..a674967efff8 100644
--- a/newlib/libc/stdio/vfprintf.c
+++ b/newlib/libc/stdio/vfprintf.c
@@ -71,17 +71,17 @@ SYNOPSIS
 	char *vasnprintf(char *<[str]>, size_t *<[size]>, const char *<[fmt]>,
                          va_list <[list]>);
 
-	int _vprintf_r(struct _reent *<[reent]>, const char *<[fmt]>,
+	int _vprintf_r(__reent_ptr_t <[reent]>, const char *<[fmt]>,
                         va_list <[list]>);
-	int _vfprintf_r(struct _reent *<[reent]>, FILE *<[fp]>,
+	int _vfprintf_r(__reent_ptr_t <[reent]>, FILE *<[fp]>,
                         const char *<[fmt]>, va_list <[list]>);
-	int _vsprintf_r(struct _reent *<[reent]>, char *<[str]>,
+	int _vsprintf_r(__reent_ptr_t <[reent]>, char *<[str]>,
                         const char *<[fmt]>, va_list <[list]>);
-	int _vasprintf_r(struct _reent *<[reent]>, char **<[str]>,
+	int _vasprintf_r(__reent_ptr_t <[reent]>, char **<[str]>,
                          const char *<[fmt]>, va_list <[list]>);
-	int _vsnprintf_r(struct _reent *<[reent]>, char *<[str]>,
+	int _vsnprintf_r(__reent_ptr_t <[reent]>, char *<[str]>,
                          size_t <[size]>, const char *<[fmt]>, va_list <[list]>);
-	char *_vasnprintf_r(struct _reent *<[reent]>, char *<[str]>,
+	char *_vasnprintf_r(__reent_ptr_t <[reent]>, char *<[str]>,
                             size_t *<[size]>, const char *<[fmt]>, va_list <[list]>);
 
 DESCRIPTION
@@ -177,20 +177,20 @@ static char *rcsid = "$Id$";
 
 # ifdef _FVWRITE_IN_STREAMIO
 #  define __SPRINT __ssprint_r
-   int __ssprint_r (struct _reent *, FILE *, register struct __suio *);
+   int __ssprint_r (__reent_ptr_t, FILE *, register struct __suio *);
 # else
 #  define __SPRINT __ssputs_r
-   int __ssputs_r (struct _reent *, FILE *, const char *, size_t);
+   int __ssputs_r (__reent_ptr_t, FILE *, const char *, size_t);
 # endif
 
 #else /* !STRING_ONLY */
 
 # ifdef _FVWRITE_IN_STREAMIO
 #  define __SPRINT __sprint_r
-   int __sprint_r (struct _reent *, FILE *, register struct __suio *);
+   int __sprint_r (__reent_ptr_t, FILE *, register struct __suio *);
 # else
 #  define __SPRINT __sfputs_r
-   int __sfputs_r (struct _reent *, FILE *, const char *buf, size_t);
+   int __sfputs_r (__reent_ptr_t, FILE *, const char *buf, size_t);
 # endif
 
 #ifdef _UNBUF_STREAM_OPT
@@ -202,7 +202,7 @@ static char *rcsid = "$Id$";
  * Make sure to avoid inlining.
  */
 _NOINLINE_STATIC int
-__sbprintf (struct _reent *rptr,
+__sbprintf (__reent_ptr_t rptr,
        register FILE *fp,
        const char *fmt,
        va_list ap)
@@ -255,7 +255,7 @@ __sbprintf (struct _reent *rptr,
 
 # ifdef _NO_LONGDBL
 
-extern char *_dtoa_r (struct _reent *, double, int,
+extern char *_dtoa_r (__reent_ptr_t, double, int,
 			      int, int *, int *, char **);
 
 #  define _PRINTF_FLOAT_TYPE double
@@ -264,7 +264,7 @@ extern char *_dtoa_r (struct _reent *, double, int,
 
 # else /* !_NO_LONGDBL */
 
-extern char *_ldtoa_r (struct _reent *, _LONG_DOUBLE, int,
+extern char *_ldtoa_r (__reent_ptr_t, _LONG_DOUBLE, int,
 			      int, int *, int *, char **);
 
 extern int _ldcheck (_LONG_DOUBLE *);
@@ -274,7 +274,7 @@ extern int _ldcheck (_LONG_DOUBLE *);
 #  define FREXP frexpl
 # endif /* !_NO_LONGDBL */
 
-static char *cvt(struct _reent *, _PRINTF_FLOAT_TYPE, int, int, char *, int *,
+static char *cvt(__reent_ptr_t, _PRINTF_FLOAT_TYPE, int, int, char *, int *,
                  int, int *, char *);
 
 static int exponent(char *, int, int);
@@ -347,7 +347,7 @@ union arg_val
 };
 
 static union arg_val *
-get_arg (struct _reent *data, int n, char *fmt,
+get_arg (__reent_ptr_t data, int n, char *fmt,
                  va_list *ap, int *numargs, union arg_val *args,
                  int *arg_type, char **last_fmt);
 #endif /* !_NO_POS_ARGS */
@@ -386,7 +386,7 @@ get_arg (struct _reent *data, int n, char *fmt,
 # define GROUPING	0x400		/* use grouping ("'" flag) */
 #endif
 
-int _VFPRINTF_R (struct _reent *, FILE *, const char *, va_list);
+int _VFPRINTF_R (__reent_ptr_t, FILE *, const char *, va_list);
 
 #ifndef STRING_ONLY
 int
@@ -401,7 +401,7 @@ VFPRINTF (FILE * fp,
 #endif /* STRING_ONLY */
 
 int
-_VFPRINTF_R (struct _reent *data,
+_VFPRINTF_R (__reent_ptr_t data,
        FILE * fp,
        const char *fmt0,
        va_list ap)
@@ -1549,7 +1549,7 @@ error:
    [aAeEfFgG]; if it is [aA], then the return string lives in BUF,
    otherwise the return value shares the mprec reentrant storage.  */
 static char *
-cvt(struct _reent *data, _PRINTF_FLOAT_TYPE value, int ndigits, int flags,
+cvt(__reent_ptr_t data, _PRINTF_FLOAT_TYPE value, int ndigits, int flags,
     char *sign, int *decpt, int ch, int *length, char *buf)
 {
 	int mode, dsgn;
@@ -1786,7 +1786,7 @@ const __ACTION __action_table[MAX_STATE][MAX_CH_CLASS] = {
 
 /* function to get positional parameter N where n = N - 1 */
 static union arg_val *
-get_arg (struct _reent *data,
+get_arg (__reent_ptr_t data,
        int n,
        char *fmt,
        va_list *ap,
diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c
index 71e2c3e22223..f8fb2a4b4f81 100644
--- a/newlib/libc/stdio/vfscanf.c
+++ b/newlib/libc/stdio/vfscanf.c
@@ -39,11 +39,11 @@ SYNOPSIS
 	int vfscanf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
 	int vsscanf(const char *<[str]>, const char *<[fmt]>, va_list <[list]>);
 
-	int _vscanf_r(struct _reent *<[reent]>, const char *<[fmt]>,
+	int _vscanf_r(__reent_ptr_t <[reent]>, const char *<[fmt]>,
                        va_list <[list]>);
-	int _vfscanf_r(struct _reent *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
+	int _vfscanf_r(__reent_ptr_t <[reent]>, FILE *<[fp]>, const char *<[fmt]>,
                        va_list <[list]>);
-	int _vsscanf_r(struct _reent *<[reent]>, const char *<[str]>,
+	int _vsscanf_r(__reent_ptr_t <[reent]>, const char *<[str]>,
                        const char *<[fmt]>, va_list <[list]>);
 
 DESCRIPTION
@@ -229,7 +229,7 @@ VFSCANF (register FILE *fp,
        const char *fmt,
        va_list ap)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   CHECK_INIT(reent, fp);
   return __SVFSCANF_R (reent, fp, fmt, ap);
@@ -246,7 +246,7 @@ __SVFSCANF (register FILE *fp,
 #endif /* !_REENT_ONLY */
 
 int
-_VFSCANF_R (struct _reent *data,
+_VFSCANF_R (__reent_ptr_t data,
        register FILE *fp,
        const char *fmt,
        va_list ap)
@@ -261,7 +261,7 @@ _VFSCANF_R (struct _reent *data,
  * regular ungetc which will drag in file I/O items we don't need.
  * So, we create our own trimmed-down version.  */
 int
-_sungetc_r (struct _reent *data,
+_sungetc_r (__reent_ptr_t data,
 	int c,
 	register FILE *fp)
 {
@@ -318,7 +318,7 @@ _sungetc_r (struct _reent *data,
 
 /* String only version of __srefill_r for sscanf family.  */
 int
-__ssrefill_r (struct _reent * ptr,
+__ssrefill_r (__reent_ptr_t ptr,
        register FILE * fp)
 {
   /*
@@ -343,7 +343,7 @@ __ssrefill_r (struct _reent * ptr,
 }
 
 size_t
-_sfread_r (struct _reent * ptr,
+_sfread_r (__reent_ptr_t ptr,
        void *buf,
        size_t size,
        size_t count,
@@ -379,13 +379,13 @@ _sfread_r (struct _reent * ptr,
   return count;
 }
 #else /* !STRING_ONLY || !INTEGER_ONLY */
-int _sungetc_r (struct _reent *, int, register FILE *);
-int __ssrefill_r (struct _reent *, register FILE *);
-size_t _sfread_r (struct _reent *, void *buf, size_t, size_t, FILE *);
+int _sungetc_r (__reent_ptr_t, int, register FILE *);
+int __ssrefill_r (__reent_ptr_t, register FILE *);
+size_t _sfread_r (__reent_ptr_t, void *buf, size_t, size_t, FILE *);
 #endif /* !STRING_ONLY || !INTEGER_ONLY */
 
 static inline int
-__wctob (struct _reent *rptr, wint_t wc)
+__wctob (__reent_ptr_t rptr, wint_t wc)
 {
   mbstate_t mbs;
   unsigned char pmb[MB_LEN_MAX];
@@ -397,7 +397,7 @@ __wctob (struct _reent *rptr, wint_t wc)
 }
 
 int
-__SVFSCANF_R (struct _reent *rptr,
+__SVFSCANF_R (__reent_ptr_t rptr,
        register FILE *fp,
        char const *fmt0,
        va_list ap)
@@ -548,7 +548,7 @@ __SVFSCANF_R (struct _reent *rptr,
     while (0)
 #endif
 
-  #define CCFN_PARAMS	(struct _reent *, const char *, char **, int)
+  #define CCFN_PARAMS	(__reent_ptr_t, const char *, char **, int)
   u_long (*ccfn)CCFN_PARAMS=0;	/* conversion function (strtol/strtoul) */
   char ccltab[256];		/* character class table for %[...] */
   char buf[BUF];		/* buffer for numeric conversions */
diff --git a/newlib/libc/stdio/vfwprintf.c b/newlib/libc/stdio/vfwprintf.c
index 5a5c368298d2..d61960ebdda6 100644
--- a/newlib/libc/stdio/vfwprintf.c
+++ b/newlib/libc/stdio/vfwprintf.c
@@ -57,11 +57,11 @@ SYNOPSIS
 	int vswprintf(wchar_t * __restrict <[str]>, size_t <[size]>,
 		const wchar_t *__ restrict <[fmt]>, va_list <[list]>);
 
-	int _vwprintf_r(struct _reent *<[reent]>, const wchar_t *<[fmt]>,
+	int _vwprintf_r(__reent_ptr_t <[reent]>, const wchar_t *<[fmt]>,
 		va_list <[list]>);
-	int _vfwprintf_r(struct _reent *<[reent]>, FILE *<[fp]>,
+	int _vfwprintf_r(__reent_ptr_t <[reent]>, FILE *<[fp]>,
 		const wchar_t *<[fmt]>, va_list <[list]>);
-	int _vswprintf_r(struct _reent *<[reent]>, wchar_t *<[str]>,
+	int _vswprintf_r(__reent_ptr_t <[reent]>, wchar_t *<[str]>,
 		size_t <[size]>, const wchar_t *<[fmt]>, va_list <[list]>);
 
 DESCRIPTION
@@ -149,7 +149,7 @@ SEEALSO
 # undef _NO_LONGLONG
 #endif
 
-int _VFWPRINTF_R (struct _reent *, FILE *, const wchar_t *, va_list);
+int _VFWPRINTF_R (__reent_ptr_t, FILE *, const wchar_t *, va_list);
 /* Defined in vfprintf.c. */
 #ifdef _FVWRITE_IN_STREAMIO
 # ifdef STRING_ONLY
@@ -157,14 +157,14 @@ int _VFWPRINTF_R (struct _reent *, FILE *, const wchar_t *, va_list);
 # else
 #  define __SPRINT __swprint_r
 # endif
-int __SPRINT (struct _reent *, FILE *, register struct __suio *);
+int __SPRINT (__reent_ptr_t, FILE *, register struct __suio *);
 #else
 # ifdef STRING_ONLY
 #  define __SPRINT __ssputws_r
 # else
 #  define __SPRINT __sfputws_r
 # endif
-int __SPRINT (struct _reent *, FILE *, const wchar_t *, size_t);
+int __SPRINT (__reent_ptr_t, FILE *, const wchar_t *, size_t);
 #endif
 #ifndef STRING_ONLY
 #ifdef _UNBUF_STREAM_OPT
@@ -174,7 +174,7 @@ int __SPRINT (struct _reent *, FILE *, const wchar_t *, size_t);
  * worries about ungetc buffers and so forth.
  */
 static int
-__sbwprintf (struct _reent *rptr,
+__sbwprintf (__reent_ptr_t rptr,
        register FILE *fp,
        const wchar_t *fmt,
        va_list ap)
@@ -227,7 +227,7 @@ __sbwprintf (struct _reent *rptr,
 
 # ifdef _NO_LONGDBL
 
-extern char *_dtoa_r (struct _reent *, double, int,
+extern char *_dtoa_r (__reent_ptr_t, double, int,
 			      int, int *, int *, char **);
 
 #  define _PRINTF_FLOAT_TYPE double
@@ -236,7 +236,7 @@ extern char *_dtoa_r (struct _reent *, double, int,
 
 # else /* !_NO_LONGDBL */
 
-extern char *_ldtoa_r (struct _reent *, _LONG_DOUBLE, int,
+extern char *_ldtoa_r (__reent_ptr_t, _LONG_DOUBLE, int,
 			      int, int *, int *, char **);
 
 extern int _ldcheck (_LONG_DOUBLE *);
@@ -246,7 +246,7 @@ extern int _ldcheck (_LONG_DOUBLE *);
 #  define FREXP frexpl
 # endif /* !_NO_LONGDBL */
 
-static wchar_t *wcvt(struct _reent *, _PRINTF_FLOAT_TYPE, int, int, wchar_t *,
+static wchar_t *wcvt(__reent_ptr_t, _PRINTF_FLOAT_TYPE, int, int, wchar_t *,
 		    int *, int, int *, wchar_t *, int);
 
 static int wexponent(wchar_t *, int, int);
@@ -321,7 +321,7 @@ union arg_val
 };
 
 static union arg_val *
-get_arg (struct _reent *data, int n, wchar_t *fmt,
+get_arg (__reent_ptr_t data, int n, wchar_t *fmt,
                  va_list *ap, int *numargs, union arg_val *args,
                  int *arg_type, wchar_t **last_fmt);
 #endif /* !_NO_POS_ARGS */
@@ -373,7 +373,7 @@ VFWPRINTF (FILE *__restrict fp,
 #endif /* STRING_ONLY */
 
 int
-_VFWPRINTF_R (struct _reent *data,
+_VFWPRINTF_R (__reent_ptr_t data,
        FILE * fp,
        const wchar_t *fmt0,
        va_list ap)
@@ -1551,7 +1551,7 @@ error:
    of characters will be returned in BUF, but *LENGTH will be set to
    the full length of the string before the truncation.  */
 static wchar_t *
-wcvt(struct _reent *data, _PRINTF_FLOAT_TYPE value, int ndigits, int flags,
+wcvt(__reent_ptr_t data, _PRINTF_FLOAT_TYPE value, int ndigits, int flags,
      wchar_t *sign, int *decpt, int ch, int *length, wchar_t *buf, int len)
 {
 	int mode, dsgn;
@@ -1731,7 +1731,7 @@ wexponent(wchar_t *p0, int exp, int fmtch)
 
 /* function to get positional parameter N where n = N - 1 */
 static union arg_val *
-get_arg (struct _reent *data,
+get_arg (__reent_ptr_t data,
        int n,
        wchar_t *fmt,
        va_list *ap,
diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c
index d2f91dde2ba2..62a5c9b38c4c 100644
--- a/newlib/libc/stdio/vfwscanf.c
+++ b/newlib/libc/stdio/vfwscanf.c
@@ -41,11 +41,11 @@ SYNOPSIS
 	int vswscanf(const wchar_t *__restrict <[str]>,
                      const wchar_t *__restrict <[fmt]>, va_list <[list]>);
 
-	int _vwscanf(struct _reent *<[reent]>, const wchar_t *<[fmt]>,
+	int _vwscanf(__reent_ptr_t <[reent]>, const wchar_t *<[fmt]>,
                        va_list <[list]>);
-	int _vfwscanf(struct _reent *<[reent]>, FILE *<[fp]>,
+	int _vfwscanf(__reent_ptr_t <[reent]>, FILE *<[fp]>,
                       const wchar_t *<[fmt]>, va_list <[list]>);
-	int _vswscanf(struct _reent *<[reent]>, const wchar_t *<[str]>,
+	int _vswscanf(__reent_ptr_t <[reent]>, const wchar_t *<[str]>,
                        const wchar_t *<[fmt]>, va_list <[list]>);
 
 DESCRIPTION
@@ -230,7 +230,7 @@ VFWSCANF (register FILE *__restrict fp,
        const wchar_t *__restrict fmt,
        va_list ap)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   CHECK_INIT(reent, fp);
   return __SVFWSCANF_R (reent, fp, fmt, ap);
@@ -247,7 +247,7 @@ __SVFWSCANF (register FILE *fp,
 #endif /* !_REENT_ONLY */
 
 int
-_VFWSCANF_R (struct _reent *data,
+_VFWSCANF_R (__reent_ptr_t data,
        register FILE *fp,
        const wchar_t *fmt,
        va_list ap)
@@ -262,7 +262,7 @@ _VFWSCANF_R (struct _reent *data,
  * regular ungetwc which will drag in file I/O items we don't need.
  * So, we create our own trimmed-down version.  */
 static wint_t
-_sungetwc_r (struct _reent *data,
+_sungetwc_r (__reent_ptr_t data,
 	wint_t wc,
 	register FILE *fp)
 {
@@ -284,10 +284,10 @@ _sungetwc_r (struct _reent *data,
   return wc;
 }
 
-extern int __ssrefill_r (struct _reent *ptr, register FILE * fp);
+extern int __ssrefill_r (__reent_ptr_t ptr, register FILE * fp);
 
 static size_t
-_sfgetwc_r (struct _reent * ptr,
+_sfgetwc_r (__reent_ptr_t ptr,
        FILE * fp)
 {
   wchar_t wc;
@@ -302,7 +302,7 @@ _sfgetwc_r (struct _reent * ptr,
 #endif /* STRING_ONLY */
 
 int
-__SVFWSCANF_R (struct _reent *rptr,
+__SVFWSCANF_R (__reent_ptr_t rptr,
        register FILE *fp,
        wchar_t const *fmt0,
        va_list ap)
@@ -327,7 +327,7 @@ __SVFWSCANF_R (struct _reent *rptr,
 
   mbstate_t mbs;                /* value to keep track of multibyte state */
 
-  #define CCFN_PARAMS	(struct _reent *, const wchar_t *, wchar_t **, int)
+  #define CCFN_PARAMS	(__reent_ptr_t, const wchar_t *, wchar_t **, int)
   unsigned long (*ccfn)CCFN_PARAMS=0;	/* conversion function (wcstol/wcstoul) */
   wchar_t buf[BUF];		/* buffer for numeric conversions */
   const wchar_t *ccls;          /* character class start */
diff --git a/newlib/libc/stdio/viprintf.c b/newlib/libc/stdio/viprintf.c
index 12b7b10e9072..125c48f1aa02 100644
--- a/newlib/libc/stdio/viprintf.c
+++ b/newlib/libc/stdio/viprintf.c
@@ -56,17 +56,17 @@ SYNOPSIS
 	char *vasniprintf(char *<[str]>, size_t *<[size]>, const char *<[fmt]>,
                           va_list <[list]>);
 
-	int _viprintf_r(struct _reent *<[reent]>, const char *<[fmt]>,
+	int _viprintf_r(__reent_ptr_t <[reent]>, const char *<[fmt]>,
                         va_list <[list]>);
-	int _vfiprintf_r(struct _reent *<[reent]>, FILE *<[fp]>,
+	int _vfiprintf_r(__reent_ptr_t <[reent]>, FILE *<[fp]>,
                         const char *<[fmt]>, va_list <[list]>);
-	int _vsiprintf_r(struct _reent *<[reent]>, char *<[str]>,
+	int _vsiprintf_r(__reent_ptr_t <[reent]>, char *<[str]>,
                         const char *<[fmt]>, va_list <[list]>);
-	int _vsniprintf_r(struct _reent *<[reent]>, char *<[str]>,
+	int _vsniprintf_r(__reent_ptr_t <[reent]>, char *<[str]>,
                           size_t <[size]>, const char *<[fmt]>, va_list <[list]>);
-	int _vasiprintf_r(struct _reent *<[reent]>, char **<[str]>,
+	int _vasiprintf_r(__reent_ptr_t <[reent]>, char **<[str]>,
                           const char *<[fmt]>, va_list <[list]>);
-	char *_vasniprintf_r(struct _reent *<[reent]>, char *<[str]>,
+	char *_vasniprintf_r(__reent_ptr_t <[reent]>, char *<[str]>,
                              size_t *<[size]>, const char *<[fmt]>, va_list <[list]>);
 
 DESCRIPTION
@@ -104,7 +104,7 @@ int
 viprintf (const char *fmt,
        va_list ap)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   _REENT_SMALL_CHECK_INIT (reent);
   return _vfiprintf_r (reent, _stdout_r (reent), fmt, ap);
@@ -113,7 +113,7 @@ viprintf (const char *fmt,
 #endif /* !_REENT_ONLY */
 
 int
-_viprintf_r (struct _reent *ptr,
+_viprintf_r (__reent_ptr_t ptr,
        const char *fmt,
        va_list ap)
 {
diff --git a/newlib/libc/stdio/viscanf.c b/newlib/libc/stdio/viscanf.c
index 6cc16cdacf92..2454a59f29bb 100644
--- a/newlib/libc/stdio/viscanf.c
+++ b/newlib/libc/stdio/viscanf.c
@@ -41,11 +41,11 @@ SYNOPSIS
 	int vfiscanf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
 	int vsiscanf(const char *<[str]>, const char *<[fmt]>, va_list <[list]>);
 
-	int _viscanf_r(struct _reent *<[reent]>, const char *<[fmt]>, 
+	int _viscanf_r(__reent_ptr_t <[reent]>, const char *<[fmt]>,
                        va_list <[list]>);
-	int _vfiscanf_r(struct _reent *<[reent]>, FILE *<[fp]>, const char *<[fmt]>, 
+	int _vfiscanf_r(__reent_ptr_t <[reent]>, FILE *<[fp]>, const char *<[fmt]>,
                        va_list <[list]>);
-	int _vsiscanf_r(struct _reent *<[reent]>, const char *<[str]>,
+	int _vsiscanf_r(__reent_ptr_t <[reent]>, const char *<[str]>,
                        const char *<[fmt]>, va_list <[list]>);
 
 DESCRIPTION
@@ -88,7 +88,7 @@ int
 viscanf (const char *fmt,
        va_list ap)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   _REENT_SMALL_CHECK_INIT (reent);
   return __svfiscanf_r (reent, _stdin_r (reent), fmt, ap);
@@ -97,7 +97,7 @@ viscanf (const char *fmt,
 #endif /* !_REENT_ONLY */
 
 int
-_viscanf_r (struct _reent *ptr,
+_viscanf_r (__reent_ptr_t ptr,
        const char *fmt,
        va_list ap)
 {
diff --git a/newlib/libc/stdio/vprintf.c b/newlib/libc/stdio/vprintf.c
index 8e13cbb8aaf0..bd92b2e6e220 100644
--- a/newlib/libc/stdio/vprintf.c
+++ b/newlib/libc/stdio/vprintf.c
@@ -28,7 +28,7 @@ int
 vprintf (const char *fmt,
        va_list ap)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   _REENT_SMALL_CHECK_INIT (reent);
   return _vfprintf_r (reent, _stdout_r (reent), fmt, ap);
@@ -42,7 +42,7 @@ viprintf (const char *, __VALIST) _ATTRIBUTE ((__alias__("vprintf")));
 #endif /* !_REENT_ONLY */
 
 int
-_vprintf_r (struct _reent *ptr,
+_vprintf_r (__reent_ptr_t ptr,
        const char *__restrict fmt,
        va_list ap)
 {
@@ -52,6 +52,6 @@ _vprintf_r (struct _reent *ptr,
 
 #ifdef _NANO_FORMATTED_IO
 int
-_viprintf_r (struct _reent *, const char *, __VALIST)
+_viprintf_r (__reent_ptr_t, const char *, __VALIST)
        _ATTRIBUTE ((__alias__("_vprintf_r")));
 #endif
diff --git a/newlib/libc/stdio/vscanf.c b/newlib/libc/stdio/vscanf.c
index 9e123572bafe..99f71a8d632b 100644
--- a/newlib/libc/stdio/vscanf.c
+++ b/newlib/libc/stdio/vscanf.c
@@ -29,7 +29,7 @@ int
 vscanf (const char *fmt,
        va_list ap)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   _REENT_SMALL_CHECK_INIT (reent);
   return __svfscanf_r (reent, _stdin_r (reent), fmt, ap);
@@ -43,7 +43,7 @@ viscanf (const char *, __VALIST) _ATTRIBUTE ((__alias__("vscanf")));
 #endif /* !_REENT_ONLY */
 
 int
-_vscanf_r (struct _reent *ptr,
+_vscanf_r (__reent_ptr_t ptr,
        const char *__restrict fmt,
        va_list ap)
 {
@@ -53,6 +53,6 @@ _vscanf_r (struct _reent *ptr,
 
 #ifdef _NANO_FORMATTED_IO
 int
-_viscanf_r (struct _reent *, const char *, __VALIST)
+_viscanf_r (__reent_ptr_t, const char *, __VALIST)
        _ATTRIBUTE ((__alias__("_vscanf_r")));
 #endif
diff --git a/newlib/libc/stdio/vsiprintf.c b/newlib/libc/stdio/vsiprintf.c
index af07ad85e8cd..c739ae27fd7c 100644
--- a/newlib/libc/stdio/vsiprintf.c
+++ b/newlib/libc/stdio/vsiprintf.c
@@ -41,7 +41,7 @@ vsiprintf (char *str,
 #endif /* !_REENT_ONLY */
 
 int
-_vsiprintf_r (struct _reent *ptr,
+_vsiprintf_r (__reent_ptr_t ptr,
        char *str,
        const char *fmt,
        va_list ap)
diff --git a/newlib/libc/stdio/vsiscanf.c b/newlib/libc/stdio/vsiscanf.c
index 4e28d1079390..7bb86a1566c2 100644
--- a/newlib/libc/stdio/vsiscanf.c
+++ b/newlib/libc/stdio/vsiscanf.c
@@ -41,7 +41,7 @@ vsiscanf (const char *str,
 #endif /* !_REENT_ONLY */
 
 int
-_vsiscanf_r (struct _reent *ptr,
+_vsiscanf_r (__reent_ptr_t ptr,
        const char *str,
        const char *fmt,
        va_list ap)
diff --git a/newlib/libc/stdio/vsniprintf.c b/newlib/libc/stdio/vsniprintf.c
index a50a0a993115..90b831daea71 100644
--- a/newlib/libc/stdio/vsniprintf.c
+++ b/newlib/libc/stdio/vsniprintf.c
@@ -43,7 +43,7 @@ vsniprintf (char *str,
 #endif /* !_REENT_ONLY */
 
 int
-_vsniprintf_r (struct _reent *ptr,
+_vsniprintf_r (__reent_ptr_t ptr,
        char *str,
        size_t size,
        const char *fmt,
diff --git a/newlib/libc/stdio/vsnprintf.c b/newlib/libc/stdio/vsnprintf.c
index d9c72b526ba5..722192777464 100644
--- a/newlib/libc/stdio/vsnprintf.c
+++ b/newlib/libc/stdio/vsnprintf.c
@@ -49,7 +49,7 @@ vsniprintf (char *, size_t, const char *, __VALIST)
 #endif /* !_REENT_ONLY */
 
 int
-_vsnprintf_r (struct _reent *ptr,
+_vsnprintf_r (__reent_ptr_t ptr,
        char *__restrict str,
        size_t size,
        const char *__restrict fmt,
@@ -78,6 +78,6 @@ _vsnprintf_r (struct _reent *ptr,
 
 #ifdef _NANO_FORMATTED_IO
 int
-_vsniprintf_r (struct _reent *, char *, size_t, const char *, __VALIST)
+_vsniprintf_r (__reent_ptr_t, char *, size_t, const char *, __VALIST)
        _ATTRIBUTE ((__alias__("_vsnprintf_r")));
 #endif
diff --git a/newlib/libc/stdio/vsprintf.c b/newlib/libc/stdio/vsprintf.c
index 4d4619fd0324..05ece783b171 100644
--- a/newlib/libc/stdio/vsprintf.c
+++ b/newlib/libc/stdio/vsprintf.c
@@ -47,7 +47,7 @@ vsiprintf (char *, const char *, __VALIST)
 #endif /* !_REENT_ONLY */
 
 int
-_vsprintf_r (struct _reent *ptr,
+_vsprintf_r (__reent_ptr_t ptr,
        char *__restrict str,
        const char *__restrict fmt,
        va_list ap)
@@ -67,6 +67,6 @@ _vsprintf_r (struct _reent *ptr,
 
 #ifdef _NANO_FORMATTED_IO
 int
-_vsiprintf_r (struct _reent *, char *, const char *, __VALIST)
+_vsiprintf_r (__reent_ptr_t, char *, const char *, __VALIST)
        _ATTRIBUTE ((__alias__("_vsprintf_r")));
 #endif
diff --git a/newlib/libc/stdio/vsscanf.c b/newlib/libc/stdio/vsscanf.c
index 6150f541bb24..90ee4c1694a3 100644
--- a/newlib/libc/stdio/vsscanf.c
+++ b/newlib/libc/stdio/vsscanf.c
@@ -47,7 +47,7 @@ vsiscanf (const char *, const char *, __VALIST)
 #endif /* !_REENT_ONLY */
 
 int
-_vsscanf_r (struct _reent *ptr,
+_vsscanf_r (__reent_ptr_t ptr,
        const char *__restrict str,
        const char *__restrict fmt,
        va_list ap)
@@ -67,6 +67,6 @@ _vsscanf_r (struct _reent *ptr,
 
 #ifdef _NANO_FORMATTED_IO
 int
-_vsiscanf_r (struct _reent *, const char *, const char *, __VALIST)
+_vsiscanf_r (__reent_ptr_t, const char *, const char *, __VALIST)
        _ATTRIBUTE ((__alias__("_vsscanf_r")));
 #endif
diff --git a/newlib/libc/stdio/vswprintf.c b/newlib/libc/stdio/vswprintf.c
index ab2e52ff4921..9b377ea740f6 100644
--- a/newlib/libc/stdio/vswprintf.c
+++ b/newlib/libc/stdio/vswprintf.c
@@ -31,7 +31,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #include "local.h"
 
 int
-_vswprintf_r (struct _reent *ptr,
+_vswprintf_r (__reent_ptr_t ptr,
        wchar_t *str,
        size_t size,
        const wchar_t *fmt,
diff --git a/newlib/libc/stdio/vswscanf.c b/newlib/libc/stdio/vswscanf.c
index 415c98b0f0ff..7aa3182d060e 100644
--- a/newlib/libc/stdio/vswscanf.c
+++ b/newlib/libc/stdio/vswscanf.c
@@ -42,7 +42,7 @@ vswscanf (const wchar_t *__restrict str, const wchar_t * __restrict fmt,
 #endif /* !_REENT_ONLY */
 
 int
-_vswscanf_r (struct _reent *ptr, const wchar_t *str, const wchar_t *fmt,
+_vswscanf_r (__reent_ptr_t ptr, const wchar_t *str, const wchar_t *fmt,
 	     va_list ap)
 {
   FILE f;
diff --git a/newlib/libc/stdio/vwprintf.c b/newlib/libc/stdio/vwprintf.c
index 358d87690b1f..c7f16a95b651 100644
--- a/newlib/libc/stdio/vwprintf.c
+++ b/newlib/libc/stdio/vwprintf.c
@@ -29,7 +29,7 @@ int
 vwprintf (const wchar_t *__restrict fmt,
        va_list ap)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   _REENT_SMALL_CHECK_INIT (reent);
   return _vfwprintf_r (reent, _stdout_r (reent), fmt, ap);
@@ -38,7 +38,7 @@ vwprintf (const wchar_t *__restrict fmt,
 #endif /* !_REENT_ONLY */
 
 int
-_vwprintf_r (struct _reent *ptr,
+_vwprintf_r (__reent_ptr_t ptr,
        const wchar_t *fmt,
        va_list ap)
 {
diff --git a/newlib/libc/stdio/vwscanf.c b/newlib/libc/stdio/vwscanf.c
index c994bad457a6..76b95c797a4f 100644
--- a/newlib/libc/stdio/vwscanf.c
+++ b/newlib/libc/stdio/vwscanf.c
@@ -30,7 +30,7 @@
 int
 vwscanf (const wchar_t *__restrict fmt, va_list ap)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   _REENT_SMALL_CHECK_INIT (reent);
   return __svfwscanf_r (reent, _stdin_r (reent), fmt, ap);
@@ -39,7 +39,7 @@ vwscanf (const wchar_t *__restrict fmt, va_list ap)
 #endif /* !_REENT_ONLY */
 
 int
-_vwscanf_r (struct _reent *ptr, const wchar_t *fmt, va_list ap)
+_vwscanf_r (__reent_ptr_t ptr, const wchar_t *fmt, va_list ap)
 {
   _REENT_SMALL_CHECK_INIT (ptr);
   return __svfwscanf_r (ptr, _stdin_r (ptr), fmt, ap);
diff --git a/newlib/libc/stdio/wbuf.c b/newlib/libc/stdio/wbuf.c
index 2e742e255b02..23fe049959c5 100644
--- a/newlib/libc/stdio/wbuf.c
+++ b/newlib/libc/stdio/wbuf.c
@@ -33,7 +33,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
  */
 
 int
-__swbuf_r (struct _reent *ptr,
+__swbuf_r (__reent_ptr_t ptr,
        register int c,
        register FILE *fp)
 {
diff --git a/newlib/libc/stdio/wbufw.c b/newlib/libc/stdio/wbufw.c
index 01639df696ce..ff460ce668e1 100644
--- a/newlib/libc/stdio/wbufw.c
+++ b/newlib/libc/stdio/wbufw.c
@@ -34,7 +34,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
  */
 
 int
-__swbufw_r (struct _reent *ptr,
+__swbufw_r (__reent_ptr_t ptr,
        register int c,
        register FILE *fp)
 {
diff --git a/newlib/libc/stdio/wprintf.c b/newlib/libc/stdio/wprintf.c
index 32be6f12b884..c173dc189a62 100644
--- a/newlib/libc/stdio/wprintf.c
+++ b/newlib/libc/stdio/wprintf.c
@@ -24,7 +24,7 @@
 #include "local.h"
 
 int
-_wprintf_r (struct _reent *ptr,
+_wprintf_r (__reent_ptr_t ptr,
        const wchar_t *fmt, ...)
 {
   int ret;
@@ -44,7 +44,7 @@ wprintf (const wchar_t *__restrict fmt, ...)
 {
   int ret;
   va_list ap;
-  struct _reent *ptr = _REENT;
+  __reent_ptr_t ptr = _REENT;
 
   _REENT_SMALL_CHECK_INIT (ptr);
   va_start (ap, fmt);
diff --git a/newlib/libc/stdio/wscanf.c b/newlib/libc/stdio/wscanf.c
index 4de79222a0f3..dffde6f7ef01 100644
--- a/newlib/libc/stdio/wscanf.c
+++ b/newlib/libc/stdio/wscanf.c
@@ -30,7 +30,7 @@ wscanf(const wchar_t *__restrict fmt, ...)
 {
   int ret;
   va_list ap;
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   _REENT_SMALL_CHECK_INIT (reent);
   va_start (ap, fmt);
@@ -42,7 +42,7 @@ wscanf(const wchar_t *__restrict fmt, ...)
 #endif /* !_REENT_ONLY */
 
 int
-_wscanf_r(struct _reent *ptr, const wchar_t *fmt, ...)
+_wscanf_r(__reent_ptr_t ptr, const wchar_t *fmt, ...)
 {
   int ret;
   va_list ap;
diff --git a/newlib/libc/stdio/wsetup.c b/newlib/libc/stdio/wsetup.c
index 0fd9690aa629..48f0bab9322b 100644
--- a/newlib/libc/stdio/wsetup.c
+++ b/newlib/libc/stdio/wsetup.c
@@ -30,7 +30,7 @@
  */
 
 int
-__swsetup_r (struct _reent *ptr,
+__swsetup_r (__reent_ptr_t ptr,
        register FILE * fp)
 {
   /* Make sure stdio is set up.  */
diff --git a/newlib/libc/stdio64/fdopen64.c b/newlib/libc/stdio64/fdopen64.c
index d93b3d4d8d43..396c344b1e27 100644
--- a/newlib/libc/stdio64/fdopen64.c
+++ b/newlib/libc/stdio64/fdopen64.c
@@ -35,7 +35,7 @@ File pointer or <<NULL>>, as for <<fopen>>.
 extern int __sflags ();
 
 FILE *
-_fdopen64_r (struct _reent *ptr,
+_fdopen64_r (__reent_ptr_t ptr,
 	int fd,
 	const char *mode)
 {
diff --git a/newlib/libc/stdio64/fgetpos64.c b/newlib/libc/stdio64/fgetpos64.c
index 52ead9d0d29a..44f78a7e40d6 100644
--- a/newlib/libc/stdio64/fgetpos64.c
+++ b/newlib/libc/stdio64/fgetpos64.c
@@ -10,7 +10,7 @@ INDEX
 SYNOPSIS
 	#include <stdio.h>
 	int fgetpos64(FILE *<[fp]>, _fpos64_t *<[pos]>);
-	int _fgetpos64_r(struct _reent *<[ptr]>, FILE *<[fp]>, 
+	int _fgetpos64_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>,
 	                 _fpos64_t *<[pos]>);
 
 DESCRIPTION
@@ -45,7 +45,7 @@ No supporting OS subroutines are required.
 #ifdef __LARGE64_FILES
 
 int
-_fgetpos64_r (struct _reent * ptr,
+_fgetpos64_r (__reent_ptr_t ptr,
 	FILE * fp,
 	_fpos64_t * pos)
 {
diff --git a/newlib/libc/stdio64/fopen64.c b/newlib/libc/stdio64/fopen64.c
index 4eee1f273627..4cd2c9751e36 100644
--- a/newlib/libc/stdio64/fopen64.c
+++ b/newlib/libc/stdio64/fopen64.c
@@ -62,7 +62,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #ifdef __LARGE64_FILES
 
 FILE *
-_fopen64_r (struct _reent *ptr,
+_fopen64_r (__reent_ptr_t ptr,
 	const char *file,
 	const char *mode)
 {
diff --git a/newlib/libc/stdio64/freopen64.c b/newlib/libc/stdio64/freopen64.c
index 4d1e9b76ccc0..d0e2729fa28d 100644
--- a/newlib/libc/stdio64/freopen64.c
+++ b/newlib/libc/stdio64/freopen64.c
@@ -28,7 +28,7 @@ SYNOPSIS
 	#include <stdio.h>
 	FILE *freopen64(const char *<[file]>, const char *<[mode]>,
 		        FILE *<[fp]>);
-	FILE *_freopen64_r(struct _reent *<[ptr]>, const char *<[file]>,
+	FILE *_freopen64_r(__reent_ptr_t <[ptr]>, const char *<[file]>,
 		        const char *<[mode]>, FILE *<[fp]>);
 
 DESCRIPTION
@@ -75,7 +75,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
 #ifdef __LARGE64_FILES
 
 FILE *
-_freopen64_r (struct _reent *ptr,
+_freopen64_r (__reent_ptr_t ptr,
 	const char *file,
 	const char *mode,
 	register FILE *fp)
diff --git a/newlib/libc/stdio64/fseeko64.c b/newlib/libc/stdio64/fseeko64.c
index c5b30aed0f9e..691fc383efab 100644
--- a/newlib/libc/stdio64/fseeko64.c
+++ b/newlib/libc/stdio64/fseeko64.c
@@ -27,7 +27,7 @@ INDEX
 SYNOPSIS
 	#include <stdio.h>
 	int fseeko64(FILE *<[fp]>, _off64_t <[offset]>, int <[whence]>);
-	int _fseeko64_r (struct _reent *<[ptr]>, FILE *<[fp]>,
+	int _fseeko64_r (__reent_ptr_t <[ptr]>, FILE *<[fp]>,
                          _off64_t <[offset]>, int <[whence]>);
 
 DESCRIPTION
@@ -85,12 +85,12 @@ Supporting OS subroutines required: <<close>>, <<fstat64>>, <<isatty>>,
  */
 
 _off64_t
-_fseeko64_r (struct _reent *ptr,
+_fseeko64_r (__reent_ptr_t ptr,
      register FILE *fp,
      _off64_t offset,
      int whence)
 {
-  _fpos64_t (*seekfn) (struct _reent *, void *, _fpos64_t, int);
+  _fpos64_t (*seekfn) (__reent_ptr_t, void *, _fpos64_t, int);
   _fpos64_t target, curoff;
   size_t n;
 
diff --git a/newlib/libc/stdio64/fsetpos64.c b/newlib/libc/stdio64/fsetpos64.c
index 254eb53d7578..59c924a1c6ba 100644
--- a/newlib/libc/stdio64/fsetpos64.c
+++ b/newlib/libc/stdio64/fsetpos64.c
@@ -10,7 +10,7 @@ INDEX
 SYNOPSIS
 	#include <stdio.h>
 	int fsetpos64(FILE *<[fp]>, const _fpos64_t *<[pos]>);
-	int _fsetpos64_r(struct _reent *<[ptr]>, FILE *<[fp]>, 
+	int _fsetpos64_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>,
 	                 const _fpos64_t *<[pos]>);
 
 DESCRIPTION
@@ -41,7 +41,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
 #ifdef __LARGE64_FILES
 
 int
-_fsetpos64_r (struct _reent *ptr,
+_fsetpos64_r (__reent_ptr_t ptr,
 	FILE * iop,
 	const _fpos64_t * pos)
 {
diff --git a/newlib/libc/stdio64/ftello64.c b/newlib/libc/stdio64/ftello64.c
index cd00def468c8..cd96fb571a9f 100644
--- a/newlib/libc/stdio64/ftello64.c
+++ b/newlib/libc/stdio64/ftello64.c
@@ -27,7 +27,7 @@ INDEX
 SYNOPSIS
 	#include <stdio.h>
 	_off64_t ftello64(FILE *<[fp]>);
-	_off64_t _ftello64_r(struct _reent *<[ptr]>, FILE *<[fp]>);
+	_off64_t _ftello64_r(__reent_ptr_t <[ptr]>, FILE *<[fp]>);
 
 DESCRIPTION
 Objects of type <<FILE>> can have a ``position'' that records how much
@@ -76,7 +76,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
 #ifdef __LARGE64_FILES
 
 _off64_t
-_ftello64_r (struct _reent *ptr,
+_ftello64_r (__reent_ptr_t ptr,
 	register FILE * fp)
 {
   _fpos64_t pos;
diff --git a/newlib/libc/stdio64/stdio64.c b/newlib/libc/stdio64/stdio64.c
index 95cb25288f57..71d96ead3ca2 100644
--- a/newlib/libc/stdio64/stdio64.c
+++ b/newlib/libc/stdio64/stdio64.c
@@ -26,7 +26,7 @@
 
 #ifdef __LARGE64_FILES
 _fpos64_t
-__sseek64 (struct _reent *ptr,
+__sseek64 (__reent_ptr_t ptr,
        void *cookie,
        _fpos64_t offset,
        int whence)
@@ -46,7 +46,7 @@ __sseek64 (struct _reent *ptr,
 }
 
 _READ_WRITE_RETURN_TYPE
-__swrite64 (struct _reent *ptr,
+__swrite64 (__reent_ptr_t ptr,
        void *cookie,
        char const *buf,
        _READ_WRITE_BUFSIZE_TYPE n)
diff --git a/newlib/libc/stdio64/tmpfile64.c b/newlib/libc/stdio64/tmpfile64.c
index 35b035c91576..1a5afb62a84e 100644
--- a/newlib/libc/stdio64/tmpfile64.c
+++ b/newlib/libc/stdio64/tmpfile64.c
@@ -53,7 +53,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<getpid>>,
 #ifdef __LARGE64_FILES
 
 FILE *
-_tmpfile64_r (struct _reent *ptr)
+_tmpfile64_r (__reent_ptr_t ptr)
 {
   FILE *fp;
   int e;
diff --git a/newlib/libc/stdlib/__adjust.c b/newlib/libc/stdlib/__adjust.c
index ab6f125b9311..6c42f7ec55fd 100644
--- a/newlib/libc/stdlib/__adjust.c
+++ b/newlib/libc/stdlib/__adjust.c
@@ -9,7 +9,7 @@
 #define abs(x) (((x) < 0) ? -(x) : (x))
 
 double
-__adjust (struct _reent *ptr,
+__adjust (__reent_ptr_t ptr,
 	double *acc,
 	int dexp,
 	int sign)
diff --git a/newlib/libc/stdlib/_mallocr.c b/newlib/libc/stdlib/_mallocr.c
index 56968cbd1d0e..123896a26422 100644
--- a/newlib/libc/stdlib/_mallocr.c
+++ b/newlib/libc/stdlib/_mallocr.c
@@ -330,20 +330,20 @@ extern "C" {
 #endif
 
 #if __STD_C
-extern void __malloc_lock(struct _reent *);
-extern void __malloc_unlock(struct _reent *);
+extern void __malloc_lock(__reent_ptr_t);
+extern void __malloc_unlock(__reent_ptr_t);
 #else
 extern void __malloc_lock();
 extern void __malloc_unlock();
 #endif
 
 #if __STD_C
-#define RARG struct _reent *reent_ptr,
-#define RONEARG struct _reent *reent_ptr
+#define RARG __reent_ptr_t reent_ptr,
+#define RONEARG __reent_ptr_t reent_ptr
 #else
 #define RARG reent_ptr
 #define RONEARG reent_ptr
-#define RDECL struct _reent *reent_ptr;
+#define RDECL __reent_ptr_t reent_ptr;
 #endif
 
 #define RERRNO _REENT_ERRNO(reent_ptr)
diff --git a/newlib/libc/stdlib/atoi.c b/newlib/libc/stdlib/atoi.c
index 4da53e80ac9b..d512019f61e1 100644
--- a/newlib/libc/stdlib/atoi.c
+++ b/newlib/libc/stdlib/atoi.c
@@ -15,8 +15,8 @@ SYNOPSIS
 	#include <stdlib.h>
         int atoi(const char *<[s]>);
 	long atol(const char *<[s]>);
-        int _atoi_r(struct _reent *<[ptr]>, const char *<[s]>);
-        long _atol_r(struct _reent *<[ptr]>, const char *<[s]>);
+        int _atoi_r(__reent_ptr_t <[ptr]>, const char *<[s]>);
+        long _atol_r(__reent_ptr_t <[ptr]>, const char *<[s]>);
 
 DESCRIPTION
    <<atoi>> converts the initial portion of a string to an <<int>>.
@@ -54,7 +54,7 @@ atoi (const char *s)
 #endif /* !_REENT_ONLY */
 
 int
-_atoi_r (struct _reent *ptr,
+_atoi_r (__reent_ptr_t ptr,
 	const char *s)
 {
   return (int) _strtol_r (ptr, s, NULL, 10);
diff --git a/newlib/libc/stdlib/atol.c b/newlib/libc/stdlib/atol.c
index a5c8ee9f404e..79987328d270 100644
--- a/newlib/libc/stdlib/atol.c
+++ b/newlib/libc/stdlib/atol.c
@@ -14,7 +14,7 @@ atol (const char *s)
 #endif /* !_REENT_ONLY */
 
 long
-_atol_r (struct _reent *ptr, const char *s)
+_atol_r (__reent_ptr_t ptr, const char *s)
 {
   return _strtol_r (ptr, s, NULL, 10);
 }
diff --git a/newlib/libc/stdlib/atoll.c b/newlib/libc/stdlib/atoll.c
index 11edeae49dc0..b6d5684eac85 100644
--- a/newlib/libc/stdlib/atoll.c
+++ b/newlib/libc/stdlib/atoll.c
@@ -10,7 +10,7 @@ INDEX
 SYNOPSIS
         #include <stdlib.h>
         long long atoll(const char *<[str]>);
-        long long _atoll_r(struct _reent *<[ptr]>, const char *<[str]>);
+        long long _atoll_r(__reent_ptr_t <[ptr]>, const char *<[str]>);
 
 DESCRIPTION
 The function <<atoll>> converts the initial portion of the string 
@@ -72,7 +72,7 @@ atoll (const char *str)
 #endif /* !_REENT_ONLY */
 
 long long
-_atoll_r (struct _reent *ptr,
+_atoll_r (__reent_ptr_t ptr,
        const char *str)
 {
 	return _strtoll_r(ptr, str, (char **)NULL, 10);
diff --git a/newlib/libc/stdlib/drand48.c b/newlib/libc/stdlib/drand48.c
index 0616894483be..35f3684c76dc 100644
--- a/newlib/libc/stdlib/drand48.c
+++ b/newlib/libc/stdlib/drand48.c
@@ -14,7 +14,7 @@
 #include "rand48.h"
 
 double
-_drand48_r (struct _reent *r)
+_drand48_r (__reent_ptr_t r)
 {
   _REENT_CHECK_RAND48(r);
   return _erand48_r(r, __rand48_seed);
diff --git a/newlib/libc/stdlib/dtoa.c b/newlib/libc/stdlib/dtoa.c
index 198fa663a2ec..274925853e32 100644
--- a/newlib/libc/stdlib/dtoa.c
+++ b/newlib/libc/stdlib/dtoa.c
@@ -180,7 +180,7 @@ quorem (_Bigint * b, _Bigint * S)
 
 
 char *
-_dtoa_r (struct _reent *ptr,
+_dtoa_r (__reent_ptr_t ptr,
 	double _d,
 	int mode,
 	int ndigits,
diff --git a/newlib/libc/stdlib/ecvtbuf.c b/newlib/libc/stdlib/ecvtbuf.c
index 514896682593..f0ee81ad66e5 100644
--- a/newlib/libc/stdlib/ecvtbuf.c
+++ b/newlib/libc/stdlib/ecvtbuf.c
@@ -63,7 +63,7 @@ _Thread_local int _tls_cvtlen;
 #endif
 
 static void
-print_f (struct _reent *ptr,
+print_f (__reent_ptr_t ptr,
 	char *buf,
 	double invalue,
 	int ndigit,
@@ -131,7 +131,7 @@ print_f (struct _reent *ptr,
    WIDTH is the number of digits of precision after the decimal point.  */
 
 static void
-print_e (struct _reent *ptr,
+print_e (__reent_ptr_t ptr,
 	char *buf,
 	double invalue,
 	int width,
@@ -227,7 +227,7 @@ fcvtbuf (double invalue,
 	int *sign,
 	char *fcvt_buf)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
   char *save;
   char *p;
   char *end;
@@ -276,7 +276,7 @@ ecvtbuf (double invalue,
 	int *sign,
 	char *fcvt_buf)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
   char *save;
   char *p;
   char *end;
@@ -320,7 +320,7 @@ ecvtbuf (double invalue,
 #endif
 
 char *
-_gcvt (struct _reent *ptr,
+_gcvt (__reent_ptr_t ptr,
 	double invalue,
 	int ndigit,
 	char *buf,
@@ -423,7 +423,7 @@ _gcvt (struct _reent *ptr,
 }
 
 char *
-_dcvt (struct _reent *ptr,
+_dcvt (__reent_ptr_t ptr,
 	char *buffer,
 	double invalue,
 	int precision,
diff --git a/newlib/libc/stdlib/envlock.c b/newlib/libc/stdlib/envlock.c
index bd843afc250c..6bc6689b9ee0 100644
--- a/newlib/libc/stdlib/envlock.c
+++ b/newlib/libc/stdlib/envlock.c
@@ -9,8 +9,8 @@ INDEX
 
 SYNOPSIS
 	#include <envlock.h>
-	void __env_lock (struct _reent *<[reent]>);
-	void __env_unlock (struct _reent *<[reent]>);
+	void __env_lock (__reent_ptr_t <[reent]>);
+	void __env_unlock (__reent_ptr_t <[reent]>);
 
 DESCRIPTION
 The <<setenv>> family of routines call these functions when they need to
@@ -36,7 +36,7 @@ __LOCK_INIT_RECURSIVE(static, __env_recursive_mutex);
 #endif
 
 void
-__env_lock (struct _reent *ptr)
+__env_lock (__reent_ptr_t ptr)
 {
 #ifndef __SINGLE_THREAD__
   __lock_acquire_recursive (__env_recursive_mutex);
@@ -44,7 +44,7 @@ __env_lock (struct _reent *ptr)
 }
 
 void
-__env_unlock (struct _reent *ptr)
+__env_unlock (__reent_ptr_t ptr)
 {
 #ifndef __SINGLE_THREAD__
   __lock_release_recursive (__env_recursive_mutex);
diff --git a/newlib/libc/stdlib/erand48.c b/newlib/libc/stdlib/erand48.c
index 1be4a953e93b..9816135c9fe7 100644
--- a/newlib/libc/stdlib/erand48.c
+++ b/newlib/libc/stdlib/erand48.c
@@ -14,7 +14,7 @@
 #include "rand48.h"
 
 double
-_erand48_r (struct _reent *r,
+_erand48_r (__reent_ptr_t r,
        unsigned short xseed[3])
 {
   __dorand48(r, xseed);
diff --git a/newlib/libc/stdlib/gdtoa-dmisc.c b/newlib/libc/stdlib/gdtoa-dmisc.c
index f330f8ae7d5a..4841af7cb8c2 100644
--- a/newlib/libc/stdlib/gdtoa-dmisc.c
+++ b/newlib/libc/stdlib/gdtoa-dmisc.c
@@ -41,9 +41,9 @@ THIS SOFTWARE.
 
  char *
 #ifdef KR_headers
-rv_alloc(ptr, i) struct _reent *ptr, int i;
+rv_alloc(ptr, i) __reent_ptr_t ptr, int i;
 #else
-rv_alloc(struct _reent *ptr, int i)
+rv_alloc(__reent_ptr_t ptr, int i)
 #endif
 {
 	int j;
@@ -72,9 +72,9 @@ rv_alloc(struct _reent *ptr, int i)
 
  char *
 #ifdef KR_headers
-nrv_alloc(ptr, s, rve, n) struct _reent *ptr, char *s, **rve; int n;
+nrv_alloc(ptr, s, rve, n) __reent_ptr_t ptr, char *s, **rve; int n;
 #else
-nrv_alloc(struct _reent *ptr, char *s, char **rve, int n)
+nrv_alloc(__reent_ptr_t ptr, char *s, char **rve, int n)
 #endif
 {
 	char *rv, *t;
@@ -97,9 +97,9 @@ nrv_alloc(struct _reent *ptr, char *s, char **rve, int n)
 
  void
 #ifdef KR_headers
-freedtoa(ptr, s) struct _reent *ptr, char *s;
+freedtoa(ptr, s) __reent_ptr_t ptr, char *s;
 #else
-freedtoa(struct _reent *ptr, char *s)
+freedtoa(__reent_ptr_t ptr, char *s)
 #endif
 {
 	/* Free buffer allocated in a compatible way with legacy _ldtoa_r(). */
diff --git a/newlib/libc/stdlib/gdtoa-gdtoa.c b/newlib/libc/stdlib/gdtoa-gdtoa.c
index d29a81eab16b..b0220a88a155 100644
--- a/newlib/libc/stdlib/gdtoa-gdtoa.c
+++ b/newlib/libc/stdlib/gdtoa-gdtoa.c
@@ -40,7 +40,7 @@ THIS SOFTWARE.
 bitstob(ptr, bits, nbits, bbits) ULong *bits;
 struct _reent ptr, int nbits; int *bbits;
 #else
-bitstob(struct _reent *ptr, ULong *bits, int nbits, int *bbits)
+bitstob(__reent_ptr_t ptr, ULong *bits, int nbits, int *bbits)
 #endif
 {
 	int i, k;
@@ -119,10 +119,10 @@ bitstob(struct _reent *ptr, ULong *bits, int nbits, int *bbits)
 gdtoa
 #ifdef KR_headers
 	(ptr, fpi, be, bits, kindp, mode, ndigits, decpt, rve)
-	struct _reent *ptr, FPI *fpi; int be; ULong *bits;
+	__reent_ptr_t ptr, FPI *fpi; int be; ULong *bits;
 	int *kindp, mode, ndigits, *decpt; char **rve;
 #else
-	(struct _reent *ptr, FPI *fpi, int be, ULong *bits, int *kindp,
+	(__reent_ptr_t ptr, FPI *fpi, int be, ULong *bits, int *kindp,
 	 int mode, int ndigits, int *decpt, char **rve)
 #endif
 {
diff --git a/newlib/libc/stdlib/gdtoa-gethex.c b/newlib/libc/stdlib/gdtoa-gethex.c
index 74f30e69013d..04a28d19df6d 100644
--- a/newlib/libc/stdlib/gdtoa-gethex.c
+++ b/newlib/libc/stdlib/gdtoa-gethex.c
@@ -98,7 +98,7 @@ rshift (_Bigint *b,
 }
 
 static _Bigint *
-increment (struct _reent *ptr,
+increment (__reent_ptr_t ptr,
 	_Bigint *b)
 {
 	__ULong *x, *xe;
@@ -141,7 +141,7 @@ increment (struct _reent *ptr,
 
 
 int
-gethex (struct _reent *ptr, const char **sp, const FPI *fpi,
+gethex (__reent_ptr_t ptr, const char **sp, const FPI *fpi,
 	Long *exp, _Bigint **bp, int sign, locale_t loc)
 {
 	_Bigint *b;
diff --git a/newlib/libc/stdlib/gdtoa-ldtoa.c b/newlib/libc/stdlib/gdtoa-ldtoa.c
index d5db270a67ad..25a2efd11024 100644
--- a/newlib/libc/stdlib/gdtoa-ldtoa.c
+++ b/newlib/libc/stdlib/gdtoa-ldtoa.c
@@ -48,7 +48,7 @@
  * use INT_MAX in ldtoa() instead.
  */
 char *
-_ldtoa_r(struct _reent *ptr,
+_ldtoa_r(__reent_ptr_t ptr,
     long double ld, int mode, int ndigits, int *decpt, int *sign, char **rve)
 {
 	FPI fpi = {
@@ -121,7 +121,7 @@ DEF_STRONG(_ldtoa_r);
 #else   /* (LDBL_MANT_DIG == DBL_MANT_DIG) */
 
 char *
-_ldtoa_r(struct _reent *ptr,
+_ldtoa_r(__reent_ptr_t ptr,
     long double ld, int mode, int ndigits, int *decpt, int *sign,
     char **rve)
 {
diff --git a/newlib/libc/stdlib/gdtoa.h b/newlib/libc/stdlib/gdtoa.h
index f4d2a56db879..be03709ad9e1 100644
--- a/newlib/libc/stdlib/gdtoa.h
+++ b/newlib/libc/stdlib/gdtoa.h
@@ -106,19 +106,19 @@ typedef struct _Bigint Bigint;
 extern "C" {
 #endif
 
-extern char* __dtoa  ANSI((struct _reent *ptr,
+extern char* __dtoa  ANSI((__reent_ptr_t ptr,
 			double d, int mode, int ndigits, int *decpt,
 			int *sign, char **rve));
-extern char* __gdtoa ANSI((struct _reent *ptr,
+extern char* __gdtoa ANSI((__reent_ptr_t ptr,
 			FPI *fpi, int be, ULong *bits, int *kindp,
 			int mode, int ndigits, int *decpt, char **rve));
-extern void __freedtoa ANSI((struct _reent *, char*));
+extern void __freedtoa ANSI((__reent_ptr_t, char*));
 extern float  strtof ANSI((CONST char *, char **));
 extern double strtod ANSI((CONST char *, char **));
 extern int __strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
 char	*__hdtoa(double, const char *, int, int *, int *, char **);
 char	*__hldtoa(long double, const char *, int, int *, int *, char **);
-char	*__ldtoa(struct _reent *ptr,
+char	*__ldtoa(__reent_ptr_t ptr,
 		 long double *, int, int, int *, int *, char **);
 
 PROTO_NORMAL(__dtoa);
diff --git a/newlib/libc/stdlib/gdtoaimp.h b/newlib/libc/stdlib/gdtoaimp.h
index f2da3fc679cf..b949b7acd955 100644
--- a/newlib/libc/stdlib/gdtoaimp.h
+++ b/newlib/libc/stdlib/gdtoaimp.h
@@ -197,10 +197,10 @@ THIS SOFTWARE.
 #define trailz __trailz_D2A
 
 extern char *dtoa_result;
-extern char *nrv_alloc ANSI((struct _reent *, char*, char **, int));
+extern char *nrv_alloc ANSI((__reent_ptr_t, char*, char **, int));
 extern int quorem ANSI((Bigint*, Bigint*));
 extern void rshift ANSI((Bigint*, int));
-extern char *rv_alloc ANSI((struct _reent *, int));
+extern char *rv_alloc ANSI((__reent_ptr_t, int));
 extern int trailz ANSI((Bigint*));
 
 #endif /* GDTOAIMP_H_INCLUDED */
diff --git a/newlib/libc/stdlib/getenv_r.c b/newlib/libc/stdlib/getenv_r.c
index 6e51800ec3af..d20a58eb4aad 100644
--- a/newlib/libc/stdlib/getenv_r.c
+++ b/newlib/libc/stdlib/getenv_r.c
@@ -9,7 +9,7 @@ INDEX
 
 SYNOPSIS
 	#include <stdlib.h>
-	char *_getenv_r(struct _reent *<[reent_ptr]>, const char *<[name]>);
+	char *_getenv_r(__reent_ptr_t <[reent_ptr]>, const char *<[name]>);
 
 DESCRIPTION
 <<_getenv_r>> searches the list of environment variable names and values
@@ -73,7 +73,7 @@ static char ***p_environ = &environ;
  */
 
 char *
-_findenv_r (struct _reent *reent_ptr,
+_findenv_r (__reent_ptr_t reent_ptr,
 	register const char *name,
 	int *offset)
 {
@@ -117,7 +117,7 @@ _findenv_r (struct _reent *reent_ptr,
  */
 
 char *
-_getenv_r (struct _reent *reent_ptr,
+_getenv_r (__reent_ptr_t reent_ptr,
 	const char *name)
 {
   int offset;
diff --git a/newlib/libc/stdlib/jrand48.c b/newlib/libc/stdlib/jrand48.c
index 185e0da90c82..2f31b4e9a64c 100644
--- a/newlib/libc/stdlib/jrand48.c
+++ b/newlib/libc/stdlib/jrand48.c
@@ -14,7 +14,7 @@
 #include "rand48.h"
 
 long
-_jrand48_r (struct _reent *r,
+_jrand48_r (__reent_ptr_t r,
        unsigned short xseed[3])
 {
   __dorand48(r, xseed);
diff --git a/newlib/libc/stdlib/l64a.c b/newlib/libc/stdlib/l64a.c
index 6f12b6151ec2..142f9aca9746 100644
--- a/newlib/libc/stdlib/l64a.c
+++ b/newlib/libc/stdlib/l64a.c
@@ -37,7 +37,7 @@ l64a (long value)
 }
 
 char *
-_l64a_r (struct _reent *rptr,
+_l64a_r (__reent_ptr_t rptr,
      long value)
 {
   char *ptr;
diff --git a/newlib/libc/stdlib/lcong48.c b/newlib/libc/stdlib/lcong48.c
index d1109f0ac304..bd674654c122 100644
--- a/newlib/libc/stdlib/lcong48.c
+++ b/newlib/libc/stdlib/lcong48.c
@@ -22,7 +22,7 @@ _Thread_local unsigned short _tls_rand48_add = _RAND48_ADD;
 #endif
 
 void
-_lcong48_r (struct _reent *r,
+_lcong48_r (__reent_ptr_t r,
        unsigned short p[7])
 {
   _REENT_CHECK_RAND48(r);
diff --git a/newlib/libc/stdlib/ldtoa.c b/newlib/libc/stdlib/ldtoa.c
index 36613faad8c1..a23ffa03949c 100644
--- a/newlib/libc/stdlib/ldtoa.c
+++ b/newlib/libc/stdlib/ldtoa.c
@@ -15,7 +15,7 @@
 /* These are the externally visible entries. */
 /* linux name:  long double _IO_strtold (char *, char **); */
 long double _strtold (char *, char **);
-char *_ldtoa_r (struct _reent *, long double, int, int, int *, int *,
+char *_ldtoa_r (__reent_ptr_t, long double, int, int, int *, int *,
 		char **);
 int _ldcheck (long double *);
 #if 0
@@ -2788,7 +2788,7 @@ _IO_ldtostr (x, string, ndigs, flags, fmt)
 /* This routine will not return more than NDEC+1 digits. */
 
 char *
-_ldtoa_r (struct _reent *ptr, long double d, int mode, int ndigits,
+_ldtoa_r (__reent_ptr_t ptr, long double d, int mode, int ndigits,
 	  int *decpt, int *sign, char **rve)
 {
   unsigned short e[NI];
diff --git a/newlib/libc/stdlib/local.h b/newlib/libc/stdlib/local.h
index 26fd4f05dce9..3ea816602847 100644
--- a/newlib/libc/stdlib/local.h
+++ b/newlib/libc/stdlib/local.h
@@ -3,7 +3,7 @@
 #ifndef _LOCAL_H_
 #define _LOCAL_H_
 
-char *	_gcvt (struct _reent *, double , int , char *, char, int);
+char *	_gcvt (__reent_ptr_t, double , int , char *, char, int);
 
 #include "../locale/setlocale.h"
 
@@ -11,7 +11,7 @@ char *	_gcvt (struct _reent *, double , int , char *, char, int);
 #include <wchar.h>
 #endif
 
-typedef int wctomb_f (struct _reent *, char *, wchar_t, mbstate_t *);
+typedef int wctomb_f (__reent_ptr_t, char *, wchar_t, mbstate_t *);
 typedef wctomb_f *wctomb_p;
 
 wctomb_f __ascii_wctomb;
@@ -32,7 +32,7 @@ wctomb_f __big5_wctomb;
 
 #define __WCTOMB (__get_current_locale ()->wctomb)
 
-typedef int mbtowc_f (struct _reent *, wchar_t *, const char *, size_t,
+typedef int mbtowc_f (__reent_ptr_t, wchar_t *, const char *, size_t,
 		      mbstate_t *);
 typedef mbtowc_f *mbtowc_p;
 
diff --git a/newlib/libc/stdlib/lrand48.c b/newlib/libc/stdlib/lrand48.c
index a28284e61211..40d2bfba34d3 100644
--- a/newlib/libc/stdlib/lrand48.c
+++ b/newlib/libc/stdlib/lrand48.c
@@ -14,7 +14,7 @@
 #include "rand48.h"
 
 long
-_lrand48_r (struct _reent *r)
+_lrand48_r (__reent_ptr_t r)
 {
   _REENT_CHECK_RAND48(r);
   __dorand48(r, __rand48_seed);
diff --git a/newlib/libc/stdlib/mblen.c b/newlib/libc/stdlib/mblen.c
index 24df61519449..10122b867532 100644
--- a/newlib/libc/stdlib/mblen.c
+++ b/newlib/libc/stdlib/mblen.c
@@ -52,7 +52,7 @@ mblen (const char *s,
 {
 #ifdef _MB_CAPABLE
   int retval = 0;
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
   mbstate_t *state;
   
   _REENT_CHECK_MISC(reent);
diff --git a/newlib/libc/stdlib/mblen_r.c b/newlib/libc/stdlib/mblen_r.c
index ff173700215e..c722aa8ced32 100644
--- a/newlib/libc/stdlib/mblen_r.c
+++ b/newlib/libc/stdlib/mblen_r.c
@@ -7,7 +7,7 @@ INDEX
 
 SYNOPSIS
 	#include <stdlib.h>
-	int _mblen_r(struct _reent *<[r]>, const char *<[s]>, size_t <[n]>, int *<[state]>);
+	int _mblen_r(__reent_ptr_t <[r]>, const char *<[s]>, size_t <[n]>, int *<[state]>);
 
 DESCRIPTION
 When _MB_CAPABLE is not defined, this is a minimal ANSI-conforming 
@@ -41,7 +41,7 @@ effects vary with the locale.
 #include "local.h"
 
 int
-_mblen_r (struct _reent *r,
+_mblen_r (__reent_ptr_t r,
         const char *s,
         size_t n,
         mbstate_t *state)
diff --git a/newlib/libc/stdlib/mbrlen.c b/newlib/libc/stdlib/mbrlen.c
index 39e175e43b3a..6361b673f73d 100644
--- a/newlib/libc/stdlib/mbrlen.c
+++ b/newlib/libc/stdlib/mbrlen.c
@@ -15,7 +15,7 @@ mbrlen(const char *__restrict s, size_t n, mbstate_t *__restrict ps)
 #ifdef _MB_CAPABLE
   if (ps == NULL)
     {
-      struct _reent *reent = _REENT;
+      __reent_ptr_t reent = _REENT;
 
       _REENT_CHECK_MISC(reent);
       ps = &(_REENT_MBRLEN_STATE(reent));
diff --git a/newlib/libc/stdlib/mbrtowc.c b/newlib/libc/stdlib/mbrtowc.c
index e641b8cd62d7..426106f31b89 100644
--- a/newlib/libc/stdlib/mbrtowc.c
+++ b/newlib/libc/stdlib/mbrtowc.c
@@ -12,7 +12,7 @@ _Thread_local _mbstate_t _tls_mbrtowc_state;
 #endif
 
 size_t
-_mbrtowc_r (struct _reent *ptr,
+_mbrtowc_r (__reent_ptr_t ptr,
 	wchar_t *pwc,
 	const char *s,
 	size_t n,
@@ -54,7 +54,7 @@ mbrtowc (wchar_t *__restrict pwc,
   return _mbrtowc_r (_REENT, pwc, s, n, ps);
 #else
   int retval = 0;
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
 #ifdef _MB_CAPABLE
   if (ps == NULL)
diff --git a/newlib/libc/stdlib/mbsnrtowcs.c b/newlib/libc/stdlib/mbsnrtowcs.c
index 2effc501cdfc..7f94429a335a 100644
--- a/newlib/libc/stdlib/mbsnrtowcs.c
+++ b/newlib/libc/stdlib/mbsnrtowcs.c
@@ -19,7 +19,7 @@ SYNOPSIS
 			 mbstate_t *__restrict <[ps]>);
 
 	#include <wchar.h>
-	size_t _mbsrtowcs_r(struct _reent *<[ptr]>, wchar_t *<[dst]>,
+	size_t _mbsrtowcs_r(__reent_ptr_t <[ptr]>, wchar_t *<[dst]>,
 			    const char **<[src]>, size_t <[len]>,
 			    mbstate_t *<[ps]>);
 
@@ -29,7 +29,7 @@ SYNOPSIS
 			  size_t <[len]>, mbstate_t *__restrict <[ps]>);
 
 	#include <wchar.h>
-	size_t _mbsnrtowcs_r(struct _reent *<[ptr]>, wchar_t *<[dst]>,
+	size_t _mbsnrtowcs_r(__reent_ptr_t <[ptr]>, wchar_t *<[dst]>,
 			     const char **<[src]>, size_t <[nms]>,
 			     size_t <[len]>, mbstate_t *<[ps]>);
 
@@ -75,7 +75,7 @@ _Thread_local _mbstate_t _tls_mbsrtowcs_state;
 #endif
 
 size_t
-_mbsnrtowcs_r (struct _reent *r,
+_mbsnrtowcs_r (__reent_ptr_t r,
 	wchar_t *dst,
 	const char **src,
 	size_t nms,
diff --git a/newlib/libc/stdlib/mbsrtowcs.c b/newlib/libc/stdlib/mbsrtowcs.c
index 82589c606799..027c2da0dc2d 100644
--- a/newlib/libc/stdlib/mbsrtowcs.c
+++ b/newlib/libc/stdlib/mbsrtowcs.c
@@ -8,7 +8,7 @@
 #include <errno.h>
 
 size_t
-_mbsrtowcs_r (struct _reent *r,
+_mbsrtowcs_r (__reent_ptr_t r,
 	wchar_t *dst,
 	const char **src,
 	size_t len,
diff --git a/newlib/libc/stdlib/mbstowcs_r.c b/newlib/libc/stdlib/mbstowcs_r.c
index 43aea2cdf627..7e772eacd37c 100644
--- a/newlib/libc/stdlib/mbstowcs_r.c
+++ b/newlib/libc/stdlib/mbstowcs_r.c
@@ -3,7 +3,7 @@
 #include "local.h"
 
 size_t
-_mbstowcs_r (struct _reent *r,
+_mbstowcs_r (__reent_ptr_t r,
         wchar_t       *__restrict pwcs,
         const char    *__restrict s,
         size_t         n,
diff --git a/newlib/libc/stdlib/mbtowc.c b/newlib/libc/stdlib/mbtowc.c
index fbd8df61de97..01fc7c3c4a47 100644
--- a/newlib/libc/stdlib/mbtowc.c
+++ b/newlib/libc/stdlib/mbtowc.c
@@ -60,7 +60,7 @@ mbtowc (wchar_t *__restrict pwc,
 {
 #ifdef _MB_CAPABLE
   int retval = 0;
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
   mbstate_t *ps;
 
   _REENT_CHECK_MISC(reent);
diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c
index cab8333d70df..79e6524e0686 100644
--- a/newlib/libc/stdlib/mbtowc_r.c
+++ b/newlib/libc/stdlib/mbtowc_r.c
@@ -8,7 +8,7 @@
 #include "local.h"
 
 int
-_mbtowc_r (struct _reent *r,
+_mbtowc_r (__reent_ptr_t r,
         wchar_t       *__restrict pwc,
         const char    *__restrict s,
         size_t         n,
@@ -18,7 +18,7 @@ _mbtowc_r (struct _reent *r,
 }
 
 int
-__ascii_mbtowc (struct _reent *r,
+__ascii_mbtowc (__reent_ptr_t r,
         wchar_t       *pwc,
         const char    *s,
         size_t         n,
@@ -87,7 +87,7 @@ static JIS_ACTION JIS_action_table[JIS_S_NUM][JIS_C_NUM] = {
 
 #ifdef _MB_EXTENDED_CHARSETS_ISO
 static int
-___iso_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+___iso_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 	       int iso_idx, mbstate_t *state)
 {
   wchar_t dummy;
@@ -125,105 +125,105 @@ ___iso_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
 }
 
 static int
-__iso_8859_1_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__iso_8859_1_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		     mbstate_t *state)
 {
   return ___iso_mbtowc (r, pwc, s, n, -1, state);
 }
 
 static int
-__iso_8859_2_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__iso_8859_2_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		     mbstate_t *state)
 {
   return ___iso_mbtowc (r, pwc, s, n, 0, state);
 }
 
 static int
-__iso_8859_3_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__iso_8859_3_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		     mbstate_t *state)
 {
   return ___iso_mbtowc (r, pwc, s, n, 1, state);
 }
 
 static int
-__iso_8859_4_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__iso_8859_4_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		     mbstate_t *state)
 {
   return ___iso_mbtowc (r, pwc, s, n, 2, state);
 }
 
 static int
-__iso_8859_5_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__iso_8859_5_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		     mbstate_t *state)
 {
   return ___iso_mbtowc (r, pwc, s, n, 3, state);
 }
 
 static int
-__iso_8859_6_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__iso_8859_6_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		     mbstate_t *state)
 {
   return ___iso_mbtowc (r, pwc, s, n, 4, state);
 }
 
 static int
-__iso_8859_7_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__iso_8859_7_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		     mbstate_t *state)
 {
   return ___iso_mbtowc (r, pwc, s, n, 5, state);
 }
 
 static int
-__iso_8859_8_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__iso_8859_8_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		     mbstate_t *state)
 {
   return ___iso_mbtowc (r, pwc, s, n, 6, state);
 }
 
 static int
-__iso_8859_9_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__iso_8859_9_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		     mbstate_t *state)
 {
   return ___iso_mbtowc (r, pwc, s, n, 7, state);
 }
 
 static int
-__iso_8859_10_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__iso_8859_10_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		      mbstate_t *state)
 {
   return ___iso_mbtowc (r, pwc, s, n, 8, state);
 }
 
 static int
-__iso_8859_11_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__iso_8859_11_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		      mbstate_t *state)
 {
   return ___iso_mbtowc (r, pwc, s, n, 9, state);
 }
 
 static int
-__iso_8859_13_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__iso_8859_13_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		      mbstate_t *state)
 {
   return ___iso_mbtowc (r, pwc, s, n, 10, state);
 }
 
 static int
-__iso_8859_14_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__iso_8859_14_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		      mbstate_t *state)
 {
   return ___iso_mbtowc (r, pwc, s, n, 11, state);
 }
 
 static int
-__iso_8859_15_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__iso_8859_15_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		      mbstate_t *state)
 {
   return ___iso_mbtowc (r, pwc, s, n, 12, state);
 }
 
 static int
-__iso_8859_16_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__iso_8859_16_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		      mbstate_t *state)
 {
   return ___iso_mbtowc (r, pwc, s, n, 13, state);
@@ -260,7 +260,7 @@ __iso_mbtowc (int val)
 
 #ifdef _MB_EXTENDED_CHARSETS_WINDOWS
 static int
-___cp_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+___cp_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 	      int cp_idx, mbstate_t *state)
 {
   wchar_t dummy;
@@ -298,189 +298,189 @@ ___cp_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
 }
 
 static int
-__cp_437_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_437_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		 mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 0, state);
 }
 
 static int
-__cp_720_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_720_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		 mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 1, state);
 }
 
 static int
-__cp_737_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_737_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		 mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 2, state);
 }
 
 static int
-__cp_775_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_775_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		 mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 3, state);
 }
 
 static int
-__cp_850_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_850_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		 mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 4, state);
 }
 
 static int
-__cp_852_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_852_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		 mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 5, state);
 }
 
 static int
-__cp_855_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_855_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		 mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 6, state);
 }
 
 static int
-__cp_857_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_857_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		 mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 7, state);
 }
 
 static int
-__cp_858_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_858_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		 mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 8, state);
 }
 
 static int
-__cp_862_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_862_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		 mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 9, state);
 }
 
 static int
-__cp_866_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_866_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		 mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 10, state);
 }
 
 static int
-__cp_874_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_874_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		 mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 11, state);
 }
 
 static int
-__cp_1125_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_1125_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		  mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 12, state);
 }
 
 static int
-__cp_1250_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_1250_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		  mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 13, state);
 }
 
 static int
-__cp_1251_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_1251_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		  mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 14, state);
 }
 
 static int
-__cp_1252_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_1252_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		  mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 15, state);
 }
 
 static int
-__cp_1253_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_1253_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		  mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 16, state);
 }
 
 static int
-__cp_1254_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_1254_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		  mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 17, state);
 }
 
 static int
-__cp_1255_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_1255_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		  mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 18, state);
 }
 
 static int
-__cp_1256_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_1256_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		  mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 19, state);
 }
 
 static int
-__cp_1257_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_1257_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		  mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 20, state);
 }
 
 static int
-__cp_1258_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_1258_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		  mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 21, state);
 }
 
 static int
-__cp_20866_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_20866_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		   mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 22, state);
 }
 
 static int
-__cp_21866_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_21866_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		   mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 23, state);
 }
 
 static int
-__cp_101_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_101_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		 mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 24, state);
 }
 
 static int
-__cp_102_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_102_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		 mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 25, state);
 }
 
 static int
-__cp_103_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
+__cp_103_mbtowc (__reent_ptr_t r, wchar_t *pwc, const char *s, size_t n,
 		 mbstate_t *state)
 {
   return ___cp_mbtowc (r, pwc, s, n, 26, state);
@@ -526,7 +526,7 @@ __cp_mbtowc (int val)
 #endif /* _MB_EXTENDED_CHARSETS_WINDOWS */
 
 int
-__utf8_mbtowc (struct _reent *r,
+__utf8_mbtowc (__reent_ptr_t r,
         wchar_t       *pwc,
         const char    *s,
         size_t         n,
@@ -727,7 +727,7 @@ __utf8_mbtowc (struct _reent *r,
    because the underlying OS requires wchar_t == UTF-16. */
 #ifndef  __CYGWIN__
 int
-__sjis_mbtowc (struct _reent *r,
+__sjis_mbtowc (__reent_ptr_t r,
         wchar_t       *pwc,
         const char    *s,
         size_t         n,
@@ -783,7 +783,7 @@ __sjis_mbtowc (struct _reent *r,
 }
 
 int
-__eucjp_mbtowc (struct _reent *r,
+__eucjp_mbtowc (__reent_ptr_t r,
         wchar_t       *pwc,
         const char    *s,
         size_t         n,
@@ -865,7 +865,7 @@ __eucjp_mbtowc (struct _reent *r,
 }
 
 int
-__jis_mbtowc (struct _reent *r,
+__jis_mbtowc (__reent_ptr_t r,
         wchar_t       *pwc,
         const char    *s,
         size_t         n,
diff --git a/newlib/libc/stdlib/mlock.c b/newlib/libc/stdlib/mlock.c
index e5ac131954e5..c02354995bff 100644
--- a/newlib/libc/stdlib/mlock.c
+++ b/newlib/libc/stdlib/mlock.c
@@ -10,8 +10,8 @@ INDEX
 
 SYNOPSIS
 	#include <malloc.h>
-	void __malloc_lock (struct _reent *<[reent]>);
-	void __malloc_unlock (struct _reent *<[reent]>);
+	void __malloc_lock (__reent_ptr_t <[reent]>);
+	void __malloc_unlock (__reent_ptr_t <[reent]>);
 
 DESCRIPTION
 The <<malloc>> family of routines call these functions when they need to lock
@@ -37,7 +37,7 @@ __LOCK_INIT_RECURSIVE(static, __malloc_recursive_mutex);
 #endif
 
 void
-__malloc_lock (struct _reent *ptr)
+__malloc_lock (__reent_ptr_t ptr)
 {
 #ifndef __SINGLE_THREAD__
   __lock_acquire_recursive (__malloc_recursive_mutex);
@@ -45,7 +45,7 @@ __malloc_lock (struct _reent *ptr)
 }
 
 void
-__malloc_unlock (struct _reent *ptr)
+__malloc_unlock (__reent_ptr_t ptr)
 {
 #ifndef __SINGLE_THREAD__
   __lock_release_recursive (__malloc_recursive_mutex);
diff --git a/newlib/libc/stdlib/mprec.c b/newlib/libc/stdlib/mprec.c
index 1f534b068e38..18a60900c0dd 100644
--- a/newlib/libc/stdlib/mprec.c
+++ b/newlib/libc/stdlib/mprec.c
@@ -99,7 +99,7 @@ _Thread_local struct _Bigint **_tls_mp_freelist;
 */
 
 _Bigint *
-Balloc (struct _reent *ptr, int k)
+Balloc (__reent_ptr_t ptr, int k)
 {
   int x;
   _Bigint *rv ;
@@ -138,7 +138,7 @@ Balloc (struct _reent *ptr, int k)
 }
 
 void
-Bfree (struct _reent *ptr, _Bigint * v)
+Bfree (__reent_ptr_t ptr, _Bigint * v)
 {
   _REENT_CHECK_MP(ptr);
   if (v)
@@ -149,7 +149,7 @@ Bfree (struct _reent *ptr, _Bigint * v)
 }
 
 _Bigint *
-multadd (struct _reent *ptr,
+multadd (__reent_ptr_t ptr,
 	_Bigint * b,
 	int m,
 	int a)
@@ -195,7 +195,7 @@ multadd (struct _reent *ptr,
 }
 
 _Bigint *
-s2b (struct _reent * ptr,
+s2b (__reent_ptr_t ptr,
 	const char *s,
 	int nd0,
 	int nd,
@@ -318,7 +318,7 @@ lo0bits (__ULong *y)
 }
 
 _Bigint *
-i2b (struct _reent * ptr, int i)
+i2b (__reent_ptr_t ptr, int i)
 {
   _Bigint *b;
 
@@ -329,7 +329,7 @@ i2b (struct _reent * ptr, int i)
 }
 
 _Bigint *
-mult (struct _reent * ptr, _Bigint * a, _Bigint * b)
+mult (__reent_ptr_t ptr, _Bigint * a, _Bigint * b)
 {
   _Bigint *c;
   int k, wa, wb, wc;
@@ -421,7 +421,7 @@ mult (struct _reent * ptr, _Bigint * a, _Bigint * b)
 }
 
 _Bigint *
-pow5mult (struct _reent * ptr, _Bigint * b, int k)
+pow5mult (__reent_ptr_t ptr, _Bigint * b, int k)
 {
   _Bigint *b1, *p5, *p51;
   int i;
@@ -460,7 +460,7 @@ pow5mult (struct _reent * ptr, _Bigint * b, int k)
 }
 
 _Bigint *
-lshift (struct _reent * ptr, _Bigint * b, int k)
+lshift (__reent_ptr_t ptr, _Bigint * b, int k)
 {
   int i, k1, n, n1;
   _Bigint *b1;
@@ -550,7 +550,7 @@ cmp (_Bigint * a, _Bigint * b)
 }
 
 _Bigint *
-diff (struct _reent * ptr,
+diff (__reent_ptr_t ptr,
 	_Bigint * a, _Bigint * b)
 {
   _Bigint *c;
@@ -756,7 +756,7 @@ ret_d:
 }
 
 _Bigint *
-d2b (struct _reent * ptr,
+d2b (__reent_ptr_t ptr,
 	double _d,
 	int *e,
 	int *bits)
diff --git a/newlib/libc/stdlib/mprec.h b/newlib/libc/stdlib/mprec.h
index c2d0a0ac3eec..b9d7daed8f49 100644
--- a/newlib/libc/stdlib/mprec.h
+++ b/newlib/libc/stdlib/mprec.h
@@ -362,32 +362,32 @@ struct _reent ;
 struct FPI;
 double 		ulp (double x);
 double		b2d (_Bigint *a , int *e);
-_Bigint *	Balloc (struct _reent *p, int k);
-void 		Bfree (struct _reent *p, _Bigint *v);
-_Bigint *	multadd (struct _reent *p, _Bigint *, int, int);
-_Bigint *	s2b (struct _reent *, const char*, int, int, __ULong);
-_Bigint	*	i2b (struct _reent *,int);
-_Bigint *	mult (struct _reent *, _Bigint *, _Bigint *);
-_Bigint *	pow5mult (struct _reent *, _Bigint *, int k);
+_Bigint *	Balloc (__reent_ptr_t p, int k);
+void 		Bfree (__reent_ptr_t p, _Bigint *v);
+_Bigint *	multadd (__reent_ptr_t p, _Bigint *, int, int);
+_Bigint *	s2b (__reent_ptr_t, const char*, int, int, __ULong);
+_Bigint	*	i2b (__reent_ptr_t,int);
+_Bigint *	mult (__reent_ptr_t, _Bigint *, _Bigint *);
+_Bigint *	pow5mult (__reent_ptr_t, _Bigint *, int k);
 int 		hi0bits (__ULong);
 int 		lo0bits (__ULong *);
-_Bigint *	d2b (struct _reent *p, double d, int *e, int *bits);
-_Bigint *	lshift (struct _reent *p, _Bigint *b, int k);
+_Bigint *	d2b (__reent_ptr_t p, double d, int *e, int *bits);
+_Bigint *	lshift (__reent_ptr_t p, _Bigint *b, int k);
 int		match (const char**, char*);
-_Bigint *	diff (struct _reent *p, _Bigint *a, _Bigint *b);
+_Bigint *	diff (__reent_ptr_t p, _Bigint *a, _Bigint *b);
 int		cmp (_Bigint *a, _Bigint *b);
-int		gethex (struct _reent *p, const char **sp, const struct FPI *fpi, Long *exp, _Bigint **bp, int sign, locale_t loc);
+int		gethex (__reent_ptr_t p, const char **sp, const struct FPI *fpi, Long *exp, _Bigint **bp, int sign, locale_t loc);
 double		ratio (_Bigint *a, _Bigint *b);
 __ULong		any_on (_Bigint *b, int k);
 void		copybits (__ULong *c, int n, _Bigint *b);
-double		_strtod_l (struct _reent *ptr, const char *__restrict s00,
+double		_strtod_l (__reent_ptr_t ptr, const char *__restrict s00,
 			   char **__restrict se, locale_t loc);
 #if defined (_HAVE_LONG_DOUBLE) && !defined (_LDBL_EQ_DBL)
-int		_strtorx_l (struct _reent *, const char *, char **, int,
+int		_strtorx_l (__reent_ptr_t, const char *, char **, int,
 			    void *, locale_t);
-int		_strtorQ_l (struct _reent *, const char *, char **, int,
+int		_strtorQ_l (__reent_ptr_t, const char *, char **, int,
 			    void *, locale_t);
-int		_strtodg_l (struct _reent *p, const char *s00, char **se,
+int		_strtodg_l (__reent_ptr_t p, const char *s00, char **se,
 			    struct FPI *fpi, Long *exp, __ULong *bits,
 			    locale_t);
 #endif /* _HAVE_LONG_DOUBLE && !_LDBL_EQ_DBL */
diff --git a/newlib/libc/stdlib/mrand48.c b/newlib/libc/stdlib/mrand48.c
index bb1e454c9d30..4f0a205209aa 100644
--- a/newlib/libc/stdlib/mrand48.c
+++ b/newlib/libc/stdlib/mrand48.c
@@ -14,7 +14,7 @@
 #include "rand48.h"
 
 long
-_mrand48_r (struct _reent *r)
+_mrand48_r (__reent_ptr_t r)
 {
   _REENT_CHECK_RAND48(r);
   __dorand48(r, __rand48_seed);
diff --git a/newlib/libc/stdlib/mstats.c b/newlib/libc/stdlib/mstats.c
index 85c20f1bc0ef..46a48e7989e1 100644
--- a/newlib/libc/stdlib/mstats.c
+++ b/newlib/libc/stdlib/mstats.c
@@ -114,7 +114,7 @@ mallopt (int p,
    malloc_stats.  */
 
 void
-_mstats_r (struct _reent *ptr,
+_mstats_r (__reent_ptr_t ptr,
 	char *s)
 {
   _REENT_SMALL_CHECK_INIT(ptr);
diff --git a/newlib/libc/stdlib/nano-mallocr.c b/newlib/libc/stdlib/nano-mallocr.c
index 030be44add84..f298d288e4e9 100644
--- a/newlib/libc/stdlib/nano-mallocr.c
+++ b/newlib/libc/stdlib/nano-mallocr.c
@@ -56,8 +56,8 @@
 #include <sys/config.h>
 #include <reent.h>
 
-#define RARG struct _reent *reent_ptr,
-#define RONEARG struct _reent *reent_ptr
+#define RARG __reent_ptr_t reent_ptr,
+#define RONEARG __reent_ptr_t reent_ptr
 #define RCALL reent_ptr,
 #define RONECALL reent_ptr
 
diff --git a/newlib/libc/stdlib/nrand48.c b/newlib/libc/stdlib/nrand48.c
index cca0e5f7a6d3..1540ebc953d1 100644
--- a/newlib/libc/stdlib/nrand48.c
+++ b/newlib/libc/stdlib/nrand48.c
@@ -14,7 +14,7 @@
 #include "rand48.h"
 
 long
-_nrand48_r (struct _reent *r,
+_nrand48_r (__reent_ptr_t r,
        unsigned short xseed[3])
 {
   __dorand48 (r, xseed);
diff --git a/newlib/libc/stdlib/putenv_r.c b/newlib/libc/stdlib/putenv_r.c
index 459348bb4cbe..e24d0c8d8e31 100644
--- a/newlib/libc/stdlib/putenv_r.c
+++ b/newlib/libc/stdlib/putenv_r.c
@@ -30,7 +30,7 @@
                or replaces the environment variable "name"
                with "value" which is specified by str as "name=value". */
 int
-_putenv_r (struct _reent *reent_ptr,
+_putenv_r (__reent_ptr_t reent_ptr,
 	char   *str)
 {
   register char *p, *equal;
diff --git a/newlib/libc/stdlib/rand.c b/newlib/libc/stdlib/rand.c
index ba9cc80f2b21..5238b1cd9476 100644
--- a/newlib/libc/stdlib/rand.c
+++ b/newlib/libc/stdlib/rand.c
@@ -65,7 +65,7 @@ _Thread_local unsigned long long _tls_rand_next = 1;
 void
 srand (unsigned int seed)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   _REENT_CHECK_RAND48(reent);
   _REENT_RAND_NEXT(reent) = seed;
@@ -74,7 +74,7 @@ srand (unsigned int seed)
 int
 rand (void)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   /* This multiplier was obtained from Knuth, D.E., "The Art of
      Computer Programming," Vol 2, Seminumerical Algorithms, Third
diff --git a/newlib/libc/stdlib/rand48.c b/newlib/libc/stdlib/rand48.c
index 626b3ef84c51..53c0fd0a27e2 100644
--- a/newlib/libc/stdlib/rand48.c
+++ b/newlib/libc/stdlib/rand48.c
@@ -130,7 +130,7 @@ No supporting OS subroutines are required.
 #include "rand48.h"
 
 void
-__dorand48 (struct _reent *r,
+__dorand48 (__reent_ptr_t r,
        unsigned short xseed[3])
 {
   unsigned long accu;
diff --git a/newlib/libc/stdlib/rand48.h b/newlib/libc/stdlib/rand48.h
index 26455e35a271..0cb38b9d8910 100644
--- a/newlib/libc/stdlib/rand48.h
+++ b/newlib/libc/stdlib/rand48.h
@@ -17,7 +17,7 @@
 #include <math.h>
 #include <stdlib.h>
 
-extern void __dorand48 (struct _reent *r, unsigned short[3]);
+extern void __dorand48 (__reent_ptr_t r, unsigned short[3]);
 #define __rand48_seed	_REENT_RAND48_SEED(r)
 #define __rand48_mult	_REENT_RAND48_MULT(r)
 #define __rand48_add	_REENT_RAND48_ADD(r)
diff --git a/newlib/libc/stdlib/random.c b/newlib/libc/stdlib/random.c
index 131dc056c068..8c69fd1d8a65 100644
--- a/newlib/libc/stdlib/random.c
+++ b/newlib/libc/stdlib/random.c
@@ -59,7 +59,7 @@ algorithm as <<rand>>.
 void
 srandom (unsigned int seed)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   _REENT_CHECK_RAND48(reent);
   _REENT_RAND_NEXT(reent) = seed;
@@ -68,7 +68,7 @@ srandom (unsigned int seed)
 long int
 random (void)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   /* This multiplier was obtained from Knuth, D.E., "The Art of
      Computer Programming," Vol 2, Seminumerical Algorithms, Third
diff --git a/newlib/libc/stdlib/reallocf.c b/newlib/libc/stdlib/reallocf.c
index d62752a80eb0..1705352c9d75 100644
--- a/newlib/libc/stdlib/reallocf.c
+++ b/newlib/libc/stdlib/reallocf.c
@@ -31,7 +31,7 @@
 #include <stdlib.h>
 
 void *
-_reallocf_r (struct _reent *reentptr,
+_reallocf_r (__reent_ptr_t reentptr,
 	void *ptr,
 	size_t size)
 {
diff --git a/newlib/libc/stdlib/seed48.c b/newlib/libc/stdlib/seed48.c
index 25f0e501e9fb..1fb2eddee24d 100644
--- a/newlib/libc/stdlib/seed48.c
+++ b/newlib/libc/stdlib/seed48.c
@@ -14,7 +14,7 @@
 #include "rand48.h"
 
 unsigned short *
-_seed48_r (struct _reent *r,
+_seed48_r (__reent_ptr_t r,
        unsigned short xseed[3])
 {
   static unsigned short sseed[3];
diff --git a/newlib/libc/stdlib/setenv.c b/newlib/libc/stdlib/setenv.c
index d8f5bfe1f489..8eaf101fba4c 100644
--- a/newlib/libc/stdlib/setenv.c
+++ b/newlib/libc/stdlib/setenv.c
@@ -22,7 +22,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-extern int _unsetenv_r (struct _reent *, const char *);
+extern int _unsetenv_r (__reent_ptr_t, const char *);
 
 /*
  * setenv --
diff --git a/newlib/libc/stdlib/setenv_r.c b/newlib/libc/stdlib/setenv_r.c
index 84d87a6ed2da..3a39b265bc73 100644
--- a/newlib/libc/stdlib/setenv_r.c
+++ b/newlib/libc/stdlib/setenv_r.c
@@ -37,7 +37,7 @@ extern char **environ;
 static char ***p_environ = &environ;
 
 /* _findenv_r is defined in getenv_r.c.  */
-extern char *_findenv_r (struct _reent *, const char *, int *);
+extern char *_findenv_r (__reent_ptr_t, const char *, int *);
 
 /*
  * _setenv_r --
@@ -48,7 +48,7 @@ extern char *_findenv_r (struct _reent *, const char *, int *);
  */
 
 int
-_setenv_r (struct _reent *reent_ptr,
+_setenv_r (__reent_ptr_t reent_ptr,
 	const char *name,
 	const char *value,
 	int rewrite)
@@ -131,7 +131,7 @@ _setenv_r (struct _reent *reent_ptr,
  *	Delete environmental variable "name".
  */
 int
-_unsetenv_r (struct _reent *reent_ptr,
+_unsetenv_r (__reent_ptr_t reent_ptr,
         const char *name)
 {
   register char **P;
diff --git a/newlib/libc/stdlib/srand48.c b/newlib/libc/stdlib/srand48.c
index 573f62018e27..1f89df4ee477 100644
--- a/newlib/libc/stdlib/srand48.c
+++ b/newlib/libc/stdlib/srand48.c
@@ -14,7 +14,7 @@
 #include "rand48.h"
 
 void
-_srand48_r (struct _reent *r,
+_srand48_r (__reent_ptr_t r,
        long seed)
 {
   _REENT_CHECK_RAND48(r);
diff --git a/newlib/libc/stdlib/std.h b/newlib/libc/stdlib/std.h
index c000a67c6fed..2288f7d90c90 100644
--- a/newlib/libc/stdlib/std.h
+++ b/newlib/libc/stdlib/std.h
@@ -23,5 +23,5 @@
 #define DECP	0x04
 
 int    		__ten_mul(double *acc, int digit);
-double		__adjust(struct _reent *ptr, double *acc, int dexp, int sign);
+double		__adjust(__reent_ptr_t ptr, double *acc, int dexp, int sign);
 double		__exp10(unsigned x);
diff --git a/newlib/libc/stdlib/strtod.c b/newlib/libc/stdlib/strtod.c
index 9156ed7d69c9..b141510bbdbb 100644
--- a/newlib/libc/stdlib/strtod.c
+++ b/newlib/libc/stdlib/strtod.c
@@ -240,7 +240,7 @@ ULtod (__ULong *L,
 #endif /* !NO_HEX_FP */
 
 double
-_strtod_l (struct _reent *ptr, const char *__restrict s00, char **__restrict se,
+_strtod_l (__reent_ptr_t ptr, const char *__restrict s00, char **__restrict se,
 	   locale_t loc)
 {
 #ifdef Avoid_Underflow
@@ -1273,7 +1273,7 @@ _strtod_l (struct _reent *ptr, const char *__restrict s00, char **__restrict se,
 }
 
 double
-_strtod_r (struct _reent *ptr,
+_strtod_r (__reent_ptr_t ptr,
 	const char *__restrict s00,
 	char **__restrict se)
 {
diff --git a/newlib/libc/stdlib/strtodg.c b/newlib/libc/stdlib/strtodg.c
index 4e706abd1673..b4501d2f0755 100644
--- a/newlib/libc/stdlib/strtodg.c
+++ b/newlib/libc/stdlib/strtodg.c
@@ -52,7 +52,7 @@ fivesbits[] = {	 0,  3,  5,  7, 10, 12, 14, 17, 19, 21,
 		};
 
 static _Bigint *
-sum (struct _reent *p, _Bigint *a, _Bigint *b)
+sum (__reent_ptr_t p, _Bigint *a, _Bigint *b)
 {
 	_Bigint *c;
 	__ULong carry, *xc, *xa, *xb, *xe, y;
@@ -160,7 +160,7 @@ trailz (_Bigint *b)
 	}
 
 static _Bigint *
-increment (struct _reent *p, _Bigint *b)
+increment (__reent_ptr_t p, _Bigint *b)
 {
 	__ULong *x, *xe;
 	_Bigint *b1;
@@ -245,7 +245,7 @@ all_on (_Bigint *b, int n)
 	}
 
 _Bigint *
-set_ones (struct _reent *p, _Bigint *b, int n)
+set_ones (__reent_ptr_t p, _Bigint *b, int n)
 {
 	int k;
 	__ULong *x, *xe;
@@ -269,7 +269,7 @@ set_ones (struct _reent *p, _Bigint *b, int n)
 	}
 
 static int
-rvOK (struct _reent *p, double d, FPI *fpi, Long *exp, __ULong *bits, int exact,
+rvOK (__reent_ptr_t p, double d, FPI *fpi, Long *exp, __ULong *bits, int exact,
       int rd, int *irv)
 {
 	_Bigint *b;
@@ -413,7 +413,7 @@ mantbits (U d)
 	}
 
 int
-_strtodg_l (struct _reent *p, const char *s00, char **se, FPI *fpi, Long *exp,
+_strtodg_l (__reent_ptr_t p, const char *s00, char **se, FPI *fpi, Long *exp,
 	    __ULong *bits, locale_t loc)
 {
 	int abe, abits, asub;
diff --git a/newlib/libc/stdlib/strtoimax.c b/newlib/libc/stdlib/strtoimax.c
index 73789bb57d67..570d81732ee7 100644
--- a/newlib/libc/stdlib/strtoimax.c
+++ b/newlib/libc/stdlib/strtoimax.c
@@ -57,7 +57,7 @@ __FBSDID("$FreeBSD: head/lib/libc/stdlib/strtoimax.c 251672 2013-06-13 00:19:30Z
  *Reentrant version of strtoimax.
  */
 static intmax_t
-_strtoimax_l(struct _reent *rptr, const char * __restrict nptr,
+_strtoimax_l(__reent_ptr_t rptr, const char * __restrict nptr,
 	     char ** __restrict endptr, int base, locale_t loc)
 {
 	const char *s = nptr;
@@ -149,7 +149,7 @@ noconv:
 }
 
 intmax_t
-_strtoimax_r(struct _reent *rptr, const char *__restrict nptr,
+_strtoimax_r(__reent_ptr_t rptr, const char *__restrict nptr,
 	     char **__restrict endptr, int base)
 {
 	return _strtoimax_l(rptr, nptr, endptr, base, __get_current_locale());
diff --git a/newlib/libc/stdlib/strtol.c b/newlib/libc/stdlib/strtol.c
index f3e9eb2ae21b..521d565a17b1 100644
--- a/newlib/libc/stdlib/strtol.c
+++ b/newlib/libc/stdlib/strtol.c
@@ -127,7 +127,7 @@ No supporting OS subroutines are required.
  * Convert a string to a long integer.
  */
 static long
-_strtol_l (struct _reent *rptr, const char *__restrict nptr,
+_strtol_l (__reent_ptr_t rptr, const char *__restrict nptr,
 	   char **__restrict endptr, int base, locale_t loc)
 {
 	register const unsigned char *s = (const unsigned char *)nptr;
@@ -214,7 +214,7 @@ _strtol_l (struct _reent *rptr, const char *__restrict nptr,
 }
 
 long
-_strtol_r (struct _reent *rptr,
+_strtol_r (__reent_ptr_t rptr,
 	const char *__restrict nptr,
 	char **__restrict endptr,
 	int base)
diff --git a/newlib/libc/stdlib/strtold.c b/newlib/libc/stdlib/strtold.c
index 57cc38e30f15..7f5f3e6187d6 100644
--- a/newlib/libc/stdlib/strtold.c
+++ b/newlib/libc/stdlib/strtold.c
@@ -63,7 +63,7 @@ __flt_rounds(void)
  * different long double formats.
  */
 static long double
-_strtold_impl(struct _reent *ptr, const char *__restrict s00,
+_strtold_impl(__reent_ptr_t ptr, const char *__restrict s00,
               char **__restrict se, locale_t loc) {
 #if defined(_LDBL_EQ_DBL)
   /* On platforms where long double is as wide as double. */
@@ -83,7 +83,7 @@ _strtold_impl(struct _reent *ptr, const char *__restrict s00,
 }
 
 long double
-_strtold_r(struct _reent *ptr, const char *__restrict s00,
+_strtold_r(__reent_ptr_t ptr, const char *__restrict s00,
            char **__restrict se) {
   return _strtold_impl(ptr, s00, se, __get_current_locale());
 }
diff --git a/newlib/libc/stdlib/strtoll.c b/newlib/libc/stdlib/strtoll.c
index 7512b9ce98e9..b7cfd9734506 100644
--- a/newlib/libc/stdlib/strtoll.c
+++ b/newlib/libc/stdlib/strtoll.c
@@ -129,7 +129,7 @@ No supporting OS subroutines are required.
  * Convert a string to a long long integer.
  */
 static long long
-_strtoll_l (struct _reent *rptr, const char *__restrict nptr,
+_strtoll_l (__reent_ptr_t rptr, const char *__restrict nptr,
 	    char **__restrict endptr, int base, locale_t loc)
 {
 	register const unsigned char *s = (const unsigned char *)nptr;
@@ -211,7 +211,7 @@ _strtoll_l (struct _reent *rptr, const char *__restrict nptr,
 }
 
 long long
-_strtoll_r (struct _reent *rptr,
+_strtoll_r (__reent_ptr_t rptr,
 	const char *__restrict nptr,
 	char **__restrict endptr,
 	int base)
diff --git a/newlib/libc/stdlib/strtorQ.c b/newlib/libc/stdlib/strtorQ.c
index e9e0b9f28c8e..03395b289b20 100644
--- a/newlib/libc/stdlib/strtorQ.c
+++ b/newlib/libc/stdlib/strtorQ.c
@@ -102,10 +102,10 @@ ULtoQ(ULong *L, ULong *bits, Long exp, int k)
 
  int
 #ifdef KR_headers
-_strtorQ_l(p, s, sp, rounding, L, locale) struct _reent *p; CONST char *s;
+_strtorQ_l(p, s, sp, rounding, L, locale) __reent_ptr_t p; CONST char *s;
 char **sp; int rounding; void *L; locale_t locale;
 #else
-_strtorQ_l(struct _reent *p, CONST char *s, char **sp,
+_strtorQ_l(__reent_ptr_t p, CONST char *s, char **sp,
            int rounding, void *L, locale_t locale)
 #endif
 {
diff --git a/newlib/libc/stdlib/strtorx.c b/newlib/libc/stdlib/strtorx.c
index 4faed8542c31..9a87263fdaa2 100644
--- a/newlib/libc/stdlib/strtorx.c
+++ b/newlib/libc/stdlib/strtorx.c
@@ -97,9 +97,9 @@ ULtox(__UShort *L, __ULong *bits, Long exp, int k)
 
  int
 #ifdef KR_headers
-_strtorx_l(p, s, sp, rounding, L, loc) struct _reent *p; const char *s; char **sp; int rounding; void *L; locale_t loc;
+_strtorx_l(p, s, sp, rounding, L, loc) __reent_ptr_t p; const char *s; char **sp; int rounding; void *L; locale_t loc;
 #else
-_strtorx_l(struct _reent *p, const char *s, char **sp, int rounding, void *L,
+_strtorx_l(__reent_ptr_t p, const char *s, char **sp, int rounding, void *L,
 	   locale_t loc)
 #endif
 {
diff --git a/newlib/libc/stdlib/strtoul.c b/newlib/libc/stdlib/strtoul.c
index 1601bc773cda..7c7a91fa812e 100644
--- a/newlib/libc/stdlib/strtoul.c
+++ b/newlib/libc/stdlib/strtoul.c
@@ -127,7 +127,7 @@ PORTABILITY
  * Convert a string to an unsigned long integer.
  */
 static unsigned long
-_strtoul_l (struct _reent *rptr, const char *__restrict nptr,
+_strtoul_l (__reent_ptr_t rptr, const char *__restrict nptr,
 	    char **__restrict endptr, int base, locale_t loc)
 {
 	register const unsigned char *s = (const unsigned char *)nptr;
@@ -188,7 +188,7 @@ _strtoul_l (struct _reent *rptr, const char *__restrict nptr,
 }
 
 unsigned long
-_strtoul_r (struct _reent *rptr,
+_strtoul_r (__reent_ptr_t rptr,
 	const char *__restrict nptr,
 	char **__restrict endptr,
 	int base)
diff --git a/newlib/libc/stdlib/strtoull.c b/newlib/libc/stdlib/strtoull.c
index 93147ba3ddb1..5ee15fc8bc80 100644
--- a/newlib/libc/stdlib/strtoull.c
+++ b/newlib/libc/stdlib/strtoull.c
@@ -125,7 +125,7 @@ PORTABILITY
  * Convert a string to an unsigned long long integer.
  */
 static unsigned long long
-_strtoull_l (struct _reent *rptr, const char *__restrict nptr,
+_strtoull_l (__reent_ptr_t rptr, const char *__restrict nptr,
 	     char **__restrict endptr, int base, locale_t loc)
 {
 	register const unsigned char *s = (const unsigned char *)nptr;
@@ -186,7 +186,7 @@ _strtoull_l (struct _reent *rptr, const char *__restrict nptr,
 }
 
 unsigned long long
-_strtoull_r (struct _reent *rptr,
+_strtoull_r (__reent_ptr_t rptr,
 	const char *__restrict nptr,
 	char **__restrict endptr,
 	int base)
diff --git a/newlib/libc/stdlib/strtoumax.c b/newlib/libc/stdlib/strtoumax.c
index e55445ba7049..55bd08a0e794 100644
--- a/newlib/libc/stdlib/strtoumax.c
+++ b/newlib/libc/stdlib/strtoumax.c
@@ -57,7 +57,7 @@ __FBSDID("$FreeBSD: head/lib/libc/stdlib/strtoumax.c 251672 2013-06-13 00:19:30Z
  *Reentrant version of strtoumax.
  */
 static uintmax_t
-_strtoumax_l(struct _reent *rptr, const char * __restrict nptr,
+_strtoumax_l(__reent_ptr_t rptr, const char * __restrict nptr,
 	     char ** __restrict endptr, int base, locale_t loc)
 {
 	const char *s = nptr;
@@ -128,7 +128,7 @@ noconv:
 }
 
 uintmax_t
-_strtoumax_r(struct _reent *rptr, const char *__restrict nptr,
+_strtoumax_r(__reent_ptr_t rptr, const char *__restrict nptr,
 	     char **__restrict endptr, int base)
 {
 	return _strtoumax_l(rptr, nptr, endptr, base, __get_current_locale());
diff --git a/newlib/libc/stdlib/system.c b/newlib/libc/stdlib/system.c
index c31f6f12d5b6..c55ac1859285 100644
--- a/newlib/libc/stdlib/system.c
+++ b/newlib/libc/stdlib/system.c
@@ -55,11 +55,11 @@ Supporting OS subroutines required: <<_exit>>, <<_execve>>, <<_fork_r>>,
 int _system(const char *s);
 
 #if defined (unix) || defined (__CYGWIN__)
-static int do_system (struct _reent *ptr, const char *s);
+static int do_system (__reent_ptr_t ptr, const char *s);
 #endif
 
 int
-_system_r (struct _reent *ptr,
+_system_r (__reent_ptr_t ptr,
      const char *s)
 {
 #if defined(HAVE_SYSTEM)
@@ -110,7 +110,7 @@ extern char **environ;
 static char ***p_environ = &environ;
 
 static int
-do_system (struct _reent *ptr,
+do_system (__reent_ptr_t ptr,
      const char *s)
 {
   char *argv[4];
@@ -141,7 +141,7 @@ do_system (struct _reent *ptr,
 
 #if defined (__CYGWIN__)
 static int
-do_system (struct _reent *ptr,
+do_system (__reent_ptr_t ptr,
      const char *s)
 {
   char *argv[4];
diff --git a/newlib/libc/stdlib/wcrtomb.c b/newlib/libc/stdlib/wcrtomb.c
index 1b84720ac42d..f6af732b561f 100644
--- a/newlib/libc/stdlib/wcrtomb.c
+++ b/newlib/libc/stdlib/wcrtomb.c
@@ -11,7 +11,7 @@ _Thread_local _mbstate_t _tls_wcrtomb_state;
 #endif
 
 size_t
-_wcrtomb_r (struct _reent *ptr,
+_wcrtomb_r (__reent_ptr_t ptr,
 	char *s,
 	wchar_t wc,
 	mbstate_t *ps)
@@ -52,7 +52,7 @@ wcrtomb (char *__restrict s,
   return _wcrtomb_r (_REENT, s, wc, ps);
 #else
   int retval = 0;
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
   char buf[10];
 
 #ifdef _MB_CAPABLE
diff --git a/newlib/libc/stdlib/wcsnrtombs.c b/newlib/libc/stdlib/wcsnrtombs.c
index abef7ac36b78..424a7e764819 100644
--- a/newlib/libc/stdlib/wcsnrtombs.c
+++ b/newlib/libc/stdlib/wcsnrtombs.c
@@ -18,7 +18,7 @@ SYNOPSIS
 			 mbstate_t *__restrict <[ps]>);
 
 	#include <wchar.h>
-	size_t _wcsrtombs_r(struct _reent *<[ptr]>, char *<[dst]>,
+	size_t _wcsrtombs_r(__reent_ptr_t <[ptr]>, char *<[dst]>,
 			    const wchar_t **<[src]>, size_t <[len]>,
 			    mbstate_t *<[ps]>);
 
@@ -29,7 +29,7 @@ SYNOPSIS
 			  mbstate_t *__restrict <[ps]>);
 
 	#include <wchar.h>
-	size_t _wcsnrtombs_r(struct _reent *<[ptr]>, char *<[dst]>,
+	size_t _wcsnrtombs_r(__reent_ptr_t <[ptr]>, char *<[dst]>,
 			     const wchar_t **<[src]>, size_t <[nwc]>,
 			     size_t <[len]>, mbstate_t *<[ps]>);
 
@@ -77,7 +77,7 @@ _Thread_local _mbstate_t _tls_wcsrtombs_state;
 #endif
 
 size_t
-_wcsnrtombs_l (struct _reent *r, char *dst, const wchar_t **src, size_t nwc,
+_wcsnrtombs_l (__reent_ptr_t r, char *dst, const wchar_t **src, size_t nwc,
 	       size_t len, mbstate_t *ps, struct __locale_t *loc)
 {
   char *ptr = dst;
@@ -142,7 +142,7 @@ _wcsnrtombs_l (struct _reent *r, char *dst, const wchar_t **src, size_t nwc,
 } 
 
 size_t
-_wcsnrtombs_r (struct _reent *r,
+_wcsnrtombs_r (__reent_ptr_t r,
 	char *dst,
 	const wchar_t **src,
 	size_t nwc,
diff --git a/newlib/libc/stdlib/wcsrtombs.c b/newlib/libc/stdlib/wcsrtombs.c
index dc4807d2a29c..dfcc8556c56b 100644
--- a/newlib/libc/stdlib/wcsrtombs.c
+++ b/newlib/libc/stdlib/wcsrtombs.c
@@ -5,7 +5,7 @@
 #include <wchar.h>
 
 size_t
-_wcsrtombs_r (struct _reent *r,
+_wcsrtombs_r (__reent_ptr_t r,
 	char *dst,
 	const wchar_t **src,
 	size_t len,
diff --git a/newlib/libc/stdlib/wcstod.c b/newlib/libc/stdlib/wcstod.c
index 7b0983470822..49e363b95333 100644
--- a/newlib/libc/stdlib/wcstod.c
+++ b/newlib/libc/stdlib/wcstod.c
@@ -142,7 +142,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
 #include "mprec.h"
 
 double
-_wcstod_l (struct _reent *ptr, const wchar_t *nptr, wchar_t **endptr,
+_wcstod_l (__reent_ptr_t ptr, const wchar_t *nptr, wchar_t **endptr,
 	   locale_t loc)
 {
         static const mbstate_t initial;
@@ -214,7 +214,7 @@ _wcstod_l (struct _reent *ptr, const wchar_t *nptr, wchar_t **endptr,
 }
 
 double
-_wcstod_r (struct _reent *ptr,
+_wcstod_r (__reent_ptr_t ptr,
 	const wchar_t *nptr,
 	wchar_t **endptr)
 {
@@ -222,7 +222,7 @@ _wcstod_r (struct _reent *ptr,
 }
 
 float
-_wcstof_r (struct _reent *ptr,
+_wcstof_r (__reent_ptr_t ptr,
 	const wchar_t *nptr,
 	wchar_t **endptr)
 {
diff --git a/newlib/libc/stdlib/wcstoimax.c b/newlib/libc/stdlib/wcstoimax.c
index fc94efec4546..570b320b3880 100644
--- a/newlib/libc/stdlib/wcstoimax.c
+++ b/newlib/libc/stdlib/wcstoimax.c
@@ -58,7 +58,7 @@ __FBSDID("$FreeBSD: head/lib/libc/locale/wcstoimax.c 314436 2017-02-28 23:42:47Z
  *Reentrant version of wcstoimax.
  */
 static intmax_t
-_wcstoimax_l(struct _reent *rptr, const wchar_t * __restrict nptr,
+_wcstoimax_l(__reent_ptr_t rptr, const wchar_t * __restrict nptr,
 	     wchar_t ** __restrict endptr, int base, locale_t loc)
 {
 	const wchar_t *s = nptr;
@@ -135,7 +135,7 @@ noconv:
 }
 
 intmax_t
-_wcstoimax_r(struct _reent *rptr, const wchar_t *__restrict nptr,
+_wcstoimax_r(__reent_ptr_t rptr, const wchar_t *__restrict nptr,
 	     wchar_t **__restrict endptr, int base)
 {
 	return _wcstoimax_l(rptr, nptr, endptr, base, __get_current_locale());
diff --git a/newlib/libc/stdlib/wcstol.c b/newlib/libc/stdlib/wcstol.c
index 3f498710055a..eddd8d62d09b 100644
--- a/newlib/libc/stdlib/wcstol.c
+++ b/newlib/libc/stdlib/wcstol.c
@@ -128,7 +128,7 @@ No supporting OS subroutines are required.
  * Convert a wide string to a long integer.
  */
 static long
-_wcstol_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr,
+_wcstol_l (__reent_ptr_t rptr, const wchar_t *nptr, wchar_t **endptr,
 	   int base, locale_t loc)
 {
 	register const wchar_t *s = nptr;
@@ -210,7 +210,7 @@ _wcstol_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr,
 }
 
 long
-_wcstol_r (struct _reent *rptr,
+_wcstol_r (__reent_ptr_t rptr,
 	const wchar_t *nptr,
 	wchar_t **endptr,
 	int base)
diff --git a/newlib/libc/stdlib/wcstoll.c b/newlib/libc/stdlib/wcstoll.c
index f59b0aa4aff2..55966b810d43 100644
--- a/newlib/libc/stdlib/wcstoll.c
+++ b/newlib/libc/stdlib/wcstoll.c
@@ -128,7 +128,7 @@ No supporting OS subroutines are required.
  * Convert a wide string to a long long integer.
  */
 long long
-_wcstoll_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr,
+_wcstoll_l (__reent_ptr_t rptr, const wchar_t *nptr, wchar_t **endptr,
 	    int base, locale_t loc)
 {
 	register const wchar_t *s = nptr;
@@ -210,7 +210,7 @@ _wcstoll_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr,
 }
 
 long long
-_wcstoll_r (struct _reent *rptr,
+_wcstoll_r (__reent_ptr_t rptr,
 	const wchar_t *nptr,
 	wchar_t **endptr,
 	int base)
diff --git a/newlib/libc/stdlib/wcstombs_r.c b/newlib/libc/stdlib/wcstombs_r.c
index 2c82a2c25737..cac6245ac737 100644
--- a/newlib/libc/stdlib/wcstombs_r.c
+++ b/newlib/libc/stdlib/wcstombs_r.c
@@ -3,7 +3,7 @@
 #include "local.h"
 
 size_t
-_wcstombs_r (struct _reent *r,
+_wcstombs_r (__reent_ptr_t r,
         char          *__restrict s,
         const wchar_t *__restrict pwcs,
         size_t         n,
diff --git a/newlib/libc/stdlib/wcstoul.c b/newlib/libc/stdlib/wcstoul.c
index 963cb47de819..8f90cf75afb4 100644
--- a/newlib/libc/stdlib/wcstoul.c
+++ b/newlib/libc/stdlib/wcstoul.c
@@ -128,7 +128,7 @@ PORTABILITY
  * Convert a wide string to an unsigned long integer.
  */
 unsigned long
-_wcstoul_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr,
+_wcstoul_l (__reent_ptr_t rptr, const wchar_t *nptr, wchar_t **endptr,
 	    int base, locale_t loc)
 {
 	register const wchar_t *s = nptr;
@@ -189,7 +189,7 @@ _wcstoul_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr,
 }
 
 unsigned long
-_wcstoul_r (struct _reent *rptr,
+_wcstoul_r (__reent_ptr_t rptr,
 	const wchar_t *nptr,
 	wchar_t **endptr,
 	int base)
diff --git a/newlib/libc/stdlib/wcstoull.c b/newlib/libc/stdlib/wcstoull.c
index bc48b8d4b705..ae294a5aaba1 100644
--- a/newlib/libc/stdlib/wcstoull.c
+++ b/newlib/libc/stdlib/wcstoull.c
@@ -140,7 +140,7 @@ PORTABILITY
  * Convert a wide string to an unsigned long long integer.
  */
 unsigned long long
-_wcstoull_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr,
+_wcstoull_l (__reent_ptr_t rptr, const wchar_t *nptr, wchar_t **endptr,
 	     int base, locale_t loc)
 {
 	register const wchar_t *s = nptr;
@@ -205,7 +205,7 @@ _wcstoull_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr,
 }
 
 unsigned long long
-_wcstoull_r (struct _reent *rptr,
+_wcstoull_r (__reent_ptr_t rptr,
 	const wchar_t *nptr,
 	wchar_t **endptr,
 	int base)
diff --git a/newlib/libc/stdlib/wcstoumax.c b/newlib/libc/stdlib/wcstoumax.c
index f7954f02de57..e97f161afe4c 100644
--- a/newlib/libc/stdlib/wcstoumax.c
+++ b/newlib/libc/stdlib/wcstoumax.c
@@ -58,7 +58,7 @@ __FBSDID("$FreeBSD: head/lib/libc/locale/wcstoumax.c 314436 2017-02-28 23:42:47Z
  *Reentrant version of wcstoumax.
  */
 static uintmax_t
-_wcstoumax_l(struct _reent *rptr,const wchar_t * __restrict nptr,
+_wcstoumax_l(__reent_ptr_t rptr,const wchar_t * __restrict nptr,
 	     wchar_t ** __restrict endptr, int base, locale_t loc)
 {
 	const wchar_t *s = nptr;
@@ -134,7 +134,7 @@ noconv:
 }
 
 uintmax_t
-_wcstoumax_r(struct _reent *rptr, const wchar_t *__restrict nptr,
+_wcstoumax_r(__reent_ptr_t rptr, const wchar_t *__restrict nptr,
 	     wchar_t **__restrict endptr, int base)
 {
 	return _wcstoumax_l(rptr, nptr, endptr, base, __get_current_locale());
diff --git a/newlib/libc/stdlib/wctob.c b/newlib/libc/stdlib/wctob.c
index 61365a178a15..c426a5623988 100644
--- a/newlib/libc/stdlib/wctob.c
+++ b/newlib/libc/stdlib/wctob.c
@@ -8,7 +8,7 @@
 int
 wctob (wint_t wc)
 {
-  struct _reent *reent;
+  __reent_ptr_t reent;
   mbstate_t mbs;
   unsigned char pmb[MB_LEN_MAX];
 
diff --git a/newlib/libc/stdlib/wctomb.c b/newlib/libc/stdlib/wctomb.c
index f56dccf25aa8..9195d7063b8c 100644
--- a/newlib/libc/stdlib/wctomb.c
+++ b/newlib/libc/stdlib/wctomb.c
@@ -54,7 +54,7 @@ wctomb (char *s,
         wchar_t wchar)
 {
 #ifdef _MB_CAPABLE
-	struct _reent *reent = _REENT;
+	__reent_ptr_t reent = _REENT;
 
         _REENT_CHECK_MISC(reent);
 
diff --git a/newlib/libc/stdlib/wctomb_r.c b/newlib/libc/stdlib/wctomb_r.c
index ec6adfa498cb..dc91ad0adac2 100644
--- a/newlib/libc/stdlib/wctomb_r.c
+++ b/newlib/libc/stdlib/wctomb_r.c
@@ -7,7 +7,7 @@
 #include "local.h"
 
 int
-_wctomb_r (struct _reent *r,
+_wctomb_r (__reent_ptr_t r,
         char          *s,
         wchar_t        _wchar,
         mbstate_t     *state)
@@ -16,7 +16,7 @@ _wctomb_r (struct _reent *r,
 }
 
 int
-__ascii_wctomb (struct _reent *r,
+__ascii_wctomb (__reent_ptr_t r,
         char          *s,
         wchar_t        _wchar,
         mbstate_t     *state)
@@ -44,7 +44,7 @@ __ascii_wctomb (struct _reent *r,
 #define __state __count
 
 int
-__utf8_wctomb (struct _reent *r,
+__utf8_wctomb (__reent_ptr_t r,
         char          *s,
         wchar_t        _wchar,
         mbstate_t     *state)
@@ -137,7 +137,7 @@ __utf8_wctomb (struct _reent *r,
    because the underlying OS requires wchar_t == UTF-16. */
 #ifndef __CYGWIN__
 int
-__sjis_wctomb (struct _reent *r,
+__sjis_wctomb (__reent_ptr_t r,
         char          *s,
         wchar_t        _wchar,
         mbstate_t     *state)
@@ -170,7 +170,7 @@ __sjis_wctomb (struct _reent *r,
 }
 
 int
-__eucjp_wctomb (struct _reent *r,
+__eucjp_wctomb (__reent_ptr_t r,
         char          *s,
         wchar_t        _wchar,
         mbstate_t     *state)
@@ -209,7 +209,7 @@ __eucjp_wctomb (struct _reent *r,
 }
 
 int
-__jis_wctomb (struct _reent *r,
+__jis_wctomb (__reent_ptr_t r,
         char          *s,
         wchar_t        _wchar,
         mbstate_t     *state)
@@ -259,7 +259,7 @@ __jis_wctomb (struct _reent *r,
 
 #ifdef _MB_EXTENDED_CHARSETS_ISO
 static int
-___iso_wctomb (struct _reent *r, char *s, wchar_t _wchar, int iso_idx,
+___iso_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, int iso_idx,
 	       mbstate_t *state)
 {
   wint_t wchar = _wchar;
@@ -295,91 +295,91 @@ ___iso_wctomb (struct _reent *r, char *s, wchar_t _wchar, int iso_idx,
   return 1;
 }
 
-int __iso_8859_1_wctomb (struct _reent *r, char *s, wchar_t _wchar,
+int __iso_8859_1_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar,
 			 mbstate_t *state)
 {
   return ___iso_wctomb (r, s, _wchar, -1, state);
 }
 
-int __iso_8859_2_wctomb (struct _reent *r, char *s, wchar_t _wchar,
+int __iso_8859_2_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar,
 			 mbstate_t *state)
 {
   return ___iso_wctomb (r, s, _wchar, 0, state);
 }
 
-int __iso_8859_3_wctomb (struct _reent *r, char *s, wchar_t _wchar,
+int __iso_8859_3_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar,
 			 mbstate_t *state)
 {
   return ___iso_wctomb (r, s, _wchar, 1, state);
 }
 
-int __iso_8859_4_wctomb (struct _reent *r, char *s, wchar_t _wchar,
+int __iso_8859_4_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar,
 			 mbstate_t *state)
 {
   return ___iso_wctomb (r, s, _wchar, 2, state);
 }
 
-int __iso_8859_5_wctomb (struct _reent *r, char *s, wchar_t _wchar,
+int __iso_8859_5_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar,
 			 mbstate_t *state)
 {
   return ___iso_wctomb (r, s, _wchar, 3, state);
 }
 
-int __iso_8859_6_wctomb (struct _reent *r, char *s, wchar_t _wchar,
+int __iso_8859_6_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar,
 			 mbstate_t *state)
 {
   return ___iso_wctomb (r, s, _wchar, 4, state);
 }
 
-int __iso_8859_7_wctomb (struct _reent *r, char *s, wchar_t _wchar,
+int __iso_8859_7_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar,
 			 mbstate_t *state)
 {
   return ___iso_wctomb (r, s, _wchar, 5, state);
 }
 
-int __iso_8859_8_wctomb (struct _reent *r, char *s, wchar_t _wchar,
+int __iso_8859_8_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar,
 			 mbstate_t *state)
 {
   return ___iso_wctomb (r, s, _wchar, 6, state);
 }
 
-int __iso_8859_9_wctomb (struct _reent *r, char *s, wchar_t _wchar,
+int __iso_8859_9_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar,
 			 mbstate_t *state)
 {
   return ___iso_wctomb (r, s, _wchar, 7, state);
 }
 
-int __iso_8859_10_wctomb (struct _reent *r, char *s, wchar_t _wchar,
+int __iso_8859_10_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar,
 			  mbstate_t *state)
 {
   return ___iso_wctomb (r, s, _wchar, 8, state);
 }
 
-int __iso_8859_11_wctomb (struct _reent *r, char *s, wchar_t _wchar,
+int __iso_8859_11_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar,
 			  mbstate_t *state)
 {
   return ___iso_wctomb (r, s, _wchar, 9, state);
 }
 
-int __iso_8859_13_wctomb (struct _reent *r, char *s, wchar_t _wchar,
+int __iso_8859_13_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar,
 			  mbstate_t *state)
 {
   return ___iso_wctomb (r, s, _wchar, 10, state);
 }
 
-int __iso_8859_14_wctomb (struct _reent *r, char *s, wchar_t _wchar,
+int __iso_8859_14_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar,
 			  mbstate_t *state)
 {
   return ___iso_wctomb (r, s, _wchar, 11, state);
 }
 
-int __iso_8859_15_wctomb (struct _reent *r, char *s, wchar_t _wchar,
+int __iso_8859_15_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar,
 			  mbstate_t *state)
 {
   return ___iso_wctomb (r, s, _wchar, 12, state);
 }
 
-int __iso_8859_16_wctomb (struct _reent *r, char *s, wchar_t _wchar,
+int __iso_8859_16_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar,
 			  mbstate_t *state)
 {
   return ___iso_wctomb (r, s, _wchar, 13, state);
@@ -416,7 +416,7 @@ __iso_wctomb (int val)
 
 #ifdef _MB_EXTENDED_CHARSETS_WINDOWS
 static int
-___cp_wctomb (struct _reent *r, char *s, wchar_t _wchar, int cp_idx,
+___cp_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, int cp_idx,
 	      mbstate_t *state)
 {
   wint_t wchar = _wchar;
@@ -452,163 +452,163 @@ ___cp_wctomb (struct _reent *r, char *s, wchar_t _wchar, int cp_idx,
 }
 
 static int
-__cp_437_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_437_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 0, state);
 }
 
 static int
-__cp_720_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_720_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 1, state);
 }
 
 static int
-__cp_737_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_737_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 2, state);
 }
 
 static int
-__cp_775_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_775_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 3, state);
 }
 
 static int
-__cp_850_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_850_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 4, state);
 }
 
 static int
-__cp_852_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_852_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 5, state);
 }
 
 static int
-__cp_855_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_855_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 6, state);
 }
 
 static int
-__cp_857_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_857_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 7, state);
 }
 
 static int
-__cp_858_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_858_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 8, state);
 }
 
 static int
-__cp_862_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_862_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 9, state);
 }
 
 static int
-__cp_866_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_866_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 10, state);
 }
 
 static int
-__cp_874_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_874_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 11, state);
 }
 
 static int
-__cp_1125_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_1125_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 12, state);
 }
 
 static int
-__cp_1250_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_1250_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 13, state);
 }
 
 static int
-__cp_1251_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_1251_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 14, state);
 }
 
 static int
-__cp_1252_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_1252_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 15, state);
 }
 
 static int
-__cp_1253_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_1253_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 16, state);
 }
 
 static int
-__cp_1254_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_1254_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 17, state);
 }
 
 static int
-__cp_1255_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_1255_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 18, state);
 }
 
 static int
-__cp_1256_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_1256_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 19, state);
 }
 
 static int
-__cp_1257_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_1257_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 20, state);
 }
 
 static int
-__cp_1258_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_1258_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 21, state);
 }
 
 static int
-__cp_20866_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_20866_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 22, state);
 }
 
 static int
-__cp_21866_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_21866_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 23, state);
 }
 
 static int
-__cp_101_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_101_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 24, state);
 }
 
 static int
-__cp_102_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_102_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 25, state);
 }
 
 static int
-__cp_103_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state)
+__cp_103_wctomb (__reent_ptr_t r, char *s, wchar_t _wchar, mbstate_t *state)
 {
   return ___cp_wctomb (r, s, _wchar, 26, state);
 }
diff --git a/newlib/libc/string/strdup_r.c b/newlib/libc/string/strdup_r.c
index 14c80f73f18c..3241a68a25a4 100644
--- a/newlib/libc/string/strdup_r.c
+++ b/newlib/libc/string/strdup_r.c
@@ -3,7 +3,7 @@
 #include <string.h>
 
 char *
-_strdup_r (struct _reent *reent_ptr,
+_strdup_r (__reent_ptr_t reent_ptr,
         const char   *str)
 {
   size_t len = strlen (str) + 1;
diff --git a/newlib/libc/string/strerror.c b/newlib/libc/string/strerror.c
index 8f961d3b5dda..5e3a11f216ca 100644
--- a/newlib/libc/string/strerror.c
+++ b/newlib/libc/string/strerror.c
@@ -385,7 +385,7 @@ QUICKREF
 #include <string.h>
 
 char *
-_strerror_r (struct _reent *ptr,
+_strerror_r (__reent_ptr_t ptr,
 	int errnum,
 	int internal,
 	int *errptr)
diff --git a/newlib/libc/string/strndup_r.c b/newlib/libc/string/strndup_r.c
index 1b6cf84e5837..d3f5a06a9e04 100644
--- a/newlib/libc/string/strndup_r.c
+++ b/newlib/libc/string/strndup_r.c
@@ -3,7 +3,7 @@
 #include <string.h>
 
 char *
-_strndup_r (struct _reent *reent_ptr,
+_strndup_r (__reent_ptr_t reent_ptr,
         const char   *str,
         size_t n)
 {
diff --git a/newlib/libc/string/strsignal.c b/newlib/libc/string/strsignal.c
index 89d39fe3c2f0..8538ee7fb312 100644
--- a/newlib/libc/string/strsignal.c
+++ b/newlib/libc/string/strsignal.c
@@ -60,7 +60,7 @@ char *
 strsignal (int signal)
 {
   char *buffer;
-  struct _reent *ptr;
+  __reent_ptr_t ptr;
 
   ptr = _REENT;
 
diff --git a/newlib/libc/string/strtok.c b/newlib/libc/string/strtok.c
index 2a11c9196bb4..d6474344741a 100644
--- a/newlib/libc/string/strtok.c
+++ b/newlib/libc/string/strtok.c
@@ -86,7 +86,7 @@ char *
 strtok (register char *__restrict s,
 	register const char *__restrict delim)
 {
-	struct _reent *reent = _REENT;
+	__reent_ptr_t reent = _REENT;
 
 	_REENT_CHECK_MISC(reent);
 	return __strtok_r (s, delim, &(_REENT_STRTOK_LAST(reent)), 1);
diff --git a/newlib/libc/string/wcsdup.c b/newlib/libc/string/wcsdup.c
index e0e97c0bd127..ebc9f6502bdc 100644
--- a/newlib/libc/string/wcsdup.c
+++ b/newlib/libc/string/wcsdup.c
@@ -12,7 +12,7 @@ SYNOPSIS
 	wchar_t *wcsdup(const wchar_t *<[str]>);
 
 	#include <wchar.h>
-	wchar_t *_wcsdup_r(struct _reent *<[ptr]>, const wchar_t *<[str]>);
+	wchar_t *_wcsdup_r(__reent_ptr_t <[ptr]>, const wchar_t *<[str]>);
 
 DESCRIPTION
 	<<wcsdup>> allocates a new wide character string using <<malloc>>,
@@ -36,7 +36,7 @@ QUICKREF
 #include <wchar.h>
 
 wchar_t *
-_wcsdup_r (struct _reent *p, const wchar_t *str)
+_wcsdup_r (__reent_ptr_t p, const wchar_t *str)
 {
   size_t len = wcslen (str) + 1;
   wchar_t *copy = _malloc_r (p, len * sizeof (wchar_t));
diff --git a/newlib/libc/sys/arm/syscalls.c b/newlib/libc/sys/arm/syscalls.c
index dd49ca0613a7..8220099872e4 100644
--- a/newlib/libc/sys/arm/syscalls.c
+++ b/newlib/libc/sys/arm/syscalls.c
@@ -56,7 +56,7 @@ register char * stack_ptr asm ("sp");
 
 
 /* following is copied from libc/stdio/local.h to check std streams */
-extern void   __sinit (struct _reent *);
+extern void   __sinit (__reent_ptr_t);
 #define CHECK_INIT(ptr) \
   do						\
     {						\
diff --git a/newlib/libc/sys/atari/filemode.c b/newlib/libc/sys/atari/filemode.c
index ea8ff7455da5..17fd5b7cc813 100644
--- a/newlib/libc/sys/atari/filemode.c
+++ b/newlib/libc/sys/atari/filemode.c
@@ -22,7 +22,7 @@ __LOCK_INIT(static, __setmode_mutex);
 short setmode_fd;
 FILE* setmode_fp;
 
-int setmode_helper(struct _reent *ptr, FILE *f)
+int setmode_helper(__reent_ptr_t ptr, FILE *f)
 {
 	/*
 		We call __sfileno instead of fileno, as the latter tries to lock the filepointer.
diff --git a/newlib/libc/sys/or1k/mlock.c b/newlib/libc/sys/or1k/mlock.c
index a0c038335651..955bf7e5a0d7 100644
--- a/newlib/libc/sys/or1k/mlock.c
+++ b/newlib/libc/sys/or1k/mlock.c
@@ -44,7 +44,7 @@ extern void or1k_critical_end(uint32_t restore);
 /**
  * Recursive lock of the malloc
  */
-void __malloc_lock(struct _reent *ptr) {
+void __malloc_lock(__reent_ptr_t ptr) {
 	uint32_t restore;
 	uint32_t id;
 
@@ -78,7 +78,7 @@ void __malloc_lock(struct _reent *ptr) {
 	return;
 }
 
-void __malloc_unlock(struct _reent *ptr) {
+void __malloc_unlock(__reent_ptr_t ptr) {
 	// Decrement counter. The lock may be unlocked recursively
 	_or1k_malloc_lock_cnt--;
 
diff --git a/newlib/libc/sys/rdos/rdoshelp.c b/newlib/libc/sys/rdos/rdoshelp.c
index 20d25353d094..a7620e71f225 100644
--- a/newlib/libc/sys/rdos/rdoshelp.c
+++ b/newlib/libc/sys/rdos/rdoshelp.c
@@ -154,7 +154,7 @@ int __rdos_thread_mutex_unlock (int handle)
 #   Returns....: *
 #
 ##########################################################################*/
-void __init_rdos(struct _reent *reent)
+void __init_rdos(__reent_ptr_t reent)
 {
 	once_section = RdosCreateSection();
 	_REENT_INIT_PTR(reent);
diff --git a/newlib/libc/sys/rtems/crt0.c b/newlib/libc/sys/rtems/crt0.c
index 67f9d730249f..380222fdefb3 100644
--- a/newlib/libc/sys/rtems/crt0.c
+++ b/newlib/libc/sys/rtems/crt0.c
@@ -134,48 +134,48 @@ RTEMS_STUB(_ssize_t, write (int fd, const void *buf, size_t nbytes), { return -1
 RTEMS_STUB(ssize_t, writev (int fd, const struct iovec *iov, int iovcnt), { return -1; })
 
 /* stubs for functions from reent.h */
-RTEMS_STUB(int, _close_r (struct _reent *r, int fd), { return -1; })
+RTEMS_STUB(int, _close_r (__reent_ptr_t r, int fd), { return -1; })
 #if defined(_NO_EXECVE)
-RTEMS_STUB(int, _execve_r (struct _reent *r, char *, char **, char **), { return -1; })
+RTEMS_STUB(int, _execve_r (__reent_ptr_t r, char *, char **, char **), { return -1; })
 #endif
-RTEMS_STUB(int, _fcntl_r (struct _reent *ptr, int fd, int cmd, int arg ), { return -1; })
+RTEMS_STUB(int, _fcntl_r (__reent_ptr_t ptr, int fd, int cmd, int arg ), { return -1; })
 #if !(defined (REENTRANT_SYSCALLS_PROVIDED) || defined (NO_EXEC))
 #ifndef NO_FORK
 /* cf. newlib/libc/reent/execr.c */
-RTEMS_STUB(int, _fork_r (struct _reent *r), { return -1; })
+RTEMS_STUB(int, _fork_r (__reent_ptr_t r), { return -1; })
 #endif
 #endif
-RTEMS_STUB(int, _fstat_r (struct _reent *r, int fd, struct stat *buf), { return -1; })
+RTEMS_STUB(int, _fstat_r (__reent_ptr_t r, int fd, struct stat *buf), { return -1; })
 RTEMS_STUB(uid_t, geteuid (), { return -1; })
 RTEMS_STUB(gid_t, getgid (), { return -1; })
-RTEMS_STUB(gid_t, _getgid_r (struct _reent *r), { return -1; })
+RTEMS_STUB(gid_t, _getgid_r (__reent_ptr_t r), { return -1; })
 RTEMS_STUB(struct _reent *, __getreent (void), { return 0; })
 RTEMS_STUB(pid_t, getpid (), { return -1; })
 RTEMS_STUB(pid_t, getppid (), { return -1; })
-RTEMS_STUB(pid_t, _getpid_r (struct _reent *r), { return -1; })
-RTEMS_STUB(int, _gettimeofday_r(struct _reent *r, struct timeval *tp, void *tzp), { return 0; })
-RTEMS_STUB(int, _isatty_r (struct _reent *r, int fd), { return isatty( fd ); })
-RTEMS_STUB(int, _kill_r (struct _reent *r, int pid, int sig ), { return -1; })
+RTEMS_STUB(pid_t, _getpid_r (__reent_ptr_t r), { return -1; })
+RTEMS_STUB(int, _gettimeofday_r(__reent_ptr_t r, struct timeval *tp, void *tzp), { return 0; })
+RTEMS_STUB(int, _isatty_r (__reent_ptr_t r, int fd), { return isatty( fd ); })
+RTEMS_STUB(int, _kill_r (__reent_ptr_t r, int pid, int sig ), { return -1; })
 #if !defined(REENTRANT_SYSCALLS_PROVIDED)
 /* cf. newlib/libc/reent/linkr.c */
-RTEMS_STUB(int, _link_r (struct _reent *r, const char *oldpath, const char *newpath), { return -1; })
+RTEMS_STUB(int, _link_r (__reent_ptr_t r, const char *oldpath, const char *newpath), { return -1; })
 #endif
-RTEMS_STUB(_off_t, _lseek_r ( struct _reent *ptr, int fd, _off_t offset, int whence ), { return -1; })
-RTEMS_STUB(int, _open_r (struct _reent *r, const char *buf, int flags, int mode), { return -1; })
-RTEMS_STUB(_ssize_t, _read_r (struct _reent *r, int fd, void *buf, size_t nbytes), { return -1; })
-RTEMS_STUB(int, _rename_r (struct _reent *r, const char *a, const char *b), { return -1; })
+RTEMS_STUB(_off_t, _lseek_r ( __reent_ptr_t ptr, int fd, _off_t offset, int whence ), { return -1; })
+RTEMS_STUB(int, _open_r (__reent_ptr_t r, const char *buf, int flags, int mode), { return -1; })
+RTEMS_STUB(_ssize_t, _read_r (__reent_ptr_t r, int fd, void *buf, size_t nbytes), { return -1; })
+RTEMS_STUB(int, _rename_r (__reent_ptr_t r, const char *a, const char *b), { return -1; })
 #if !(defined (REENTRANT_SYSCALLS_PROVIDED) || defined (MALLOC_PROVIDED))
 /* cf. newlib/libc/reent/sbrkr.c */
-RTEMS_STUB(void *,_sbrk_r (struct _reent *r, ptrdiff_t addr), { return 0; })
+RTEMS_STUB(void *,_sbrk_r (__reent_ptr_t r, ptrdiff_t addr), { return 0; })
 #endif
-RTEMS_STUB(int, _stat_r (struct _reent *r, const char *path, struct stat *buf), { return -1; })
-RTEMS_STUB(_CLOCK_T_, _times_r (struct _reent *r, struct tms *ptms), { return -1; })
-RTEMS_STUB(int, _unlink_r (struct _reent *r, const char *path), { return -1; })
+RTEMS_STUB(int, _stat_r (__reent_ptr_t r, const char *path, struct stat *buf), { return -1; })
+RTEMS_STUB(_CLOCK_T_, _times_r (__reent_ptr_t r, struct tms *ptms), { return -1; })
+RTEMS_STUB(int, _unlink_r (__reent_ptr_t r, const char *path), { return -1; })
 #if !(defined (REENTRANT_SYSCALLS_PROVIDED) || defined (NO_EXEC))
 /* cf. newlib/libc/reent/execr.c */
-RTEMS_STUB(int, _wait_r (struct _reent *r, int *status), { return -1; })
+RTEMS_STUB(int, _wait_r (__reent_ptr_t r, int *status), { return -1; })
 #endif
-RTEMS_STUB(_ssize_t, _write_r (struct _reent *r, int fd, const void *buf, size_t nbytes), { return -1; })
+RTEMS_STUB(_ssize_t, _write_r (__reent_ptr_t r, int fd, const void *buf, size_t nbytes), { return -1; })
 
 
 RTEMS_STUB(int, _execve(const char *path, char * const *argv, char * const *envp), { return -1; })
@@ -189,10 +189,10 @@ RTEMS_STUB(int, issetugid (void), { return 0; })
 #endif
 
 /* stdlib.h */
-RTEMS_STUB(void *, _realloc_r(struct _reent *r, void *p, size_t s), { return 0; })
-RTEMS_STUB(void *, _calloc_r(struct _reent *r, size_t s1, size_t s2), { return 0; })
-RTEMS_STUB(void *, _malloc_r(struct _reent * r, size_t s), { return 0; })
-RTEMS_STUB(void, _free_r(struct _reent *r, void *p), { })
+RTEMS_STUB(void *, _realloc_r(__reent_ptr_t r, void *p, size_t s), { return 0; })
+RTEMS_STUB(void *, _calloc_r(__reent_ptr_t r, size_t s1, size_t s2), { return 0; })
+RTEMS_STUB(void *, _malloc_r(__reent_ptr_t r, size_t s), { return 0; })
+RTEMS_STUB(void, _free_r(__reent_ptr_t r, void *p), { })
 
 /* stubs for functions required by libc/stdlib */
 RTEMS_STUB(void, __assert_func(const char *file, int line, const char *func, const char *failedexpr), { while (1) ;})
diff --git a/newlib/libc/syscalls/syssbrk.c b/newlib/libc/syscalls/syssbrk.c
index 79b876321cbb..1eaaba8b77d1 100644
--- a/newlib/libc/syscalls/syssbrk.c
+++ b/newlib/libc/syscalls/syssbrk.c
@@ -3,7 +3,7 @@
 #include <reent.h>
 #include <unistd.h>
 
-extern void *_sbrk_r (struct _reent *, ptrdiff_t);
+extern void *_sbrk_r (__reent_ptr_t, ptrdiff_t);
 extern void *_sbrk (ptrdiff_t);
 
 void *
diff --git a/newlib/libc/time/asctime.c b/newlib/libc/time/asctime.c
index a81506181502..52c96f07a1c3 100644
--- a/newlib/libc/time/asctime.c
+++ b/newlib/libc/time/asctime.c
@@ -54,7 +54,7 @@ _Thread_local char _tls_asctime_buf[_REENT_ASCTIME_SIZE];
 char *
 asctime (const struct tm *tim_p)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   _REENT_CHECK_ASCTIME_BUF(reent);
   return asctime_r (tim_p, _REENT_ASCTIME_BUF(reent));
diff --git a/newlib/libc/time/gmtime.c b/newlib/libc/time/gmtime.c
index a78d55433958..9264d7ab7c9c 100644
--- a/newlib/libc/time/gmtime.c
+++ b/newlib/libc/time/gmtime.c
@@ -56,7 +56,7 @@ _Thread_local struct __tm _tls_localtime_buf;
 struct tm *
 gmtime (const time_t * tim_p)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   _REENT_CHECK_TM(reent);
   return gmtime_r (tim_p, (struct tm *)_REENT_TM(reent));
diff --git a/newlib/libc/time/lcltime.c b/newlib/libc/time/lcltime.c
index ded98c57aef8..44bf5d6c0934 100644
--- a/newlib/libc/time/lcltime.c
+++ b/newlib/libc/time/lcltime.c
@@ -45,7 +45,7 @@ ANSI C requires <<localtime>>.
 struct tm *
 localtime (const time_t * tim_p)
 {
-  struct _reent *reent = _REENT;
+  __reent_ptr_t reent = _REENT;
 
   _REENT_CHECK_TM(reent);
   return localtime_r (tim_p, (struct tm *)_REENT_TM(reent));
diff --git a/newlib/libc/time/local.h b/newlib/libc/time/local.h
index bfe06e62230d..9ec3d7bd9c4a 100644
--- a/newlib/libc/time/local.h
+++ b/newlib/libc/time/local.h
@@ -24,7 +24,7 @@ int         __tzcalc_limits (int __year);
 
 extern const int __month_lengths[2][MONSPERYEAR];
 
-void _tzset_unlocked_r (struct _reent *);
+void _tzset_unlocked_r (__reent_ptr_t);
 void _tzset_unlocked (void);
 
 /* locks for multi-threading */
diff --git a/newlib/libc/time/strftime.c b/newlib/libc/time/strftime.c
index 56f227c5f3b8..0680b300457e 100644
--- a/newlib/libc/time/strftime.c
+++ b/newlib/libc/time/strftime.c
@@ -1859,7 +1859,7 @@ const struct list  List[] = {
 
 #if defined(STUB_getenv_r)
 char *
-_getenv_r(struct _reent *p, const char *cp) { return getenv(cp); }
+_getenv_r(__reent_ptr_t p, const char *cp) { return getenv(cp); }
 #endif
 
 int
diff --git a/newlib/libc/time/tzset.c b/newlib/libc/time/tzset.c
index 77accbfb0485..67a64f4331fe 100644
--- a/newlib/libc/time/tzset.c
+++ b/newlib/libc/time/tzset.c
@@ -10,7 +10,7 @@ INDEX
 SYNOPSIS
 	#include <time.h>
 	void tzset(void);
-	void _tzset_r (struct _reent *<[reent_ptr]>);
+	void _tzset_r (__reent_ptr_t <[reent_ptr]>);
 
 DESCRIPTION
 <<tzset>> examines the <[TZ]> environment variable and sets up the three
diff --git a/newlib/libc/time/tzset_r.c b/newlib/libc/time/tzset_r.c
index 5ea922e1e816..f3fe1ce47c74 100644
--- a/newlib/libc/time/tzset_r.c
+++ b/newlib/libc/time/tzset_r.c
@@ -17,7 +17,7 @@ static char __tzname_dst[TZNAME_MAX + 2];
 static char *prev_tzenv = NULL;
 
 void
-_tzset_unlocked_r (struct _reent *reent_ptr)
+_tzset_unlocked_r (__reent_ptr_t reent_ptr)
 {
   char *tzenv;
   unsigned short hh, mm, ss, m, w, d;
@@ -265,7 +265,7 @@ _tzset_unlocked_r (struct _reent *reent_ptr)
 }
 
 void
-_tzset_r (struct _reent *reent_ptr)
+_tzset_r (__reent_ptr_t reent_ptr)
 {
   TZ_LOCK;
   _tzset_unlocked_r (reent_ptr);
diff --git a/newlib/libc/unix/pread.c b/newlib/libc/unix/pread.c
index 61daac3b4734..94138b027cf0 100644
--- a/newlib/libc/unix/pread.c
+++ b/newlib/libc/unix/pread.c
@@ -11,7 +11,7 @@ INDEX
 SYNOPSIS
 	#include <unistd.h>
 	ssize_t pread(int <[fd]>, void *<[buf]>, size_t <[n]>, off_t <[off]>);
-	ssize_t _pread_r(struct _reent *<[rptr]>, int <[fd]>, 
+	ssize_t _pread_r(__reent_ptr_t <[rptr]>, int <[fd]>,
                          void *<[buf]>, size_t <[n]>, off_t <[off]>);
 
 DESCRIPTION
@@ -38,7 +38,7 @@ Supporting OS subroutine required: <<read>>, <<lseek>>.
 #include <reent.h>
 
 ssize_t
-_pread_r (struct _reent *rptr,
+_pread_r (__reent_ptr_t rptr,
      int fd,
      void *buf,
      size_t n,
diff --git a/newlib/libc/unix/pwrite.c b/newlib/libc/unix/pwrite.c
index 60166c9f9587..b4c46a3fd346 100644
--- a/newlib/libc/unix/pwrite.c
+++ b/newlib/libc/unix/pwrite.c
@@ -12,7 +12,7 @@ SYNOPSIS
 	#include <unistd.h>
 	ssize_t pwrite(int <[fd]>, const void *<[buf]>, 
                        size_t <[n]>, off_t <[off]>);
-	ssize_t _pwrite_r(struct _reent *<[rptr]>, int <[fd]>, 
+	ssize_t _pwrite_r(__reent_ptr_t <[rptr]>, int <[fd]>,
                           const void *<[buf]>, size_t <[n]>, off_t <[off]>);
 
 DESCRIPTION
@@ -39,7 +39,7 @@ Supporting OS subroutine required: <<write>>, <<lseek>>.
 #include <reent.h>
 
 ssize_t
-_pwrite_r (struct _reent *rptr,
+_pwrite_r (__reent_ptr_t rptr,
      int fd,
      const void *buf,
      size_t n,
-- 
2.56.1



More information about the Newlib mailing list