Commit Graph

22 Commits

Author SHA1 Message Date
Christophe Lyon 3878d82a2b [ARM] Cast string pointers to int to avoid compiler warnings.
2018-10-01  Christophe Lyon  <christophe.lyon@linaro.org>

    	* newlib/libc/sys/arm/syscalls.c (_unlink): Cast 'path' to int.
    	(_system): Cast 's' to int.
    	(_rename): Cast 'newpath' and 'oldpath' to int.
2018-10-05 12:00:44 +01:00
Andy Koppe 3017f23f1c Avoid ARM SWI Seek when querying file position
Issuing an ARM semi-hosting Seek command when just querying file
position with SEEK_CUR and offset zero is unnecessary, because unlike
the lseek() Unix system call the Seek command does not actually return
the file position. For that reason, syscalls.c for ARM keeps track of
file position in the 'poslog', so we can just return that.

Moreover, since the Seek command only accepts an absolute file position,
SEEK_CUR operations are implemented by adding the relative offset to the
position in the poslog. If the host implements non-binary files with
implicit carriage return characters but doesn't discount those implicit
CRs when implementing Seek (by just mapping straight to Windows file
operations), this actually ended up wrongly changing file position when
using SEEK_CUR with offset zero or functions like ftell() or fgetpos()
that are based on that.

Also, use off_t rather than int for the poslog.
2018-09-03 09:40:39 +02:00
Richard Earnshaw 0bb8697333 [arm] Fix syscalls.c for newlib embedded syscalls builds
Newlib has a build configuration where syscalls can be directly
embedded in the newlib library rather than relying on libgloss.

This configuration was broken recently by an update to the libgloss
support for Arm that was not propagated to the syscalls interface in
newlib itself.  This patch restores the build.  It's essentially a
copy of https://sourceware.org/ml/newlib/2018/msg00128.html but there
are some other minor cleanups and changes that I've made at the same
time.  None of those cleanups affect functionality.

The prototypes of the following functions have been updated: _link,
_sbrk, _getpid, _write, _swiwrite, _lseek, _swilseek, _read and
_swiread.

Signed-off-by: Richard Earnshaw <Richard.Earnshaw@arm.com>
2018-03-15 09:55:11 +00:00
Yaakov Selkowitz 70ee6b17df ansification: remove _EXFUN, _EXFUN_NOTHROW
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:29 -06:00
Yaakov Selkowitz eea249da3b ansification: remove _PARAMS
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:13 -06:00
Jeff Johnston 35dcecc6db 2014-02-11 Joey Ye <joey.ye@arm.com>
* libc/sys/arm/syscalls.c (_sbrk): Define as weak symbols.
        (_read, _write): Ditto.
2014-02-11 19:54:30 +00:00
Corinna Vinschen 320a1e7412 * libc/sys/arm/syscalls.c (do_AngelSWI): Delete.
* libc/sys/arm/libcfuncs.c (do_AngelSWI): Delete.
	* libc/sys/arm/swi.h: Copy over from libgloss.
2013-07-19 09:57:51 +00:00
Jeff Johnston a639937a9a 2008-01-03 Jeff Johnston <jjohnstn@redhat.com>
Make isatty syscall handling consistent with other newlib syscalls.

        * libc/include/_syslist.h: Add _isatty.
        * libc/include/reent.h: Add _isatty_r.
        * libc/include/sys/unistd.h: Add _isatty.
        * libc/posix/Makefile.am: Add new _isatty.c file.
        * libc/posix/Makefile.in: Regenerated.
        * libc/posix/_isatty.c: New file.
        * libc/posix/isatty.c: Changed to call _isatty().
        * libc/reent/Makefile.am: Add new isattyr.c file.
        * libc/reent/Makefile.in: Regenerated.
        * libc/reent/isattyr.c: New file.
        * libc/stdio/freopen.c: Changed to call _isatty_r().
        * libc/stdio/makebuf.c: Ditto.
        * libc/sys/a29khif/_isatty.S: Change isatty to _isatty.
        * libc/sys/arc/isatty.c: Ditto.
        * libc/sys/arm/syscalls.c: Ditto.
        * libc/sys/d10v/syscalls.c: Ditto.
        * libc/sys/h8300hms/syscalls.c: Ditto.
        * libc/sys/h8500hms/syscalls.c: Ditto.
        * libc/sys/linux/Makefile.am: Add new isatty.c file.
        * libc/sys/linux/Makefile.in: Regenerated.
        * libc/sys/linux/isatty.c: New file.
        * libc/syscalls/Makefile.am: Add new sysisatty.c file.
        * libc/syscalls/Makefile.in: Regenerated.
        * libc/syscalls/sysisatty.c: New file.
