diff options
author | Joel Sherrill <joel@rtems.org> | 2019-10-07 10:48:23 -0500 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2020-01-17 16:13:35 -0600 |
commit | 5e7b3c6533aae1bedce65c1b2dfc28a34cfe8161 (patch) | |
tree | 995a5d0b5a81e43a9759b3f75c89aa9744694a4d /cpukit/libcsupport/src | |
parent | bsp/raspberrypi: Updated the console API. (diff) | |
download | rtems-5e7b3c6533aae1bedce65c1b2dfc28a34cfe8161.tar.bz2 |
posix_devctl - Add support for SOCKCLOSE
The FACE Technical Standard, Edition 3.0 and later require the definition
of the subcommand SOCKCLOSE in <devctl.h>.
Reference: ​https://www.opengroup.org/face
closes #3856.
Diffstat (limited to 'cpukit/libcsupport/src')
-rw-r--r-- | cpukit/libcsupport/src/posix_devctl.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/cpukit/libcsupport/src/posix_devctl.c b/cpukit/libcsupport/src/posix_devctl.c index 415b94e278..0646ee4356 100644 --- a/cpukit/libcsupport/src/posix_devctl.c +++ b/cpukit/libcsupport/src/posix_devctl.c @@ -1,5 +1,6 @@ /* - * Copyright (c) 2016 Joel Sherrill <joel@rtems.org>. All rights reserved. + * Copyright (c) 2016, 2020 Joel Sherrill <joel@rtems.org>. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,6 +34,8 @@ #include <sys/ioctl.h> #include <rtems/seterr.h> +#include <unistd.h> + int posix_devctl( int fd, int dcmd, @@ -68,5 +71,16 @@ int posix_devctl( *dev_info_ptr = 0; } + /* + * The FACE Technical Standard Edition 3.0 and newer requires the SOCKCLOSE + * ioctl command. This is because the Security Profile does not include + * close() and applications need a way to close sockets. Closing sockets is + * a minimum requirement so using close() in the implementation meets that + * requirement but also lets the application close other file types. + */ + if (dcmd == SOCKCLOSE ) { + return close(fd); + } + return ioctl(fd, dcmd, dev_data_ptr); } |