Index: testsuites/psxtests/Makefile.am
===================================================================
--- testsuites/psxtests/Makefile.am	(revision 89bff5aeb5acbff71d632ce5cb678a1012fa8221)
+++ testsuites/psxtests/Makefile.am	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
@@ -1083,5 +1083,16 @@
 	psxhdrs/sys/socket/sendto.c psxhdrs/sys/socket/setsockopt.c \
 	psxhdrs/sys/socket/shutdown.c psxhdrs/sys/socket/socket.c \
-	psxhdrs/sys/socket/socketpair.c
+	psxhdrs/sys/socket/socketpair.c \
+	psxhdrs/dirent/alphasort.c \
+	psxhdrs/dirent/closedir.c \
+	psxhdrs/dirent/dirfd.c \
+	psxhdrs/dirent/fdopendir.c \
+	psxhdrs/dirent/opendir.c \
+	psxhdrs/dirent/readdir.c \
+	psxhdrs/dirent/readdir_r.c \
+	psxhdrs/dirent/rewinddir.c \
+	psxhdrs/dirent/scandir.c \
+	psxhdrs/dirent/seekdir.c \
+	psxhdrs/dirent/telldir.c
 endif
 
Index: testsuites/psxtests/psxhdrs/dirent/alphasort.c
===================================================================
--- testsuites/psxtests/psxhdrs/dirent/alphasort.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
+++ testsuites/psxtests/psxhdrs/dirent/alphasort.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief alphasort() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <dirent.h>
+
+  int test( void );
+
+  int test( void )
+  {
+    const struct dirent **d1 = NULL;
+    const struct dirent **d2 = NULL;
+    int result;
+
+    result = alphasort( d1, d2 );
+
+    return result;
+  }
Index: testsuites/psxtests/psxhdrs/dirent/closedir.c
===================================================================
--- testsuites/psxtests/psxhdrs/dirent/closedir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
+++ testsuites/psxtests/psxhdrs/dirent/closedir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief closedir() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <dirent.h>
+
+  int test( void );
+
+  int test( void )
+  {
+    DIR *dir;
+    int result;
+
+    dir = opendir( "/" );
+    result = closedir( dir );
+
+    return result;
+  }
Index: testsuites/psxtests/psxhdrs/dirent/dirfd.c
===================================================================
--- testsuites/psxtests/psxhdrs/dirent/dirfd.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
+++ testsuites/psxtests/psxhdrs/dirent/dirfd.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief dirfd() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <dirent.h>
+
+  int test( void );
+
+  int test( void )
+  {
+    DIR *dirp;
+    int result;
+
+    dirp = opendir( "/" );
+    result = dirfd( dirp );
+
+    return result;
+  }
Index: testsuites/psxtests/psxhdrs/dirent/fdopendir.c
===================================================================
--- testsuites/psxtests/psxhdrs/dirent/fdopendir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
+++ testsuites/psxtests/psxhdrs/dirent/fdopendir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
@@ -0,0 +1,49 @@
+/**
+ *  @file
+ *  @brief fdopendir() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <dirent.h>
+  #include <fcntl.h>
+  #include <sys/stat.h>
+  #include <sys/types.h>
+
+  int test( void );
+
+  int pass = 1;
+
+  int test( void )
+  {
+    int fd;
+    DIR *result;
+
+    if( pass == 1 )
+    {
+      fd = open( "./", O_RDONLY );
+      result = fdopendir( fd );
+      (void) result;
+      pass = 0;
+    }
+
+    return pass;
+  }
Index: testsuites/psxtests/psxhdrs/dirent/opendir.c
===================================================================
--- testsuites/psxtests/psxhdrs/dirent/opendir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
+++ testsuites/psxtests/psxhdrs/dirent/opendir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
@@ -0,0 +1,44 @@
+/**
+ *  @file
+ *  @brief opendir() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <dirent.h>
+
+  int test( void );
+
+  int result = 1;
+
+  int test( void )
+  {
+    DIR *dir;
+
+    if( result == 1 )
+    {
+      dir = opendir( "/" );
+      (void) dir;
+      result = 0;
+    }
+
+    return result;
+  }
Index: testsuites/psxtests/psxhdrs/dirent/readdir.c
===================================================================
--- testsuites/psxtests/psxhdrs/dirent/readdir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
+++ testsuites/psxtests/psxhdrs/dirent/readdir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
@@ -0,0 +1,45 @@
+/**
+ *  @file
+ *  @brief readdir() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <dirent.h>
+
+  int test( void );
+  int pass = 1;
+
+  int test( void )
+  {
+    DIR *dirp;
+    struct dirent *result;
+
+    if( pass == 1 )
+    {
+      dirp = opendir( "/" );
+      result = readdir( dirp );
+      (void) result;
+      pass = 0;
+    }
+
+    return pass;
+  }
Index: testsuites/psxtests/psxhdrs/dirent/readdir_r.c
===================================================================
--- testsuites/psxtests/psxhdrs/dirent/readdir_r.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
+++ testsuites/psxtests/psxhdrs/dirent/readdir_r.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
@@ -0,0 +1,42 @@
+/**
+ *  @file
+ *  @brief readdir_r() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <dirent.h>
+
+  int test( void );
+
+  int test( void )
+  {
+    DIR *dirp;
+    struct dirent *entry = NULL;
+    struct dirent *result = NULL;
+    int pass;
+
+    dirp = opendir( "/" );
+    entry = readdir(dirp);
+    pass = readdir_r( dirp,  entry, &result);
+
+    return pass;
+  }
Index: testsuites/psxtests/psxhdrs/dirent/rewinddir.c
===================================================================
--- testsuites/psxtests/psxhdrs/dirent/rewinddir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
+++ testsuites/psxtests/psxhdrs/dirent/rewinddir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
@@ -0,0 +1,43 @@
+/**
+ *  @file
+ *  @brief rewinddir() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <dirent.h>
+
+  int test( void );
+  int result = 1;
+
+  int test( void )
+  {
+    DIR *dirp;
+
+    if( result == 1 )
+    {
+    dirp = opendir( "/" );
+    rewinddir( dirp );
+    result = 0;
+    }
+
+    return result;
+  }
Index: testsuites/psxtests/psxhdrs/dirent/scandir.c
===================================================================
--- testsuites/psxtests/psxhdrs/dirent/scandir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
+++ testsuites/psxtests/psxhdrs/dirent/scandir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
@@ -0,0 +1,38 @@
+/**
+ *  @file
+ *  @brief scandir() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <dirent.h>
+
+  int test( void );
+
+  int test( void )
+  {
+    struct dirent **namelist;
+    int result;
+
+    result = scandir( ".", &namelist, NULL, alphasort );
+
+    return result;
+  }
Index: testsuites/psxtests/psxhdrs/dirent/seekdir.c
===================================================================
--- testsuites/psxtests/psxhdrs/dirent/seekdir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
+++ testsuites/psxtests/psxhdrs/dirent/seekdir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
@@ -0,0 +1,45 @@
+/**
+ *  @file
+ *  @brief seekdir() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <dirent.h>
+
+  int test( void );
+  int result = 1;
+
+  int test( void )
+  {
+    DIR *dirp;
+    long loc;
+
+    if( result == 1 )
+    {
+      dirp = opendir( "/" );
+      loc = telldir( dirp );
+      seekdir( dirp, loc );
+      result = 0;
+    }
+
+    return result;
+  }
Index: testsuites/psxtests/psxhdrs/dirent/telldir.c
===================================================================
--- testsuites/psxtests/psxhdrs/dirent/telldir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
+++ testsuites/psxtests/psxhdrs/dirent/telldir.c	(revision 27a8fc56ee036c5e8f0303ef35dde1f3b0fb755b)
@@ -0,0 +1,45 @@
+/**
+ *  @file
+ *  @brief telldir() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <dirent.h>
+
+  int test( void );
+  int result = 1;
+
+  int test( void )
+  {
+    DIR *dirp;
+    long loc;
+
+    if( result == 1 )
+    {
+      dirp = opendir( "/" );
+      loc = telldir( dirp );
+      (void) loc;
+      result = 0;
+    }
+
+    return result;
+  }
