summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/sys/filedesc.h
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys/sys/filedesc.h')
-rw-r--r--freebsd/sys/sys/filedesc.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/freebsd/sys/sys/filedesc.h b/freebsd/sys/sys/filedesc.h
index 579e5213..b1c3e24b 100644
--- a/freebsd/sys/sys/filedesc.h
+++ b/freebsd/sys/sys/filedesc.h
@@ -192,19 +192,20 @@ static inline int
falloc_caps(struct thread *td, struct file **resultfp, int *resultfd,
int flags, struct filecaps *fcaps)
{
- rtems_libio_t *iop = rtems_libio_allocate();
+ rtems_libio_t *iop;
- (void) td;
- (void) flags;
- (void) fcaps;
+ (void)td;
+ (void)flags;
+ (void)fcaps;
+ iop = rtems_libio_allocate();
*resultfp = rtems_bsd_iop_to_fp(iop);
if (iop != NULL) {
+ rtems_libio_iop_hold(iop);
iop->pathinfo.mt_entry = &rtems_filesystem_null_mt_entry;
rtems_filesystem_location_add_to_mt_entry(&iop->pathinfo);
*resultfd = rtems_libio_iop_to_descriptor(iop);
-
return (0);
} else {
return (ENFILE);
@@ -263,17 +264,14 @@ static inline int
fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
struct file **fpp, seq_t *seqp)
{
+ struct file *fp;
+
(void)fdp;
(void)needrightsp;
(void)seqp;
-
- *fpp = rtems_bsd_get_file(fd);
-
- if (*fpp != NULL) {
- return (0);
- } else {
- return (EBADF);
- }
+ fp = rtems_bsd_get_file(fd);
+ *fpp = fp;
+ return (fp != NULL ? 0 : EBADF);
}
#endif /* __rtems__ */