From 5e7b3c6533aae1bedce65c1b2dfc28a34cfe8161 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 7 Oct 2019 10:48:23 -0500 Subject: posix_devctl - Add support for SOCKCLOSE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The FACE Technical Standard, Edition 3.0 and later require the definition of the subcommand SOCKCLOSE in . Reference: ​https://www.opengroup.org/face closes #3856. --- testsuites/psxtests/psxdevctl01/test.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'testsuites/psxtests/psxdevctl01/test.c') diff --git a/testsuites/psxtests/psxdevctl01/test.c b/testsuites/psxtests/psxdevctl01/test.c index ed22ba8410..b45725cb58 100644 --- a/testsuites/psxtests/psxdevctl01/test.c +++ b/testsuites/psxtests/psxdevctl01/test.c @@ -76,6 +76,32 @@ int main( rtems_test_assert( status == -1 ); rtems_test_assert( errno == EBADF ); + puts( "posix_devctl() SOCKCLOSE on invalid file descriptor -- EBADF" ); + fd = 21; + dcmd = SOCKCLOSE; + dev_data_ptr = NULL; + nbyte = 0; + status = posix_devctl( fd, dcmd, dev_data_ptr, nbyte, NULL ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == EBADF ); + + /* + * Create a file, open it, and close it via posix_devctl(). + * Then verify it is really closed. + */ + puts( "posix_devctl() SOCKCLOSE on valid file descriptor -- OK" ); + fd = open("tmp_for_close", O_CREAT | O_RDWR, S_IRWXU ); + rtems_test_assert( fd != -1 ); + + dcmd = SOCKCLOSE; + dev_data_ptr = NULL; + nbyte = 0; + status = posix_devctl( fd, dcmd, dev_data_ptr, nbyte, NULL ); + rtems_test_assert( status == 0 ); + + status = close( fd ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == EBADF ); TEST_END(); exit(0); } -- cgit v1.2.3