diff options
author | Matt Joyce <matthew.joyce@embedded-brains.de> | 2022-01-18 12:13:04 +0300 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-07-13 07:55:41 +0300 |
commit | f3b8138239d3ba34c4ecaa4305b0fbd7eb4e28a5 (patch) | |
tree | 80cc7a629134d4568bf5dc71898266555a6863b0 /newlib/libc/reent | |
parent | d0d78e96ebf4187fb9362465f1a397680447046f (diff) |
Add _REENT_ERRNO(ptr)
Add a _REENT_ERRNO() macro to encapsulate the access to the
_errno member of struct reent. This will help to replace the
structure member with a thread-local storage object in a follow
up patch.
Replace uses of __errno_r() with _REENT_ERRNO(). Keep __errno_r() macro for
potential users outside of Newlib.
Diffstat (limited to 'newlib/libc/reent')
-rw-r--r-- | newlib/libc/reent/closer.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/execr.c | 6 | ||||
-rw-r--r-- | newlib/libc/reent/fcntlr.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/fstat64r.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/fstatr.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/gettimeofdayr.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/isattyr.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/linkr.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/lseek64r.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/lseekr.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/mkdirr.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/open64r.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/openr.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/readr.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/renamer.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/sbrkr.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/signalr.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/stat64r.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/statr.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/unlinkr.c | 2 | ||||
-rw-r--r-- | newlib/libc/reent/writer.c | 2 |
21 files changed, 23 insertions, 23 deletions
diff --git a/newlib/libc/reent/closer.c b/newlib/libc/reent/closer.c index deb34b002..2d72b2ab5 100644 --- a/newlib/libc/reent/closer.c +++ b/newlib/libc/reent/closer.c @@ -45,7 +45,7 @@ _close_r (ptr, fd) errno = 0; if ((ret = _close (fd)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/execr.c b/newlib/libc/reent/execr.c index 59b61223e..541fb8624 100644 --- a/newlib/libc/reent/execr.c +++ b/newlib/libc/reent/execr.c @@ -54,7 +54,7 @@ _execve_r (struct _reent *ptr, errno = 0; if ((ret = _execve (name, argv, env)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } @@ -86,7 +86,7 @@ _fork_r (struct _reent *ptr) errno = 0; if ((ret = _fork ()) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } @@ -118,7 +118,7 @@ _wait_r (struct _reent *ptr, errno = 0; if ((ret = _wait (status)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/fcntlr.c b/newlib/libc/reent/fcntlr.c index cd19d226f..f60aa091c 100644 --- a/newlib/libc/reent/fcntlr.c +++ b/newlib/libc/reent/fcntlr.c @@ -49,7 +49,7 @@ _fcntl_r (struct _reent *ptr, errno = 0; if ((ret = _fcntl (fd, cmd, arg)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/fstat64r.c b/newlib/libc/reent/fstat64r.c index c546f5c1d..a049206e2 100644 --- a/newlib/libc/reent/fstat64r.c +++ b/newlib/libc/reent/fstat64r.c @@ -55,7 +55,7 @@ _fstat64_r (struct _reent *ptr, errno = 0; if ((ret = _fstat64 (fd, pstat)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/fstatr.c b/newlib/libc/reent/fstatr.c index ec906c98d..9a02e9a68 100644 --- a/newlib/libc/reent/fstatr.c +++ b/newlib/libc/reent/fstatr.c @@ -53,7 +53,7 @@ _fstat_r (ptr, fd, pstat) errno = 0; if ((ret = _fstat (fd, pstat)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/gettimeofdayr.c b/newlib/libc/reent/gettimeofdayr.c index 9b982a993..aa60e5e3a 100644 --- a/newlib/libc/reent/gettimeofdayr.c +++ b/newlib/libc/reent/gettimeofdayr.c @@ -60,7 +60,7 @@ _gettimeofday_r (struct _reent *ptr, errno = 0; if ((ret = _gettimeofday (ptimeval, ptimezone)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/isattyr.c b/newlib/libc/reent/isattyr.c index f21bf25b2..f76945519 100644 --- a/newlib/libc/reent/isattyr.c +++ b/newlib/libc/reent/isattyr.c @@ -50,7 +50,7 @@ _isatty_r (ptr, fd) errno = 0; if ((ret = _isatty (fd)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/linkr.c b/newlib/libc/reent/linkr.c index b22da5f94..169b6eeec 100644 --- a/newlib/libc/reent/linkr.c +++ b/newlib/libc/reent/linkr.c @@ -51,7 +51,7 @@ _link_r (struct _reent *ptr, errno = 0; if ((ret = _link (old, new)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/lseek64r.c b/newlib/libc/reent/lseek64r.c index 40769fb6d..c9afd01df 100644 --- a/newlib/libc/reent/lseek64r.c +++ b/newlib/libc/reent/lseek64r.c @@ -50,7 +50,7 @@ _lseek64_r (struct _reent *ptr, errno = 0; if ((ret = _lseek64 (fd, pos, whence)) == (_off64_t) -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/lseekr.c b/newlib/libc/reent/lseekr.c index ac2daaab9..77e66b8e1 100644 --- a/newlib/libc/reent/lseekr.c +++ b/newlib/libc/reent/lseekr.c @@ -47,7 +47,7 @@ _lseek_r (struct _reent *ptr, errno = 0; if ((ret = _lseek (fd, pos, whence)) == (_off_t) -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/mkdirr.c b/newlib/libc/reent/mkdirr.c index fd72df64c..cf66a24d3 100644 --- a/newlib/libc/reent/mkdirr.c +++ b/newlib/libc/reent/mkdirr.c @@ -48,7 +48,7 @@ _mkdir_r (struct _reent *ptr, errno = 0; if ((ret = _mkdir (path, mode)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/open64r.c b/newlib/libc/reent/open64r.c index 84bd67e34..fe288d083 100644 --- a/newlib/libc/reent/open64r.c +++ b/newlib/libc/reent/open64r.c @@ -52,7 +52,7 @@ _open64_r (ptr, file, flags, mode) errno = 0; if ((ret = _open64 (file, flags, mode)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/openr.c b/newlib/libc/reent/openr.c index c6a7db5de..824315438 100644 --- a/newlib/libc/reent/openr.c +++ b/newlib/libc/reent/openr.c @@ -48,7 +48,7 @@ _open_r (struct _reent *ptr, errno = 0; if ((ret = _open (file, flags, mode)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/readr.c b/newlib/libc/reent/readr.c index 7fccefd32..b2ae300d3 100644 --- a/newlib/libc/reent/readr.c +++ b/newlib/libc/reent/readr.c @@ -47,7 +47,7 @@ _read_r (struct _reent *ptr, errno = 0; if ((ret = (_ssize_t)_read (fd, buf, cnt)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/renamer.c b/newlib/libc/reent/renamer.c index 5420dc4a0..7e1e111a8 100644 --- a/newlib/libc/reent/renamer.c +++ b/newlib/libc/reent/renamer.c @@ -49,7 +49,7 @@ _rename_r (struct _reent *ptr, #ifdef HAVE_RENAME errno = 0; if ((ret = _rename (old, new)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; #else if (_link_r (ptr, old, new) == -1) return -1; diff --git a/newlib/libc/reent/sbrkr.c b/newlib/libc/reent/sbrkr.c index 21c4bd913..ec948fe6b 100644 --- a/newlib/libc/reent/sbrkr.c +++ b/newlib/libc/reent/sbrkr.c @@ -49,7 +49,7 @@ _sbrk_r (struct _reent *ptr, errno = 0; if ((ret = (char *)(_sbrk (incr))) == (void *) -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/signalr.c b/newlib/libc/reent/signalr.c index 345910e4b..863ae7400 100644 --- a/newlib/libc/reent/signalr.c +++ b/newlib/libc/reent/signalr.c @@ -51,7 +51,7 @@ _kill_r (struct _reent *ptr, errno = 0; if ((ret = _kill (pid, sig)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/stat64r.c b/newlib/libc/reent/stat64r.c index b64736ef2..160d08e33 100644 --- a/newlib/libc/reent/stat64r.c +++ b/newlib/libc/reent/stat64r.c @@ -53,7 +53,7 @@ _stat64_r (struct _reent *ptr, errno = 0; if ((ret = _stat64 (file, pstat)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/statr.c b/newlib/libc/reent/statr.c index 9388e0246..99453e789 100644 --- a/newlib/libc/reent/statr.c +++ b/newlib/libc/reent/statr.c @@ -53,7 +53,7 @@ _stat_r (struct _reent *ptr, errno = 0; if ((ret = _stat (file, pstat)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/unlinkr.c b/newlib/libc/reent/unlinkr.c index 41bac0194..495e65b02 100644 --- a/newlib/libc/reent/unlinkr.c +++ b/newlib/libc/reent/unlinkr.c @@ -45,7 +45,7 @@ _unlink_r (struct _reent *ptr, errno = 0; if ((ret = _unlink (file)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } diff --git a/newlib/libc/reent/writer.c b/newlib/libc/reent/writer.c index 704aba18b..ac2217c57 100644 --- a/newlib/libc/reent/writer.c +++ b/newlib/libc/reent/writer.c @@ -47,7 +47,7 @@ _write_r (struct _reent *ptr, errno = 0; if ((ret = (_ssize_t)_write (fd, buf, cnt)) == -1 && errno != 0) - ptr->_errno = errno; + _REENT_ERRNO(ptr) = errno; return ret; } |