2008-01-03 22:33:37 +00:00
Jeff Johnston 0be2bc94e7 2007-07-06 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/time.h (gettimeofday): Change to proper
        prototype where second parameter is void *.
        * libc/reent/gettimeofdayr.c (_gettimeofday_r): Change prototype
        accordingly.
        * libc/include/reent.h: Fix prototype for _gettimeofday_r.
        * libc/sys/arm/syscalls.c: Fix gettimeofday function signature.
        * libc/sys/rdos/gettod.c: Ditto.
        * libc/sys/sh/syscalls.c: Ditto.
        * libc/time/time.c (time): Change call to _gettimeofday_r
        to pass NULL as 2nd argument.
2007-07-06 16:56:30 +00:00
Jeff Johnston c4cac45fe9 2006-06-13 Sandra Loosemore <sandra@codesourcery.com>
* /libc/sys/arm/syscalls.c (_unlink, isatty, _system, _rename):
        Make them do something useful in the ARM_RDI_MONITOR case.
2006-06-13 20:50:24 +00:00
Jeff Johnston 6ea486a6df 2006-06-05 Shaun Jackman <sjackman@gmail.com>
configure.host (newlib_cflags) [arm, thumb, xscale]:  Remove
        -DABORT_PROVIDED flag.
        * newlib/libc/sys/arm/syscalls.c (kill, exit): Sync with libgloss.
        * newlib/libc/sys/arm/libcfunc.c (abort): Ditto.
2006-06-05 19:45:08 +00:00
Jeff Johnston 9bbe6d5d28 2006-02-07 Paul Brook <paul@codesourcery.com>
* libc/machine/arm/setjmp.S: Add Thumb-2 support.
        * libc/sys/arm/crt0.S: Add Thumb-2 startup code.
        * libc/sys/arm/libcfunc.c (do_AngelSWI): Use AngelSWIInsn.
        * libc/sys/arm/swi.h (AngelSWIInsn, AngelSWIAsm): Define.
        * libc/sys/arm/trap.S: Disable for Thumb-2.
2006-02-07 18:44:54 +00:00
Jeff Johnston 1159e0fd94 2005-02-07 Antony King <antony.king@st.com>
* libc/stdio/clearerr.c (clearerr): Ensure CHECK_INIT() is
        called before _flockfile to prevent lock object use before
        initialisation. _REENT_SMALL_CHECK_INIT() and CHECK_INIT()
        take a struct _reent * instead of a FILE *.
        * libc/stdio/fclose.c (_fclose_r): Ditto.
        * libc/stdio/feof.c (feof): Ditto.
        * libc/stdio/ferror.c (ferror): Ditto.
        * libc/stdio/fflush.c (fflush): Ditto.
        * libc/stdio/fgetc.c (fgetc): Ditto.
        * libc/stdio/fgets.c (fgets): Ditto.
        * libc/stdio/fileno.c (fileno): Ditto.
        * libc/stdio/fputc.c (fputc): Ditto.
        * libc/stdio/fputs.c (fputs): Ditto.
        * libc/stdio/fread.c (fread): Ditto.
        * libc/stdio/freopen.c (_freopen_r): Ditto.
        * libc/stdio/fseek.c (_fseek_r): Ditto.
        * libc/stdio/ftell.c (_ftell_r): Ditto.
        * libc/stdio/fwrite.c (fwrite): Ditto.
        * libc/stdio/getc.c (getc): Ditto.
        * libc/stdio/getdelim.c (__getdelim): Ditto.
        * libc/stdio/putc.c (putc): Ditto.
        * libc/stdio/setvbuf.c (setvbuf): Ditto.
        * libc/stdio/ungetc.c (_ungetc_r): Ditto.
        * libc/stdio/vfprintf.c (_VFPRINTF_R): Ditto.
        * libc/stdio64/freopen64.c (_freopen64_r): Ditto.
        * libc/stdio64/fseeko64.c (_fseeko64_r): Ditto.
        * libc/stdio64/ftello64.c (_ftello64_r): Ditto.
        * libc/stdio/local.h (CHECK_INIT): Argument is now a struct
        _reent * instead of a FILE * and so replace incorrect use of
        _REENT with argument.
        * libc/sys/arm/syscalls.c (CHECK_INIT): Ditto.
        * libc/stdio/getchar.c (getchar): _REENT_SMALL_CHECK_INIT() and
        CHECK_INIT() take a struct _reent * instead of a FILE *.
        * libc/stdio/iprintf.c (iprintf, _iprintf_r): Ditto.
        * libc/stdio/iscanf.c (iscanf, _iscanf_r): Ditto.
        * libc/stdio/perror.c (perror): Ditto.
        * libc/stdio/printf.c (printf, _printf_r): Ditto.
        * libc/stdio/putchar.c (putchar): Ditto.
        * libc/stdio/puts.c (puts): Ditto.
        * libc/stdio/refill.c (__srefill): Ditto.
        * libc/stdio/scanf.c (scanf, _scanf_r): Ditto.
        * libc/stdio/vfscanf.c (VFSCANF, _VFSCANF_R): Ditto.
        * libc/stdio/viprintf.c (viprintf, _viprintf_r): Ditto.
        * libc/stdio/viscanf.c (viscanf, _viscanf_r): Ditto.
        * libc/stdio/vprintf.c (vprintf, _vprintf_r): Ditto.
        * libc/stdio/vscanf.c (vscanf, _vscanf_r): Ditto.
        * libc/stdio/wbuf.c (__swbuf): Ditto.
        * libc/stdio/wsetup.c (__swsetup): Ditto.
        * libc/stdlib/mallocr.c (malloc_stats): Ditto.
        * libc/stdlib/mstats.c (_mstats_r): Ditto.
        * libc/include/sys/reent.h (_REENT_SMALL_CHECK_INIT): Ditto.
        * libc/machine/powerpc/vfscanf.c (vfscanf): Ditto.
        * libc/stdio/fgetpos.c (_fgetpos_r): Removed unnecessary calls
        to _flockfile and _funlockfile; rely on locking in _ftell_r.
        * libc/stdio64/fgetpos64.c (_fgetpos64_r): Ditto (_ftello64_r).
        * libc/machine/powerpc/vfprintf.c (__sbprintf): Removed unnecessary
        initialision of _data field in FILE structure.
        * libc/machine/powerpc/vfprintf.c (VFPRINTF): Added CHECK_INIT() call.
2005-02-08 01:33:19 +00:00
Jeff Johnston 9488c41488 2004-01-06 Mark Mitchell <mark@codesourcery.com>
* libc/sys/arm/syscalls.c (unistd.h): Include it.
        (remap_handle): Use STDIN_FILENO instead of __sfileno(stdin).
        Similarly for stdout and stderr.
2004-01-06 19:27:21 +00:00
Thomas Fitzsimmons 9c7d6a9d7e * libc/sys/arm/syscalls.c (_rename): Add parameter names.
(_sbrk): Add cast of return value.
2002-05-06 20:46:37 +00:00
Jonathan Larmour 588f16bb29 Fix trivial typo in last change 2002-04-29 21:52:36 +00:00
Jonathan Larmour 822afa537a * libc/sys/arm/syscalls.c (_rename): New function. Just a stub.
(_system): New function. Ditto.
	* libc/stdlib/system.c (_system_r): Call _system if HAVE_SYSTEM.
	* configure.host: define HAVE_SYSTEM and HAVE_RENAME for xscale
	targets.
2002-04-29 21:49:56 +00:00
Jeff Johnston d2a246ad72 2002-03-12 Richard Earnshaw <rearnsha@arm.com>
* libc/sys/arm/access.c: New file.
        * libc/sys/arm/Makefile.am (lib_a_SOURCES): Add access.c.
        * libc/sys/arm/Makefile.in: Regenerate.
        * libc/sys/arm/syscalls.c (_stat): New function.
2002-03-12 21:25:12 +00:00
Nick Clifton b2db0ebcfe _sbrk(): Return -1 rather than aborting if too much memory is requested. 2002-01-17 16:39:53 +00:00
Nick Clifton 79908d67bc Fix compile time warning messages.
Add "cc" to list of registers clobbered bu do_AgelSWI
2000-03-24 18:17:17 +00:00
Fernando Nasser 7684ddaf52 Thu Mar 22 14:57:00 2000 Fernando Nasser <fnasser@redhat.com>
* libc/sys/arm/syscalls.c (do_AngelSWI): Prevent registers with valid
	information to be clobbered by an Angel C library support syscall.
2000-03-23 20:19:13 +00:00
Christopher Faylor 8a0efa53e4 import newlib-2000-02-17 snapshot 2000-02-17 19:39:52 +00:00