Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
NuttX RTOS
Commits
ab815f91
Commit
ab815f91
authored
16 years ago
by
patacongo
Browse files
Options
Downloads
Patches
Plain Diff
Simplication
git-svn-id:
svn://svn.code.sf.net/p/nuttx/code/trunk@794
42af7a65-404d-4744-a932-0658087f49c3
parent
2d52cdfa
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fs/fs_close.c
+0
-18
0 additions, 18 deletions
fs/fs_close.c
fs/fs_files.c
+19
-8
19 additions, 8 deletions
fs/fs_files.c
with
19 additions
and
26 deletions
fs/fs_close.c
+
0
−
18
View file @
ab815f91
...
...
@@ -81,7 +81,6 @@ int close(int fd)
{
int
err
;
#if CONFIG_NFILE_DESCRIPTORS > 0
FAR
struct
filelist
*
list
;
int
ret
;
/* Did we get a valid file descriptor? */
...
...
@@ -105,23 +104,6 @@ int close(int fd)
}
#if CONFIG_NFILE_DESCRIPTORS > 0
/* Get the thread-specific file list */
list
=
sched_getfiles
();
if
(
!
list
)
{
err
=
EMFILE
;
goto
errout
;
}
/* If the file was properly opened, there should be an inode assigned */
if
(
!
list
->
fl_files
[
fd
].
f_inode
)
{
err
=
EBADF
;
goto
errout
;
}
/* Close the driver or mountpoint. NOTES: (1) there is no
* exclusion mechanism here , the driver or mountpoint must be
* able to handle concurrent operations internally, (2) The driver
...
...
This diff is collapsed.
Click to expand it.
fs/fs_files.c
+
19
−
8
View file @
ab815f91
...
...
@@ -399,18 +399,29 @@ int files_allocate(FAR struct inode *inode, int oflags, off_t pos)
int
files_close
(
int
filedes
)
{
FAR
struct
filelist
*
list
;
int
ret
=
-
EBADF
;
int
ret
;
/* Get the thread-specific file list */
list
=
sched_getfiles
();
if
(
list
)
if
(
!
list
)
{
if
(
filedes
>=
0
&&
filedes
<
CONFIG_NFILE_DESCRIPTORS
)
{
_files_semtake
(
list
);
ret
=
_files_close
(
&
list
->
fl_files
[
filedes
]);
_files_semgive
(
list
);
}
return
-
EMFILE
;
}
/* If the file was properly opened, there should be an inode assigned */
if
(
filedes
<
0
||
filedes
>=
CONFIG_NFILE_DESCRIPTORS
||
!
list
->
fl_files
[
filedes
].
f_inode
)
{
return
-
EBADF
;
}
/* Perform the protected close operation */
_files_semtake
(
list
);
ret
=
_files_close
(
&
list
->
fl_files
[
filedes
]);
_files_semgive
(
list
);
return
ret
;
}
/****************************************************************************
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment