libc: Cleanup FreeBSD files
Remove code specific to FreeBSD so that they can be used in this
repository.
Change-Id: I5c11eb5b3c05a7fb91aed08371a1f7a0e6122a94
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
diff --git a/include/lib/libc/errno.h b/include/lib/libc/errno.h
index ad140ab..029912f 100644
--- a/include/lib/libc/errno.h
+++ b/include/lib/libc/errno.h
@@ -36,17 +36,13 @@
* @(#)errno.h 8.5 (Berkeley) 1/21/94
* $FreeBSD$
*/
+/*
+ * Portions copyright (c) 2018, ARM Limited and Contributors.
+ * All rights reserved.
+ */
-#ifndef _SYS_ERRNO_H_
-#define _SYS_ERRNO_H_
-
-#if !defined(_KERNEL) && !defined(_STANDALONE)
-#include <sys/cdefs.h>
-__BEGIN_DECLS
-int * __error(void);
-__END_DECLS
-#define errno (* __error())
-#endif
+#ifndef ERRNO_H
+#define ERRNO_H
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
@@ -63,9 +59,7 @@
#define ENOMEM 12 /* Cannot allocate memory */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
-#ifndef _POSIX_SOURCE
#define ENOTBLK 15 /* Block device required */
-#endif
#define EBUSY 16 /* Device busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
@@ -76,9 +70,7 @@
#define ENFILE 23 /* Too many open files in system */
#define EMFILE 24 /* Too many open files */
#define ENOTTY 25 /* Inappropriate ioctl for device */
-#ifndef _POSIX_SOURCE
#define ETXTBSY 26 /* Text file busy */
-#endif
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Illegal seek */
@@ -92,7 +84,6 @@
/* non-blocking and interrupt i/o */
#define EAGAIN 35 /* Resource temporarily unavailable */
-#ifndef _POSIX_SOURCE
#define EWOULDBLOCK EAGAIN /* Operation would block */
#define EINPROGRESS 36 /* Operation now in progress */
#define EALREADY 37 /* Operation already in progress */
@@ -127,18 +118,14 @@
#define ECONNREFUSED 61 /* Connection refused */
#define ELOOP 62 /* Too many levels of symbolic links */
-#endif /* _POSIX_SOURCE */
#define ENAMETOOLONG 63 /* File name too long */
/* should be rearranged */
-#ifndef _POSIX_SOURCE
#define EHOSTDOWN 64 /* Host is down */
#define EHOSTUNREACH 65 /* No route to host */
-#endif /* _POSIX_SOURCE */
#define ENOTEMPTY 66 /* Directory not empty */
/* quotas & mush */
-#ifndef _POSIX_SOURCE
#define EPROCLIM 67 /* Too many processes */
#define EUSERS 68 /* Too many users */
#define EDQUOT 69 /* Disc quota exceeded */
@@ -151,12 +138,10 @@
#define EPROGUNAVAIL 74 /* RPC prog. not avail */
#define EPROGMISMATCH 75 /* Program version wrong */
#define EPROCUNAVAIL 76 /* Bad procedure for program */
-#endif /* _POSIX_SOURCE */
#define ENOLCK 77 /* No locks available */
#define ENOSYS 78 /* Function not implemented */
-#ifndef _POSIX_SOURCE
#define EFTYPE 79 /* Inappropriate file type or format */
#define EAUTH 80 /* Authentication error */
#define ENEEDAUTH 81 /* Need authenticator */
@@ -168,41 +153,17 @@
#define ENOATTR 87 /* Attribute not found */
#define EDOOFUS 88 /* Programming error */
-#endif /* _POSIX_SOURCE */
#define EBADMSG 89 /* Bad message */
#define EMULTIHOP 90 /* Multihop attempted */
#define ENOLINK 91 /* Link has been severed */
#define EPROTO 92 /* Protocol error */
-#ifndef _POSIX_SOURCE
#define ENOTCAPABLE 93 /* Capabilities insufficient */
#define ECAPMODE 94 /* Not permitted in capability mode */
#define ENOTRECOVERABLE 95 /* State not recoverable */
#define EOWNERDEAD 96 /* Previous owner died */
-#endif /* _POSIX_SOURCE */
-#ifndef _POSIX_SOURCE
#define ELAST 96 /* Must be equal largest errno */
-#endif /* _POSIX_SOURCE */
-#if defined(_KERNEL) || defined(_WANT_KERNEL_ERRNO)
-/* pseudo-errors returned inside kernel to modify return to process */
-#define ERESTART (-1) /* restart syscall */
-#define EJUSTRETURN (-2) /* don't modify regs, just return */
-#define ENOIOCTL (-3) /* ioctl not handled by this layer */
-#define EDIRIOCTL (-4) /* do direct ioctl in GEOM */
-#define ERELOOKUP (-5) /* retry the directory lookup */
-#endif
-
-#ifndef _KERNEL
-#if __EXT1_VISIBLE
-/* ISO/IEC 9899:2011 K.3.2.2 */
-#ifndef _ERRNO_T_DEFINED
-#define _ERRNO_T_DEFINED
-typedef int errno_t;
-#endif
-#endif /* __EXT1_VISIBLE */
-#endif
-
-#endif
+#endif /* ERRNO_H */