libs: nxstyle fixes

nxstyle fixes to pass the CI checks

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
Alin Jerpelea
2021-03-02 14:33:27 +01:00
committed by Xiang Xiao
parent 796ef13b20
commit d6b50a1d3f
93 changed files with 475 additions and 348 deletions
+1
View File
@@ -33,6 +33,7 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
/**************************************************************************** /****************************************************************************
+1
View File
@@ -33,6 +33,7 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
/**************************************************************************** /****************************************************************************
+15 -13
View File
@@ -78,19 +78,20 @@ int readdir_r(FAR DIR *dirp, FAR struct dirent *entry,
tmp = readdir(dirp); tmp = readdir(dirp);
if (!tmp) if (!tmp)
{ {
int error = get_errno(); int error = get_errno();
if (!error) if (!error)
{ {
if (result) if (result)
{ {
*result = NULL; *result = NULL;
} }
return 0;
} return 0;
else }
{ else
return error; {
} return error;
}
} }
if (entry) if (entry)
@@ -102,5 +103,6 @@ int readdir_r(FAR DIR *dirp, FAR struct dirent *entry,
{ {
*result = entry; *result = entry;
} }
return 0; return 0;
} }
+4 -4
View File
@@ -32,9 +32,9 @@
#ifndef __SWAP_UINT32_ISMACRO #ifndef __SWAP_UINT32_ISMACRO
uint32_t __swap_uint32(uint32_t n) uint32_t __swap_uint32(uint32_t n)
{ {
return (uint32_t)(((((uint32_t)(n)) & 0x000000ffUL) << 24) | return (uint32_t)(((((uint32_t)(n)) & 0x000000fful) << 24) |
((((uint32_t)(n)) & 0x0000ff00UL) << 8) | ((((uint32_t)(n)) & 0x0000ff00ul) << 8) |
((((uint32_t)(n)) & 0x00ff0000UL) >> 8) | ((((uint32_t)(n)) & 0x00ff0000ul) >> 8) |
((((uint32_t)(n)) & 0xff000000UL) >> 24)); ((((uint32_t)(n)) & 0xff000000ul) >> 24));
} }
#endif #endif
+8 -8
View File
@@ -34,13 +34,13 @@
#ifdef CONFIG_HAVE_LONG_LONG #ifdef CONFIG_HAVE_LONG_LONG
uint64_t __swap_uint64(uint64_t n) uint64_t __swap_uint64(uint64_t n)
{ {
return (uint64_t)(((((uint64_t)(n)) & 0x00000000000000ffULL) << 56) | return (uint64_t)(((((uint64_t)(n)) & 0x00000000000000ffull) << 56) |
((((uint64_t)(n)) & 0x000000000000ff00ULL) << 40) | ((((uint64_t)(n)) & 0x000000000000ff00ull) << 40) |
((((uint64_t)(n)) & 0x0000000000ff0000ULL) << 24) | ((((uint64_t)(n)) & 0x0000000000ff0000ull) << 24) |
((((uint64_t)(n)) & 0x00000000ff000000ULL) << 8) | ((((uint64_t)(n)) & 0x00000000ff000000ull) << 8) |
((((uint64_t)(n)) & 0x000000ff00000000ULL) >> 8) | ((((uint64_t)(n)) & 0x000000ff00000000ull) >> 8) |
((((uint64_t)(n)) & 0x0000ff0000000000ULL) >> 24) | ((((uint64_t)(n)) & 0x0000ff0000000000ull) >> 24) |
((((uint64_t)(n)) & 0x00ff000000000000ULL) >> 40) | ((((uint64_t)(n)) & 0x00ff000000000000ull) >> 40) |
((((uint64_t)(n)) & 0xff00000000000000ULL) >> 56)); ((((uint64_t)(n)) & 0xff00000000000000ull) >> 56));
} }
#endif #endif
+1
View File
@@ -45,5 +45,6 @@ b16_t b16cos(b16_t rad)
{ {
rad -= b16TWOPI; rad -= b16TWOPI;
} }
return b16sin(rad); return b16sin(rad);
} }
+8 -8
View File
@@ -38,7 +38,8 @@
/**************************************************************************** /****************************************************************************
* Name: b16sin * 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) b16_t b16sin(b16_t rad)
@@ -54,29 +55,28 @@ b16_t b16sin(b16_t rad)
rad += b16TWOPI; rad += b16TWOPI;
} }
else if (rad > b16PI) else if (rad > b16PI)
{ {
rad -= b16TWOPI; rad -= b16TWOPI;
} }
/* tmp1 = 1.27323954 * rad /* tmp1 = 1.27323954 * rad
* tmp2 = .405284735 * rad * rad * tmp2 = .405284735 * rad * rad
*/ */
tmp1 = b16mulb16(b16_1P27323954, rad); tmp1 = b16mulb16(b16_1P27323954, rad);
tmp2 = b16mulb16(b16_P405284735, b16sqr(rad)); tmp2 = b16mulb16(b16_P405284735, b16sqr(rad));
if (rad < 0) if (rad < 0)
{ {
/* tmp3 = 1.27323954 * rad + .405284735 * rad * rad */ /* tmp3 = 1.27323954 * rad + .405284735 * rad * rad */
tmp3 = tmp1 + tmp2; tmp3 = tmp1 + tmp2;
} }
else 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 */ /* tmp1 = tmp3*tmp3 */
+4 -2
View File
@@ -171,6 +171,7 @@ b16_t b16sqr(b16_t a)
{ {
sq = b16MAX; sq = b16MAX;
} }
return sq; return sq;
} }
@@ -236,7 +237,7 @@ ub16_t ub16divub16(ub16_t num, ub16_t denom)
term1 = ((uint32_t)num & 0xffff0000) / denom; term1 = ((uint32_t)num & 0xffff0000) / denom;
if (term1 >= 0x00010000) if (term1 >= 0x00010000)
{ {
return ub16MAX; /* Will overflow */ return ub16MAX; /* Will overflow */
} }
/* Finish the division */ /* Finish the division */
@@ -249,8 +250,9 @@ ub16_t ub16divub16(ub16_t num, ub16_t denom)
if (product < term1) if (product < term1)
{ {
return ub16MAX; /* Overflowed */ return ub16MAX; /* Overflowed */
} }
return product; return product;
} }
+4
View File
@@ -37,4 +37,8 @@
struct group g_group; struct group g_group;
char g_group_buffer[GRPBUF_RESERVE_SIZE]; char g_group_buffer[GRPBUF_RESERVE_SIZE];
/****************************************************************************
* Public Functions
****************************************************************************/
#endif /* CONFIG_LIBC_GROUP_FILE */ #endif /* CONFIG_LIBC_GROUP_FILE */
+3 -2
View File
@@ -80,12 +80,13 @@ FAR char *basename(FAR char *path)
/* Check for trailing slash characters */ /* Check for trailing slash characters */
len = strlen(path); len = strlen(path);
while (path[len-1] == '/') while (path[len - 1] == '/')
{ {
/* Remove trailing '/' UNLESS this would make a zero length string */ /* Remove trailing '/' UNLESS this would make a zero length string */
if (len > 1) if (len > 1)
{ {
path[len-1] = '\0'; path[len - 1] = '\0';
len--; len--;
} }
else else
+5 -4
View File
@@ -80,12 +80,13 @@ FAR char *dirname(FAR char *path)
/* Check for trailing slash characters */ /* Check for trailing slash characters */
len = strlen(path); len = strlen(path);
while (path[len-1] == '/') while (path[len - 1] == '/')
{ {
/* Remove trailing '/' UNLESS this would make a zero length string */ /* Remove trailing '/' UNLESS this would make a zero length string */
if (len > 1) if (len > 1)
{ {
path[len-1] = '\0'; path[len - 1] = '\0';
len--; len--;
} }
else else
@@ -102,8 +103,8 @@ FAR char *dirname(FAR char *path)
p = strrchr(path, '/'); p = strrchr(path, '/');
if (p) if (p)
{ {
/* Handle the case where the only '/' in the string is the at the beginning /* Handle the case where the only '/' in the string is the at the
* of the path. * beginning of the path.
*/ */
if (p == path) if (p == path)
+2 -1
View File
@@ -49,6 +49,7 @@
FAR char *setlocale(int category, FAR const char *locale) FAR char *setlocale(int category, FAR const char *locale)
{ {
return ((locale == NULL || strcmp(locale, "POSIX") == 0 || 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 #endif
+18 -16
View File
@@ -1,28 +1,30 @@
/**************************************************************************** /****************************************************************************
* libs/libc/lzf/lzf.h * 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- * Redistribution and use in source and binary forms, with or without
* tion, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are
* met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright
* this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* OF THE POSSIBILITY OF SUCH DAMAGE. * 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. * and might also be slower. Default is to autodetect.
*/ */
/*#define LZF_USER_OFFSETS autodetect */ /* #define LZF_USER_OFFSETS autodetect */
#ifndef LZF_USE_OFFSETS #ifndef LZF_USE_OFFSETS
# define LZF_USE_OFFSETS (UINTPTR_MAX > 0xffffffffU) # define LZF_USE_OFFSETS (UINTPTR_MAX > 0xffffffffU)
+25 -24
View File
@@ -3,26 +3,27 @@
* *
* Copyright (c) 2000-2010 Marc Alexander Lehmann <schmorp@schmorp.de> * Copyright (c) 2000-2010 Marc Alexander Lehmann <schmorp@schmorp.de>
* *
* Redistribution and use in source and binary forms, with or without modifica- * Redistribution and use in source and binary forms, with or without
* tion, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions
* are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright
* this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * INCIDENTAL, SPE- CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* OF THE POSSIBILITY OF SUCH DAMAGE. * 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) - 1] = lit - 1; /* Stop run */
op -= !lit; /* Undo run if length is zero */ op -= !lit; /* Undo run if length is zero */
for (;;) for (; ; )
{ {
if (expect_true(maxlen > 16)) if (expect_true(maxlen > 16))
{ {
@@ -330,7 +331,7 @@ size_t lzf_compress(FAR const void *const in_data,
} }
else else
{ {
*op++ = (off >> 8) + ( 7 << 5); *op++ = (off >> 8) + (7 << 5);
*op++ = len - 7; *op++ = len - 7;
} }
@@ -388,8 +389,8 @@ size_t lzf_compress(FAR const void *const in_data,
if (expect_false(lit == MAX_LIT)) if (expect_false(lit == MAX_LIT))
{ {
op[- lit - 1] = lit - 1; /* Stop run */ op[(- lit) - 1] = lit - 1; /* Stop run */
lit = 0; /* Start run */ lit = 0; /* Start run */
op++; op++;
} }
} }
@@ -409,14 +410,14 @@ size_t lzf_compress(FAR const void *const in_data,
if (expect_false(lit == MAX_LIT)) if (expect_false(lit == MAX_LIT))
{ {
op[- lit - 1] = lit - 1; /* Stop run */ op[(- lit) - 1] = lit - 1; /* Stop run */
lit = 0; /* Start run */ lit = 0; /* Start run */
op++; op++;
} }
} }
op[- lit - 1] = lit - 1; /* End run */ op[(- lit) - 1] = lit - 1; /* End run */
op -= !lit; /* Undo run if length is zero */ op -= !lit; /* Undo run if length is zero */
cs = op - (uint8_t *)out_data; cs = op - (uint8_t *)out_data;
+19 -15
View File
@@ -1,28 +1,30 @@
/**************************************************************************** /****************************************************************************
* libs/libc/lzf/lzf_c.c * 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- * Redistribution and use in source and binary forms, with or without
* tion, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are
* met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright
* this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * OF MER CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * (INCLUDING NEGLIGENCE OR OTH- ERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* OF THE POSSIBILITY OF SUCH DAMAGE. * 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); set_errno(EINVAL);
return 0; return 0;
} }
#endif #endif
if (len == 7) if (len == 7)
{ {
@@ -288,6 +291,7 @@ unsigned int lzf_decompress (FAR const void *const in_data,
*op++ = *ref++; *op++ = *ref++;
case 0: case 0:
/* Two octets more */ /* Two octets more */
*op++ = *ref++; *op++ = *ref++;
+34 -14
View File
@@ -77,7 +77,8 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_ident[EI_CLASS] != ELFCLASS32) 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; return false;
} }
@@ -89,7 +90,8 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB)
#endif #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; return false;
} }
@@ -97,11 +99,13 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if ((ehdr->e_entry & 3) != 0) 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; return false;
} }
/* TODO: Check ABI here. */ /* TODO: Check ABI here. */
return true; 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_CALL:
case R_ARM_JUMP24: case R_ARM_JUMP24:
{ {
binfo("Performing PC24 [%d] link at addr %08lx [%08lx] to sym '%p' st_value=%08lx\n", binfo("Performing PC24 [%d] link", ELF32_R_TYPE(rel->r_info),
ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t *)addr), binfo(" at addr %08lx [%08lx] to sym '%p' st_value=%08lx\n",
sym, (long)sym->st_value); (long)addr,
(long)(*(uint32_t *)addr),
sym,
(long)sym->st_value);
offset = (*(uint32_t *)addr & 0x00ffffff) << 2; offset = (*(uint32_t *)addr & 0x00ffffff) << 2;
if (offset & 0x02000000) 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; 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", berr("ERROR: PC24 [%d] relocation out of range, offset=%08lx\n",
ELF32_R_TYPE(rel->r_info), offset); 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_ABS32:
case R_ARM_TARGET1: /* New ABI: TARGET1 always treated as 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", binfo("Performing ABS32 link");
(long)addr, (long)(*(uint32_t *)addr), sym, (long)sym->st_value); 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; *(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: case R_ARM_PREL31:
{ {
binfo("Performing PREL31 link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n", binfo("Performing PREL31 link at");
(long)addr, (long)(*(uint32_t *)addr), sym, (long)sym->st_value); 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; offset = *(uint32_t *)addr + sym->st_value - addr;
*(uint32_t *)addr = offset & 0x7fffffff; *(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_MOVW_ABS_NC:
case R_ARM_MOVT_ABS: case R_ARM_MOVT_ABS:
{ {
binfo("Performing MOVx_ABS [%d] link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n", binfo("Performing MOVx_ABS [%d] link", ELF32_R_TYPE(rel->r_info));
ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t *)addr), binfo(" at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
sym, (long)sym->st_value); (long)addr, (long)(*(uint32_t *)addr),
sym,
(long)sym->st_value);
offset = *(uint32_t *)addr; offset = *(uint32_t *)addr;
offset = ((offset & 0xf0000) >> 4) | (offset & 0xfff); offset = ((offset & 0xf0000) >> 4) | (offset & 0xfff);
+25 -25
View File
@@ -208,22 +208,22 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
* upper_insn: * upper_insn:
* *
* 1 1 1 1 1 1 * 1 1 1 1 1 1
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions
* +----------+---+-------------------------------+--------------+ * +----------+---+--------------------------+----------+
* |1 1 1 |OP1| OP2 | | 32-Bit Instructions * |1 1 1 |OP1| OP2 | | 32-Bit
* +----------+---+--+-----+----------------------+--------------+ * +----------+---+--+-----+-----------------+----------+
* |1 1 1 | 1 0| S | imm10 | BL Instruction * |1 1 1 | 1 0| S | imm10 | BL
* +----------+------+-----+-------------------------------------+ * +----------+------+-----+----------------------------+
* *
* lower_insn: * lower_insn:
* *
* 1 1 1 1 1 1 * 1 1 1 1 1 1
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions
* +---+---------------------------------------------------------+ * +---+------------------------------------------------+
* |OP | | 32-Bit Instructions * |OP | | 32-Bit
* +---+--+---+---+---+------------------------------------------+ * +---+--+---+---+---+---------------------------------+
* |1 1 |J1 | 1 |J2 | imm11 | BL Instruction * |1 1 |J1 | 1 |J2 | imm11 | BL
* +------+---+---+---+------------------------------------------+ * +------+---+---+---+---------------------------------+
* *
* The branch target is encoded in these bits: * 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: * upper_insn:
* *
* 1 1 1 1 1 1 * 1 1 1 1 1 1
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions
* +----------+---+-------------------------------+--------------+ * +----------+---+--------------------------+----------+
* |1 1 1 |OP1| OP2 | | 32-Bit Instructions * |1 1 1 |OP1| OP2 | | 32-Bit
* +----------+---+--+-----+----------------------+--------------+ * +----------+---+--+-----+-----------------+----------+
* |1 1 1 | 1 0| i | 1 0 1 1 0 0 | imm4 | MOVT Instruction * |1 1 1 | 1 0| i |1 0 1 1 0 0 | imm4 | MOVT
* +----------+------+-----+----------------------+--------------+ * +----------+------+-----+-----------------+----------+
* *
* lower_insn: * lower_insn:
* *
* 1 1 1 1 1 1 * 1 1 1 1 1 1
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions
* +---+---------------------------------------------------------+ * +---+-----------------------------------------------+
* |OP | | 32-Bit Instructions * |OP | | 32-Bit
* +---+----------+--------------+-------------------------------+ * +---+----------+-----------+------------------------+
* |0 | imm3 | Rd | imm8 | MOVT Instruction * |0 | imm3 | Rd | imm8 | MOVT
* +---+----------+--------------+-------------------------------+ * +---+----------+-----------+------------------------+
* *
* The 16-bit immediate value is encoded in these bits: * The 16-bit immediate value is encoded in these bits:
* *
+24 -24
View File
@@ -211,22 +211,22 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
* upper_insn: * upper_insn:
* *
* 1 1 1 1 1 1 * 1 1 1 1 1 1
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions
* +----------+---+-------------------------------+--------------+ * +----------+---+--------------------------+----------+
* |1 1 1 |OP1| OP2 | | 32-Bit Instructions * |1 1 1 |OP1| OP2 | | 32-Bit
* +----------+---+--+-----+----------------------+--------------+ * +----------+---+--+-----+-----------------+----------+
* |1 1 1 | 1 0| S | imm10 | BL Instruction * |1 1 1 | 1 0| S | imm10 | BL
* +----------+------+-----+-------------------------------------+ * +----------+------+-----+----------------------------+
* *
* lower_insn: * lower_insn:
* *
* 1 1 1 1 1 1 * 1 1 1 1 1 1
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions
* +---+---------------------------------------------------------+ * +---+------------------------------------------------+
* |OP | | 32-Bit Instructions * |OP | | 32-Bit
* +---+--+---+---+---+------------------------------------------+ * +---+--+---+---+---+---------------------------------+
* |1 1 |J1 | 1 |J2 | imm11 | BL Instruction * |1 1 |J1 | 1 |J2 | imm11 | BL
* +------+---+---+---+------------------------------------------+ * +------+---+---+---+--------------------------------+
* *
* The branch target is encoded in these bits: * 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: * upper_insn:
* *
* 1 1 1 1 1 1 * 1 1 1 1 1 1
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instruction
* +----------+---+-------------------------------+--------------+ * +----------+---+--------------------------+----------+
* |1 1 1 |OP1| OP2 | | 32-Bit Instructions * |1 1 1 |OP1| OP2 | | 32-Bit
* +----------+---+--+-----+----------------------+--------------+ * +----------+---+--+-----+-----------------+----------+
* |1 1 1 | 1 0| i | 1 0 1 1 0 0 | imm4 | MOVT Instruction * |1 1 1 | 1 0| i |1 0 1 1 0 0 | imm4 | MOVT
* +----------+------+-----+----------------------+--------------+ * +----------+------+-----+-----------------+----------+
* *
* lower_insn: * lower_insn:
* *
* 1 1 1 1 1 1 * 1 1 1 1 1 1
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions
* +---+---------------------------------------------------------+ * +---+-------------------------------------------------+
* |OP | | 32-Bit Instructions * |OP | | 32-Bit
* +---+----------+--------------+-------------------------------+ * +---+----------+--------+-----------------------------+
* |0 | imm3 | Rd | imm8 | MOVT Instruction * |0 | imm3 | Rd | imm8 | MOVT
* +---+----------+--------------+-------------------------------+ * +---+----------+--------+-----------------------------+
* *
* The 16-bit immediate value is encoded in these bits: * The 16-bit immediate value is encoded in these bits:
* *
+24 -13
View File
@@ -77,7 +77,8 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_ident[EI_CLASS] != ELFCLASS32) 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; return false;
} }
@@ -89,7 +90,8 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB)
#endif #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; return false;
} }
@@ -97,11 +99,13 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if ((ehdr->e_entry & 3) != 0) 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; return false;
} }
/* TODO: Check ABI here. */ /* TODO: Check ABI here. */
return true; 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_CALL:
case R_ARM_JUMP24: case R_ARM_JUMP24:
{ {
binfo("Performing PC24 [%d] link at addr %08lx [%08lx] to sym '%p' st_value=%08lx\n", binfo("Performing PC24 [%d] link at", ELF32_R_TYPE(rel->r_info));
ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t *)addr), binfo(" addr %08lx [%08lx] to sym '%p' st_value=%08lx\n",
(long)addr, (long)(*(uint32_t *)addr),
sym, (long)sym->st_value); sym, (long)sym->st_value);
offset = (*(uint32_t *)addr & 0x00ffffff) << 2; 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; 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); ELF32_R_TYPE(rel->r_info), offset);
return -EINVAL; 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_ABS32:
case R_ARM_TARGET1: /* New ABI: TARGET1 always treated as 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", binfo("Performing ABS32 link at");
(long)addr, (long)(*(uint32_t *)addr), sym, (long)sym->st_value); 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; *(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: case R_ARM_PREL31:
{ {
binfo("Performing PREL31 link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n", binfo("Performing PREL31 link at");
(long)addr, (long)(*(uint32_t *)addr), sym, (long)sym->st_value); 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; offset = *(uint32_t *)addr + sym->st_value - addr;
*(uint32_t *)addr = offset & 0x7fffffff; *(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_MOVW_ABS_NC:
case R_ARM_MOVT_ABS: case R_ARM_MOVT_ABS:
{ {
binfo("Performing MOVx_ABS [%d] link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n", binfo("Performing MOVx_ABS [%d] link at", ELF32_R_TYPE(rel->r_info));
ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t *)addr), binfo(" addr=%08lx [%08lx] to sym=%p st_value=%08lx\n",
(long)addr, (long)(*(uint32_t *)addr),
sym, (long)sym->st_value); sym, (long)sym->st_value);
offset = *(uint32_t *)addr; offset = *(uint32_t *)addr;
+2 -2
View File
@@ -36,10 +36,10 @@ uint32_t htonl(uint32_t hl)
#ifdef CONFIG_ENDIAN_BIG #ifdef CONFIG_ENDIAN_BIG
return hl; return hl;
#else #else
return (( (hl) >> 24) | return (((hl) >> 24) |
(((hl) >> 8) & 0x0000ff00) | (((hl) >> 8) & 0x0000ff00) |
(((hl) << 8) & 0x00ff0000) | (((hl) << 8) & 0x00ff0000) |
( (hl) << 24)); ((hl) << 24));
#endif #endif
} }
+4 -2
View File
@@ -51,9 +51,11 @@
int pthread_attr_getaffinity_np(FAR const pthread_attr_t *attr, int pthread_attr_getaffinity_np(FAR const pthread_attr_t *attr,
size_t cpusetsize, cpu_set_t *cpuset) 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; *cpuset = attr->affinity;
return OK; return OK;
+2 -1
View File
@@ -53,7 +53,8 @@ int pthread_attr_setaffinity_np(FAR pthread_attr_t *attr,
size_t cpusetsize, size_t cpusetsize,
FAR const cpu_set_t *cpuset) 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) && DEBUGASSERT(attr != NULL && cpusetsize == sizeof(cpu_set_t) &&
cpuset != NULL && *cpuset != 0); cpuset != NULL && *cpuset != 0);
@@ -63,5 +63,6 @@ int pthread_barrierattr_destroy(FAR pthread_barrierattr_t *attr)
{ {
attr->pshared = PTHREAD_PROCESS_PRIVATE; attr->pshared = PTHREAD_PROCESS_PRIVATE;
} }
return ret; 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; int ret = OK;
@@ -62,5 +63,6 @@ int pthread_barrierattr_getpshared(FAR const pthread_barrierattr_t *attr, FAR in
{ {
*pshared = attr->pshared; *pshared = attr->pshared;
} }
return ret; return ret;
} }
@@ -62,5 +62,6 @@ int pthread_barrierattr_init(FAR pthread_barrierattr_t *attr)
{ {
attr->pshared = PTHREAD_PROCESS_PRIVATE; attr->pshared = PTHREAD_PROCESS_PRIVATE;
} }
return ret; return ret;
} }
@@ -56,25 +56,26 @@
* Name: pthread_barrierattr_setpshared * Name: pthread_barrierattr_setpshared
* *
* Description: * Description:
* The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit a * The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit
* barrier to be operated upon by any thread that has access to the memory where * a barrier to be operated upon by any thread that has access to the
* the barrier is allocated. If the process-shared attribute is * memory where the barrier is allocated. If the process-shared attribute
* PTHREAD_PROCESS_PRIVATE, the barrier can only be operated upon by threads * is PTHREAD_PROCESS_PRIVATE, the barrier can only be operated upon by
* created within the same process as the thread that initialized the barrier. * threads created within the same process as the thread that initialized
* If threads of different processes attempt to operate on such a barrier, the * the barrier.
* behavior is undefined. The default value of the attribute is * 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. * PTHREAD_PROCESS_PRIVATE.
* *
* Both constants PTHREAD_PROCESS_SHARED and PTHREAD_PROCESS_PRIVATE are defined * Both constants PTHREAD_PROCESS_SHARED and PTHREAD_PROCESS_PRIVATE are
* in pthread.h. * defined in pthread.h.
* *
* Input Parameters: * Input Parameters:
* attr - barrier attributes to be modified. * attr - barrier attributes to be modified.
* pshared - the new value of the pshared attribute. * pshared - the new value of the pshared attribute.
* *
* Returned Value: * Returned Value:
* 0 (OK) on success or EINVAL if either attr is invalid or pshared is not one * 0 (OK) on success or EINVAL if either attr is invalid or pshared is not
* of PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE. * one of PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE.
* *
* Assumptions: * Assumptions:
* *
@@ -84,7 +85,8 @@ int pthread_barrierattr_setpshared(FAR pthread_barrierattr_t *attr, int pshared)
{ {
int ret = OK; 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; ret = EINVAL;
} }
@@ -92,5 +94,6 @@ int pthread_barrierattr_setpshared(FAR pthread_barrierattr_t *attr, int pshared)
{ {
attr->pshared = pshared; attr->pshared = pshared;
} }
return ret; return ret;
} }
+2 -1
View File
@@ -70,7 +70,8 @@
****************************************************************************/ ****************************************************************************/
int pthread_barrier_init(FAR pthread_barrier_t *barrier, 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; int ret = OK;
+6 -6
View File
@@ -36,9 +36,9 @@
* Description: * Description:
* The mutex object referenced by mutex is locked by calling * The mutex object referenced by mutex is locked by calling
* pthread_mutex_lock(). If the mutex is already locked, the calling thread * pthread_mutex_lock(). If the mutex is already locked, the calling thread
* blocks until the mutex becomes available. This operation returns with the * blocks until the mutex becomes available. This operation returns with
* mutex object referenced by mutex in the locked state with the calling * the mutex object referenced by mutex in the locked state with the
* thread as its owner. * calling thread as its owner.
* *
* If the mutex type is PTHREAD_MUTEX_NORMAL, deadlock detection is not * If the mutex type is PTHREAD_MUTEX_NORMAL, deadlock detection is not
* provided. Attempting to relock the mutex causes deadlock. If a thread * 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 * 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 * 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 * 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 * lock count reaches zero, the mutex becomes available for other threads
* acquire. If a thread attempts to unlock a mutex that it has not locked or * to acquire. If a thread attempts to unlock a mutex that it has not
* a mutex which is unlocked, an error will be returned. * 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 * 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 * 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; int ret = OK;
@@ -61,7 +61,8 @@ int pthread_mutexattr_setrobust(pthread_mutexattr_t *attr, int robust)
#elif defined(CONFIG_PTHREAD_MUTEX_BOTH) #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; attr->robust = robust;
return OK; return OK;
+3 -1
View File
@@ -81,7 +81,9 @@ int pthread_once(FAR pthread_once_t *once_control,
return OK; 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(); sched_unlock();
return OK; return OK;
+4 -1
View File
@@ -31,7 +31,10 @@
/**************************************************************************** /****************************************************************************
* Public Functions * 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 #if PTHREAD_CANCEL_ENABLE != TASK_CANCEL_ENABLE
# error We must have PTHREAD_CANCEL_ENABLE == TASK_CANCEL_ENABLE # error We must have PTHREAD_CANCEL_ENABLE == TASK_CANCEL_ENABLE
@@ -29,6 +29,7 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* The following are defined in different header files but must have the /* The following are defined in different header files but must have the
* same values. * same values.
*/ */
+4 -3
View File
@@ -181,9 +181,10 @@ int pthread_spin_lock(pthread_spinlock_t *lock)
} }
/* Loop until we successfully take the spinlock (i.e., until the previous /* 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 * state of the spinlock was SP_UNLOCKED).
* is performed via boardctl() to avoid a variety of issues. An option * NOTE that the test/set operaion is performed via boardctl() to avoid a
* might be to move the implementation of up_testset() to libs/libc/machine. * variety of issues. An option might be to move the implementation of
* up_testset() to libs/libc/machine.
*/ */
do do
+4
View File
@@ -37,4 +37,8 @@
struct passwd g_passwd; struct passwd g_passwd;
char g_passwd_buffer[CONFIG_LIBC_PASSWD_LINESIZE]; char g_passwd_buffer[CONFIG_LIBC_PASSWD_LINESIZE];
/****************************************************************************
* Public Functions
****************************************************************************/
#endif /* CONFIG_LIBC_GROUP_FILE */ #endif /* CONFIG_LIBC_GROUP_FILE */
+1 -1
View File
@@ -25,7 +25,7 @@
#include <queue.h> #include <queue.h>
/**************************************************************************** /****************************************************************************
* public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
+3 -3
View File
@@ -100,9 +100,9 @@ _sa_handler_t signal(int signo, _sa_handler_t func)
*/ */
if (ret == OK) if (ret == OK)
{ {
return oact.sa_handler; return oact.sa_handler;
} }
return (_sa_handler_t)SIG_ERR; return (_sa_handler_t)SIG_ERR;
} }
-1
View File
@@ -98,7 +98,6 @@ int posix_spawnattr_init(posix_spawnattr_t *attr)
attr->budget.tv_nsec = param.sched_ss_init_budget.tv_nsec; attr->budget.tv_nsec = param.sched_ss_init_budget.tv_nsec;
#endif #endif
#ifndef CONFIG_ARCH_ADDRENV #ifndef CONFIG_ARCH_ADDRENV
/* Default stack size */ /* Default stack size */
+2 -1
View File
@@ -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); DEBUGASSERT(attr);
attr->stacksize = stacksize; attr->stacksize = stacksize;
+2 -1
View File
@@ -55,7 +55,8 @@ void add_file_action(FAR posix_spawn_file_actions_t *file_actions,
/* Find the end of the list */ /* 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; next;
prev = next, next = next->flink); prev = next, next = next->flink);
+5 -3
View File
@@ -58,8 +58,9 @@
* *
****************************************************************************/ ****************************************************************************/
int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *file_actions, int posix_spawn_file_actions_addclose(
int fd) FAR posix_spawn_file_actions_t *file_actions,
int fd)
{ {
FAR struct spawn_close_file_action_s *entry; 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 */ /* 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; return OK;
} }
+5 -3
View File
@@ -59,8 +59,9 @@
* *
****************************************************************************/ ****************************************************************************/
int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *file_actions, int posix_spawn_file_actions_adddup2(
int fd1, int fd2) FAR posix_spawn_file_actions_t *file_actions,
int fd1, int fd2)
{ {
FAR struct spawn_dup2_file_action_s *entry; 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 */ /* 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; return OK;
} }
+5 -2
View File
@@ -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 *curr;
FAR struct spawn_general_file_action_s *next; 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;
curr = next) 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; next = curr->flink;
lib_free(curr); lib_free(curr);
+2 -1
View File
@@ -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; FAR struct spawn_general_file_action_s *entry;
+2 -1
View File
@@ -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; *file_actions = NULL;
return OK; return OK;
+6 -6
View File
@@ -34,6 +34,12 @@
#include "libc.h" #include "libc.h"
/* Include floating point functions */
#ifdef CONFIG_LIBC_FLOATINGPOINT
# include "stdio/lib_libdtoa.c"
#endif
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
@@ -193,12 +199,6 @@ static const char g_nullstring[] = "(null)";
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
/* Include floating point functions */
#ifdef CONFIG_LIBC_FLOATINGPOINT
# include "stdio/lib_libdtoa.c"
#endif
/**************************************************************************** /****************************************************************************
* Name: ptohex * Name: ptohex
****************************************************************************/ ****************************************************************************/
+4 -4
View File
@@ -39,10 +39,10 @@
* *
* Description: * Description:
* fgetpos() function is an alternate interfaces equivalent to ftell(). * fgetpos() function is an alternate interfaces equivalent to ftell().
* It gets the current value of the file offset and store it in the location * It gets the current value of the file offset and store it in the
* referenced by pos. On some non-UNIX systems an fpos_t object may be a * location referenced by pos. On some non-UNIX systems an fpos_t object
* complex object and fsetpos may be the only way to portably reposition a * may be a complex object and fsetpos may be the only way to portably
* stream. * reposition a stream.
* *
* Returned Value: * Returned Value:
* Zero on succes; -1 on failure with errno set appropriately. * Zero on succes; -1 on failure with errno set appropriately.
+2 -2
View File
@@ -46,8 +46,8 @@
* set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the * 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, * start of the file, the current position indicator, or end-of-file,
* respectively. A successful call to the fseek() function clears the * 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) * end-of-file indicator for the stream and undoes any effects of the
* function on the same stream. * ungetc(3) function on the same stream.
* *
* Returned Value: * Returned Value:
* Zero on succes; -1 on failure with errno set appropriately. * Zero on succes; -1 on failure with errno set appropriately.
+5 -2
View File
@@ -55,10 +55,13 @@ static off_t lib_getrdoffset(FAR FILE *stream)
off_t rdoffset = 0; off_t rdoffset = 0;
lib_take_semaphore(stream); 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 #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 #else
rdoffset = stream->fs_bufread - stream->fs_bufpos; rdoffset = stream->fs_bufread - stream->fs_bufpos;
#endif #endif
+7 -7
View File
@@ -42,8 +42,8 @@
* Name: lib_fflush * Name: lib_fflush
* *
* Description: * Description:
* The function lib_fflush() forces a write of all user-space buffered data for * The function lib_fflush() forces a write of all user-space buffered data
* the given output or update stream via the stream's underlying write * for the given output or update stream via the stream's underlying write
* function. The open status of the stream is unaffected. * function. The open status of the stream is unaffected.
* *
* Input Parameters: * Input Parameters:
@@ -83,7 +83,7 @@ ssize_t lib_fflush(FAR FILE *stream, bool bforce)
ret = 0; ret = 0;
goto errout_with_sem; goto errout_with_sem;
} }
/* Make sure that the buffer holds valid data */ /* Make sure that the buffer holds valid data */
@@ -146,10 +146,10 @@ ssize_t lib_fflush(FAR FILE *stream, bool bforce)
*/ */
while (nbuffer) while (nbuffer)
{ {
*stream->fs_bufpos++ = *src++; *stream->fs_bufpos++ = *src++;
--nbuffer; --nbuffer;
} }
} }
/* Restore normal access to the stream and return the number of bytes /* Restore normal access to the stream and return the number of bytes

Some files were not shown because too many files have changed in this diff Show More