libs: nxstyle fixes
nxstyle fixes to pass the CI checks Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
parent
796ef13b20
commit
d6b50a1d3f
@ -33,6 +33,7 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -33,6 +33,7 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -78,19 +78,20 @@ int readdir_r(FAR DIR *dirp, FAR struct dirent *entry,
|
||||
tmp = readdir(dirp);
|
||||
if (!tmp)
|
||||
{
|
||||
int error = get_errno();
|
||||
if (!error)
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
*result = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return error;
|
||||
}
|
||||
int error = get_errno();
|
||||
if (!error)
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
*result = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
if (entry)
|
||||
@ -102,5 +103,6 @@ int readdir_r(FAR DIR *dirp, FAR struct dirent *entry,
|
||||
{
|
||||
*result = entry;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -32,9 +32,9 @@
|
||||
#ifndef __SWAP_UINT32_ISMACRO
|
||||
uint32_t __swap_uint32(uint32_t n)
|
||||
{
|
||||
return (uint32_t)(((((uint32_t)(n)) & 0x000000ffUL) << 24) |
|
||||
((((uint32_t)(n)) & 0x0000ff00UL) << 8) |
|
||||
((((uint32_t)(n)) & 0x00ff0000UL) >> 8) |
|
||||
((((uint32_t)(n)) & 0xff000000UL) >> 24));
|
||||
return (uint32_t)(((((uint32_t)(n)) & 0x000000fful) << 24) |
|
||||
((((uint32_t)(n)) & 0x0000ff00ul) << 8) |
|
||||
((((uint32_t)(n)) & 0x00ff0000ul) >> 8) |
|
||||
((((uint32_t)(n)) & 0xff000000ul) >> 24));
|
||||
}
|
||||
#endif
|
||||
|
@ -34,13 +34,13 @@
|
||||
#ifdef CONFIG_HAVE_LONG_LONG
|
||||
uint64_t __swap_uint64(uint64_t n)
|
||||
{
|
||||
return (uint64_t)(((((uint64_t)(n)) & 0x00000000000000ffULL) << 56) |
|
||||
((((uint64_t)(n)) & 0x000000000000ff00ULL) << 40) |
|
||||
((((uint64_t)(n)) & 0x0000000000ff0000ULL) << 24) |
|
||||
((((uint64_t)(n)) & 0x00000000ff000000ULL) << 8) |
|
||||
((((uint64_t)(n)) & 0x000000ff00000000ULL) >> 8) |
|
||||
((((uint64_t)(n)) & 0x0000ff0000000000ULL) >> 24) |
|
||||
((((uint64_t)(n)) & 0x00ff000000000000ULL) >> 40) |
|
||||
((((uint64_t)(n)) & 0xff00000000000000ULL) >> 56));
|
||||
return (uint64_t)(((((uint64_t)(n)) & 0x00000000000000ffull) << 56) |
|
||||
((((uint64_t)(n)) & 0x000000000000ff00ull) << 40) |
|
||||
((((uint64_t)(n)) & 0x0000000000ff0000ull) << 24) |
|
||||
((((uint64_t)(n)) & 0x00000000ff000000ull) << 8) |
|
||||
((((uint64_t)(n)) & 0x000000ff00000000ull) >> 8) |
|
||||
((((uint64_t)(n)) & 0x0000ff0000000000ull) >> 24) |
|
||||
((((uint64_t)(n)) & 0x00ff000000000000ull) >> 40) |
|
||||
((((uint64_t)(n)) & 0xff00000000000000ull) >> 56));
|
||||
}
|
||||
#endif
|
||||
|
@ -45,5 +45,6 @@ b16_t b16cos(b16_t rad)
|
||||
{
|
||||
rad -= b16TWOPI;
|
||||
}
|
||||
|
||||
return b16sin(rad);
|
||||
}
|
||||
|
@ -38,7 +38,8 @@
|
||||
|
||||
/****************************************************************************
|
||||
* Name: b16sin
|
||||
* Ref: http://lab.polygonal.de/2007/07/18/fast-and-accurate-sinecosine-approximation/
|
||||
* Ref:
|
||||
* lab.polygonal.de/2007/07/18/fast-and-accurate-sinecosine-approximation/
|
||||
****************************************************************************/
|
||||
|
||||
b16_t b16sin(b16_t rad)
|
||||
@ -54,29 +55,28 @@ b16_t b16sin(b16_t rad)
|
||||
rad += b16TWOPI;
|
||||
}
|
||||
else if (rad > b16PI)
|
||||
{
|
||||
{
|
||||
rad -= b16TWOPI;
|
||||
}
|
||||
}
|
||||
|
||||
/* tmp1 = 1.27323954 * rad
|
||||
* tmp2 = .405284735 * rad * rad
|
||||
*/
|
||||
|
||||
|
||||
tmp1 = b16mulb16(b16_1P27323954, rad);
|
||||
tmp2 = b16mulb16(b16_P405284735, b16sqr(rad));
|
||||
|
||||
if (rad < 0)
|
||||
{
|
||||
/* tmp3 = 1.27323954 * rad + .405284735 * rad * rad */
|
||||
/* tmp3 = 1.27323954 * rad + .405284735 * rad * rad */
|
||||
|
||||
tmp3 = tmp1 + tmp2;
|
||||
tmp3 = tmp1 + tmp2;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* tmp3 = 1.27323954 * rad - 0.405284735 * rad * rad */
|
||||
/* tmp3 = 1.27323954 * rad - 0.405284735 * rad * rad */
|
||||
|
||||
tmp3 = tmp1 - tmp2;
|
||||
tmp3 = tmp1 - tmp2;
|
||||
}
|
||||
|
||||
/* tmp1 = tmp3*tmp3 */
|
||||
|
@ -171,6 +171,7 @@ b16_t b16sqr(b16_t a)
|
||||
{
|
||||
sq = b16MAX;
|
||||
}
|
||||
|
||||
return sq;
|
||||
}
|
||||
|
||||
@ -236,7 +237,7 @@ ub16_t ub16divub16(ub16_t num, ub16_t denom)
|
||||
term1 = ((uint32_t)num & 0xffff0000) / denom;
|
||||
if (term1 >= 0x00010000)
|
||||
{
|
||||
return ub16MAX; /* Will overflow */
|
||||
return ub16MAX; /* Will overflow */
|
||||
}
|
||||
|
||||
/* Finish the division */
|
||||
@ -249,8 +250,9 @@ ub16_t ub16divub16(ub16_t num, ub16_t denom)
|
||||
|
||||
if (product < term1)
|
||||
{
|
||||
return ub16MAX; /* Overflowed */
|
||||
return ub16MAX; /* Overflowed */
|
||||
}
|
||||
|
||||
return product;
|
||||
}
|
||||
|
||||
|
@ -37,4 +37,8 @@
|
||||
struct group g_group;
|
||||
char g_group_buffer[GRPBUF_RESERVE_SIZE];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* CONFIG_LIBC_GROUP_FILE */
|
||||
|
@ -80,12 +80,13 @@ FAR char *basename(FAR char *path)
|
||||
/* Check for trailing slash characters */
|
||||
|
||||
len = strlen(path);
|
||||
while (path[len-1] == '/')
|
||||
while (path[len - 1] == '/')
|
||||
{
|
||||
/* Remove trailing '/' UNLESS this would make a zero length string */
|
||||
|
||||
if (len > 1)
|
||||
{
|
||||
path[len-1] = '\0';
|
||||
path[len - 1] = '\0';
|
||||
len--;
|
||||
}
|
||||
else
|
||||
|
@ -80,12 +80,13 @@ FAR char *dirname(FAR char *path)
|
||||
/* Check for trailing slash characters */
|
||||
|
||||
len = strlen(path);
|
||||
while (path[len-1] == '/')
|
||||
while (path[len - 1] == '/')
|
||||
{
|
||||
/* Remove trailing '/' UNLESS this would make a zero length string */
|
||||
|
||||
if (len > 1)
|
||||
{
|
||||
path[len-1] = '\0';
|
||||
path[len - 1] = '\0';
|
||||
len--;
|
||||
}
|
||||
else
|
||||
@ -102,8 +103,8 @@ FAR char *dirname(FAR char *path)
|
||||
p = strrchr(path, '/');
|
||||
if (p)
|
||||
{
|
||||
/* Handle the case where the only '/' in the string is the at the beginning
|
||||
* of the path.
|
||||
/* Handle the case where the only '/' in the string is the at the
|
||||
* beginning of the path.
|
||||
*/
|
||||
|
||||
if (p == path)
|
||||
|
@ -49,6 +49,7 @@
|
||||
FAR char *setlocale(int category, FAR const char *locale)
|
||||
{
|
||||
return ((locale == NULL || strcmp(locale, "POSIX") == 0 ||
|
||||
strcmp(locale, "C") == 0 || strcmp(locale, "") == 0) ? "C" : NULL);
|
||||
strcmp(locale, "C") == 0 || strcmp(locale, "") ==
|
||||
0) ? "C" : NULL);
|
||||
}
|
||||
#endif
|
||||
|
@ -1,28 +1,30 @@
|
||||
/****************************************************************************
|
||||
* libs/libc/lzf/lzf.h
|
||||
*
|
||||
* Copyright (c) 2000-2007 Marc Alexander Lehmann <schmorp@schmorp.de>
|
||||
* Copyright (c) 2000-2007
|
||||
* Author: Marc Alexander Lehmann <schmorp@schmorp.de>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modifica-
|
||||
* tion, are permitted provided that the following conditions are met:
|
||||
* 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.
|
||||
* 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 AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
|
||||
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
|
||||
* CIAL, 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 OTH-
|
||||
* ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@ -80,7 +82,7 @@ using namespace std;
|
||||
* and might also be slower. Default is to autodetect.
|
||||
*/
|
||||
|
||||
/*#define LZF_USER_OFFSETS autodetect */
|
||||
/* #define LZF_USER_OFFSETS autodetect */
|
||||
|
||||
#ifndef LZF_USE_OFFSETS
|
||||
# define LZF_USE_OFFSETS (UINTPTR_MAX > 0xffffffffU)
|
||||
|
@ -3,26 +3,27 @@
|
||||
*
|
||||
* Copyright (c) 2000-2010 Marc Alexander Lehmann <schmorp@schmorp.de>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modifica-
|
||||
* tion, are permitted provided that the following conditions are met:
|
||||
* 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.
|
||||
* 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 AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
|
||||
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
|
||||
* CIAL, 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 OTH-
|
||||
* ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPE- CIAL, 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@ -208,10 +209,10 @@ size_t lzf_compress(FAR const void *const in_data,
|
||||
}
|
||||
}
|
||||
|
||||
op[- lit - 1] = lit - 1; /* Stop run */
|
||||
op -= !lit; /* Undo run if length is zero */
|
||||
op[(- lit) - 1] = lit - 1; /* Stop run */
|
||||
op -= !lit; /* Undo run if length is zero */
|
||||
|
||||
for (;;)
|
||||
for (; ; )
|
||||
{
|
||||
if (expect_true(maxlen > 16))
|
||||
{
|
||||
@ -330,7 +331,7 @@ size_t lzf_compress(FAR const void *const in_data,
|
||||
}
|
||||
else
|
||||
{
|
||||
*op++ = (off >> 8) + ( 7 << 5);
|
||||
*op++ = (off >> 8) + (7 << 5);
|
||||
*op++ = len - 7;
|
||||
}
|
||||
|
||||
@ -388,8 +389,8 @@ size_t lzf_compress(FAR const void *const in_data,
|
||||
|
||||
if (expect_false(lit == MAX_LIT))
|
||||
{
|
||||
op[- lit - 1] = lit - 1; /* Stop run */
|
||||
lit = 0; /* Start run */
|
||||
op[(- lit) - 1] = lit - 1; /* Stop run */
|
||||
lit = 0; /* Start run */
|
||||
op++;
|
||||
}
|
||||
}
|
||||
@ -409,14 +410,14 @@ size_t lzf_compress(FAR const void *const in_data,
|
||||
|
||||
if (expect_false(lit == MAX_LIT))
|
||||
{
|
||||
op[- lit - 1] = lit - 1; /* Stop run */
|
||||
lit = 0; /* Start run */
|
||||
op[(- lit) - 1] = lit - 1; /* Stop run */
|
||||
lit = 0; /* Start run */
|
||||
op++;
|
||||
}
|
||||
}
|
||||
|
||||
op[- lit - 1] = lit - 1; /* End run */
|
||||
op -= !lit; /* Undo run if length is zero */
|
||||
op[(- lit) - 1] = lit - 1; /* End run */
|
||||
op -= !lit; /* Undo run if length is zero */
|
||||
|
||||
cs = op - (uint8_t *)out_data;
|
||||
|
||||
|
@ -1,28 +1,30 @@
|
||||
/****************************************************************************
|
||||
* libs/libc/lzf/lzf_c.c
|
||||
*
|
||||
* Copyright (c) 2000-2010 Marc Alexander Lehmann <schmorp@schmorp.de>
|
||||
* Copyright (c) 2000-2010
|
||||
* Author: Marc Alexander Lehmann <schmorp@schmorp.de>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modifica-
|
||||
* tion, are permitted provided that the following conditions are met:
|
||||
* 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.
|
||||
* 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 AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
|
||||
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
|
||||
* CIAL, 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 OTH-
|
||||
* ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MER CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR 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 OTH- ERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@ -204,6 +206,7 @@ unsigned int lzf_decompress (FAR const void *const in_data,
|
||||
set_errno(EINVAL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
if (len == 7)
|
||||
{
|
||||
@ -288,6 +291,7 @@ unsigned int lzf_decompress (FAR const void *const in_data,
|
||||
*op++ = *ref++;
|
||||
|
||||
case 0:
|
||||
|
||||
/* Two octets more */
|
||||
|
||||
*op++ = *ref++;
|
||||
|
@ -77,7 +77,8 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
|
||||
|
||||
if (ehdr->e_ident[EI_CLASS] != ELFCLASS32)
|
||||
{
|
||||
berr("ERROR: Need 32-bit objects: e_ident[EI_CLASS]=%02x\n", ehdr->e_ident[EI_CLASS]);
|
||||
berr("ERROR: Need 32-bit objects: e_ident[EI_CLASS]=%02x\n",
|
||||
ehdr->e_ident[EI_CLASS]);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -89,7 +90,8 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
|
||||
if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB)
|
||||
#endif
|
||||
{
|
||||
berr("ERROR: Wrong endian-ness: e_ident[EI_DATA]=%02x\n", ehdr->e_ident[EI_DATA]);
|
||||
berr("ERROR: Wrong endian-ness: e_ident[EI_DATA]=%02x\n",
|
||||
ehdr->e_ident[EI_DATA]);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -97,11 +99,13 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
|
||||
|
||||
if ((ehdr->e_entry & 3) != 0)
|
||||
{
|
||||
berr("ERROR: Entry point is not properly aligned: %08x\n", ehdr->e_entry);
|
||||
berr("ERROR: Entry point is not properly aligned: %08x\n",
|
||||
ehdr->e_entry);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* TODO: Check ABI here. */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -155,9 +159,12 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
case R_ARM_CALL:
|
||||
case R_ARM_JUMP24:
|
||||
{
|
||||
binfo("Performing PC24 [%d] link at addr %08lx [%08lx] to sym '%p' st_value=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t *)addr),
|
||||
sym, (long)sym->st_value);
|
||||
binfo("Performing PC24 [%d] link", ELF32_R_TYPE(rel->r_info),
|
||||
binfo(" at addr %08lx [%08lx] to sym '%p' st_value=%08lx\n",
|
||||
(long)addr,
|
||||
(long)(*(uint32_t *)addr),
|
||||
sym,
|
||||
(long)sym->st_value);
|
||||
|
||||
offset = (*(uint32_t *)addr & 0x00ffffff) << 2;
|
||||
if (offset & 0x02000000)
|
||||
@ -166,7 +173,9 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
}
|
||||
|
||||
offset += sym->st_value - addr;
|
||||
if (offset & 3 || offset < (int32_t) 0xfe000000 || offset >= (int32_t) 0x02000000)
|
||||
if (offset & 3 || offset <
|
||||
(int32_t) 0xfe000000 || offset >=
|
||||
(int32_t) 0x02000000)
|
||||
{
|
||||
berr("ERROR: PC24 [%d] relocation out of range, offset=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), offset);
|
||||
@ -184,8 +193,13 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
case R_ARM_ABS32:
|
||||
case R_ARM_TARGET1: /* New ABI: TARGET1 always treated as ABS32 */
|
||||
{
|
||||
binfo("Performing ABS32 link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
(long)addr, (long)(*(uint32_t *)addr), sym, (long)sym->st_value);
|
||||
binfo("Performing ABS32 link");
|
||||
binfo(" at addr=%08lx [%08lx]
|
||||
to sym=%p st_value=%08lx\n",
|
||||
(long)addr,
|
||||
(long)(*(uint32_t *)addr),
|
||||
sym,
|
||||
(long)sym->st_value);
|
||||
|
||||
*(uint32_t *)addr += sym->st_value;
|
||||
}
|
||||
@ -208,8 +222,12 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
|
||||
case R_ARM_PREL31:
|
||||
{
|
||||
binfo("Performing PREL31 link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
(long)addr, (long)(*(uint32_t *)addr), sym, (long)sym->st_value);
|
||||
binfo("Performing PREL31 link at");
|
||||
binfo(" addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
(long)addr,
|
||||
(long)(*(uint32_t *)addr),
|
||||
sym,
|
||||
(long)sym->st_value);
|
||||
|
||||
offset = *(uint32_t *)addr + sym->st_value - addr;
|
||||
*(uint32_t *)addr = offset & 0x7fffffff;
|
||||
@ -219,9 +237,11 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
case R_ARM_MOVW_ABS_NC:
|
||||
case R_ARM_MOVT_ABS:
|
||||
{
|
||||
binfo("Performing MOVx_ABS [%d] link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t *)addr),
|
||||
sym, (long)sym->st_value);
|
||||
binfo("Performing MOVx_ABS [%d] link", ELF32_R_TYPE(rel->r_info));
|
||||
binfo(" at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
(long)addr, (long)(*(uint32_t *)addr),
|
||||
sym,
|
||||
(long)sym->st_value);
|
||||
|
||||
offset = *(uint32_t *)addr;
|
||||
offset = ((offset & 0xf0000) >> 4) | (offset & 0xfff);
|
||||
|
@ -208,22 +208,22 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
* upper_insn:
|
||||
*
|
||||
* 1 1 1 1 1 1
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
* +----------+---+-------------------------------+--------------+
|
||||
* |1 1 1 |OP1| OP2 | | 32-Bit Instructions
|
||||
* +----------+---+--+-----+----------------------+--------------+
|
||||
* |1 1 1 | 1 0| S | imm10 | BL Instruction
|
||||
* +----------+------+-----+-------------------------------------+
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions
|
||||
* +----------+---+--------------------------+----------+
|
||||
* |1 1 1 |OP1| OP2 | | 32-Bit
|
||||
* +----------+---+--+-----+-----------------+----------+
|
||||
* |1 1 1 | 1 0| S | imm10 | BL
|
||||
* +----------+------+-----+----------------------------+
|
||||
*
|
||||
* lower_insn:
|
||||
*
|
||||
* 1 1 1 1 1 1
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
* +---+---------------------------------------------------------+
|
||||
* |OP | | 32-Bit Instructions
|
||||
* +---+--+---+---+---+------------------------------------------+
|
||||
* |1 1 |J1 | 1 |J2 | imm11 | BL Instruction
|
||||
* +------+---+---+---+------------------------------------------+
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions
|
||||
* +---+------------------------------------------------+
|
||||
* |OP | | 32-Bit
|
||||
* +---+--+---+---+---+---------------------------------+
|
||||
* |1 1 |J1 | 1 |J2 | imm11 | BL
|
||||
* +------+---+---+---+---------------------------------+
|
||||
*
|
||||
* The branch target is encoded in these bits:
|
||||
*
|
||||
@ -381,22 +381,22 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
* upper_insn:
|
||||
*
|
||||
* 1 1 1 1 1 1
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
* +----------+---+-------------------------------+--------------+
|
||||
* |1 1 1 |OP1| OP2 | | 32-Bit Instructions
|
||||
* +----------+---+--+-----+----------------------+--------------+
|
||||
* |1 1 1 | 1 0| i | 1 0 1 1 0 0 | imm4 | MOVT Instruction
|
||||
* +----------+------+-----+----------------------+--------------+
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions
|
||||
* +----------+---+--------------------------+----------+
|
||||
* |1 1 1 |OP1| OP2 | | 32-Bit
|
||||
* +----------+---+--+-----+-----------------+----------+
|
||||
* |1 1 1 | 1 0| i |1 0 1 1 0 0 | imm4 | MOVT
|
||||
* +----------+------+-----+-----------------+----------+
|
||||
*
|
||||
* lower_insn:
|
||||
*
|
||||
* 1 1 1 1 1 1
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
* +---+---------------------------------------------------------+
|
||||
* |OP | | 32-Bit Instructions
|
||||
* +---+----------+--------------+-------------------------------+
|
||||
* |0 | imm3 | Rd | imm8 | MOVT Instruction
|
||||
* +---+----------+--------------+-------------------------------+
|
||||
* 1 1 1 1 1 1
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions
|
||||
* +---+-----------------------------------------------+
|
||||
* |OP | | 32-Bit
|
||||
* +---+----------+-----------+------------------------+
|
||||
* |0 | imm3 | Rd | imm8 | MOVT
|
||||
* +---+----------+-----------+------------------------+
|
||||
*
|
||||
* The 16-bit immediate value is encoded in these bits:
|
||||
*
|
||||
|
@ -211,22 +211,22 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
* upper_insn:
|
||||
*
|
||||
* 1 1 1 1 1 1
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
* +----------+---+-------------------------------+--------------+
|
||||
* |1 1 1 |OP1| OP2 | | 32-Bit Instructions
|
||||
* +----------+---+--+-----+----------------------+--------------+
|
||||
* |1 1 1 | 1 0| S | imm10 | BL Instruction
|
||||
* +----------+------+-----+-------------------------------------+
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions
|
||||
* +----------+---+--------------------------+----------+
|
||||
* |1 1 1 |OP1| OP2 | | 32-Bit
|
||||
* +----------+---+--+-----+-----------------+----------+
|
||||
* |1 1 1 | 1 0| S | imm10 | BL
|
||||
* +----------+------+-----+----------------------------+
|
||||
*
|
||||
* lower_insn:
|
||||
*
|
||||
* 1 1 1 1 1 1
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
* +---+---------------------------------------------------------+
|
||||
* |OP | | 32-Bit Instructions
|
||||
* +---+--+---+---+---+------------------------------------------+
|
||||
* |1 1 |J1 | 1 |J2 | imm11 | BL Instruction
|
||||
* +------+---+---+---+------------------------------------------+
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions
|
||||
* +---+------------------------------------------------+
|
||||
* |OP | | 32-Bit
|
||||
* +---+--+---+---+---+---------------------------------+
|
||||
* |1 1 |J1 | 1 |J2 | imm11 | BL
|
||||
* +------+---+---+---+--------------------------------+
|
||||
*
|
||||
* The branch target is encoded in these bits:
|
||||
*
|
||||
@ -386,22 +386,22 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
* upper_insn:
|
||||
*
|
||||
* 1 1 1 1 1 1
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
* +----------+---+-------------------------------+--------------+
|
||||
* |1 1 1 |OP1| OP2 | | 32-Bit Instructions
|
||||
* +----------+---+--+-----+----------------------+--------------+
|
||||
* |1 1 1 | 1 0| i | 1 0 1 1 0 0 | imm4 | MOVT Instruction
|
||||
* +----------+------+-----+----------------------+--------------+
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instruction
|
||||
* +----------+---+--------------------------+----------+
|
||||
* |1 1 1 |OP1| OP2 | | 32-Bit
|
||||
* +----------+---+--+-----+-----------------+----------+
|
||||
* |1 1 1 | 1 0| i |1 0 1 1 0 0 | imm4 | MOVT
|
||||
* +----------+------+-----+-----------------+----------+
|
||||
*
|
||||
* lower_insn:
|
||||
*
|
||||
* 1 1 1 1 1 1
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
* +---+---------------------------------------------------------+
|
||||
* |OP | | 32-Bit Instructions
|
||||
* +---+----------+--------------+-------------------------------+
|
||||
* |0 | imm3 | Rd | imm8 | MOVT Instruction
|
||||
* +---+----------+--------------+-------------------------------+
|
||||
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions
|
||||
* +---+-------------------------------------------------+
|
||||
* |OP | | 32-Bit
|
||||
* +---+----------+--------+-----------------------------+
|
||||
* |0 | imm3 | Rd | imm8 | MOVT
|
||||
* +---+----------+--------+-----------------------------+
|
||||
*
|
||||
* The 16-bit immediate value is encoded in these bits:
|
||||
*
|
||||
|
@ -77,7 +77,8 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
|
||||
|
||||
if (ehdr->e_ident[EI_CLASS] != ELFCLASS32)
|
||||
{
|
||||
berr("ERROR: Need 32-bit objects: e_ident[EI_CLASS]=%02x\n", ehdr->e_ident[EI_CLASS]);
|
||||
berr("ERROR: Need 32-bit objects: e_ident[EI_CLASS]=%02x\n",
|
||||
ehdr->e_ident[EI_CLASS]);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -89,7 +90,8 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
|
||||
if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB)
|
||||
#endif
|
||||
{
|
||||
berr("ERROR: Wrong endian-ness: e_ident[EI_DATA]=%02x\n", ehdr->e_ident[EI_DATA]);
|
||||
berr("ERROR: Wrong endian-ness: e_ident[EI_DATA]=%02x\n",
|
||||
ehdr->e_ident[EI_DATA]);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -97,11 +99,13 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
|
||||
|
||||
if ((ehdr->e_entry & 3) != 0)
|
||||
{
|
||||
berr("ERROR: Entry point is not properly aligned: %08x\n", ehdr->e_entry);
|
||||
berr("ERROR: Entry point is not properly aligned: %08x\n",
|
||||
ehdr->e_entry);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* TODO: Check ABI here. */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -157,8 +161,9 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
case R_ARM_CALL:
|
||||
case R_ARM_JUMP24:
|
||||
{
|
||||
binfo("Performing PC24 [%d] link at addr %08lx [%08lx] to sym '%p' st_value=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t *)addr),
|
||||
binfo("Performing PC24 [%d] link at", ELF32_R_TYPE(rel->r_info));
|
||||
binfo(" addr %08lx [%08lx] to sym '%p' st_value=%08lx\n",
|
||||
(long)addr, (long)(*(uint32_t *)addr),
|
||||
sym, (long)sym->st_value);
|
||||
|
||||
offset = (*(uint32_t *)addr & 0x00ffffff) << 2;
|
||||
@ -168,9 +173,10 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
}
|
||||
|
||||
offset += sym->st_value - addr;
|
||||
if (offset & 3 || offset < (int32_t) 0xfe000000 || offset >= (int32_t) 0x02000000)
|
||||
if (offset & 3 || offset < (int32_t) 0xfe000000 ||
|
||||
offset >= (int32_t) 0x02000000)
|
||||
{
|
||||
berr("ERROR: ERROR: PC24 [%d] relocation out of range, offset=%08lx\n",
|
||||
berr("ERROR: PC24 [%d] relocation out of range, offset=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), offset);
|
||||
|
||||
return -EINVAL;
|
||||
@ -186,8 +192,10 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
case R_ARM_ABS32:
|
||||
case R_ARM_TARGET1: /* New ABI: TARGET1 always treated as ABS32 */
|
||||
{
|
||||
binfo("Performing ABS32 link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
(long)addr, (long)(*(uint32_t *)addr), sym, (long)sym->st_value);
|
||||
binfo("Performing ABS32 link at");
|
||||
binfo(" addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
(long)addr, (long)(*(uint32_t *)addr), sym,
|
||||
(long)sym->st_value);
|
||||
|
||||
*(uint32_t *)addr += sym->st_value;
|
||||
}
|
||||
@ -210,8 +218,10 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
|
||||
case R_ARM_PREL31:
|
||||
{
|
||||
binfo("Performing PREL31 link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
(long)addr, (long)(*(uint32_t *)addr), sym, (long)sym->st_value);
|
||||
binfo("Performing PREL31 link at");
|
||||
binfo(" addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
(long)addr, (long)(*(uint32_t *)addr), sym,
|
||||
(long)sym->st_value);
|
||||
|
||||
offset = *(uint32_t *)addr + sym->st_value - addr;
|
||||
*(uint32_t *)addr = offset & 0x7fffffff;
|
||||
@ -221,8 +231,9 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
|
||||
case R_ARM_MOVW_ABS_NC:
|
||||
case R_ARM_MOVT_ABS:
|
||||
{
|
||||
binfo("Performing MOVx_ABS [%d] link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t *)addr),
|
||||
binfo("Performing MOVx_ABS [%d] link at", ELF32_R_TYPE(rel->r_info));
|
||||
binfo(" addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
|
||||
(long)addr, (long)(*(uint32_t *)addr),
|
||||
sym, (long)sym->st_value);
|
||||
|
||||
offset = *(uint32_t *)addr;
|
||||
|
@ -36,10 +36,10 @@ uint32_t htonl(uint32_t hl)
|
||||
#ifdef CONFIG_ENDIAN_BIG
|
||||
return hl;
|
||||
#else
|
||||
return (( (hl) >> 24) |
|
||||
return (((hl) >> 24) |
|
||||
(((hl) >> 8) & 0x0000ff00) |
|
||||
(((hl) << 8) & 0x00ff0000) |
|
||||
( (hl) << 24));
|
||||
((hl) << 24));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -51,9 +51,11 @@
|
||||
int pthread_attr_getaffinity_np(FAR const pthread_attr_t *attr,
|
||||
size_t cpusetsize, cpu_set_t *cpuset)
|
||||
{
|
||||
linfo("attr=0x%p cpusetsize=%d cpuset=0x%p\n", attr, (int)cpusetsize, cpuset);
|
||||
linfo("attr=0x%p cpusetsize=%d cpuset=0x%p\n",
|
||||
attr, (int)cpusetsize, cpuset);
|
||||
|
||||
DEBUGASSERT(attr != NULL && cpusetsize == sizeof(cpu_set_t) && cpuset != NULL);
|
||||
DEBUGASSERT(attr != NULL && cpusetsize == sizeof(cpu_set_t) &&
|
||||
cpuset != NULL);
|
||||
|
||||
*cpuset = attr->affinity;
|
||||
return OK;
|
||||
|
@ -53,7 +53,8 @@ int pthread_attr_setaffinity_np(FAR pthread_attr_t *attr,
|
||||
size_t cpusetsize,
|
||||
FAR const cpu_set_t *cpuset)
|
||||
{
|
||||
linfo("attr=0x%p cpusetsize=%d cpuset=0x%p\n", attr, (int)cpusetsize, cpuset);
|
||||
linfo("attr=0x%p cpusetsize=%d cpuset=0x%p\n",
|
||||
attr, (int)cpusetsize, cpuset);
|
||||
|
||||
DEBUGASSERT(attr != NULL && cpusetsize == sizeof(cpu_set_t) &&
|
||||
cpuset != NULL && *cpuset != 0);
|
||||
|
@ -63,5 +63,6 @@ int pthread_barrierattr_destroy(FAR pthread_barrierattr_t *attr)
|
||||
{
|
||||
attr->pshared = PTHREAD_PROCESS_PRIVATE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -50,7 +50,8 @@
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
int pthread_barrierattr_getpshared(FAR const pthread_barrierattr_t *attr, FAR int *pshared)
|
||||
int pthread_barrierattr_getpshared(FAR const pthread_barrierattr_t *attr,
|
||||
FAR int *pshared)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
@ -62,5 +63,6 @@ int pthread_barrierattr_getpshared(FAR const pthread_barrierattr_t *attr, FAR in
|
||||
{
|
||||
*pshared = attr->pshared;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -62,5 +62,6 @@ int pthread_barrierattr_init(FAR pthread_barrierattr_t *attr)
|
||||
{
|
||||
attr->pshared = PTHREAD_PROCESS_PRIVATE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -56,25 +56,26 @@
|
||||
* Name: pthread_barrierattr_setpshared
|
||||
*
|
||||
* Description:
|
||||
* The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit a
|
||||
* barrier to be operated upon by any thread that has access to the memory where
|
||||
* the barrier is allocated. If the process-shared attribute is
|
||||
* PTHREAD_PROCESS_PRIVATE, the barrier can only be operated upon by threads
|
||||
* created within the same process as the thread that initialized the barrier.
|
||||
* If threads of different processes attempt to operate on such a barrier, the
|
||||
* behavior is undefined. The default value of the attribute is
|
||||
* The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit
|
||||
* a barrier to be operated upon by any thread that has access to the
|
||||
* memory where the barrier is allocated. If the process-shared attribute
|
||||
* is PTHREAD_PROCESS_PRIVATE, the barrier can only be operated upon by
|
||||
* threads created within the same process as the thread that initialized
|
||||
* the barrier.
|
||||
* If threads of different processes attempt to operate on such a barrier,
|
||||
* the behavior is undefined. The default value of the attribute is
|
||||
* PTHREAD_PROCESS_PRIVATE.
|
||||
*
|
||||
* Both constants PTHREAD_PROCESS_SHARED and PTHREAD_PROCESS_PRIVATE are defined
|
||||
* in pthread.h.
|
||||
* Both constants PTHREAD_PROCESS_SHARED and PTHREAD_PROCESS_PRIVATE are
|
||||
* defined in pthread.h.
|
||||
*
|
||||
* Input Parameters:
|
||||
* attr - barrier attributes to be modified.
|
||||
* pshared - the new value of the pshared attribute.
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) on success or EINVAL if either attr is invalid or pshared is not one
|
||||
* of PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE.
|
||||
* 0 (OK) on success or EINVAL if either attr is invalid or pshared is not
|
||||
* one of PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
@ -84,7 +85,8 @@ int pthread_barrierattr_setpshared(FAR pthread_barrierattr_t *attr, int pshared)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
if (!attr || (pshared != PTHREAD_PROCESS_SHARED && pshared != PTHREAD_PROCESS_PRIVATE))
|
||||
if (!attr || (pshared != PTHREAD_PROCESS_SHARED &&
|
||||
pshared != PTHREAD_PROCESS_PRIVATE))
|
||||
{
|
||||
ret = EINVAL;
|
||||
}
|
||||
@ -92,5 +94,6 @@ int pthread_barrierattr_setpshared(FAR pthread_barrierattr_t *attr, int pshared)
|
||||
{
|
||||
attr->pshared = pshared;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -70,7 +70,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
int pthread_barrier_init(FAR pthread_barrier_t *barrier,
|
||||
FAR const pthread_barrierattr_t *attr, unsigned int count)
|
||||
FAR const pthread_barrierattr_t *attr,
|
||||
unsigned int count)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
|
@ -36,9 +36,9 @@
|
||||
* Description:
|
||||
* The mutex object referenced by mutex is locked by calling
|
||||
* pthread_mutex_lock(). If the mutex is already locked, the calling thread
|
||||
* blocks until the mutex becomes available. This operation returns with the
|
||||
* mutex object referenced by mutex in the locked state with the calling
|
||||
* thread as its owner.
|
||||
* blocks until the mutex becomes available. This operation returns with
|
||||
* the mutex object referenced by mutex in the locked state with the
|
||||
* calling thread as its owner.
|
||||
*
|
||||
* If the mutex type is PTHREAD_MUTEX_NORMAL, deadlock detection is not
|
||||
* provided. Attempting to relock the mutex causes deadlock. If a thread
|
||||
@ -56,9 +56,9 @@
|
||||
* for the first time, the lock count is set to one. Every time a thread
|
||||
* relocks this mutex, the lock count is incremented by one. Each time the
|
||||
* thread unlocks the mutex, the lock count is decremented by one. When the
|
||||
* lock count reaches zero, the mutex becomes available for other threads to
|
||||
* acquire. If a thread attempts to unlock a mutex that it has not locked or
|
||||
* a mutex which is unlocked, an error will be returned.
|
||||
* lock count reaches zero, the mutex becomes available for other threads
|
||||
* to acquire. If a thread attempts to unlock a mutex that it has not
|
||||
* locked or a mutex which is unlocked, an error will be returned.
|
||||
*
|
||||
* If a signal is delivered to a thread waiting for a mutex, upon return
|
||||
* from the signal handler the thread resumes waiting for the mutex as if
|
||||
|
@ -49,7 +49,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int pthread_mutexattr_getpshared(FAR const pthread_mutexattr_t *attr, FAR int *pshared)
|
||||
int pthread_mutexattr_getpshared(FAR const pthread_mutexattr_t *attr,
|
||||
FAR int *pshared)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
|
@ -61,7 +61,8 @@ int pthread_mutexattr_setrobust(pthread_mutexattr_t *attr, int robust)
|
||||
|
||||
#elif defined(CONFIG_PTHREAD_MUTEX_BOTH)
|
||||
|
||||
if (attr != NULL && (robust == PTHREAD_MUTEX_STALLED || robust == _PTHREAD_MFLAGS_ROBUST))
|
||||
if (attr != NULL && (robust == PTHREAD_MUTEX_STALLED ||
|
||||
robust == _PTHREAD_MFLAGS_ROBUST))
|
||||
{
|
||||
attr->robust = robust;
|
||||
return OK;
|
||||
|
@ -81,7 +81,9 @@ int pthread_once(FAR pthread_once_t *once_control,
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* The init_routine has already been called. Restore pre-emption and return */
|
||||
/* The init_routine has already been called.
|
||||
* Restore pre-emption and return
|
||||
*/
|
||||
|
||||
sched_unlock();
|
||||
return OK;
|
||||
|
@ -31,7 +31,10 @@
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
/* These are defined in different header files but must have the same values. */
|
||||
|
||||
/* These are defined in different header files but must have the same
|
||||
* values.
|
||||
*/
|
||||
|
||||
#if PTHREAD_CANCEL_ENABLE != TASK_CANCEL_ENABLE
|
||||
# error We must have PTHREAD_CANCEL_ENABLE == TASK_CANCEL_ENABLE
|
||||
|
@ -29,6 +29,7 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* The following are defined in different header files but must have the
|
||||
* same values.
|
||||
*/
|
||||
|
@ -181,9 +181,10 @@ int pthread_spin_lock(pthread_spinlock_t *lock)
|
||||
}
|
||||
|
||||
/* Loop until we successfully take the spinlock (i.e., until the previous
|
||||
* state of the spinlock was SP_UNLOCKED). NOTE that the test/set operaion
|
||||
* is performed via boardctl() to avoid a variety of issues. An option
|
||||
* might be to move the implementation of up_testset() to libs/libc/machine.
|
||||
* state of the spinlock was SP_UNLOCKED).
|
||||
* NOTE that the test/set operaion is performed via boardctl() to avoid a
|
||||
* variety of issues. An option might be to move the implementation of
|
||||
* up_testset() to libs/libc/machine.
|
||||
*/
|
||||
|
||||
do
|
||||
|
@ -37,4 +37,8 @@
|
||||
struct passwd g_passwd;
|
||||
char g_passwd_buffer[CONFIG_LIBC_PASSWD_LINESIZE];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* CONFIG_LIBC_GROUP_FILE */
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <queue.h>
|
||||
|
||||
/****************************************************************************
|
||||
* public Functions
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -100,9 +100,9 @@ _sa_handler_t signal(int signo, _sa_handler_t func)
|
||||
*/
|
||||
|
||||
if (ret == OK)
|
||||
{
|
||||
return oact.sa_handler;
|
||||
}
|
||||
{
|
||||
return oact.sa_handler;
|
||||
}
|
||||
|
||||
return (_sa_handler_t)SIG_ERR;
|
||||
}
|
||||
|
@ -98,7 +98,6 @@ int posix_spawnattr_init(posix_spawnattr_t *attr)
|
||||
attr->budget.tv_nsec = param.sched_ss_init_budget.tv_nsec;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef CONFIG_ARCH_ADDRENV
|
||||
/* Default stack size */
|
||||
|
||||
|
@ -52,7 +52,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int task_spawnattr_setstacksize(FAR posix_spawnattr_t *attr, size_t stacksize)
|
||||
int task_spawnattr_setstacksize(FAR posix_spawnattr_t *attr,
|
||||
size_t stacksize)
|
||||
{
|
||||
DEBUGASSERT(attr);
|
||||
attr->stacksize = stacksize;
|
||||
|
@ -55,7 +55,8 @@ void add_file_action(FAR posix_spawn_file_actions_t *file_actions,
|
||||
|
||||
/* Find the end of the list */
|
||||
|
||||
for (prev = NULL, next = (FAR struct spawn_general_file_action_s *)*file_actions;
|
||||
for (prev = NULL,
|
||||
next = (FAR struct spawn_general_file_action_s *)*file_actions;
|
||||
next;
|
||||
prev = next, next = next->flink);
|
||||
|
||||
|
@ -58,8 +58,9 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *file_actions,
|
||||
int fd)
|
||||
int posix_spawn_file_actions_addclose(
|
||||
FAR posix_spawn_file_actions_t *file_actions,
|
||||
int fd)
|
||||
{
|
||||
FAR struct spawn_close_file_action_s *entry;
|
||||
|
||||
@ -82,6 +83,7 @@ int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *file_actio
|
||||
|
||||
/* And add it to the file action list */
|
||||
|
||||
add_file_action(file_actions, (FAR struct spawn_general_file_action_s *)entry);
|
||||
add_file_action(file_actions,
|
||||
(FAR struct spawn_general_file_action_s *)entry);
|
||||
return OK;
|
||||
}
|
||||
|
@ -59,8 +59,9 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *file_actions,
|
||||
int fd1, int fd2)
|
||||
int posix_spawn_file_actions_adddup2(
|
||||
FAR posix_spawn_file_actions_t *file_actions,
|
||||
int fd1, int fd2)
|
||||
{
|
||||
FAR struct spawn_dup2_file_action_s *entry;
|
||||
|
||||
@ -86,6 +87,7 @@ int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *file_action
|
||||
|
||||
/* And add it to the file action list */
|
||||
|
||||
add_file_action(file_actions, (FAR struct spawn_general_file_action_s *)entry);
|
||||
add_file_action(file_actions,
|
||||
(FAR struct spawn_general_file_action_s *)entry);
|
||||
return OK;
|
||||
}
|
||||
|
@ -57,7 +57,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int posix_spawn_file_actions_destroy(FAR posix_spawn_file_actions_t *file_actions)
|
||||
int posix_spawn_file_actions_destroy(
|
||||
FAR posix_spawn_file_actions_t *file_actions)
|
||||
{
|
||||
FAR struct spawn_general_file_action_s *curr;
|
||||
FAR struct spawn_general_file_action_s *next;
|
||||
@ -70,7 +71,9 @@ int posix_spawn_file_actions_destroy(FAR posix_spawn_file_actions_t *file_action
|
||||
curr;
|
||||
curr = next)
|
||||
{
|
||||
/* Get the pointer to the next element before destroying the current one */
|
||||
/* Get the pointer to the next element before destroying the current
|
||||
* one
|
||||
*/
|
||||
|
||||
next = curr->flink;
|
||||
lib_free(curr);
|
||||
|
@ -59,7 +59,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void posix_spawn_file_actions_dump(FAR posix_spawn_file_actions_t *file_actions)
|
||||
void posix_spawn_file_actions_dump(
|
||||
FAR posix_spawn_file_actions_t *file_actions)
|
||||
{
|
||||
FAR struct spawn_general_file_action_s *entry;
|
||||
|
||||
|
@ -48,7 +48,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int posix_spawn_file_actions_init(FAR posix_spawn_file_actions_t *file_actions)
|
||||
int posix_spawn_file_actions_init(
|
||||
FAR posix_spawn_file_actions_t *file_actions)
|
||||
{
|
||||
*file_actions = NULL;
|
||||
return OK;
|
||||
|
@ -34,6 +34,12 @@
|
||||
|
||||
#include "libc.h"
|
||||
|
||||
/* Include floating point functions */
|
||||
|
||||
#ifdef CONFIG_LIBC_FLOATINGPOINT
|
||||
# include "stdio/lib_libdtoa.c"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@ -193,12 +199,6 @@ static const char g_nullstring[] = "(null)";
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/* Include floating point functions */
|
||||
|
||||
#ifdef CONFIG_LIBC_FLOATINGPOINT
|
||||
# include "stdio/lib_libdtoa.c"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ptohex
|
||||
****************************************************************************/
|
||||
|
@ -39,10 +39,10 @@
|
||||
*
|
||||
* Description:
|
||||
* fgetpos() function is an alternate interfaces equivalent to ftell().
|
||||
* It gets the current value of the file offset and store it in the location
|
||||
* referenced by pos. On some non-UNIX systems an fpos_t object may be a
|
||||
* complex object and fsetpos may be the only way to portably reposition a
|
||||
* stream.
|
||||
* It gets the current value of the file offset and store it in the
|
||||
* location referenced by pos. On some non-UNIX systems an fpos_t object
|
||||
* may be a complex object and fsetpos may be the only way to portably
|
||||
* reposition a stream.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero on succes; -1 on failure with errno set appropriately.
|
||||
|
@ -46,8 +46,8 @@
|
||||
* set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the
|
||||
* start of the file, the current position indicator, or end-of-file,
|
||||
* respectively. A successful call to the fseek() function clears the
|
||||
* end-of-file indicator for the stream and undoes any effects of the ungetc(3)
|
||||
* function on the same stream.
|
||||
* end-of-file indicator for the stream and undoes any effects of the
|
||||
* ungetc(3) function on the same stream.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero on succes; -1 on failure with errno set appropriately.
|
||||
|
@ -55,10 +55,13 @@ static off_t lib_getrdoffset(FAR FILE *stream)
|
||||
off_t rdoffset = 0;
|
||||
lib_take_semaphore(stream);
|
||||
|
||||
if (stream->fs_bufstart != NULL && stream->fs_bufread != stream->fs_bufstart)
|
||||
if (stream->fs_bufstart !=
|
||||
NULL && stream->fs_bufread !=
|
||||
stream->fs_bufstart)
|
||||
{
|
||||
#if CONFIG_NUNGET_CHARS > 0
|
||||
rdoffset = stream->fs_bufread - stream->fs_bufpos + stream->fs_nungotten;
|
||||
rdoffset = stream->fs_bufread - stream->fs_bufpos +
|
||||
stream->fs_nungotten;
|
||||
#else
|
||||
rdoffset = stream->fs_bufread - stream->fs_bufpos;
|
||||
#endif
|
||||
|
@ -42,8 +42,8 @@
|
||||
* Name: lib_fflush
|
||||
*
|
||||
* Description:
|
||||
* The function lib_fflush() forces a write of all user-space buffered data for
|
||||
* the given output or update stream via the stream's underlying write
|
||||
* The function lib_fflush() forces a write of all user-space buffered data
|
||||
* for the given output or update stream via the stream's underlying write
|
||||
* function. The open status of the stream is unaffected.
|
||||
*
|
||||
* Input Parameters:
|
||||
@ -83,7 +83,7 @@ ssize_t lib_fflush(FAR FILE *stream, bool bforce)
|
||||
|
||||
ret = 0;
|
||||
goto errout_with_sem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure that the buffer holds valid data */
|
||||
|
||||
@ -146,10 +146,10 @@ ssize_t lib_fflush(FAR FILE *stream, bool bforce)
|
||||
*/
|
||||
|
||||
while (nbuffer)
|
||||
{
|
||||
*stream->fs_bufpos++ = *src++;
|
||||
--nbuffer;
|
||||
}
|
||||
{
|
||||
*stream->fs_bufpos++ = *src++;
|
||||
--nbuffer;
|
||||
}
|
||||
}
|
||||
|
||||
/* Restore normal access to the stream and return the number of bytes
|
||||
|
@ -74,9 +74,9 @@
|
||||
* Name: consume_eol
|
||||
*
|
||||
* Description:
|
||||
* If 'consume' is true, then consume_eol() will read and discard bytes from
|
||||
* 'stream' until an EOF or a newline encountered or until a read error
|
||||
* occurs.
|
||||
* If 'consume' is true, then consume_eol() will read and discard bytes
|
||||
* from 'stream' until an EOF or a newline encountered or until a read
|
||||
* error occurs.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -36,7 +36,8 @@
|
||||
|
||||
static void memoutstream_putc(FAR struct lib_outstream_s *this, int ch)
|
||||
{
|
||||
FAR struct lib_memoutstream_s *mthis = (FAR struct lib_memoutstream_s *)this;
|
||||
FAR struct lib_memoutstream_s *mthis =
|
||||
(FAR struct lib_memoutstream_s *)this;
|
||||
|
||||
DEBUGASSERT(this);
|
||||
|
||||
|
@ -42,7 +42,8 @@
|
||||
|
||||
static void rawoutstream_putc(FAR struct lib_outstream_s *this, int ch)
|
||||
{
|
||||
FAR struct lib_rawoutstream_s *rthis = (FAR struct lib_rawoutstream_s *)this;
|
||||
FAR struct lib_rawoutstream_s *rthis =
|
||||
(FAR struct lib_rawoutstream_s *)this;
|
||||
char buffer = ch;
|
||||
int nwritten;
|
||||
int errcode;
|
||||
|
@ -68,30 +68,33 @@ int lib_rdflush(FAR FILE *stream)
|
||||
lib_take_semaphore(stream);
|
||||
|
||||
/* If the buffer is currently being used for read access, then discard all
|
||||
* of the read-ahead data. We do not support concurrent buffered read/write
|
||||
* of the read-ahead data. We do not support concurrent buffered read/write
|
||||
* access.
|
||||
*/
|
||||
|
||||
if (stream->fs_bufread != stream->fs_bufstart)
|
||||
{
|
||||
/* Now adjust the stream pointer to account for the read-ahead data that
|
||||
* was not actually read by the user.
|
||||
/* Now adjust the stream pointer to account for the read-ahead data
|
||||
* that was not actually read by the user.
|
||||
*/
|
||||
|
||||
#if CONFIG_NUNGET_CHARS > 0
|
||||
off_t rdoffset = stream->fs_bufread - stream->fs_bufpos + stream->fs_nungotten;
|
||||
off_t rdoffset = stream->fs_bufread - stream->fs_bufpos +
|
||||
stream->fs_nungotten;
|
||||
#else
|
||||
off_t rdoffset = stream->fs_bufread - stream->fs_bufpos;
|
||||
#endif
|
||||
/* Mark the buffer as empty (do this before calling fseek() because fseek()
|
||||
* also calls this function).
|
||||
/* Mark the buffer as empty (do this before calling fseek() because
|
||||
* fseek() also calls this function).
|
||||
*/
|
||||
|
||||
stream->fs_bufpos = stream->fs_bufread = stream->fs_bufstart;
|
||||
#if CONFIG_NUNGET_CHARS > 0
|
||||
stream->fs_nungotten = 0;
|
||||
#endif
|
||||
/* Then seek to the position corresponding to the last data read by the user */
|
||||
/* Then seek to the position corresponding to the last data read by the
|
||||
* user
|
||||
*/
|
||||
|
||||
if (fseek(stream, -rdoffset, SEEK_CUR) < 0)
|
||||
{
|
||||
|
@ -51,8 +51,8 @@ int snprintf(FAR char *buf, size_t size, FAR const IPTR char *format, ...)
|
||||
|
||||
/* "If the value of [size] is zero on a call to snprintf(), nothing shall
|
||||
* be written, the number of bytes that would have been written had [size]
|
||||
* been sufficiently large excluding the terminating null shall be returned,
|
||||
* and [buf] may be a null pointer." -- opengroup.org
|
||||
* been sufficiently large excluding the terminating null shall be
|
||||
* returned, and [buf] may be a null pointer." -- opengroup.org
|
||||
*/
|
||||
|
||||
if (size > 0)
|
||||
|
@ -38,7 +38,8 @@
|
||||
|
||||
static void stdoutstream_putc(FAR struct lib_outstream_s *this, int ch)
|
||||
{
|
||||
FAR struct lib_stdoutstream_s *sthis = (FAR struct lib_stdoutstream_s *)this;
|
||||
FAR struct lib_stdoutstream_s *sthis =
|
||||
(FAR struct lib_stdoutstream_s *)this;
|
||||
int result;
|
||||
|
||||
DEBUGASSERT(this && sthis->stream);
|
||||
@ -70,7 +71,8 @@ static void stdoutstream_putc(FAR struct lib_outstream_s *this, int ch)
|
||||
#ifndef CONFIG_STDIO_DISABLE_BUFFERING
|
||||
static int stdoutstream_flush(FAR struct lib_outstream_s *this)
|
||||
{
|
||||
FAR struct lib_stdoutstream_s *sthis = (FAR struct lib_stdoutstream_s *)this;
|
||||
FAR struct lib_stdoutstream_s *sthis =
|
||||
(FAR struct lib_stdoutstream_s *)this;
|
||||
|
||||
DEBUGASSERT(sthis != NULL && sthis->stream != NULL);
|
||||
return lib_fflush(sthis->stream, true);
|
||||
|
@ -65,8 +65,9 @@ void abort(void)
|
||||
*
|
||||
* Note that pthread_exit() is called instead of exit(). That is because
|
||||
* we do no know if abort was called from a pthread or a normal thread
|
||||
* (we could find out, of course). If abort() is called from a non-pthread,
|
||||
* then pthread_exit() should fail and fall back to call exit() anyway.
|
||||
* (we could find out, of course). If abort() is called from a
|
||||
* non-pthread, then pthread_exit() should fail and fall back to call
|
||||
* exit() anyway.
|
||||
*
|
||||
* If exit() is called (either below or via pthread_exit()), then exit()
|
||||
* will flush and close all open files and terminate the thread. If this
|
||||
|
@ -35,5 +35,6 @@ int abs(int j)
|
||||
{
|
||||
j = -j;
|
||||
}
|
||||
|
||||
return j;
|
||||
}
|
||||
|
@ -63,7 +63,9 @@ int lib_checkbase(int base, FAR const char **pptr)
|
||||
|
||||
base = 10;
|
||||
|
||||
/* Check for leading '0' - that would signify octal or hex (or binary) */
|
||||
/* Check for leading '0' - that would signify octal
|
||||
* or hex (or binary)
|
||||
*/
|
||||
|
||||
if (*ptr == '0')
|
||||
{
|
||||
@ -83,7 +85,9 @@ int lib_checkbase(int base, FAR const char **pptr)
|
||||
}
|
||||
}
|
||||
|
||||
/* If it a hexadecimal representation, than discard any leading "0X" or "0x" */
|
||||
/* If it a hexadecimal representation,
|
||||
* than discard any leading "0X" or "0x"
|
||||
*/
|
||||
|
||||
else if (base == 16)
|
||||
{
|
||||
|
@ -35,5 +35,6 @@ long int labs(long int j)
|
||||
{
|
||||
j = -j;
|
||||
}
|
||||
|
||||
return j;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ long long int llabs(long long int j)
|
||||
{
|
||||
j = -j;
|
||||
}
|
||||
|
||||
return j;
|
||||
}
|
||||
#endif
|
||||
|
@ -39,8 +39,8 @@
|
||||
* Name: ffsl
|
||||
*
|
||||
* Description:
|
||||
* The ffsl() function will find the first bit set (beginning with the least
|
||||
* significant bit) in j, and return the index of that bit. Bits are
|
||||
* The ffsl() function will find the first bit set (beginning with the
|
||||
* least significant bit) in j, and return the index of that bit. Bits are
|
||||
* numbered starting at one (the least significant bit).
|
||||
*
|
||||
* Returned Value:
|
||||
|
@ -41,8 +41,8 @@
|
||||
* Name: ffsll
|
||||
*
|
||||
* Description:
|
||||
* The ffsll() function will find the first bit set (beginning with the least
|
||||
* significant bit) in i, and return the index of that bit. Bits are
|
||||
* The ffsll() function will find the first bit set (beginning with the
|
||||
* least significant bit) in i, and return the index of that bit. Bits are
|
||||
* numbered starting at one (the least significant bit).
|
||||
*
|
||||
* Returned Value:
|
||||
|
@ -84,5 +84,6 @@ bool lib_isbasedigit(int ch, int base, int *value)
|
||||
{
|
||||
*value = tmp;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ int memcmp(FAR const void *s1, FAR const void *s2, size_t n)
|
||||
p1++;
|
||||
p2++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -18,7 +18,6 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
@ -164,7 +163,7 @@ FAR void *memset(FAR void *s, int c, size_t n)
|
||||
#else
|
||||
/* This version is optimized for size */
|
||||
|
||||
FAR unsigned char *p = (FAR unsigned char*)s;
|
||||
FAR unsigned char *p = (FAR unsigned char *)s;
|
||||
while (n-- > 0) *p++ = c;
|
||||
#endif
|
||||
return s;
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
void lib_skipspace(const char **pptr)
|
||||
{
|
||||
const char *ptr = *pptr;
|
||||
while (isspace(*ptr)) ptr++;
|
||||
*pptr = ptr;
|
||||
const char *ptr = *pptr;
|
||||
while (isspace(*ptr)) ptr++;
|
||||
*pptr = ptr;
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ int strcasecmp(FAR const char *cs, FAR const char *ct)
|
||||
cs++;
|
||||
ct++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
@ -97,7 +97,9 @@ FAR char *strcasestr(FAR const char *str, FAR const char *substr)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check if this is the beginning of a matching substring (ignoring case) */
|
||||
/* Check if this is the beginning of a matching substring
|
||||
* (ignoring case)
|
||||
*/
|
||||
|
||||
if (strncasecmp(candidate, substr, len) == 0)
|
||||
{
|
||||
@ -113,8 +115,8 @@ FAR char *strcasestr(FAR const char *str, FAR const char *substr)
|
||||
candidate++;
|
||||
}
|
||||
|
||||
/* Won't get here, but some compilers might complain. Others might complain
|
||||
* about this code being unreachable too.
|
||||
/* Won't get here, but some compilers might complain. Others might
|
||||
* complain about this code being unreachable too.
|
||||
*/
|
||||
|
||||
return NULL;
|
||||
|
@ -40,6 +40,7 @@ char *strcat(char *dest, const char *src)
|
||||
{
|
||||
*dest++ = *src++;
|
||||
}
|
||||
|
||||
*dest = '\0';
|
||||
|
||||
return ret;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* libs/libc/string//lib_strdup.c
|
||||
* libs/libc/string/lib_strdup.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
|
@ -46,6 +46,7 @@ int strncasecmp(const char *cs, const char *ct, size_t nb)
|
||||
cs++;
|
||||
ct++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
@ -40,6 +40,7 @@ char *strncat(char *dest, const char *src, size_t n)
|
||||
{
|
||||
*dest++ = *src++;
|
||||
}
|
||||
|
||||
*dest = '\0';
|
||||
|
||||
return ret;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* libs/libc/string//lib_strndup.c
|
||||
* libs/libc/string/lib_strndup.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@ -31,6 +31,7 @@
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: strndup
|
||||
*
|
||||
|
@ -45,7 +45,9 @@ FAR char *strpbrk(FAR const char *str, FAR const char *charset)
|
||||
|
||||
while (*str)
|
||||
{
|
||||
/* Check if the character from the string matches any character in the charset */
|
||||
/* Check if the character from the string matches any character in the
|
||||
* charset
|
||||
*/
|
||||
|
||||
if (strchr(charset, *str) != NULL)
|
||||
{
|
||||
@ -54,15 +56,15 @@ FAR char *strpbrk(FAR const char *str, FAR const char *charset)
|
||||
return (FAR char *)str;
|
||||
}
|
||||
|
||||
/* This character from the strings matches none of those in the charset.
|
||||
* Try the next character from the string.
|
||||
/* This character from the strings matches none of those in the
|
||||
* charset. Try the next character from the string.
|
||||
*/
|
||||
|
||||
str++;
|
||||
}
|
||||
|
||||
/* We have looked at every character in the string, and none of them match any of
|
||||
* the characters in charset.
|
||||
/* We have looked at every character in the string, and none of them match
|
||||
* any of the characters in charset.
|
||||
*/
|
||||
|
||||
return NULL;
|
||||
|
@ -61,5 +61,6 @@ symtab_findbyname(FAR const struct symtab_s *symtab,
|
||||
return symtab;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -40,9 +40,9 @@
|
||||
*
|
||||
* Description:
|
||||
* Find the symbol in the symbol table whose value closest (but not greater
|
||||
* than), the provided value. This version assumes that table is not ordered
|
||||
* with respect to symbol name and, hence, access time will be linear with
|
||||
* respect to nsyms.
|
||||
* than), the provided value. This version assumes that table is not
|
||||
* ordered with respect to symbol name and, hence, access time will be
|
||||
* linear with respect to nsyms.
|
||||
*
|
||||
* Returned Value:
|
||||
* A reference to the symbol table entry if an entry with the matching
|
||||
@ -59,7 +59,9 @@ symtab_findbyvalue(FAR const struct symtab_s *symtab,
|
||||
DEBUGASSERT(symtab != NULL);
|
||||
for (; nsyms > 0; symtab++, nsyms--)
|
||||
{
|
||||
/* Look for symbols of lesser or equal value (probably address) to value */
|
||||
/* Look for symbols of lesser or equal value (probably address) to
|
||||
* value
|
||||
*/
|
||||
|
||||
if (symtab->sym_value <= value)
|
||||
{
|
||||
@ -73,8 +75,9 @@ symtab_findbyvalue(FAR const struct symtab_s *symtab,
|
||||
|
||||
retval = symtab;
|
||||
|
||||
/* If it is exactly equal to the search 'value', then we might as
|
||||
* well terminate early because we can't do any better than that.
|
||||
/* If it is exactly equal to the search 'value', then we might
|
||||
* as well terminate early because we can't do any better than
|
||||
* that.
|
||||
*/
|
||||
|
||||
if (retval->sym_value == value)
|
||||
|
@ -102,8 +102,8 @@ symtab_findorderedbyname(FAR const struct symtab_s *symtab,
|
||||
* the final symtab[] name.
|
||||
*
|
||||
* Example: Only the last pass through loop, suppose low = 1, high = 2,
|
||||
* mid = 1, and symtab[high].sym_name == name. Then we would get here with
|
||||
* low = 2, high = 2, but symtab[2].sym_name was never tested.
|
||||
* mid = 1, and symtab[high].sym_name == name. Then we would get here
|
||||
* with low = 2, high = 2, but symtab[2].sym_name was never tested.
|
||||
*/
|
||||
|
||||
return strcmp(name, symtab[low].sym_name) == 0 ? &symtab[low] : NULL;
|
||||
|
@ -55,8 +55,8 @@
|
||||
* intended to cause the terminal device to start
|
||||
* transmitting data to the system.
|
||||
*
|
||||
* The default on the opening of a terminal file is that neither its input nor
|
||||
* its output are suspended.
|
||||
* The default on the opening of a terminal file is that neither its input
|
||||
* nor its output are suspended.
|
||||
*
|
||||
* Returned Value:
|
||||
* Upon successful completion, 0 is returned. Otherwise, -1 is returned and
|
||||
|
@ -42,7 +42,8 @@
|
||||
* Function for flushing a terminal/serial device
|
||||
*
|
||||
* Input Parameters:
|
||||
* fd - The 'fd' argument is an open file descriptor associated with a terminal.
|
||||
* fd - The 'fd' argument is an open file descriptor associated with a
|
||||
* terminal.
|
||||
* cmd - The TCFLSH ioctl argument.
|
||||
*
|
||||
* Returned Value:
|
||||
|
@ -44,12 +44,14 @@
|
||||
* referenced by 'termiosp'.
|
||||
*
|
||||
* Input Parameters:
|
||||
* fd - The 'fd' argument is an open file descriptor associated with a terminal.
|
||||
* fd - The 'fd' argument is an open file descriptor associated with a
|
||||
* terminal.
|
||||
* termiosp - The termiosp argument is a pointer to a termios structure.
|
||||
*
|
||||
* Returned Value:
|
||||
* Upon successful completion, 0 is returned. Otherwise, -1 is returned and
|
||||
* errno is set to indicate the error. The following errors may be reported:
|
||||
* errno is set to indicate the error.
|
||||
* The following errors may be reported:
|
||||
*
|
||||
* - EBADF: The 'fd' argument is not a valid file descriptor.
|
||||
* - ENOTTY: The file associated with 'fd' is not a terminal.
|
||||
|
@ -46,8 +46,8 @@
|
||||
* If 'options' is TCSANOW, the change will occur immediately.
|
||||
*
|
||||
* If 'options' is TCSADRAIN, the change will occur after all output
|
||||
* written to 'fd' is transmitted. This function should be used when changing
|
||||
* parameters that affect output.
|
||||
* written to 'fd' is transmitted. This function should be used when
|
||||
* changing parameters that affect output.
|
||||
*
|
||||
* If 'options' is TCSAFLUSH, the change will occur after all
|
||||
* output written to 'fd' is transmitted, and all input so far received but
|
||||
|
@ -54,17 +54,17 @@ static time_t clock_gregorian2utc(int year, int month, int day)
|
||||
|
||||
temp = (month <= 2 ? -1:0);
|
||||
|
||||
return (1461*(year + 4800 + temp))/4
|
||||
+ (367*(month - 2 - 12*temp))/12
|
||||
- (3*((year + 4900 + temp)/100))/4 + day - 32075;
|
||||
return (1461 * (year + 4800 + temp)) / 4
|
||||
+ (367 * (month - 2 - 12 * temp)) / 12
|
||||
- (3 * ((year + 4900 + temp) / 100)) / 4 + day - 32075;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_JULIAN_TIME
|
||||
static time_t clock_julian2utc(int year, int month, int day)
|
||||
{
|
||||
return 367*year
|
||||
- (7*(year + 5001 + (month-9)/7))/4
|
||||
+ (275*month)/9
|
||||
return 367 * year
|
||||
- (7 * (year + 5001 + (month - 9) / 7)) / 4
|
||||
+ (275 * month) / 9
|
||||
+ day + 1729777;
|
||||
}
|
||||
#endif /* CONFIG_JULIAN_TIME */
|
||||
@ -95,7 +95,7 @@ time_t clock_calendar2utc(int year, int month, int day)
|
||||
|
||||
/* Correct year & month ranges. Shift month into range 1-12 */
|
||||
|
||||
dyear = (month-1) / 12;
|
||||
dyear = (month - 1) / 12;
|
||||
month -= 12 * dyear;
|
||||
year += dyear;
|
||||
|
||||
|
@ -73,10 +73,10 @@ int gettimeofday(FAR struct timeval *tv, FAR struct timezone *tz)
|
||||
ret = clock_gettime(CLOCK_REALTIME, &ts);
|
||||
if (ret == OK)
|
||||
{
|
||||
/* Convert the struct timespec to a struct timeval */
|
||||
/* Convert the struct timespec to a struct timeval */
|
||||
|
||||
tv->tv_sec = ts.tv_sec;
|
||||
tv->tv_usec = ts.tv_nsec / NSEC_PER_USEC;
|
||||
tv->tv_sec = ts.tv_sec;
|
||||
tv->tv_usec = ts.tv_nsec / NSEC_PER_USEC;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -85,8 +85,8 @@ static inline void _trimdir(char *path)
|
||||
* 'path' argument OR more that SYMLOOP_MAX symbolic links in the
|
||||
* resolution of the 'path' argument.
|
||||
* ENAMETOOLONG
|
||||
* The length of the path argument exceeds PATH_MAX or a pathname component
|
||||
* is longer than NAME_MAX.
|
||||
* The length of the path argument exceeds PATH_MAX or a pathname
|
||||
* component is longer than NAME_MAX.
|
||||
* ENOENT
|
||||
* A component of 'path' does not name an existing directory or path is
|
||||
* an empty string.
|
||||
@ -128,7 +128,9 @@ int chdir(FAR const char *path)
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Yes, it is a directory. Remove any trailing '/' characters from the path */
|
||||
/* Yes, it is a directory.
|
||||
* Remove any trailing '/' characters from the path
|
||||
*/
|
||||
|
||||
_trimdir(path);
|
||||
|
||||
|
@ -35,7 +35,8 @@
|
||||
* Name: getuid
|
||||
*
|
||||
* Description:
|
||||
* The getuid() function will return the real user ID of the calling process.
|
||||
* The getuid() function will return the real user ID of the calling
|
||||
* process.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
|
@ -70,10 +70,10 @@
|
||||
* unspecified whether the SIGALRM signal is blocked, unless the process'
|
||||
* signal mask is restored as part of the environment.
|
||||
*
|
||||
* Implementations may place limitations on the granularity of timer values.
|
||||
* For each interval timer, if the requested timer value requires a finer
|
||||
* granularity than the implementation supports, the actual timer value will
|
||||
* be rounded up to the next supported value.
|
||||
* Implementations may place limitations on the granularity of timer
|
||||
* values. For each interval timer, if the requested timer value requires a
|
||||
* finer granularity than the implementation supports, the actual timer
|
||||
* value will be rounded up to the next supported value.
|
||||
*
|
||||
* Interactions between sleep() and any of setitimer(), ualarm() or sleep()
|
||||
* are unspecified.
|
||||
@ -109,8 +109,8 @@ unsigned int sleep(unsigned int seconds)
|
||||
|
||||
ret = clock_nanosleep(CLOCK_REALTIME, 0, &rqtp, &rmtp);
|
||||
|
||||
/* clock_nanosleep() should only fail if it was interrupted by a signal,
|
||||
* but we treat all errors the same,
|
||||
/* clock_nanosleep() should only fail if it was interrupted by a
|
||||
* signal, but we treat all errors the same,
|
||||
*/
|
||||
|
||||
if (ret < 0)
|
||||
|
@ -61,24 +61,24 @@ void swab(FAR const void *src, FAR void *dest, ssize_t nbytes)
|
||||
*/
|
||||
|
||||
if (nbytes > 1)
|
||||
{
|
||||
/* The end of dest buffer + 1 byte (skipping any odd numbered byte at
|
||||
* the end of the buffer.
|
||||
*/
|
||||
{
|
||||
/* The end of dest buffer + 1 byte (skipping any odd numbered byte at
|
||||
* the end of the buffer.
|
||||
*/
|
||||
|
||||
end8 = dest8 + (nbytes & ~1);
|
||||
end8 = dest8 + (nbytes & ~1);
|
||||
|
||||
/* Loop until the destination is equal to the end + 1 address */
|
||||
/* Loop until the destination is equal to the end + 1 address */
|
||||
|
||||
while (dest8 != end8)
|
||||
{
|
||||
register uint8_t tmp;
|
||||
while (dest8 != end8)
|
||||
{
|
||||
register uint8_t tmp;
|
||||
|
||||
/* Transfer the bytes, swapping the order */
|
||||
/* Transfer the bytes, swapping the order */
|
||||
|
||||
tmp = *src8++;
|
||||
*dest8++ = *src8++;
|
||||
*dest8++ = tmp;
|
||||
}
|
||||
}
|
||||
tmp = *src8++;
|
||||
*dest8++ = *src8++;
|
||||
*dest8++ = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,10 +58,10 @@
|
||||
* it is unspecified whether that signal has any effect other than causing
|
||||
* usleep() to return.
|
||||
*
|
||||
* If a signal-catching function interrupts usleep() and examines or changes
|
||||
* either the time a SIGALRM is scheduled to be generated, the action
|
||||
* associated with the SIGALRM signal, or whether the SIGALRM signal is
|
||||
* blocked from delivery, the results are unspecified.
|
||||
* If a signal-catching function interrupts usleep() and examines or
|
||||
* changes either the time a SIGALRM is scheduled to be generated, the
|
||||
* action associated with the SIGALRM signal, or whether the SIGALRM signal
|
||||
* is blocked from delivery, the results are unspecified.
|
||||
*
|
||||
* If a signal-catching function interrupts usleep() and calls siglongjmp()
|
||||
* or longjmp() to restore an environment saved prior to the usleep() call,
|
||||
@ -70,15 +70,15 @@
|
||||
* unspecified whether the SIGALRM signal is blocked, unless the process'
|
||||
* signal mask is restored as part of the environment.
|
||||
*
|
||||
* Implementations may place limitations on the granularity of timer values.
|
||||
* For each interval timer, if the requested timer value requires a finer
|
||||
* granularity than the implementation supports, the actual timer value will
|
||||
* be rounded up to the next supported value.
|
||||
* Implementations may place limitations on the granularity of timer
|
||||
* values. For each interval timer, if the requested timer value requires a
|
||||
* finer granularity than the implementation supports, the actual timer
|
||||
* value will be rounded up to the next supported value.
|
||||
*
|
||||
* Interactions between usleep() and any of the following are unspecified:
|
||||
*
|
||||
* nanosleep(), setitimer(), timer_create(), timer_delete(), timer_getoverrun(),
|
||||
* timer_gettime(), timer_settime(), ualarm(), sleep()
|
||||
* nanosleep(), setitimer(), timer_create(), timer_delete(),
|
||||
* timer_getoverrun(), timer_gettime(), timer_settime(), ualarm(), sleep()
|
||||
*
|
||||
* Input Parameters:
|
||||
* usec - the number of microseconds to wait.
|
||||
|
@ -44,8 +44,8 @@
|
||||
*
|
||||
* Description:
|
||||
* Cancel previously queued work. This removes work from the work queue.
|
||||
* After work has been cancelled, it may be re-queue by calling work_queue()
|
||||
* again.
|
||||
* After work has been cancelled, it may be re-queue by calling
|
||||
* work_queue() again.
|
||||
*
|
||||
* Input Parameters:
|
||||
* qid - The work queue ID
|
||||
@ -60,7 +60,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int work_qcancel(FAR struct usr_wqueue_s *wqueue, FAR struct work_s *work)
|
||||
static int work_qcancel(FAR struct usr_wqueue_s *wqueue,
|
||||
FAR struct work_s *work)
|
||||
{
|
||||
int ret = -ENOENT;
|
||||
|
||||
|
@ -56,6 +56,7 @@
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: work_signal
|
||||
*
|
||||
|
@ -58,7 +58,9 @@ struct usr_wqueue_s
|
||||
|
||||
extern struct usr_wqueue_s g_usrwork;
|
||||
|
||||
/* This semaphore/mutex supports exclusive access to the user-mode work queue */
|
||||
/* This semaphore/mutex supports exclusive access to the user-mode work
|
||||
* queue
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_BUILD_PROTECTED
|
||||
extern sem_t g_usrsem;
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/zoneinfo.h>
|
||||
#include "romfs_zoneinfo.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
@ -32,5 +33,3 @@
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#include "romfs_zoneinfo.h"
|
||||
|
Loading…
Reference in New Issue
Block a user