Commit Graph

18 Commits

Author SHA1 Message Date
Sebastian Huber eeded3c170 Provide POSIX defined id_t in <sys/types.h>
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-15 14:51:39 +02:00
Sebastian Huber 8a5af1a184 Use __machine_*_t_defined for internal types
Newlib defines defaults for internal types via <sys/_types.h> and uses
<machine/_types.h> to let targets define their own type if necessary.

Previously for example

	#ifndef __dev_t_defined
	typedef short __dev_t;
	#endif

However, the __*_t_defined pattern conflicts with the glibc type guard
pattern for user types, e.g. dev_t in this example.  Introduce a
__machine_*_t_defined pattern for internal types (defined by
<machine/_types.h>, used by <sys/_types.h>).  For example

	#ifndef __machine_dev_t_defined
	typedef short __dev_t;
	#endif

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-15 14:51:39 +02:00
Corinna Vinschen 7b39124400 Get rid of some special cases for Cygwin in sys/types.h
Remove off_t typedef from cygwin/types.h thus relying on sys/types.h.
Introduce winsup/cygwin/machine/_types.h and move some types shared
with newlib into it.  Get rid of their definition in cygwin/types.h.
Add same handling for __key_t/key_t as for the other types.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-04-13 21:00:17 +02:00
Sebastian Huber 477463a201 Eliminate use of Newlib-specific <machine/types.h>
This change solves a glibc/BSD compatibility problem.

glibc and BSD use double underscore types for internal types.  The Linux
port of Newlib uses some glibc provided internal type definitions which
are not protected by guard defines, e.g. __off_t.  To avoid a conflict
Newlib uses single underscore types for some internal types, e.g.
_off_t.  However, for BSD compatibility we have to define the internal
types with double underscore names in <sys/_types.h>.

The header file <machine/types.h> is Newlib-specific.  It was used
instead of <sys/_types.h> to provide the internal type definitions
_CLOCK_T, _TIME_T_, _CLOCKID_T_, _TIMER_T_, and __suseconds_t.  Move
these definitions to <sys/_types.h> (there exist two instances of this
file, one for Linux and one for all other targets).  This makes the
_HAVE_SYSTYPES configuration define obsolete (could possibly break the
__RDOS__ target).  Use the standard <sys/_types.h> include throughout.

Move __loff_t defintion to default (non-Linux) <sys/_types.h>.  Define
it via _off64_t to avoid a dependency on the compiler.

Provide the __off_t definition via default (non-Linux) <sys/_types.h>
based on _off_t for all systems except Cygwin.  For Cygwin use _off64_t.
Define off_t via __off_t.

Provide the __pid_t definition via default (non-Linux) <sys/_types.h>.
This prevents a potential __pid_t and pid_t incompatibility.  Add BSD
guard defines for pid_t.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-13 13:30:27 +02:00
Joel Sherrill 8635dec1a5 2013-10-10 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/sys/rtems/machine/_types.h (__dev_t): Define.
	(__dev_t_defined) Likewise.
	* libc/include/sys/_types.h (__dev_t): Delete RTEMS specific
	definition.
2013-10-15 17:38:32 +00:00
Corinna Vinschen 7080b36417 * libc/include/sys/_types.h (_ssize_t): Define as signed equivalent of
size_t with GCC.
2013-02-21 12:27:11 +00:00
Jeff Johnston cebf33e402 2007-09-18 Patrick Mansfield <patmans@us.ibm.com>
* libc/include/sys/types.h: Use __dev_t, __uid_t, and __gid_t to
        typedef dev_t, gid_t, and uid_t.
        * libc/include/sys/_types.h: Move previous dev_t, uid_t and gid_t
        types.h code to here, but typedef __dev_t, __uid_t, and __gid_t instead.
        Change to lower case for all __foo_t_defined names.
        * libc/machine/spu/machine/_types.h: Add SPU specific __dev_t,
        __uid_t, and __gid_t making them all four bytes. Change to lower case
        for all __foo_t_defined names.
