Fix wait loop and void cast (#24)

* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
This commit is contained in:
Xiang Xiao
2020-01-02 10:49:34 -06:00
committed by Gregory Nutt
parent 316675f4db
commit 6a3c2aded6
1602 changed files with 6311 additions and 10874 deletions
+3 -3
View File
@@ -144,14 +144,14 @@ int aio_cancel(int fildes, FAR struct aiocb *aiocbp)
/* Remove the container from the list of pending transfers */
pid = aioc->aioc_pid;
(void)aioc_decant(aioc);
aioc_decant(aioc);
aiocbp->aio_result = -ECANCELED;
ret = AIO_CANCELED;
/* Signal the client */
(void)aio_signal(pid, aiocbp);
aio_signal(pid, aiocbp);
}
else
{
@@ -211,7 +211,7 @@ int aio_cancel(int fildes, FAR struct aiocb *aiocbp)
/* Signal the client */
(void)aio_signal(pid, aiocbp);
aio_signal(pid, aiocbp);
}
else
{
+1 -1
View File
@@ -109,7 +109,7 @@ static void aio_fsync_worker(FAR void *arg)
/* Signal the client */
(void)aio_signal(pid, aiocbp);
aio_signal(pid, aiocbp);
#ifdef CONFIG_PRIORITY_INHERITANCE
/* Restore the low priority worker thread default priority */
+5 -32
View File
@@ -109,9 +109,9 @@ void aio_initialize(void)
/* Initialize counting semaphores */
(void)nxsem_init(&g_aioc_freesem, 0, CONFIG_FS_NAIOC);
(void)nxsem_setprotocol(&g_aioc_freesem, SEM_PRIO_NONE);
(void)nxsem_init(&g_aio_exclsem, 0, 1);
nxsem_init(&g_aioc_freesem, 0, CONFIG_FS_NAIOC);
nxsem_setprotocol(&g_aioc_freesem, SEM_PRIO_NONE);
nxsem_init(&g_aio_exclsem, 0, 1);
g_aio_holder = INVALID_PROCESS_ID;
@@ -159,21 +159,7 @@ void aio_lock(void)
}
else
{
int ret;
/* No.. take the semaphore */
do
{
ret = nxsem_wait(&g_aio_exclsem);
/* The only case that an error should occur here is if the wait
* was awakened by a signal.
*/
DEBUGASSERT(ret == OK || ret == -EINTR);
}
while (ret == -EINTR);
nxsem_wait_uninterruptible(&g_aio_exclsem);
/* And mark it as ours */
@@ -226,25 +212,12 @@ void aio_unlock(void)
FAR struct aio_container_s *aioc_alloc(void)
{
FAR struct aio_container_s *aioc;
int ret;
/* Take a count from semaphore, thus guaranteeing that we have an AIO
* container set aside for us.
*/
do
{
/* Take the semaphore (perhaps waiting) */
ret = nxsem_wait(&g_aioc_freesem);
/* The only case that an error should occur here is if the wait was
* awakened by a signal.
*/
DEBUGASSERT(ret == OK || ret == -EINTR);
}
while (ret == -EINTR);
nxsem_wait_uninterruptible(&g_aioc_freesem);
/* Get our AIO container */
+1 -1
View File
@@ -137,7 +137,7 @@ static void aio_read_worker(FAR void *arg)
/* Signal the client */
(void)aio_signal(pid, aiocbp);
aio_signal(pid, aiocbp);
#ifdef CONFIG_PRIORITY_INHERITANCE
/* Restore the low priority worker thread default priority */
+1 -1
View File
@@ -164,7 +164,7 @@ errout:
/* Signal the client */
(void)aio_signal(pid, aiocbp);
aio_signal(pid, aiocbp);
#ifdef CONFIG_PRIORITY_INHERITANCE
/* Restore the low priority worker thread default priority */
+2 -12
View File
@@ -101,17 +101,7 @@ static FAR char *unique_chardev(void)
{
/* Get the semaphore protecting the path number */
do
{
ret = nxsem_wait(&g_devno_sem);
/* The only case that an error should occur here is if the wait
* was awakened by a signal.
*/
DEBUGASSERT(ret == OK || ret == -EINTR);
}
while (ret == -EINTR);
nxsem_wait_uninterruptible(&g_devno_sem);
/* Get the next device number and release the semaphore */
@@ -231,7 +221,7 @@ int block_proxy(FAR const char *blkdev, int oflags)
return fd;
errout_with_bchdev:
(void)unlink(chardev);
unlink(chardev);
errout_with_chardev:
kmm_free(chardev);
+1 -11
View File
@@ -96,17 +96,7 @@ static FAR char *unique_blkdev(void)
{
/* Get the semaphore protecting the path number */
do
{
ret = nxsem_wait(&g_devno_sem);
/* The only case that an error should occur here is if the wait
* was awakened by a signal.
*/
DEBUGASSERT(ret == OK || ret == -EINTR);
}
while (ret == -EINTR);
nxsem_wait_uninterruptible(&g_devno_sem);
/* Get the next device number and release the semaphore */
+4 -4
View File
@@ -625,7 +625,7 @@ fat_read_restart:
* the safest thing to do is just invalidate it
*/
(void)fat_ffcacheinvalidate(fs, ff);
fat_ffcacheinvalidate(fs, ff);
/* Read all of the sectors directly into user memory */
@@ -885,7 +885,7 @@ fat_write_restart:
* and invalidate the current cache content.
*/
(void)fat_ffcacheinvalidate(fs, ff);
fat_ffcacheinvalidate(fs, ff);
/* Write all of the sectors directly from user memory */
@@ -1236,7 +1236,7 @@ static off_t fat_seek(FAR struct file *filep, off_t offset, int whence)
* into the cluster from the position
*/
(void)fat_currentsector(fs, ff, filep->f_pos);
fat_currentsector(fs, ff, filep->f_pos);
/* Load the sector corresponding to the position */
@@ -2181,7 +2181,7 @@ static int fat_unbind(FAR void *handle, FAR struct inode **blkdriver,
{
if (inode->u.i_bops && inode->u.i_bops->close)
{
(void)inode->u.i_bops->close(inode);
inode->u.i_bops->close(inode);
}
/* We hold a reference to the block driver but should not but
+1 -1
View File
@@ -2261,7 +2261,7 @@ static int fat_putsfdirentry(struct fat_mountpt_s *fs,
/* Directory name info */
(void)fat_putsfname(fs, dirinfo);
fat_putsfname(fs, dirinfo);
/* Set the attribute attribute, write time, creation time */
+1 -15
View File
@@ -368,21 +368,7 @@ void fat_putuint32(FAR uint8_t *ptr, uint32_t value32)
void fat_semtake(struct fat_mountpt_s *fs)
{
int ret;
do
{
/* Take the semaphore (perhaps waiting) */
ret = nxsem_wait(&fs->fs_sem);
/* The only case that an error should occur here is if the wait was
* awakened by a signal.
*/
DEBUGASSERT(ret == OK || ret == -EINTR);
}
while (ret == -EINTR);
nxsem_wait_uninterruptible(&fs->fs_sem);
}
/****************************************************************************
+1 -15
View File
@@ -175,21 +175,7 @@ const struct mountpt_operations hostfs_operations =
void hostfs_semtake(FAR struct hostfs_mountpt_s *fs)
{
int ret;
do
{
/* Take the semaphore (perhaps waiting) */
ret = nxsem_wait(fs->fs_sem);
/* The only case that an error should occur here is if the wait was
* awakened by a signal.
*/
DEBUGASSERT(ret == OK || ret == -EINTR);
}
while (ret == -EINTR);
nxsem_wait_uninterruptible(fs->fs_sem);
}
/****************************************************************************
+3 -11
View File
@@ -333,18 +333,10 @@ static int hostfs_rpmsg_send_recv(uint32_t command, bool copy,
goto fail;
}
while (1)
ret = nxsem_wait_uninterruptible(&cookie.sem);
if (ret == 0)
{
ret = nxsem_wait(&cookie.sem);
if (ret != -EINTR)
{
if (ret == 0)
{
ret = cookie.result;
}
break;
}
ret = cookie.result;
}
fail:
+1 -15
View File
@@ -58,21 +58,7 @@
static inline void _files_semtake(FAR struct filelist *list)
{
int ret;
do
{
/* Take the semaphore (perhaps waiting) */
ret = nxsem_wait(&list->fl_sem);
/* The only case that an error should occur here is if the wait was
* awakened by a signal.
*/
DEBUGASSERT(ret == OK || ret == -EINTR);
}
while (ret == -EINTR);
nxsem_wait_uninterruptible(&list->fl_sem);
}
/****************************************************************************
+1 -1
View File
@@ -102,7 +102,7 @@ int file_open(FAR struct file *filep, FAR const char *path, int oflags, ...)
ret = file_detach(fd, filep);
if (ret < 0)
{
(void)close(fd);
close(fd);
return ret;
}
+4 -18
View File
@@ -62,21 +62,7 @@
static void _files_semtake(FAR struct filelist *list)
{
int ret;
do
{
/* Take the semaphore (perhaps waiting) */
ret = nxsem_wait(&list->fl_sem);
/* The only case that an error should occur here is if the wait was
* awakened by a signal.
*/
DEBUGASSERT(ret == OK || ret == -EINTR);
}
while (ret == -EINTR);
nxsem_wait_uninterruptible(&list->fl_sem);
}
/****************************************************************************
@@ -157,7 +143,7 @@ void files_initlist(FAR struct filelist *list)
/* Initialize the list access mutex */
(void)nxsem_init(&list->fl_sem, 0, 1);
nxsem_init(&list->fl_sem, 0, 1);
}
/****************************************************************************
@@ -181,12 +167,12 @@ void files_releaselist(FAR struct filelist *list)
for (i = 0; i < CONFIG_NFILE_DESCRIPTORS; i++)
{
(void)_files_close(&list->fl_files[i]);
_files_close(&list->fl_files[i]);
}
/* Destroy the semaphore */
(void)nxsem_destroy(&list->fl_sem);
nxsem_destroy(&list->fl_sem);
}
/****************************************************************************
+2 -14
View File
@@ -99,7 +99,7 @@ void inode_initialize(void)
* inode tree).
*/
(void)nxsem_init(&g_inode_sem.sem, 0, 1);
nxsem_init(&g_inode_sem.sem, 0, 1);
g_inode_sem.holder = NO_HOLDER;
g_inode_sem.count = 0;
@@ -140,19 +140,7 @@ void inode_semtake(void)
else
{
int ret;
do
{
ret = nxsem_wait(&g_inode_sem.sem);
/* The only case that an error should occur here is if the wait
* was awakened by a signal.
*/
DEBUGASSERT(ret == OK || ret == -EINTR);
}
while (ret == -EINTR);
nxsem_wait_uninterruptible(&g_inode_sem.sem);
/* No we hold the semaphore */
+2 -2
View File
@@ -553,8 +553,8 @@ int inode_search(FAR struct inode_search_s *desc)
if (desc->relpath != NULL && *desc->relpath != '\0')
{
(void)asprintf(&buffer, "%s/%s",
desc->linktgt, desc->relpath);
asprintf(&buffer, "%s/%s",
desc->linktgt, desc->relpath);
}
else
{
+1 -15
View File
@@ -188,21 +188,7 @@ const struct mountpt_operations littlefs_operations =
static void littlefs_semtake(FAR struct littlefs_mountpt_s *fs)
{
int ret;
do
{
/* Take the semaphore (perhaps waiting) */
ret = nxsem_wait(&fs->sem);
/* The only case that an error should occur here is if the wait was
* awakened by a signal.
*/
DEBUGASSERT(ret == OK || ret == -EINTR);
}
while (ret == -EINTR);
nxsem_wait_uninterruptible(&fs->sem);
}
/****************************************************************************
+5 -5
View File
@@ -429,7 +429,7 @@ static void automount_worker(FAR void *arg)
{
/* We are unmounting */
(void)automount_unmount(priv);
automount_unmount(priv);
}
/* Re-enable interrupts */
@@ -476,7 +476,7 @@ static int automount_interrupt(FAR const struct automount_lower_s *lower,
* there is no work to be canceled. No other errors are expected.
*/
(void)work_cancel(LPWORK, &priv->work);
work_cancel(LPWORK, &priv->work);
/* Set the media insertion/removal state */
@@ -502,7 +502,7 @@ static int automount_interrupt(FAR const struct automount_lower_s *lower,
{
/* Cancel any retry delays */
(void)wd_cancel(priv->wdog);
wd_cancel(priv->wdog);
}
return OK;
@@ -617,11 +617,11 @@ void automount_uninitialize(FAR void *handle)
/* Disable and detach interrupts */
AUTOMOUNT_DISABLE(lower);
(void)AUTOMOUNT_DETACH(lower);
AUTOMOUNT_DETACH(lower);
/* Release resources */
(void)wd_delete(priv->wdog);
wd_delete(priv->wdog);
/* And free the state structure */
+1 -1
View File
@@ -532,7 +532,7 @@ static ssize_t mount_read(FAR struct file *filep, FAR char *buffer,
/* Generate each entry in the routing table */
(void)foreach_mountpoint(handler, &info);
foreach_mountpoint(handler, &info);
ret = info.totalsize;
/* Update the file offset */
+1 -15
View File
@@ -128,21 +128,7 @@ static inline int nfs_pathsegment(FAR const char **path, FAR char *buffer,
void nfs_semtake(struct nfsmount *nmp)
{
int ret;
do
{
/* Take the semaphore (perhaps waiting) */
ret = nxsem_wait(&nmp->nm_sem);
/* The only case that an error should occur here is if the wait was
* awakened by a signal.
*/
DEBUGASSERT(ret == OK || ret == -EINTR);
}
while (ret == -EINTR);
nxsem_wait_uninterruptible(&nmp->nm_sem);
}
/****************************************************************************
+1 -1
View File
@@ -2226,7 +2226,7 @@ static int nfs_statfs(FAR struct inode *mountpt, FAR struct statfs *sbp)
sbp->f_type = NFS_SUPER_MAGIC;
(void)nfs_fsinfo(nmp);
nfs_fsinfo(nmp);
fsstat = &nmp->nm_msgbuffer.fsstat;
fsstat->fs.fsroot.length = txdr_unsigned(nmp->nm_fhsize);
+1 -1
View File
@@ -584,7 +584,7 @@ void rpcclnt_disconnect(struct rpcclnt *rpc)
{
if (rpc->rc_so != NULL)
{
(void)psock_close(rpc->rc_so);
psock_close(rpc->rc_so);
}
}
+2 -2
View File
@@ -315,7 +315,7 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
#ifdef CONFIG_CAN_PASS_STRUCTS
mem = kmm_mallinfo();
#else
(void)kmm_mallinfo(&mem);
kmm_mallinfo(&mem);
#endif
linesize = snprintf(procfile->line, MEMINFO_LINELEN,
@@ -341,7 +341,7 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
#ifdef CONFIG_CAN_PASS_STRUCTS
mem = kumm_mallinfo();
#else
(void)kumm_mallinfo(&mem);
kumm_mallinfo(&mem);
#endif
linesize = snprintf(procfile->line, MEMINFO_LINELEN,
+2 -2
View File
@@ -745,7 +745,7 @@ static ssize_t proc_loadavg(FAR struct proc_file_s *procfile,
* after the procfs entry was opened.
*/
(void)clock_cpuload(procfile->pid, &cpuload);
clock_cpuload(procfile->pid, &cpuload);
/* On the simulator, you may hit cpuload.total == 0, but probably never on
* real hardware.
@@ -1255,7 +1255,7 @@ static ssize_t proc_groupenv(FAR struct proc_file_s *procfile,
/* Generate output for each environment variable */
(void)env_foreach(group, proc_groupenv_callback, &info);
env_foreach(group, proc_groupenv_callback, &info);
return info.totalsize;
}
#endif
+1 -1
View File
@@ -1086,7 +1086,7 @@ static int romfs_unbind(FAR void *handle, FAR struct inode **blkdriver,
{
if (INODE_IS_BLOCK(inode) && inode->u.i_bops->close != NULL)
{
(void)inode->u.i_bops->close(inode);
inode->u.i_bops->close(inode);
}
/* We hold a reference to the block driver but should
+1 -15
View File
@@ -332,21 +332,7 @@ static inline int romfs_searchdir(struct romfs_mountpt_s *rm,
void romfs_semtake(struct romfs_mountpt_s *rm)
{
int ret;
do
{
/* Take the semaphore (perhaps waiting) */
ret = nxsem_wait(&rm->rm_sem);
/* The only case that an error should occur here is if the wait was
* awakened by a signal.
*/
DEBUGASSERT(ret == OK || ret == -EINTR);
}
while (ret == -EINTR);
nxsem_wait_uninterruptible(&rm->rm_sem);
}
/****************************************************************************
+5 -19
View File
@@ -75,21 +75,7 @@ static struct smartfs_mountpt_s *g_mounthead = NULL;
void smartfs_semtake(struct smartfs_mountpt_s *fs)
{
int ret;
do
{
/* Take the semaphore (perhaps waiting) */
ret = nxsem_wait(fs->fs_sem);
/* The only case that an error should occur here is if the wait was
* awakened by a signal.
*/
DEBUGASSERT(ret == OK || ret == -EINTR);
}
while (ret == -EINTR);
nxsem_wait_uninterruptible(fs->fs_sem);
}
/****************************************************************************
@@ -415,7 +401,7 @@ int smartfs_unmount(struct smartfs_mountpt_s *fs)
{
if (inode->u.i_bops && inode->u.i_bops->close)
{
(void)inode->u.i_bops->close(inode);
inode->u.i_bops->close(inode);
}
}
}
@@ -453,7 +439,7 @@ int smartfs_unmount(struct smartfs_mountpt_s *fs)
{
if (inode->u.i_bops && inode->u.i_bops->close)
{
(void)inode->u.i_bops->close(inode);
inode->u.i_bops->close(inode);
}
}
}
@@ -1914,7 +1900,7 @@ int smartfs_extendfile(FAR struct smartfs_mountpt_s *fs,
*/
savepos = sf->filepos;
(void)smartfs_seek_internal(fs, sf, 0, SEEK_END);
smartfs_seek_internal(fs, sf, 0, SEEK_END);
while (remaining > 0)
{
@@ -2091,7 +2077,7 @@ errout_with_buffer:
#endif
/* Restore the original file position */
(void)smartfs_seek_internal(fs, sf, savepos, SEEK_SET);
smartfs_seek_internal(fs, sf, savepos, SEEK_SET);
return ret;
}
+1 -1
View File
@@ -755,7 +755,7 @@ int spiffs_erase_block(FAR struct spiffs_s *fs, int16_t blkndx)
finfo("erase %08lx:%d\n",
(unsigned long)addr, SPIFFS_GEO_EBLOCK_SIZE(fs));
(void)spiffs_mtd_erase(fs, addr, SPIFFS_GEO_EBLOCK_SIZE(fs));
spiffs_mtd_erase(fs, addr, SPIFFS_GEO_EBLOCK_SIZE(fs));
addr += SPIFFS_GEO_EBLOCK_SIZE(fs);
size -= SPIFFS_GEO_EBLOCK_SIZE(fs);
+2 -14
View File
@@ -195,19 +195,7 @@ static void spiffs_lock_reentrant(FAR struct spiffs_sem_s *rsem)
else
{
int ret;
do
{
ret = nxsem_wait(&rsem->sem);
/* The only case that an error should occur here is if the wait
* was awakened by a signal.
*/
DEBUGASSERT(ret >= 0 || ret == -EINTR);
}
while (ret == -EINTR);
nxsem_wait_uninterruptible(&rsem->sem);
/* No we hold the semaphore */
@@ -1447,7 +1435,7 @@ static int spiffs_bind(FAR struct inode *mtdinode, FAR const void *data,
fs->lu_work = &work[SPIFFS_GEO_PAGE_SIZE(fs)];
fs->mtd_work = &work[2 * SPIFFS_GEO_PAGE_SIZE(fs)];
(void)nxsem_init(&fs->exclsem.sem, 0, 1);
nxsem_init(&fs->exclsem.sem, 0, 1);
/* Check the file system */
+1 -13
View File
@@ -228,19 +228,7 @@ static void tmpfs_lock_reentrant(FAR struct tmpfs_sem_s *sem)
else
{
int ret;
do
{
ret = nxsem_wait(&sem->ts_sem);
/* The only case that an error should occur here is if the wait
* was awakened by a signal.
*/
DEBUGASSERT(ret == OK || ret == -EINTR);
}
while (ret == -EINTR);
nxsem_wait_uninterruptible(&sem->ts_sem);
/* No we hold the semaphore */
+13 -22
View File
@@ -253,23 +253,14 @@ const struct mountpt_operations unionfs_operations =
static int unionfs_semtake(FAR struct unionfs_inode_s *ui, bool noint)
{
int ret;
do
if (noint)
{
ret = nxsem_wait(&ui->ui_exclsem);
if (ret < 0)
{
DEBUGASSERT(ret == -EINTR || ret == -ECANCELED);
if (!noint)
{
return ret;
}
}
return nxsem_wait_uninterruptible(&ui->ui_exclsem);
}
else
{
return nxsem_wait(&ui->ui_exclsem);
}
while (ret == -EINTR);
return ret;
}
/****************************************************************************
@@ -814,8 +805,8 @@ static void unionfs_destroy(FAR struct unionfs_inode_s *ui)
/* Unbind the contained file systems */
(void)unionfs_unbind_child(&ui->ui_fs[0]);
(void)unionfs_unbind_child(&ui->ui_fs[1]);
unionfs_unbind_child(&ui->ui_fs[0]);
unionfs_unbind_child(&ui->ui_fs[1]);
/* Free any allocated prefix strings */
@@ -946,7 +937,7 @@ static int unionfs_close(FAR struct file *filep)
/* Get exclusive access to the file system data structures */
(void)unionfs_semtake(ui, false);
unionfs_semtake(ui, false);
DEBUGASSERT(ui != NULL && filep->f_priv != NULL);
uf = (FAR struct unionfs_file_s *)filep->f_priv;
@@ -1620,7 +1611,7 @@ static int unionfs_closedir(FAR struct inode *mountpt,
/* Get exclusive access to the file system data structures */
(void)unionfs_semtake(ui, true);
unionfs_semtake(ui, true);
DEBUGASSERT(dir);
fu = &dir->u.unionfs;
@@ -2075,7 +2066,7 @@ static int unionfs_unbind(FAR void *handle, FAR struct inode **blkdriver,
/* Get exclusive access to the file system data structures */
(void)unionfs_semtake(ui, true);
unionfs_semtake(ui, true);
/* Mark the file system as unmounted. */
@@ -2754,8 +2745,8 @@ static int unionfs_dobind(FAR const char *fspath1, FAR const char *prefix1,
* this logic calls inode_release() in the unionfs_destroy() function.
*/
(void)inode_remove(fspath1);
(void)inode_remove(fspath2);
inode_remove(fspath1);
inode_remove(fspath2);
*handle = ui;
return OK;
+64 -64
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -86,7 +86,7 @@ int close(int fd)
/* close() is a cancellation point */
(void)enter_cancellation_point();
enter_cancellation_point();
/* Did we get a valid file descriptor? */
+1 -1
View File
@@ -285,7 +285,7 @@ int fcntl(int fd, int cmd, ...)
/* fcntl() is a cancellation point */
(void)enter_cancellation_point();
enter_cancellation_point();
/* Setup to access the variable argument list */
+1 -1
View File
@@ -222,7 +222,7 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR struct tcb_s *tcb)
#ifndef CONFIG_STDIO_DISABLE_BUFFERING
/* Initialize the semaphore the manages access to the buffer */
(void)nxsem_init(&stream->fs_sem, 0, 1);
nxsem_init(&stream->fs_sem, 0, 1);
#if CONFIG_STDIO_BUFFER_SIZE > 0
/* Allocate the IO buffer at the appropriate privilege level for
+1 -1
View File
@@ -110,7 +110,7 @@ int fsync(int fd)
/* fsync() is a cancellation point */
(void)enter_cancellation_point();
enter_cancellation_point();
/* Get the file structure corresponding to the file descriptor. */
+1 -1
View File
@@ -339,7 +339,7 @@ int open(FAR const char *path, int oflags, ...)
/* open() is a cancellation point */
(void)enter_cancellation_point();
enter_cancellation_point();
/* Let nx_vopen() do most of the work */
+5 -16
View File
@@ -72,18 +72,7 @@
static int poll_semtake(FAR sem_t *sem)
{
int ret;
/* Take the semaphore (perhaps waiting) */
ret = nxsem_wait(sem);
/* The only case that an error should occur here is if the wait were
* awakened by a signal.
*/
DEBUGASSERT(ret == OK || ret == -EINTR);
return ret;
return nxsem_wait(sem);
}
/****************************************************************************
@@ -204,16 +193,16 @@ static inline int poll_setup(FAR struct pollfd *fds, nfds_t nfds,
switch (fds[j].events & POLLMASK)
{
case POLLFD:
(void)poll_fdsetup(fds[j].fd, &fds[j], false);
poll_fdsetup(fds[j].fd, &fds[j], false);
break;
case POLLFILE:
(void)file_poll(fds[j].ptr, &fds[j], false);
file_poll(fds[j].ptr, &fds[j], false);
break;
#ifdef CONFIG_NET
case POLLSOCK:
(void)psock_poll(fds[j].ptr, &fds[j], false);
psock_poll(fds[j].ptr, &fds[j], false);
break;
#endif
@@ -452,7 +441,7 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
/* poll() is a cancellation point */
(void)enter_cancellation_point();
enter_cancellation_point();
/* This semaphore is used for signaling and, hence, should not have
* priority inheritance enabled.
+1 -1
View File
@@ -143,7 +143,7 @@ ssize_t pread(int fd, FAR void *buf, size_t nbytes, off_t offset)
/* pread() is a cancellation point */
(void)enter_cancellation_point();
enter_cancellation_point();
/* Get the file structure corresponding to the file descriptor. */
+1 -1
View File
@@ -146,7 +146,7 @@ ssize_t pwrite(int fd, FAR const void *buf, size_t nbytes, off_t offset)
/* pread() is a cancellation point */
(void)enter_cancellation_point();
enter_cancellation_point();
/* Get the file structure corresponding to the file descriptor. */
+1 -1
View File
@@ -199,7 +199,7 @@ ssize_t read(int fd, FAR void *buf, size_t nbytes)
/* read() is a cancellation point */
(void)enter_cancellation_point();
enter_cancellation_point();
/* Let nx_read() do the real work */
+1 -1
View File
@@ -122,7 +122,7 @@ ssize_t readlink(FAR const char *path, FAR char *buf, size_t bufsize)
/* Copy the link target pathto the user-provided buffer. */
*buf = '\0';
(void)strncpy(buf, node->u.i_link, bufsize);
strncpy(buf, node->u.i_link, bufsize);
/* Release our reference on the inode and return the length */
+7 -7
View File
@@ -115,7 +115,7 @@ static int pseudorename(FAR const char *oldpath, FAR struct inode *oldinode,
subdirname = basename((FAR char *)oldpath);
(void)asprintf(&subdir, "/%s", subdirname);
asprintf(&subdir, "/%s", subdirname);
if (subdir == NULL)
{
ret = -ENOMEM;
@@ -179,7 +179,7 @@ next_subdir:
tmp = subdir;
subdir = NULL;
(void)asprintf(&subdir, "%s/%s", newpath, subdirname);
asprintf(&subdir, "%s/%s", newpath, subdirname);
if (tmp != NULL)
{
@@ -213,7 +213,7 @@ next_subdir:
* won't really be removed until we call inode_release();
*/
(void)inode_remove(newpath);
inode_remove(newpath);
}
inode_release(newinode);
@@ -274,7 +274,7 @@ next_subdir:
{
/* Remove the new node we just recreated */
(void)inode_remove(newpath);
inode_remove(newpath);
goto errout_with_sem;
}
@@ -415,8 +415,8 @@ next_subdir:
FAR char *tmp = subdir;
subdir = NULL;
(void)asprintf(&subdir, "%s/%s", newrelpath,
subdirname);
asprintf(&subdir, "%s/%s", newrelpath,
subdirname);
if (tmp != NULL)
{
@@ -450,7 +450,7 @@ next_subdir:
* should check that.
*/
(void)oldinode->u.i_mops->unlink(oldinode, newrelpath);
oldinode->u.i_mops->unlink(oldinode, newrelpath);
}
}
}
+1 -1
View File
@@ -103,7 +103,7 @@ int select(int nfds, FAR fd_set *readfds, FAR fd_set *writefds,
/* select() is cancellation point */
(void)enter_cancellation_point();
enter_cancellation_point();
/* How many pollfd structures do we need to allocate? */
+1 -1
View File
@@ -232,7 +232,7 @@ ssize_t write(int fd, FAR const void *buf, size_t nbytes)
/* write() is a cancellation point */
(void)enter_cancellation_point();
enter_cancellation_point();
/* Let nx_write() do all of the work */