[libc] Update errno and strto* files for compatibility

Most of the strto* functions are only stubbed out, but they're there for
things that link to them but don't call them.
This commit is contained in:
Justin C. Miller
2024-04-30 22:20:41 -07:00
parent 172eb70551
commit 29332cbd45
21 changed files with 346 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
#include <arch/amd64/errno.h>
static int errno_value = 0;
int *
__errno_location()
{
// TODO: thread-local errno
return &errno_value;
}

View File

@@ -2,4 +2,13 @@
/// \file arch/amd64/errno.h
/// errno implementation for amd64
extern int errno;
#ifdef __cplusplus
extern "C" {
#endif
int * __errno_location();
#define errno (*__errno_location())
#ifdef __cplusplus
} // extern C
#endif

View File

@@ -0,0 +1,18 @@
/** \file strtod.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <stdlib.h>
double strtod( const char * restrict nptr, char ** restrict endptr )
{
assert(!"strtod() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file strtof.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <stdlib.h>
float strtof( const char * restrict nptr, char ** restrict endptr )
{
assert(!"strtof() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file strtol.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <stdlib.h>
long strtol( const char * restrict nptr, char ** restrict endptr, int base )
{
assert(!"strtol() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file strtold.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <stdlib.h>
long double strtold( const char * restrict nptr, char ** restrict endptr )
{
assert(!"strtold() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file strtoll.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <stdlib.h>
long long strtoll( const char * restrict nptr, char ** restrict endptr, int base )
{
assert(!"strtoll() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file strtoul.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <stdlib.h>
unsigned long strtoul( const char * restrict nptr, char ** restrict endptr, int base )
{
assert(!"strtoul() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file strtoull.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <stdlib.h>
unsigned long long strtoull( const char * restrict nptr, char ** restrict endptr, int base )
{
assert(!"strtoull() NYI");
return 0;
}

View File

@@ -23,3 +23,5 @@ int memcmp(const void *s1, const void *s2, size_t n) {
return -1;
}
extern "C" int bcmp(const void *s1, const void *s2, size_t n)
__attribute__ ((weak, alias ("memcmp")));

View File

@@ -0,0 +1,18 @@
/** \file swprintf.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <wchar.h>
int swprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, ...)
{
assert(!"swprintf() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file wcslen.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <wchar.h>
size_t wcslen(const wchar_t * s)
{
assert(!"wcslen() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file wcstod.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <wchar.h>
double wcstod(const wchar_t * restrict nptr, wchar_t ** restrict endptr)
{
assert(!"wcstod() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file wcstof.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <wchar.h>
float wcstof(const wchar_t * restrict nptr, wchar_t ** restrict endptr)
{
assert(!"wcstof() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file wcstol.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <wchar.h>
long wcstol(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base)
{
assert(!"wcstol() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file wcstold.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <wchar.h>
long double wcstold(const wchar_t * restrict nptr, wchar_t ** restrict endptr)
{
assert(!"wcstold() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file wcstoll.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <wchar.h>
long long wcstoll(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base)
{
assert(!"wcstoll() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file wcstoul.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <wchar.h>
unsigned long wcstoul(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base)
{
assert(!"wcstoul() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file wcstoull.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <wchar.h>
unsigned long long wcstoull(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base)
{
assert(!"wcstoull() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file wmemchr.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <wchar.h>
wchar_t * wmemchr(const wchar_t * s, wchar_t c, size_t n)
{
assert(!"wmemchr() NYI");
return 0;
}

View File

@@ -0,0 +1,18 @@
/** \file wmemcmp.cpp
*
* This file is part of the C standard library for the jsix operating
* system.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <assert.h>
#include <wchar.h>
int wmemcmp(const wchar_t * s1, const wchar_t * s2, size_t n)
{
assert(!"wmemcmp() NYI");
return 0;
}