2007-09-18 20:05:17 +00:00
Jeff Johnston e5ae72300f 2007-09-07 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/_types.h: Protect all types with flag
        checks to allow definition in machine/_types.h.
2007-09-07 21:24:55 +00:00
Jeff Johnston dde223343c 2007-09-07 Patrick Mansfield <patmans@us.ibm.com>
* libc/include/machine/_default_types.h: New file, contains what
	was previously in libc/include/machine/_types.h.
	* libc/include/machine/_types.h: Now only includes
	machine/_default_types.h.
	* libc/include/sys/reent.h: Remove _fpos_t and _fpos64_t.
	* libc/include/sys/_types.h: Move _fpos_t and _fpos64_t to here,
	with conditional declarations.
	* libc/machine/spu/machine/_types.h: New file, add SPU specific
	typedefs for _fpos_t and _fpos64_t.
2007-09-07 21:16:25 +00:00
Jeff Johnston d0bd3e6f56 2004-06-11 Antony King <antony.king@st.com>
* libc/include/sys/_types.h: Include <sys/lock.h> and change
        _flock_t to be of type _LOCK_RECURSIVE_T.
        * libc/include/sys/reent.h: (_REENT_INIT): Reformat.
        (_REENT_INIT_PTR): Ditto.  Use memset where appropriate.
        (_global_impure_ptr): New declaration.
        (_GLOBAL_REENT): Change to be _global_impure_ptr.
        * libc/include/sys/stdio.h: Include <sys/lock.h> and
        <sys/reent.h>.
        (_flockfile)[!_SINGLE_THREAD]: Add code for lock call.
        (_funlockfile)[!SINGLE_THREAD]: Ditto.
        * libc/reent/impure.c: Set _global_impure_ptr to _impure_ptr.
        * libc/stdio/fclose.c: Remove casting of fp lock to
        _LOCK_RECURSIVE_T.
        * libc/stdio/findfp.c: Ditto.
        * libc/stdio/fopen.c: Ditto.
        * libc/stdio/freopen.c: Ditto.
        * libc/stdio/vfprintf.c: Ditto.
        * libc/stdio64/fopen64.c: Ditto.
        * libc/stdlib/envlock.c: Add default stubs that use generic
        locking code.
        * libc/stdlib/mlock.c: Ditto.

        Jeff Johnston  <jjohnstn@redhat.com>
        * libc/sys/linux/sys/_types.h (__flock_mutex_t): New subtype.
        (_flock_t): Change to be a struct containing a single member
        named mutex which is of type __flock_mutex_t.
