summaryrefslogtreecommitdiff
path: root/StdLib/PosixLib/Gen
diff options
context:
space:
mode:
authorGuo Mang <mang.guo@intel.com>2017-08-02 09:54:47 +0800
committerGuo Mang <mang.guo@intel.com>2017-09-05 19:45:08 +0800
commit6c128c65b5ec0e5b8b5a0ccb165f3afd29e485f8 (patch)
tree444372d92a0ae8991fe4d15eb3937df43690dfda /StdLib/PosixLib/Gen
parentb207c6434d7a5a4502975d322312e07017e8a8cb (diff)
downloadedk2-platforms-6c128c65b5ec0e5b8b5a0ccb165f3afd29e485f8.tar.xz
Remove core packages since we can get them from edk2 repository
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang <mang.guo@intel.com>
Diffstat (limited to 'StdLib/PosixLib/Gen')
-rw-r--r--StdLib/PosixLib/Gen/LibGen.inf47
-rw-r--r--StdLib/PosixLib/Gen/access.c118
-rw-r--r--StdLib/PosixLib/Gen/closedir.c88
-rw-r--r--StdLib/PosixLib/Gen/dirname.c105
-rw-r--r--StdLib/PosixLib/Gen/opendir.c136
-rw-r--r--StdLib/PosixLib/Gen/readdir.c136
-rw-r--r--StdLib/PosixLib/Gen/utime.c73
7 files changed, 0 insertions, 703 deletions
diff --git a/StdLib/PosixLib/Gen/LibGen.inf b/StdLib/PosixLib/Gen/LibGen.inf
deleted file mode 100644
index 5a54686f6e..0000000000
--- a/StdLib/PosixLib/Gen/LibGen.inf
+++ /dev/null
@@ -1,47 +0,0 @@
-## @file
-# Library used for supplying glob POSIX routines.
-#
-# Copyright (c) 2011, Intel Corporation. All rights reserved. <BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010006
- BASE_NAME = LibGen
- FILE_GUID = CA599759-90A7-4fe4-BC8B-4B71C350DCAC
- MODULE_TYPE = UEFI_APPLICATION
- VERSION_STRING = 1.0
- LIBRARY_CLASS = LibGen|UEFI_APPLICATION UEFI_DRIVER
-
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources.common]
- dirname.c
- opendir.c
- closedir.c
- readdir.c
- access.c
- utime.c
-
-[Packages]
- MdePkg/MdePkg.dec
- StdLib/StdLib.dec
- StdLibPrivateInternalFiles/DoNotUse.dec
-
-[LibraryClasses]
- LibStdio
- LibString
- LibStdLib
-
-[Pcd]
diff --git a/StdLib/PosixLib/Gen/access.c b/StdLib/PosixLib/Gen/access.c
deleted file mode 100644
index 3031e4f942..0000000000
--- a/StdLib/PosixLib/Gen/access.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/** @file
- Implementation of the Posix access() function.
-
- Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials are licensed and made available under
- the terms and conditions of the BSD License that accompanies this distribution.
- The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-
-#include <ctype.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/syslimits.h>
-
-/** Save some typing later on. */
-#define GOOD_MODE (F_OK | X_OK | W_OK | R_OK)
-
-/** Determine accessibility of a file.
- The access() function checks the file, named by the pathname pointed to by
- the Path argument, for accessibility according to the bit pattern contained
- in Mode.
-
- The value of Mode is either the bitwise-inclusive OR of the access
- permissions to be checked (R_OK, W_OK, X_OK) or the existence test (F_OK).
-
- If Path ends in '/' or '\\', the target must be a directory, otherwise it doesn't matter.
- A file is executable if it is NOT a directory and it ends in ".efi".
-
- @param[in] Path Path or name of the file to be checked.
- @param[in] Mode Access permissions to check for.
-
- @retval 0 Successful completion.
- @retval -1 File is not accessible with the given Mode. The error condition
- is indicated by errno. Values of errno specific to the access
- function include: EACCES, ENOENT, ENOTDIR, ENAMETOOLONG
-**/
-int
-access(
- const char *Path,
- int Mode
- )
-{
- struct stat FileStat;
- int retval = -1;
- size_t PLength;
- uint32_t WantDir;
- uint32_t DirMatch;
-
- if((Path == NULL) || ((Mode & ~GOOD_MODE) != 0)) {
- errno = EINVAL;
- }
- else {
- PLength = strlen(Path);
- if(PLength > PATH_MAX) {
- errno = ENAMETOOLONG;
- }
- else {
- retval = stat(Path, &FileStat);
- if(retval == 0) {
- /* Path exists. FileStat now holds valid information. */
- WantDir = isDirSep(Path[PLength - 1]); // Does Path end in '/' or '\\' ?
- DirMatch = (! WantDir && (! S_ISDIR(FileStat.st_mode)));
-
- /* Test each permission individually. */
- do {
- if(Mode == F_OK) { /* Existence test. */
- if(DirMatch) { /* This is a directory or file as desired. */
- retval = 0;
- }
- else {
- /* Indicate why we failed the test. */
- errno = (WantDir) ? ENOTDIR : EISDIR;
- }
- break; /* F_OK does not combine with any other tests. */
- }
- if(Mode & R_OK) {
- if((FileStat.st_mode & READ_PERMS) == 0) {
- /* No read permissions.
- For UEFI, everything should have READ permissions.
- */
- errno = EDOOFUS; /* Programming Error. */
- break;
- }
- }
- if(Mode & W_OK) {
- if((FileStat.st_mode & WRITE_PERMS) == 0) {
- /* No write permissions. */
- errno = EACCES; /* Writing is not OK. */
- break;
- }
- }
- if(Mode & X_OK) {
- /* In EDK II, executable files end in ".efi" */
- if(strcmp(&Path[PLength-4], ".efi") != 0) {
- /* File is not an executable. */
- errno = EACCES;
- break;
- }
- }
- retval = 0;
- } while(FALSE);
- }
- else {
- /* File or path does not exist. */
- errno = ENOENT;
- }
- }
- }
- return retval;
-}
diff --git a/StdLib/PosixLib/Gen/closedir.c b/StdLib/PosixLib/Gen/closedir.c
deleted file mode 100644
index e5863b59ad..0000000000
--- a/StdLib/PosixLib/Gen/closedir.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/** @file
- Close an open directory.
-
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Copyright (c) 1983, 1993
- Regents of the University of California. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the University nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-
- NetBSD: closedir.c,v 1.15 2006/05/17 20:36:50 christos Exp
- closedir.c 8.1 (Berkeley) 6/10/93
-**/
-#include <sys/cdefs.h>
-
-#include <namespace.h>
-#include <reentrant.h>
-#include <extern.h>
-#include <sys/types.h>
-
-#include <assert.h>
-#include <dirent.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#ifdef __weak_alias
-__weak_alias(closedir,_closedir)
-#endif
-
-/*
- * close a directory.
- */
-int
-closedir(DIR *dirp)
-{
- int fd;
-
- _DIAGASSERT(dirp != NULL);
-
-#ifdef _REENTRANT
- if (__isthreaded)
- mutex_lock((mutex_t *)dirp->dd_lock);
-#endif
- fd = dirp->dd_fd;
- dirp->dd_fd = -1;
- dirp->dd_loc = 0;
- free(dirp->dd_buf);
-
-#ifdef _REENTRANT
- if (__isthreaded) {
- mutex_unlock((mutex_t *)dirp->dd_lock);
- mutex_destroy((mutex_t *)dirp->dd_lock);
- free(dirp->dd_lock);
- }
-#endif
- free((void *)dirp);
- return(close(fd));
-}
diff --git a/StdLib/PosixLib/Gen/dirname.c b/StdLib/PosixLib/Gen/dirname.c
deleted file mode 100644
index eb924d435c..0000000000
--- a/StdLib/PosixLib/Gen/dirname.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/** @file
-
- Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials are licensed and made available under
- the terms and conditions of the BSD License that accompanies this distribution.
- The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- * Copyright (c) 1997, 2002 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Klaus Klein and Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
-
- NetBSD: dirname.c,v 1.10 2008/05/10 22:39:40 christos Exp
- */
-#include <LibConfig.h>
-#include <sys/cdefs.h>
-
-#include <limits.h>
-#include <ctype.h>
-#include <string.h>
-
-#ifdef __weak_alias
-__weak_alias(dirname,_dirname)
-#endif
-
-#ifdef HAVE_DIRNAME
-char *
-dirname(char *path)
-{
- static char singledot[] = ".";
- static char result[PATH_MAX];
- const char *lastp;
- size_t len;
-
- /*
- * If `path' is a null pointer or points to an empty string,
- * return a pointer to the string ".".
- */
- if ((path == NULL) || (*path == '\0'))
- return (singledot);
-
- /* Strip trailing slashes, if any. */
- lastp = path + strlen(path) - 1;
- while (lastp != path && isDirSep(*lastp))
- lastp--;
-
- /* Terminate path at the last occurence of '/'. */
- do {
- if (isDirSep(*lastp)) {
- /* Strip trailing slashes, if any. */
- while (lastp != path && isDirSep(*lastp))
- lastp--;
-
- /* ...and copy the result into the result buffer.
- We make sure that there will be room for the terminating NUL
- and for a final '/', if necessary.
- */
- len = (lastp - path) + 1 /* last char */;
- if (len > (PATH_MAX - 2))
- len = PATH_MAX - 2;
-
- memcpy(result, path, len);
- if(*lastp == ':') { /* Have we stripped off all except the Volume name? */
- if(isDirSep(lastp[1])) { /* Was ...":/"... so we want the root of the volume. */
- result[len++] = '/';
- }
- else {
- result[len++] = '.';
- }
- }
- result[len] = '\0';
- return (result);
- }
- } while (--lastp >= path);
-
- /* No /'s found, return a pointer to the string ".". */
- return (singledot);
-}
-#endif
diff --git a/StdLib/PosixLib/Gen/opendir.c b/StdLib/PosixLib/Gen/opendir.c
deleted file mode 100644
index cb4ffbc477..0000000000
--- a/StdLib/PosixLib/Gen/opendir.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/** @file
- Open a directory.
-
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Copyright (c) 1983, 1993
- The Regents of the University of California. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the University nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-
- NetBSD: opendir.c,v 1.33 2008/01/10 09:49:04 elad Exp
- opendir.c 8.7 (Berkeley) 12/10/94
-**/
-#include <sys/cdefs.h>
-
-#include <namespace.h>
-#include <reentrant.h>
-#include <extern.h>
-#include <sys/param.h>
-//#include <sys/mount.h>
-#include <sys/stat.h>
-
-#include <assert.h>
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#define MAXITERATIONS 100
-
-/*
- * Open a directory.
- */
-DIR *
-opendir(const char *name)
-{
- _DIAGASSERT(name != NULL);
-
- return (__opendir2(name, DTF_HIDEW|DTF_NODUP));
-}
-
-DIR *
-__opendir2(const char *name, int flags)
-{
- DIR *dirp = NULL;
- int fd;
- int serrno;
- struct stat sb;
- int incr;
-
- _DIAGASSERT(name != NULL);
-
- if ((fd = open(name, O_RDONLY | O_NONBLOCK, 0)) == -1 ||
- fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
- goto error;
- if (fstat(fd, &sb) || !S_ISDIR(sb.st_mode)) {
- errno = ENOTDIR;
- goto error;
- }
- if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL)
- goto error;
- dirp->dd_buf = NULL;
-
- /*
- * If the machine's page size is an exact multiple of DIRBLKSIZ,
- * use a buffer that is cluster boundary aligned.
- * Hopefully this can be a big win someday by allowing page trades
- * to user space to be done by getdirentries()
- */
- incr = DIRBLKSIZ;
-
- dirp->dd_len = incr;
- dirp->dd_buf = malloc((size_t)dirp->dd_len);
- if (dirp->dd_buf == NULL)
- goto error;
- dirp->dd_seek = 0;
- flags &= ~DTF_REWIND;
-
- dirp->dd_loc = 0;
- dirp->dd_fd = fd;
- dirp->dd_flags = flags;
-
- /*
- * Set up seek point for rewinddir.
- */
-#ifdef _REENTRANT
- if (__isthreaded) {
- if ((dirp->dd_lock = malloc(sizeof(mutex_t))) == NULL)
- goto error;
- mutex_init((mutex_t *)dirp->dd_lock, NULL);
- }
-#endif
- dirp->dd_internal = NULL;
- return (dirp);
-error:
- serrno = errno;
- if (dirp && dirp->dd_buf)
- free(dirp->dd_buf);
- if (dirp)
- free(dirp);
- if (fd != -1)
- (void)close(fd);
- errno = serrno;
- return NULL;
-}
diff --git a/StdLib/PosixLib/Gen/readdir.c b/StdLib/PosixLib/Gen/readdir.c
deleted file mode 100644
index 13c4eaec07..0000000000
--- a/StdLib/PosixLib/Gen/readdir.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/** @file
- Get next entry in a directory.
-
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Copyright (c) 1983, 1993
- The Regents of the University of California. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the University nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-
- NetBSD: readdir.c,v 1.24 2008/05/04 18:53:26 tonnerre Exp
- readdir.c 8.3 (Berkeley) 9/29/94
- */
-#include <sys/cdefs.h>
-
-#include <namespace.h>
-#include <reentrant.h>
-#include <extern.h>
-#include <sys/param.h>
-#include <sys/stdint.h>
-
-#include <stdio.h>
-#include <dirent.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-/*
- * get next entry in a directory.
- */
-struct dirent *
-_readdir_unlocked(DIR *dirp, int skipdeleted)
-{
- struct dirent *dp;
-
-
- for (;;) {
- if (dirp->dd_loc >= dirp->dd_size) {
- if (dirp->dd_flags & __DTF_READALL)
- return (NULL);
- dirp->dd_loc = 0;
- }
- if (dirp->dd_loc == 0 && !(dirp->dd_flags & __DTF_READALL)) {
- dirp->dd_size = (long)read(dirp->dd_fd, dirp->dd_buf, (size_t)dirp->dd_len);
- if (dirp->dd_size <= 0)
- return (NULL);
- }
- dp = (struct dirent *) (void *)(dirp->dd_buf + (size_t)dirp->dd_loc);
- if ((intptr_t)dp & _DIRENT_ALIGN(dp))/* bogus pointer check */
- return (NULL);
- dirp->dd_loc += (long)dp->Size;
- if ((dp->Attribute & DT_HIDDEN) && (dirp->dd_flags & DTF_HIDEW))
- continue;
- return (dp);
- }
-}
-
-struct dirent *
-readdir(DIR *dirp)
-{
- struct dirent *dp;
-
-#ifdef _REENTRANT
- if (__isthreaded) {
- mutex_lock((mutex_t *)dirp->dd_lock);
- dp = _readdir_unlocked(dirp, 1);
- mutex_unlock((mutex_t *)dirp->dd_lock);
- }
- else
-#endif
- dp = _readdir_unlocked(dirp, 1);
- return (dp);
-}
-
-int
-readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
-{
- struct dirent *dp;
- int saved_errno;
-
- saved_errno = errno;
- errno = 0;
-#ifdef _REENTRANT
- if (__isthreaded) {
- mutex_lock((mutex_t *)dirp->dd_lock);
- if ((dp = _readdir_unlocked(dirp, 1)) != NULL)
- memcpy(entry, dp, (size_t)_DIRENT_SIZE(dp));
- mutex_unlock((mutex_t *)dirp->dd_lock);
- }
- else
-#endif
- if ((dp = _readdir_unlocked(dirp, 1)) != NULL)
- memcpy(entry, dp, (size_t)_DIRENT_SIZE(dp));
-
- if (errno != 0) {
- if (dp == NULL)
- return (errno);
- } else
- errno = saved_errno;
-
- if (dp != NULL)
- *result = entry;
- else
- *result = NULL;
-
- return (0);
-}
diff --git a/StdLib/PosixLib/Gen/utime.c b/StdLib/PosixLib/Gen/utime.c
deleted file mode 100644
index 9cb8b5b50b..0000000000
--- a/StdLib/PosixLib/Gen/utime.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/** @file
- Set file access and modification times.
-
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials are licensed and made available under
- the terms and conditions of the BSD License that accompanies this distribution.
- The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
-
- NetBSD: utime.c,v 1.12 2003/08/07 16:42:59 agc Exp
- utime.c 8.1 (Berkeley) 6/4/93
- */
-#include <LibConfig.h>
-#include <sys/EfiCdefs.h>
-
-#include "namespace.h"
-#include <sys/time.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stddef.h>
-#include <utime.h>
-
-int
-utime(
- const char *path,
- const struct utimbuf *times
- )
-{
- struct timeval tv[2], *tvp;
-
- _DIAGASSERT(path != NULL);
-
- if (times == (struct utimbuf *) NULL)
- tvp = NULL;
- else {
- tv[0].tv_sec = times->actime;
- tv[1].tv_sec = times->modtime;
- tv[0].tv_usec = tv[1].tv_usec = 0;
- tvp = tv;
- }
- return (utimes(path, tvp));
-}