Adds OS internal function nx_write() which is functionally equivalent to write() except that it does not set the errno variable and do not cause cancellation points.

This commit is contained in:
Gregory Nutt
2017-10-11 10:18:30 -06:00
parent af072d52bc
commit a00d8e16a1
14 changed files with 212 additions and 128 deletions
+6 -5
View File
@@ -299,18 +299,19 @@ static ssize_t loop_write(FAR struct inode *inode,
ret = lseek(dev->fd, offset, SEEK_SET);
if (ret == (off_t)-1)
{
_err("ERROR: Seek failed for offset=%d: %d\n", (int)offset, get_errno());
_err("ERROR: Seek failed for offset=%d: %d\n",
(int)offset, get_errno());
}
/* Then write the requested number of sectors to that position */
do
{
nbyteswritten = write(dev->fd, buffer, nsectors * dev->sectsize);
if (nbyteswritten < 0 && get_errno() != EINTR)
nbyteswritten = nx_write(dev->fd, buffer, nsectors * dev->sectsize);
if (nbyteswritten < 0 && nbyteswritten != -EINTR)
{
_err("ERROR: Write failed: %d\n", get_errno());
return -get_errno();
_err("ERROR: nx_write failed: %d\n", nbyteswritten);
return nbyteswritten;
}
}
while (nbyteswritten < 0);