2004-06-11 20:37:10 +00:00
Jeff Johnston 786ab12ce2 2004-01-23 Artem B. Bityuckiy <abitytsky@softminecorp.com>
* acinclude.m4 (--enable-newlib-iconv): New configuration option.
	(--enable-newlib-builtin-converters): Ditto.
	* configure.in: Add code to set _ICONV_ENABLED flag.
	Set _MB_LEN_MAX to 1 if not mb enabled.
	* configure: Regenerated.
	* aclocal.m4: Ditto.
	* Makefile.in: Ditto.
	* newlib.hin: Add _ICONV_ENABLED flag.
	* libc/Makefile.am: Add support for iconv.
	* libc/configure.in: Ditto.
	* libc/Makefile.in: Regenerated.
	* libc/aclocal.m4: Ditto.
	* libc/configure: Ditto.
	* libc/libc.texinfo: Add iconv documentation.
	* libc/iconv/AUTHORS, libc/iconv/COPYING, libc/iconv/Makefile.am,
	libc/iconv/Makefile.in, libc/iconv/README.ORIGINAL,
	libc/iconv/README.TODO, libc/iconv/charset.aliases,
	libc/iconv/iconv.tex, libc/iconv/ccs/Makefile.am,
	libc/iconv/ccs/Makefile.in, libc/iconv/ccs/README.CCS.SOURCES,
	libc/iconv/ccs/big5.c, libc/iconv/ccs/cns11643_plane1.c,
	libc/iconv/ccs/cns11643_plane14.c, libc/iconv/ccs/cns11643_plane2.c,
	libc/iconv/ccs/cp775.c, libc/iconv/ccs/cp850.c,
	libc/iconv/ccs/cp852.c, libc/iconv/ccs/cp855.c,
	libc/iconv/ccs/cp866.c, libc/iconv/ccs/gb_2312_80.c,
	libc/iconv/ccs/iconv_mktbl, libc/iconv/ccs/iso_8859_1.c,
	libc/iconv/ccs/iso_8859_15.c, libc/iconv/ccs/iso_8859_2.c,
	libc/iconv/ccs/iso_8859_4.c, libc/iconv/ccs/iso_8859_5.c,
	libc/iconv/ccs/jis_x0201.c, libc/iconv/ccs/jis_x0208_1983.c,
	libc/iconv/ccs/jis_x0212_1990.c, libc/iconv/ccs/koi8_r.c,
	libc/iconv/ccs/koi8_u.c, libc/iconv/ccs/ksx1001.c,
	libc/iconv/ccs/shift_jis.c, libc/iconv/ccs/us_ascii.c,
	libc/iconv/ccs/binary/Makefile.am, libc/iconv/ccs/binary/Makefile.in,
	libc/iconv/ccs/binary/big5.cct,
	libc/iconv/ccs/binary/cns11643_plane1.cct,
	libc/iconv/ccs/binary/cns11643_plane14.cct,
	libc/iconv/ccs/binary/cns11643_plane2.cct,
	libc/iconv/ccs/binary/cp775.cct, libc/iconv/ccs/binary/cp850.cct,
	libc/iconv/ccs/binary/cp852.cct, libc/iconv/ccs/binary/cp855.cct,
	libc/iconv/ccs/binary/cp866.cct, libc/iconv/ccs/binary/gb_2312_80.cct,
	libc/iconv/ccs/binary/iso_8859_1.cct,
	libc/iconv/ccs/binary/iso_8859_15.cct,
	libc/iconv/ccs/binary/iso_8859_2.cct,
	libc/iconv/ccs/binary/iso_8859_4.cct,
	libc/iconv/ccs/binary/iso_8859_5.cct,
	libc/iconv/ccs/binary/jis_x0201.cct,
	libc/iconv/ccs/binary/jis_x0208_1983.cct,
	libc/iconv/ccs/binary/jis_x0212_1990.cct,
	libc/iconv/ccs/binary/koi8_r.cct, libc/iconv/ccs/binary/koi8_u.cct,
	libc/iconv/ccs/binary/ksx1001.cct,
	libc/iconv/ccs/binary/shift_jis.cct,
	libc/iconv/ccs/binary/us_ascii.cct,
	libc/iconv/ces/Makefile.am, libc/iconv/ces/Makefile.in,
	libc/iconv/ces/euc-jp.c, libc/iconv/ces/euc-kr.c,
	libc/iconv/ces/euc-tw.c, libc/iconv/ces/gb2312.c,
	libc/iconv/ces/iso-10646-ucs-2.c, libc/iconv/ces/iso-10646-ucs-4.c,
	libc/iconv/ces/ucs-2-internal.c, libc/iconv/ces/ucs-4-internal.c,
	libc/iconv/ces/utf-16.c, libc/iconv/ces/utf-8.c,
	libc/iconv/lib/Makefile.am, libc/iconv/lib/Makefile.in,
	libc/iconv/lib/aliases.c, libc/iconv/lib/bialiasesi.c,
	libc/iconv/lib/biccs.c, libc/iconv/lib/bices.c,
	libc/iconv/lib/ccs.c, libc/iconv/lib/ces.c,
	libc/iconv/lib/ces_euc.c, libc/iconv/lib/ces_iso2022.c,
	libc/iconv/lib/ces_table.c, libc/iconv/lib/converter.c,
	libc/iconv/lib/deps.h, libc/iconv/lib/endian.h,
	libc/iconv/lib/iconv.c, libc/iconv/lib/loaddata.c,
	libc/iconv/lib/local.h, libc/include/iconv.h: New files.
	* libc/sys/linux/include/iconv.h: Ditto.
	* libc/include/sys/_types.h (_iconv_t): Added.
	* doc/aclocal.m4: Regenerated.
	* doc/configure: Ditto.
	* doc/Makefile.in: Ditto.
	* iconvdata/Makefile.in: Ditto.
	* iconvdata/aclocal.m4: Ditto.
	* iconvdata/configure: Ditto.
	* libc/*aclocal.m4: Ditto.
	* libc/*Makefile.in: Ditto.
	* libc/*configure: Ditto.
	* libm/*aclocal.m4: Ditto.
	* libm/*Makefile.in: Ditto.
	* libm/*configure: Ditto.
2004-01-23 21:37:46 +00:00
Jeff Johnston 9211a1adec 2002-09-16 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/wchar.h (mbstate_t): Change protective flag to
        be _MBSTATE_T.
        * libc/include/sys/_types.h (_mbstate_t): Remove protective flag.
        [__CYGWIN__]: Remove special code that defines mbstate_t and WEOF
        for Cygwin.
        * libc/sys/linux/sys/_types.h (_mbstate_t): Remove protective flag.
2002-09-16 18:55:25 +00:00
Jeff Johnston 9c64d2a7ba 2002-09-09 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/_types.h (_mbstate_t): Changed to use
        unsigned char internally.
        * libc/sys/linux/sys/_types.h: Ditto.
        * libc/include/sys/reent.h
        * libc/stdlib/mblen.c (mblen): Use function-specific state
        value from default reentrancy structure.
        * libc/stdlib/mblen_r.c (_mblen_r):  If return code from
        _mbtowc_r is less than 0, reset state __count value and
        return -1.
        * libc/stdlib/mbrlen.c (mbrlen): If the input state pointer
        is NULL, use the function-specific pointer provided in the
        default reentrancy structure.
        * libc/stdlib/mbrtowc.c: Add reentrant form of function.
        If input state pointer is NULL, use function-specific area
        provided in reentrancy structure.
        * libc/stdlib/mbsrtowcs.c: Ditto.
        * libc/stdlib/wcrtomb.c: Ditto.
        * libc/stdlib/wcsrtombs.c: Ditto.
        * libc/stdlib/mbstowcs.c: Reformat.
        * libc/stdlib/wcstombs.c: Ditto.
        * libc/stdlib/mbstowcs_r.c (_mbstowcs_r): If an error occurs,
        reset the state's __count value and return -1.
        * libc/stdlib/mbtowc.c: Ditto.
        * libc/stdlib/mbtowc_r.c (_mbtowc_r): Add restartable functionality.
        If number of bytes is used up before completing a valid multibyte
        character, return -2 and save the state.
        * libc/stdlib/wctomb_r.c (_wctomb_r): Define __state as __count
        and change some __count references to __state for clarity.
2002-09-09 21:42:14 +00:00
Jeff Johnston 3db40db7d8 2002-09-03 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/_types.h (_flock_t): Added.
        * libc/include/sys/lock.h (__lock_try_acquire): New interface.
        (__lock_try_acquire_recursive): Ditto.
        * libc/include/sys/reent.h (__sFILE, __sFILE64): Add new
        _lock field.
        * libc/stdio/findfp.c (std)[!__SINGLE_THREAD__]: Initialize _lock
        field.
        * libc/stdio/fopen.c (_fopen_r)[!__SINGLE_THREAD__]: Ditto.
        * libc/stdio64/fopen64.c (_fopen64_r)[!__SINGLE_THREAD__]: Ditto.
        * libc/sys/linux/include/time.h (struct timespec): Moved from
        <sys/types.h> and added check for __need_timespec flag so type
        can be defined by itself.
        * libc/sys/linux/sys/_types.h (_flock_t): New type.
        * libc/sys/linux/sys/types.h (struct timespec): Moved to
        <time.h>.
2002-09-03 19:40:36 +00:00
Thomas Fitzsimmons 8d9112f2f3 * libc/include/langinfo.h: New file.
* libc/include/wchar.h: Likewise.
	* libc/include/sys/syslimits.h: Likewise.
	* libc/locale/fix_grouping.c: Likewise.
	* libc/locale/ldpart.c: Likewise.
	* libc/locale/ldpart.h: Likewise.
	* libc/locale/lmessages.c: Likewise.
	* libc/locale/lmessages.h: Likewise.
	* libc/locale/lmonetary.c: Likewise.
	* libc/locale/lmonetary.h: Likewise.
	* libc/locale/lnumeric.c: Likewise.
	* libc/locale/lnumeric.h: Likewise.
	* libc/locale/nl_langinfo.3: Likewise.
	* libc/locale/nl_langinfo.c: Likewise.
	* libc/locale/timelocal.c: Likewise.
	* libc/locale/timelocal.h: Likewise.
	* libc/stdlib/btowc.c: Likewise.
	* libc/stdlib/mbrlen.c: Likewise.
	* libc/stdlib/mbrtowc.c: Likewise.
	* libc/stdlib/mbsinit.c: Likewise.
	* libc/stdlib/mbsrtowcs.c: Likewise.
	* libc/stdlib/wcrtomb.c: Likewise.
	* libc/stdlib/wcsrtombs.c: Likewise.
	* libc/stdlib/wctob.c: Likewise.
	* libc/sys/linux/prof-freq.c: Likewise.
	* libc/sys/linux/profile.c: Likewise.
	* libc/sys/linux/machine/i386/dl-procinfo.c: Likewise.
	* libc/sys/linux/machine/i386/dl-procinfo.h: Likewise.
	* libc/include/stdlib.h: Change re-entrant functions to take
	mbstate_t pointers.
	* libc/include/sys/_types.h: Define _mbstate_t.
	* libc/include/sys/config.h (MB_LEN_MAX): New macro.
	* libc/include/sys/errno.h (EILSEQ): New error code.
	* libc/include/sys/reent.h: Include wchar.h.  Change reentrant
	structure to use mbstate_t.
	* libc/locale/Makefile.am (LIB_SOURCES): Add new files.
	* libc/machine/powerpc/vfprintf.c: Use mbstate_t.
	* libc/machine/powerpc/vfscanf.c: Likewise.
	* libc/stdio/getdelim.c: Reallocate buffer only when necessary.
	* libc/stdio/vfprintf.c: Likewise.
	* libc/stdio/vfscanf.c: Likewise.
	* libc/stdlib/Makefile.am (LIB_SOURCES): Add new files.
	* libc/stdlib/mblen.c: Use mbstate_t.
	* libc/stdlib/mblen_r.c: Likewise.
	* libc/stdlib/mbstowcs.c: Likewise.
	* libc/stdlib/mbstowcs_r.c: Likewise.
	* libc/stdlib/mbtowc.c: Likewise.
	* libc/stdlib/mbtowc_r.c: Likewise.
	* libc/stdlib/wcstombs.c: Likewise.
	* libc/stdlib/wcstombs_r.c: Likewise.
	* libc/stdlib/wctomb_r.c: Likewise.
	* libc/sys/linux/Makefile.am (LIB_SOURCES): Add prof-freq.c and
	profile.c.
	* libc/sys/linux/machine/i386/Makefile.am (LIB_SOURCES): Add
	dl-procinfo.c.
	* libc/sys/linux/sys/errno.h (EILSEQ): New error code.
	* libc/sys/linux/sys/types.h (off_t): Define type.
	* testsuite/newlib.locale/UTF-8.c: Change locale name from UTF-8
	to C-UTF-8.
	* testsuite/newlib.locale/UTF-8.exp: Likewise.
2002-08-23 01:56:05 +00:00
Jeff Johnston dee5139131 2002-07-17 Jeff Johnston <jjohnstn@redhat.com>
* configure.host(stdio64_dir): New setting that is used to
        enable building of new stdio64 directory.
        * libc/Makefile.am[HAVE_STDIO64_DIR]: Add support for
        large files.
        (stmp-stdio64,stdio64.texi): New targets to optionally add in
        stdio64 info to info files.
        * libc/Makefile.in: Regenerated.
        * libc/configure: Ditto.
        * libc/configure.in: Add configuration variables that are set
        when stdio64 is selected as subdir in configure.host.
        * libc/libc.texinfo: Add optional menu item for Stdio64, based
        on whether STDIO64 flag is set or not.
        * libc/sys.tex: Add optional stdio64 syscalls based on whether
        STDIO64 flag is set or not.
        * libc/include/reent.h[__LARGE64_FILES]: Add new stdio64
        _r sycall routines.
        * libc/include/stdio.h[__LARGE64_FILES]: Add new stdio64 prototypes.
        (FILE): Typedef'd to __FILE instead of struct __sFILE directly.
        (__SL64): New file flag indicating file is opened via fopen64.
        * libc/include/sys/_types.h(_off64_t): Added.
        * libc/include/sys/config.h: For x86-linux, define __LARGE64_FILES.
        * libc/include/sys/reent.h(struct __sFILE64): New file structure
        for 64-bit offset large file support.
        (__FILE): New intermediate type either set to struct __sFILE64 or
        struct __sFILE, depending on whether __LARGE64_FILES is set or not.
        * libc/reent/Makefile.am[HAVE_STDIO64_DIR]: Add new files.
        * libc/reent/Makefile.in: Regenerated.
        * libc/reent/fstat64r.c: New file.
        * libc/reent/lseek64r.c: Ditto.
        * libc/reent/open64r.c: Ditto.
        * libc/reent/reent.tex: Optionally add stdio64 reentrant syscalls
        based on whether STDIO64 flag is set.
        * libc/stdio/stdio.tex: Add blank line.
        * libc/stdio64/Makefile.am: New file.
        * libc/stdio64/Makefile.in: Ditto.
        * libc/stdio64/fgetpos64.c: Ditto.
        * libc/stdio64/fopen64.: Ditto.
        * libc/stdio64/freopen64.c: Ditto.
        * libc/stdio64/fseeko64.c: Ditto.
        * libc/stdio64/fsetpos64.c: Ditto.
        * libc/stdio64/ftello64.c: Ditto.
        * libc/stdio64/local64.h: Ditto.
        * libc/stdio64/stdio64.c: Ditto.
        * libc/stdio64/stdio64.tex: Ditto.
        * libc/stdio64/tmpfile64.c: Ditto.
        * libc/sys/linux/io64.c: Add weak aliases for lseek64, fstat64, and
        open64.
2002-07-17 23:25:44 +00:00
Jeff Johnston 533b4e6644 2002-06-27 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/_types.h: Define _ssize_t as int if int is
        32-bits, otherwise define it as long.
        * libc/include/sys/types.h: Include <_ansi.h> and <sys/_types.h>
        and define ssize_t as _ssize_t.
        * libc/reent/readr.c: Change return type to _ssize_t.
        * libc/reent/writer.c: Ditto.
        * libc/sys/linux/Makefile.am: Add aio.c.
        * libc/sys/linux/Makefile.in: Regenerated.
        * libc/sys/linux/aio.c: New file.
        * libc/sys/linux/sys/cdefs.h: Add __restrict_arr definition.
        * libm/common/fdlibm.h: Undef __P before defining it.
2002-06-27 22:48:05 +00:00
Christopher Faylor 8a0efa53e4 import newlib-2000-02-17 snapshot 2000-02-17 19:39:52 +00:00