[rtems-libbsd commit] SOCKET(2): Add some FCNTL(2) support

Sebastian Huber sebh at rtems.org
Mon Dec 16 14:29:34 UTC 2013


Module:    rtems-libbsd
Branch:    master
Commit:    06ad80cbdadd3fb79da4f1245731f2c8a59f7ffd
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=06ad80cbdadd3fb79da4f1245731f2c8a59f7ffd

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Dec 13 16:14:43 2013 +0100

SOCKET(2): Add some FCNTL(2) support

---

 freebsd/sys/kern/sys_socket.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/freebsd/sys/kern/sys_socket.c b/freebsd/sys/kern/sys_socket.c
index 0877799..3508f94 100644
--- a/freebsd/sys/kern/sys_socket.c
+++ b/freebsd/sys/kern/sys_socket.c
@@ -470,6 +470,21 @@ rtems_bsd_soo_close(rtems_libio_t *iop)
 	return rtems_bsd_error_to_status_and_errno(error);
 }
 
+static int
+rtems_bsd_soo_fcntl(rtems_libio_t *iop, int cmd)
+{
+	int error = 0;
+
+	if (cmd == F_SETFL) {
+		struct file *fp = rtems_bsd_iop_to_fp(iop);
+		int nbio = iop->flags & LIBIO_FLAGS_NO_DELAY;
+
+		error = soo_ioctl(fp, FIONBIO, &nbio, NULL, NULL);
+	}
+
+	return rtems_bsd_error_to_status_and_errno(error);
+}
+
 const rtems_filesystem_file_handlers_r socketops = {
 	.open_h = rtems_filesystem_default_open,
 	.close_h = rtems_bsd_soo_close,
@@ -481,7 +496,7 @@ const rtems_filesystem_file_handlers_r socketops = {
 	.ftruncate_h = rtems_filesystem_default_ftruncate,
 	.fsync_h = rtems_filesystem_default_fsync_or_fdatasync,
 	.fdatasync_h = rtems_filesystem_default_fsync_or_fdatasync,
-	.fcntl_h = rtems_filesystem_default_fcntl,
+	.fcntl_h = rtems_bsd_soo_fcntl,
 	.poll_h = rtems_bsd_soo_poll,
 	.kqfilter_h = rtems_bsd_soo_kqfilter
 };




More information about the vc mailing list