9
0
Fork 0

The last checkin replaced some impossible error handling with DEBUGASSERT. Except that one of the case is actually possible in one cornercase and had to be restored

This commit is contained in:
Gregory Nutt 2013-09-28 15:37:16 -06:00
parent b2bb7e626f
commit e735773fe5
4 changed files with 25 additions and 13 deletions

View File

@ -165,6 +165,9 @@ I never did get networking to work on the sim target. It tries to use the tap d
(/dev/net/tun) to emulate an Ethernet NIC, but I never got it correctly integrated
with the NuttX networking (I probably should try using raw sockets instead).
Update: Max Holtzberg reports to me that the tap device actually does work properly,
but not in an NSH configuration because of stdio operations freeze the simulation.
X11 Issues
----------
There is an X11-based framebuffer driver that you can use exercise the NuttX graphics

View File

@ -80,7 +80,7 @@ off_t file_seek(FAR struct file *filep, off_t offset, int whence)
int ret;
int err = OK;
DEBUGASSERT(seekfile);
DEBUGASSERT(filep);
inode = filep->f_inode;
/* Invoke the file seek method if available */
@ -173,9 +173,6 @@ errout:
off_t lseek(int fd, off_t offset, int whence)
{
FAR struct filelist *list;
FAR struct file *filep;
FAR struct inode *inode;
int err;
/* Did we get a valid file descriptor? */
@ -184,15 +181,17 @@ off_t lseek(int fd, off_t offset, int whence)
set_errno(EBADF);
return (off_t)ERROR;
}
else
{
/* Get the thread-specific file list */
/* Get the thread-specific file list */
list = sched_getfiles();
DEBUGASSERT(list);
list = sched_getfiles();
DEBUGASSERT(list);
/* Then let file_seek do the real work */
/* Then let file_seek do the real work */
return file_seek(&list->fl_files[fd], offset, whence);
return file_seek(&list->fl_files[fd], offset, whence);
}
}
#endif

View File

@ -67,7 +67,17 @@ static inline ssize_t file_write(int fd, FAR const void *buf, size_t nbytes)
/* Get the thread-specific file list */
list = sched_getfiles();
DEBUGASSERT(list);
/* The file list can be NULL under one obscure cornercase: When memory
* management debug output is enabled. Then there may be attempts to
* write to stdout from malloc before the group data has been allocated.
*/
if (!list)
{
err = EAGAIN;
goto errout;
}
/* Was this file opened for write access? */

View File

@ -621,7 +621,7 @@ int lib_flushall(FAR struct streamlist *list);
ssize_t lib_sendfile(int outfd, int infd, off_t *offset, size_t count);
#endif
/* fs/fs_fileread.c *********************************************************/
/* fs/fs_read.c *************************************************************/
/****************************************************************************
* Name: file_read
*
@ -636,7 +636,7 @@ ssize_t lib_sendfile(int outfd, int infd, off_t *offset, size_t count);
ssize_t file_read(FAR struct file *filep, FAR void *buf, size_t nbytes);
#endif
/* fs/fs_fileread.c *********************************************************/
/* fs/fs_lseek.c ************************************************************/
/****************************************************************************
* Name: file_seek
*