Introduce __set_errno() throughout libroot.
* add errno_private.h, which defines the __set_errno() macro with and without tracing * instead of setting errno manually, all libroot's code now invokes __set_errno(), which makes it much easier to trace changes to errno * redirect glibc's use of __set_errno() to our own version
This commit is contained in:
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011, Oliver Tappe, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _ERRNO_PRIVATE_H
|
||||||
|
#define _ERRNO_PRIVATE_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
//#define TRACE_ERRNO
|
||||||
|
|
||||||
|
#if defined(TRACE_ERRNO) && !defined(_KERNEL_MODE)
|
||||||
|
# include <OS.h>
|
||||||
|
# define __set_errno(x) \
|
||||||
|
do { \
|
||||||
|
int error = (x); \
|
||||||
|
debug_printf("%s:%d - setting errno to %x\n", __FILE__, __LINE__, \
|
||||||
|
error); \
|
||||||
|
errno = error; \
|
||||||
|
} while (0)
|
||||||
|
#else
|
||||||
|
# define __set_errno(x) \
|
||||||
|
do { errno = (x); } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _ERRNO_PRIVATE_H
|
||||||
@@ -25,6 +25,8 @@ SYSHDRS =
|
|||||||
[ FDirName $(HAIKU_TOP) headers os support ]
|
[ FDirName $(HAIKU_TOP) headers os support ]
|
||||||
$(TARGET_GCC_HEADERS_DIR) ; # such that include_next will work
|
$(TARGET_GCC_HEADERS_DIR) ; # such that include_next will work
|
||||||
|
|
||||||
|
UsePrivateHeaders libroot ;
|
||||||
|
|
||||||
# some source-files generate several different objects, depending on
|
# some source-files generate several different objects, depending on
|
||||||
# the defines that are used during the compilation call.
|
# the defines that are used during the compilation call.
|
||||||
# So we explicitly state each of these (with their respective defines):
|
# So we explicitly state each of these (with their respective defines):
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
#include <errno_private.h>
|
||||||
#include <fs_info.h>
|
#include <fs_info.h>
|
||||||
#include <fs_volume.h>
|
#include <fs_volume.h>
|
||||||
|
|
||||||
@@ -116,13 +117,13 @@ mount(const char *filesystem, const char *where, const char *device, ulong flags
|
|||||||
|
|
||||||
// we don't support passing (binary) parameters
|
// we don't support passing (binary) parameters
|
||||||
if (parms != NULL || len != 0 || flags & ~1) {
|
if (parms != NULL || len != 0 || flags & ~1) {
|
||||||
errno = B_BAD_VALUE;
|
__set_errno(B_BAD_VALUE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = fs_mount_volume(where, device, filesystem, mountFlags, NULL);
|
err = fs_mount_volume(where, device, filesystem, mountFlags, NULL);
|
||||||
if (err < B_OK) {
|
if (err < B_OK) {
|
||||||
errno = err;
|
__set_errno(err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -136,7 +137,7 @@ unmount(const char *path)
|
|||||||
|
|
||||||
err = fs_unmount_volume(path, 0);
|
err = fs_unmount_volume(path, 0);
|
||||||
if (err < B_OK) {
|
if (err < B_OK) {
|
||||||
errno = err;
|
__set_errno(err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <user_group.h>
|
#include <user_group.h>
|
||||||
|
|
||||||
/* use pwents to find home */
|
/* use pwents to find home */
|
||||||
@@ -129,7 +130,7 @@ create_path(const char *path, mode_t mode)
|
|||||||
|
|
||||||
strlcpy(buffer, path, i + 1);
|
strlcpy(buffer, path, i + 1);
|
||||||
if (stat(buffer, &st) < 0) {
|
if (stat(buffer, &st) < 0) {
|
||||||
errno = 0;
|
__set_errno(0);
|
||||||
if (mkdir(buffer, mode) < 0)
|
if (mkdir(buffer, mode) < 0)
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <dirent_private.h>
|
#include <dirent_private.h>
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ open_attr_dir(int file, const char *path, bool traverse)
|
|||||||
|
|
||||||
int fd = _kern_open_attr_dir(file, path, traverse);
|
int fd = _kern_open_attr_dir(file, path, traverse);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
errno = fd;
|
__set_errno(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <dirent_private.h>
|
#include <dirent_private.h>
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ fs_open_index_dir(dev_t device)
|
|||||||
|
|
||||||
int fd = _kern_open_index_dir(device);
|
int fd = _kern_open_index_dir(device);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
errno = fd;
|
__set_errno(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
** Distributed under the terms of the Haiku License.
|
** Distributed under the terms of the Haiku License.
|
||||||
*/
|
*/
|
||||||
@@ -10,13 +10,14 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
|
||||||
#define RETURN_AND_SET_ERRNO(status) \
|
#define RETURN_AND_SET_ERRNO(status) \
|
||||||
{ \
|
{ \
|
||||||
if (status < 0) { \
|
if (status < 0) { \
|
||||||
errno = status; \
|
__set_errno(status); \
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
return status; \
|
return status; \
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <dirent_private.h>
|
#include <dirent_private.h>
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
|
|
||||||
@@ -22,14 +23,14 @@ open_query_etc(dev_t device, const char *query,
|
|||||||
uint32 flags, port_id port, int32 token)
|
uint32 flags, port_id port, int32 token)
|
||||||
{
|
{
|
||||||
if (device < 0 || query == NULL || query[0] == '\0') {
|
if (device < 0 || query == NULL || query[0] == '\0') {
|
||||||
errno = B_BAD_VALUE;
|
__set_errno(B_BAD_VALUE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open
|
// open
|
||||||
int fd = _kern_open_query(device, query, strlen(query), flags, port, token);
|
int fd = _kern_open_query(device, query, strlen(query), flags, port, token);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
errno = fd;
|
__set_errno(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ fs_open_live_query(dev_t device, const char *query,
|
|||||||
{
|
{
|
||||||
// check parameters
|
// check parameters
|
||||||
if (port < 0) {
|
if (port < 0) {
|
||||||
errno = B_BAD_VALUE;
|
__set_errno(B_BAD_VALUE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
#include <commpage_defs.h>
|
#include <commpage_defs.h>
|
||||||
|
#include <errno_private.h>
|
||||||
#include <libroot_private.h>
|
#include <libroot_private.h>
|
||||||
#include <real_time_data.h>
|
#include <real_time_data.h>
|
||||||
#include <user_timer_defs.h>
|
#include <user_timer_defs.h>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ do_seek_dir(DIR* dir)
|
|||||||
if (dir->seek_position < dir->current_position) {
|
if (dir->seek_position < dir->current_position) {
|
||||||
status_t status = _kern_rewind_dir(dir->fd);
|
status_t status = _kern_rewind_dir(dir->fd);
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +82,7 @@ do_seek_dir(DIR* dir)
|
|||||||
(char*)dir + DIR_BUFFER_SIZE - (char*)&dir->first_entry, USHRT_MAX);
|
(char*)dir + DIR_BUFFER_SIZE - (char*)&dir->first_entry, USHRT_MAX);
|
||||||
if (count <= 0) {
|
if (count <= 0) {
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
errno = count;
|
__set_errno(count);
|
||||||
|
|
||||||
// end of directory
|
// end of directory
|
||||||
return -1;
|
return -1;
|
||||||
@@ -105,7 +106,7 @@ __create_dir_struct(int fd)
|
|||||||
|
|
||||||
DIR* dir = (DIR*)malloc(DIR_BUFFER_SIZE);
|
DIR* dir = (DIR*)malloc(DIR_BUFFER_SIZE);
|
||||||
if (dir == NULL) {
|
if (dir == NULL) {
|
||||||
errno = B_NO_MEMORY;
|
__set_errno(B_NO_MEMORY);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +131,7 @@ fdopendir(int fd)
|
|||||||
// descriptors, we have to open a fresh one explicitly.
|
// descriptors, we have to open a fresh one explicitly.
|
||||||
int dirFD = _kern_open_dir(fd, NULL);
|
int dirFD = _kern_open_dir(fd, NULL);
|
||||||
if (dirFD < 0) {
|
if (dirFD < 0) {
|
||||||
errno = dirFD;
|
__set_errno(dirFD);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +165,7 @@ opendir(const char* path)
|
|||||||
|
|
||||||
int fd = _kern_open_dir(-1, path);
|
int fd = _kern_open_dir(-1, path);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
errno = fd;
|
__set_errno(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +185,7 @@ closedir(DIR* dir)
|
|||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (dir == NULL) {
|
if (dir == NULL) {
|
||||||
errno = B_BAD_VALUE;
|
__set_errno(B_BAD_VALUE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,7 +225,7 @@ readdir(DIR* dir)
|
|||||||
(char*)dir + DIR_BUFFER_SIZE - (char*)&dir->first_entry, USHRT_MAX);
|
(char*)dir + DIR_BUFFER_SIZE - (char*)&dir->first_entry, USHRT_MAX);
|
||||||
if (count <= 0) {
|
if (count <= 0) {
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
errno = count;
|
__set_errno(count);
|
||||||
|
|
||||||
// end of directory
|
// end of directory
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
#include <umask.h>
|
#include <umask.h>
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
|||||||
|
|
||||||
SubDirHdrs $(HAIKU_TOP) src system libroot posix glibc arch generic ;
|
SubDirHdrs $(HAIKU_TOP) src system libroot posix glibc arch generic ;
|
||||||
|
|
||||||
|
UsePrivateHeaders libroot ;
|
||||||
|
|
||||||
|
|
||||||
if $(OPTIM) = -O0 {
|
if $(OPTIM) = -O0 {
|
||||||
OPTIM = -O ;
|
OPTIM = -O ;
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
|||||||
|
|
||||||
SubDirHdrs $(HAIKU_TOP) src system libroot posix glibc arch generic ;
|
SubDirHdrs $(HAIKU_TOP) src system libroot posix glibc arch generic ;
|
||||||
|
|
||||||
|
UsePrivateHeaders libroot ;
|
||||||
|
|
||||||
|
|
||||||
if $(OPTIM) = -O0 {
|
if $(OPTIM) = -O0 {
|
||||||
OPTIM = -O ;
|
OPTIM = -O ;
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
|||||||
|
|
||||||
SubDirHdrs $(HAIKU_TOP) src system libroot posix glibc arch generic ;
|
SubDirHdrs $(HAIKU_TOP) src system libroot posix glibc arch generic ;
|
||||||
|
|
||||||
|
UsePrivateHeaders libroot ;
|
||||||
|
|
||||||
if $(OPTIM) = -O0 {
|
if $(OPTIM) = -O0 {
|
||||||
OPTIM = -O ;
|
OPTIM = -O ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc iconv ;
|
|||||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc locale ;
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc locale ;
|
||||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
||||||
|
|
||||||
|
UsePrivateHeaders libroot ;
|
||||||
|
|
||||||
|
|
||||||
SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ;
|
SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ;
|
||||||
|
|
||||||
MergeObject posix_gnu_iconv.o :
|
MergeObject posix_gnu_iconv.o :
|
||||||
|
|||||||
@@ -17,4 +17,4 @@
|
|||||||
02111-1307 USA. */
|
02111-1307 USA. */
|
||||||
#include_next <errno.h>
|
#include_next <errno.h>
|
||||||
|
|
||||||
#define __set_errno(val) errno = (val)
|
#include <errno_private.h>
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc locale ;
|
|||||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
||||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc iconv ;
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc iconv ;
|
||||||
|
|
||||||
|
UsePrivateHeaders libroot ;
|
||||||
|
|
||||||
# For now, all wide character functions are disabled,
|
# For now, all wide character functions are disabled,
|
||||||
# obprintf() is also disabled, because we don't have
|
# obprintf() is also disabled, because we don't have
|
||||||
# obstack functionality
|
# obstack functionality
|
||||||
|
|||||||
@@ -50,12 +50,6 @@
|
|||||||
# include <shlib-compat.h>
|
# include <shlib-compat.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifndef errno
|
|
||||||
extern int errno;
|
|
||||||
#endif
|
|
||||||
#ifndef __set_errno
|
|
||||||
# define __set_errno(Val) errno = (Val)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
/*# define open(Name, Flags, Prot) __open (Name, Flags, Prot)
|
/*# define open(Name, Flags, Prot) __open (Name, Flags, Prot)
|
||||||
|
|||||||
@@ -28,12 +28,6 @@
|
|||||||
#include <libioP.h>
|
#include <libioP.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#ifndef errno
|
|
||||||
extern int errno;
|
|
||||||
#endif
|
|
||||||
#ifndef __set_errno
|
|
||||||
# define __set_errno(Val) errno = (Val)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_IO_off64_t
|
_IO_off64_t
|
||||||
_IO_seekoff_unlocked (fp, offset, dir, mode)
|
_IO_seekoff_unlocked (fp, offset, dir, mode)
|
||||||
|
|||||||
@@ -29,9 +29,6 @@
|
|||||||
#define _LIBIO_P_H_
|
#define _LIBIO_P_H_
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#ifndef __set_errno
|
|
||||||
# define __set_errno(Val) errno = (Val)
|
|
||||||
#endif
|
|
||||||
#if defined __GLIBC__ && __GLIBC__ >= 2
|
#if defined __GLIBC__ && __GLIBC__ >= 2
|
||||||
# include <bits/libc-lock.h>
|
# include <bits/libc-lock.h>
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -44,12 +44,6 @@
|
|||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
#ifndef errno
|
|
||||||
extern int errno;
|
|
||||||
#endif
|
|
||||||
#ifndef __set_errno
|
|
||||||
# define __set_errno(Val) errno = (Val)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc misc ;
|
|||||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc locale ;
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc locale ;
|
||||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
||||||
|
|
||||||
|
UsePrivateHeaders libroot ;
|
||||||
|
|
||||||
|
|
||||||
SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ;
|
SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ;
|
||||||
|
|
||||||
MergeObject posix_gnu_misc.o :
|
MergeObject posix_gnu_misc.o :
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc stdio-common ;
|
|||||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc locale ;
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc locale ;
|
||||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
||||||
|
|
||||||
# ToDo: for now, all wide character functions are disabled
|
UsePrivateHeaders libroot ;
|
||||||
|
|
||||||
|
|
||||||
MergeObject posix_gnu_stdio.o : #_common.o :
|
MergeObject posix_gnu_stdio.o : #_common.o :
|
||||||
_itoa.c
|
_itoa.c
|
||||||
|
|||||||
@@ -24,9 +24,6 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#ifndef __set_errno
|
|
||||||
# define __set_errno(Val) errno = (Val)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifndef P_tmpdir
|
#ifndef P_tmpdir
|
||||||
|
|||||||
@@ -605,12 +605,12 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
|
|||||||
{
|
{
|
||||||
/* Eat whitespace. */
|
/* Eat whitespace. */
|
||||||
int save_errno = errno;
|
int save_errno = errno;
|
||||||
errno = 0;
|
__set_errno(0);
|
||||||
do
|
do
|
||||||
if (inchar () == EOF && errno == EINTR)
|
if (inchar () == EOF && errno == EINTR)
|
||||||
input_error ();
|
input_error ();
|
||||||
while (ISSPACE (c));
|
while (ISSPACE (c));
|
||||||
errno = save_errno;
|
__set_errno(save_errno);
|
||||||
ungetc (c, s);
|
ungetc (c, s);
|
||||||
skip_space = 0;
|
skip_space = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc locale ;
|
|||||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc stdlib ;
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc stdlib ;
|
||||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
||||||
|
|
||||||
|
UsePrivateHeaders libroot ;
|
||||||
|
|
||||||
SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ;
|
SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ;
|
||||||
|
|
||||||
MergeObject posix_gnu_stdlib.o :
|
MergeObject posix_gnu_stdlib.o :
|
||||||
|
|||||||
@@ -29,12 +29,6 @@
|
|||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#ifndef errno
|
|
||||||
extern int errno;
|
|
||||||
#endif
|
|
||||||
#ifndef __set_errno
|
|
||||||
# define __set_errno(Val) errno = (Val)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_LIMITS_H
|
#ifdef HAVE_LIMITS_H
|
||||||
# include <limits.h>
|
# include <limits.h>
|
||||||
@@ -532,7 +526,7 @@ noconv:
|
|||||||
|
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* External user entry point. */
|
/* External user entry point. */
|
||||||
|
|
||||||
#if _LIBC - 0 == 0
|
#if _LIBC - 0 == 0
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc stdlib ;
|
|||||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ctype ;
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ctype ;
|
||||||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
|
||||||
|
|
||||||
|
UsePrivateHeaders libroot ;
|
||||||
|
|
||||||
|
|
||||||
SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ;
|
SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ;
|
||||||
|
|
||||||
MergeObject posix_gnu_wcsmbs.o :
|
MergeObject posix_gnu_wcsmbs.o :
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93";
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
#ifndef __HAIKU__
|
#ifndef __HAIKU__
|
||||||
# include "collate.h"
|
# include "collate.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -155,7 +157,7 @@ static int glob1(Char *, glob_t *, size_t *);
|
|||||||
static int glob2(Char *, Char *, Char *, Char *, glob_t *, size_t *);
|
static int glob2(Char *, Char *, Char *, Char *, glob_t *, size_t *);
|
||||||
static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, size_t *);
|
static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, size_t *);
|
||||||
static int globextend(const Char *, glob_t *, size_t *);
|
static int globextend(const Char *, glob_t *, size_t *);
|
||||||
static const Char *
|
static const Char *
|
||||||
globtilde(const Char *, Char *, size_t, glob_t *);
|
globtilde(const Char *, Char *, size_t, glob_t *);
|
||||||
static int globexp1(const Char *, glob_t *, size_t *);
|
static int globexp1(const Char *, glob_t *, size_t *);
|
||||||
static int globexp2(const Char *, const Char *, glob_t *, int *, size_t *);
|
static int globexp2(const Char *, const Char *, glob_t *, int *, size_t *);
|
||||||
@@ -378,8 +380,8 @@ globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
|
|||||||
if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
|
if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
|
||||||
return pattern;
|
return pattern;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy up to the end of the string or /
|
* Copy up to the end of the string or /
|
||||||
*/
|
*/
|
||||||
eb = &patbuf[patbuf_len - 1];
|
eb = &patbuf[patbuf_len - 1];
|
||||||
for (p = pattern + 1, h = (char *) patbuf;
|
for (p = pattern + 1, h = (char *) patbuf;
|
||||||
@@ -625,7 +627,7 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
|
|||||||
if (pathend > pathend_last)
|
if (pathend > pathend_last)
|
||||||
return (GLOB_ABORTED);
|
return (GLOB_ABORTED);
|
||||||
*pathend = EOS;
|
*pathend = EOS;
|
||||||
errno = 0;
|
__set_errno(0);
|
||||||
|
|
||||||
if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
|
if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
|
||||||
/* TODO: don't call for ENOENT or ENOTDIR? */
|
/* TODO: don't call for ENOENT or ENOTDIR? */
|
||||||
@@ -711,7 +713,7 @@ globextend(const Char *path, glob_t *pglob, size_t *limit)
|
|||||||
const Char *p;
|
const Char *p;
|
||||||
|
|
||||||
if (*limit && pglob->gl_pathc > *limit) {
|
if (*limit && pglob->gl_pathc > *limit) {
|
||||||
errno = 0;
|
__set_errno(0);
|
||||||
return (GLOB_NOSPACE);
|
return (GLOB_NOSPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -850,7 +852,7 @@ g_lstat(Char *fn, struct stat *sb, glob_t *pglob)
|
|||||||
char buf[MAXPATHLEN];
|
char buf[MAXPATHLEN];
|
||||||
|
|
||||||
if (g_Ctoc(fn, buf, sizeof(buf))) {
|
if (g_Ctoc(fn, buf, sizeof(buf))) {
|
||||||
errno = ENAMETOOLONG;
|
__set_errno(ENAMETOOLONG);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
|
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
|
||||||
@@ -864,7 +866,7 @@ g_stat(Char *fn, struct stat *sb, glob_t *pglob)
|
|||||||
char buf[MAXPATHLEN];
|
char buf[MAXPATHLEN];
|
||||||
|
|
||||||
if (g_Ctoc(fn, buf, sizeof(buf))) {
|
if (g_Ctoc(fn, buf, sizeof(buf))) {
|
||||||
errno = ENAMETOOLONG;
|
__set_errno(ENAMETOOLONG);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
|
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <libroot_private.h>
|
#include <libroot_private.h>
|
||||||
#include <RegistrarDefs.h>
|
#include <RegistrarDefs.h>
|
||||||
#include <user_group.h>
|
#include <user_group.h>
|
||||||
@@ -130,7 +131,7 @@ getgrent(void)
|
|||||||
int status = getgrent_r(&sGroupBuffer, sGroupStringBuffer,
|
int status = getgrent_r(&sGroupBuffer, sGroupStringBuffer,
|
||||||
sizeof(sGroupStringBuffer), &result);
|
sizeof(sGroupStringBuffer), &result);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,7 +191,7 @@ getgrnam(const char *name)
|
|||||||
int status = getgrnam_r(name, &sGroupBuffer, sGroupStringBuffer,
|
int status = getgrnam_r(name, &sGroupBuffer, sGroupStringBuffer,
|
||||||
sizeof(sGroupStringBuffer), &result);
|
sizeof(sGroupStringBuffer), &result);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,7 +211,7 @@ getgrgid(gid_t gid)
|
|||||||
int status = getgrgid_r(gid, &sGroupBuffer, sGroupStringBuffer,
|
int status = getgrgid_r(gid, &sGroupBuffer, sGroupStringBuffer,
|
||||||
sizeof(sGroupStringBuffer), &result);
|
sizeof(sGroupStringBuffer), &result);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
SubDir HAIKU_TOP src system libroot posix locale ;
|
SubDir HAIKU_TOP src system libroot posix locale ;
|
||||||
|
|
||||||
UsePrivateHeaders
|
UsePrivateHeaders
|
||||||
|
[ FDirName libroot ]
|
||||||
[ FDirName libroot locale ]
|
[ FDirName libroot locale ]
|
||||||
[ FDirName libroot time ]
|
[ FDirName libroot time ]
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wctype.h>
|
#include <wctype.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
#include "LocaleBackend.h"
|
#include "LocaleBackend.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -187,7 +189,7 @@ towctrans(wint_t wc, wctrans_t transition)
|
|||||||
status_t status = gLocaleBackend->ToWCTrans(wc, transition, result);
|
status_t status = gLocaleBackend->ToWCTrans(wc, transition, result);
|
||||||
|
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -204,7 +206,7 @@ wctrans(const char *charClass)
|
|||||||
return _ISupper;
|
return _ISupper;
|
||||||
}
|
}
|
||||||
|
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <user_thread.h>
|
#include <user_thread.h>
|
||||||
|
|
||||||
#include "tracing_config.h"
|
#include "tracing_config.h"
|
||||||
@@ -154,7 +155,7 @@ add_address(void* address, size_t size)
|
|||||||
};
|
};
|
||||||
|
|
||||||
stack_frame* frame = (stack_frame*)get_stack_frame();
|
stack_frame* frame = (stack_frame*)get_stack_frame();
|
||||||
|
|
||||||
for (int i = 0; i < HEAP_CALL_STACK_SIZE; i++) {
|
for (int i = 0; i < HEAP_CALL_STACK_SIZE; i++) {
|
||||||
if (frame != NULL) {
|
if (frame != NULL) {
|
||||||
b->setCallStack(i, frame->return_address);
|
b->setCallStack(i, frame->return_address);
|
||||||
@@ -272,7 +273,7 @@ malloc(size_t size)
|
|||||||
void *addr = pHeap->getHeap(pHeap->getHeapIndex()).malloc(size);
|
void *addr = pHeap->getHeap(pHeap->getHeapIndex()).malloc(size);
|
||||||
if (addr == NULL) {
|
if (addr == NULL) {
|
||||||
undefer_signals();
|
undefer_signals();
|
||||||
errno = B_NO_MEMORY;
|
__set_errno(B_NO_MEMORY);
|
||||||
KTRACE("malloc(%lu) -> NULL", size);
|
KTRACE("malloc(%lu) -> NULL", size);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -308,7 +309,7 @@ calloc(size_t nelem, size_t elsize)
|
|||||||
void *ptr = pHeap->getHeap(pHeap->getHeapIndex()).malloc(size);
|
void *ptr = pHeap->getHeap(pHeap->getHeapIndex()).malloc(size);
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
undefer_signals();
|
undefer_signals();
|
||||||
errno = B_NO_MEMORY;
|
__set_errno(B_NO_MEMORY);
|
||||||
KTRACE("calloc(%lu, %lu) -> NULL", nelem, elsize);
|
KTRACE("calloc(%lu, %lu) -> NULL", nelem, elsize);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -373,7 +374,7 @@ memalign(size_t alignment, size_t size)
|
|||||||
size);
|
size);
|
||||||
if (addr == NULL) {
|
if (addr == NULL) {
|
||||||
undefer_signals();
|
undefer_signals();
|
||||||
errno = B_NO_MEMORY;
|
__set_errno(B_NO_MEMORY);
|
||||||
KTRACE("memalign(%lu, %lu) -> NULL", alignment, size);
|
KTRACE("memalign(%lu, %lu) -> NULL", alignment, size);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -469,7 +470,7 @@ realloc(void *ptr, size_t size)
|
|||||||
void *buffer = malloc(size);
|
void *buffer = malloc(size);
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
// Allocation failed, leave old block and return
|
// Allocation failed, leave old block and return
|
||||||
errno = B_NO_MEMORY;
|
__set_errno(B_NO_MEMORY);
|
||||||
KTRACE("realloc(%p, %lu) -> NULL", ptr, size);
|
KTRACE("realloc(%p, %lu) -> NULL", ptr, size);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
SubDir HAIKU_TOP src system libroot posix malloc_debug ;
|
SubDir HAIKU_TOP src system libroot posix malloc_debug ;
|
||||||
|
|
||||||
UsePrivateSystemHeaders ;
|
UsePrivateSystemHeaders ;
|
||||||
UsePrivateHeaders shared ;
|
UsePrivateHeaders libroot shared ;
|
||||||
|
|
||||||
MergeObject posix_malloc_debug.o :
|
MergeObject posix_malloc_debug.o :
|
||||||
heap.cpp
|
heap.cpp
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <locks.h>
|
#include <locks.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <libroot_private.h>
|
#include <libroot_private.h>
|
||||||
#include <RegistrarDefs.h>
|
#include <RegistrarDefs.h>
|
||||||
#include <user_group.h>
|
#include <user_group.h>
|
||||||
@@ -128,7 +129,7 @@ getpwent(void)
|
|||||||
int status = getpwent_r(&sPasswdBuffer, sPasswdStringBuffer,
|
int status = getpwent_r(&sPasswdBuffer, sPasswdStringBuffer,
|
||||||
sizeof(sPasswdStringBuffer), &result);
|
sizeof(sPasswdStringBuffer), &result);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +189,7 @@ getpwnam(const char *name)
|
|||||||
int status = getpwnam_r(name, &sPasswdBuffer, sPasswdStringBuffer,
|
int status = getpwnam_r(name, &sPasswdBuffer, sPasswdStringBuffer,
|
||||||
sizeof(sPasswdStringBuffer), &result);
|
sizeof(sPasswdStringBuffer), &result);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +209,7 @@ getpwuid(uid_t uid)
|
|||||||
int status = getpwuid_r(uid, &sPasswdBuffer, sPasswdStringBuffer,
|
int status = getpwuid_r(uid, &sPasswdBuffer, sPasswdStringBuffer,
|
||||||
sizeof(sPasswdStringBuffer), &result);
|
sizeof(sPasswdStringBuffer), &result);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,9 @@
|
|||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
#include <TypeConstants.h>
|
#include <TypeConstants.h>
|
||||||
|
|
||||||
/*
|
#include <errno_private.h>
|
||||||
|
|
||||||
|
/*
|
||||||
* Some notes.
|
* Some notes.
|
||||||
* Users are stored in an fs node (not necessarily a regular file,
|
* Users are stored in an fs node (not necessarily a regular file,
|
||||||
* that could be a dir, even the user's home dir,
|
* that could be a dir, even the user's home dir,
|
||||||
@@ -78,16 +80,16 @@ static int32 pw_tls_id;
|
|||||||
typedef struct pw_tls {
|
typedef struct pw_tls {
|
||||||
DIR *grent_query;
|
DIR *grent_query;
|
||||||
DIR *pwent_query;
|
DIR *pwent_query;
|
||||||
|
|
||||||
int gridx;
|
int gridx;
|
||||||
int pwidx;
|
int pwidx;
|
||||||
|
|
||||||
char grfile[B_PATH_NAME_LENGTH+1]; /* current group's cached file path */
|
char grfile[B_PATH_NAME_LENGTH+1]; /* current group's cached file path */
|
||||||
char pwfile[B_PATH_NAME_LENGTH+1]; /* current user's cached file path */
|
char pwfile[B_PATH_NAME_LENGTH+1]; /* current user's cached file path */
|
||||||
|
|
||||||
struct group grent;
|
struct group grent;
|
||||||
char grbuff[GRBUFFSZ]; /* XXX: merge with pwbuff ? */
|
char grbuff[GRBUFFSZ]; /* XXX: merge with pwbuff ? */
|
||||||
|
|
||||||
struct passwd pwent;
|
struct passwd pwent;
|
||||||
char pwbuff[PWBUFFSZ];
|
char pwbuff[PWBUFFSZ];
|
||||||
} pw_tls_t;
|
} pw_tls_t;
|
||||||
@@ -96,7 +98,7 @@ struct pw_tls *get_pw_tls(void)
|
|||||||
{
|
{
|
||||||
pw_tls_t *p = (pw_tls_t *)tls_get(pw_tls_id);
|
pw_tls_t *p = (pw_tls_t *)tls_get(pw_tls_id);
|
||||||
PRINT(("%s()\n", __FUNCTION__));
|
PRINT(("%s()\n", __FUNCTION__));
|
||||||
|
|
||||||
if (!p) {
|
if (!p) {
|
||||||
p = (pw_tls_t *)malloc(sizeof(pw_tls_t));
|
p = (pw_tls_t *)malloc(sizeof(pw_tls_t));
|
||||||
if (!p)
|
if (!p)
|
||||||
@@ -117,7 +119,7 @@ int dentopen(struct dirent *dent, char *path)
|
|||||||
dent->d_dev = boot_device;
|
dent->d_dev = boot_device;
|
||||||
err = get_path_for_dirent(dent, path, B_PATH_NAME_LENGTH);
|
err = get_path_for_dirent(dent, path, B_PATH_NAME_LENGTH);
|
||||||
if ((err < 0) || (path[0] != '/')) {
|
if ((err < 0) || (path[0] != '/')) {
|
||||||
errno = err;
|
__set_errno(err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
PRINT(("%s: open(%s)\n", __FUNCTION__, path));
|
PRINT(("%s: open(%s)\n", __FUNCTION__, path));
|
||||||
@@ -178,7 +180,7 @@ void endgrent(void)
|
|||||||
pw_tls_t *p;
|
pw_tls_t *p;
|
||||||
PRINT(("%s()\n", __FUNCTION__));
|
PRINT(("%s()\n", __FUNCTION__));
|
||||||
p = get_pw_tls();
|
p = get_pw_tls();
|
||||||
|
|
||||||
if (p->grent_query)
|
if (p->grent_query)
|
||||||
fs_close_query(p->grent_query);
|
fs_close_query(p->grent_query);
|
||||||
p->grent_query = NULL;
|
p->grent_query = NULL;
|
||||||
@@ -203,7 +205,7 @@ PRINT(("getgrent_r: grq = %p, idx = %d\n", p->grent_query, p->gridx));
|
|||||||
setgrent(); /* y0u clumsy app! */
|
setgrent(); /* y0u clumsy app! */
|
||||||
if (!p->grent_query)
|
if (!p->grent_query)
|
||||||
return EIO; /* something happened... */
|
return EIO; /* something happened... */
|
||||||
errno = 0;
|
__set_errno(0);
|
||||||
dent = fs_read_query(p->grent_query);
|
dent = fs_read_query(p->grent_query);
|
||||||
*gbufp = NULL;
|
*gbufp = NULL;
|
||||||
if (!dent) {
|
if (!dent) {
|
||||||
@@ -238,12 +240,12 @@ struct group *getgrent(void)
|
|||||||
p = get_pw_tls();
|
p = get_pw_tls();
|
||||||
if (!p) {
|
if (!p) {
|
||||||
/* we are really bork */
|
/* we are really bork */
|
||||||
errno = ENOMEM;
|
__set_errno(ENOMEM);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
err = getgrent_r(&p->grent, p->grbuff, GRBUFFSZ, &ent);
|
err = getgrent_r(&p->grent, p->grbuff, GRBUFFSZ, &ent);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
errno = err;
|
__set_errno(err);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!ent)
|
if (!ent)
|
||||||
@@ -265,17 +267,17 @@ struct group *getgrgid(gid_t gid)
|
|||||||
p = get_pw_tls();
|
p = get_pw_tls();
|
||||||
if (!p) {
|
if (!p) {
|
||||||
/* we are really bork */
|
/* we are really bork */
|
||||||
errno = ENOMEM;
|
__set_errno(ENOMEM);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reusing path */
|
/* reusing path */
|
||||||
sprintf(p->grfile, QT_GR_GID, gid);
|
sprintf(p->grfile, QT_GR_GID, gid);
|
||||||
query = fs_open_query(boot_device, p->grfile, 0);
|
query = fs_open_query(boot_device, p->grfile, 0);
|
||||||
PRINT(("q: %p\n", query));
|
PRINT(("q: %p\n", query));
|
||||||
if (!query)
|
if (!query)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dent = fs_read_query(query);
|
dent = fs_read_query(query);
|
||||||
if (!dent) {
|
if (!dent) {
|
||||||
fs_close_query(query);
|
fs_close_query(query);
|
||||||
@@ -291,7 +293,7 @@ struct group *getgrgid(gid_t gid)
|
|||||||
if (err)
|
if (err)
|
||||||
return NULL;
|
return NULL;
|
||||||
return &p->grent;
|
return &p->grent;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* by name */
|
/* by name */
|
||||||
@@ -307,12 +309,12 @@ struct group *getgrnam(const char *name)
|
|||||||
p = get_pw_tls();
|
p = get_pw_tls();
|
||||||
if (!p) {
|
if (!p) {
|
||||||
/* we are really bork */
|
/* we are really bork */
|
||||||
errno = ENOMEM;
|
__set_errno(ENOMEM);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!name || strlen(name) > GR_MAX_NAME) {
|
if (!name || strlen(name) > GR_MAX_NAME) {
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* reusing path */
|
/* reusing path */
|
||||||
@@ -321,7 +323,7 @@ struct group *getgrnam(const char *name)
|
|||||||
PRINT(("q: %p\n", query));
|
PRINT(("q: %p\n", query));
|
||||||
if (!query)
|
if (!query)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dent = fs_read_query(query);
|
dent = fs_read_query(query);
|
||||||
if (!dent) {
|
if (!dent) {
|
||||||
fs_close_query(query);
|
fs_close_query(query);
|
||||||
@@ -337,7 +339,7 @@ struct group *getgrnam(const char *name)
|
|||||||
if (err)
|
if (err)
|
||||||
return NULL;
|
return NULL;
|
||||||
return &p->grent;
|
return &p->grent;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -455,7 +457,7 @@ void endpwent(void)
|
|||||||
pw_tls_t *p;
|
pw_tls_t *p;
|
||||||
PRINT(("%s()\n", __FUNCTION__));
|
PRINT(("%s()\n", __FUNCTION__));
|
||||||
p = get_pw_tls();
|
p = get_pw_tls();
|
||||||
|
|
||||||
if (p->pwent_query)
|
if (p->pwent_query)
|
||||||
fs_close_query(p->pwent_query);
|
fs_close_query(p->pwent_query);
|
||||||
p->pwent_query = NULL;
|
p->pwent_query = NULL;
|
||||||
@@ -480,7 +482,7 @@ PRINT(("getpwent_r: pwq = %p, idx = %d\n", p->pwent_query, p->pwidx));
|
|||||||
setpwent(); /* y0u clumsy app! */
|
setpwent(); /* y0u clumsy app! */
|
||||||
if (!p->pwent_query)
|
if (!p->pwent_query)
|
||||||
return EIO; /* something happened... */
|
return EIO; /* something happened... */
|
||||||
errno = 0;
|
__set_errno(0);
|
||||||
dent = fs_read_query(p->pwent_query);
|
dent = fs_read_query(p->pwent_query);
|
||||||
*pwbufp = NULL;
|
*pwbufp = NULL;
|
||||||
if (!dent) {
|
if (!dent) {
|
||||||
@@ -515,12 +517,12 @@ struct passwd *getpwent(void)
|
|||||||
p = get_pw_tls();
|
p = get_pw_tls();
|
||||||
if (!p) {
|
if (!p) {
|
||||||
/* we are really bork */
|
/* we are really bork */
|
||||||
errno = ENOMEM;
|
__set_errno(ENOMEM);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
err = getpwent_r(&p->pwent, p->pwbuff, PWBUFFSZ, &ent);
|
err = getpwent_r(&p->pwent, p->pwbuff, PWBUFFSZ, &ent);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
errno = err;
|
__set_errno(err);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!ent)
|
if (!ent)
|
||||||
@@ -542,10 +544,10 @@ struct passwd *getpwuid(uid_t uid)
|
|||||||
p = get_pw_tls();
|
p = get_pw_tls();
|
||||||
if (!p) {
|
if (!p) {
|
||||||
/* we are really bork */
|
/* we are really bork */
|
||||||
errno = ENOMEM;
|
__set_errno(ENOMEM);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reusing path */
|
/* reusing path */
|
||||||
sprintf(p->pwfile, QT_PW_UID, uid);
|
sprintf(p->pwfile, QT_PW_UID, uid);
|
||||||
PRINT(("%s: query(%s)\n", __FUNCTION__, p->pwfile));
|
PRINT(("%s: query(%s)\n", __FUNCTION__, p->pwfile));
|
||||||
@@ -553,7 +555,7 @@ struct passwd *getpwuid(uid_t uid)
|
|||||||
PRINT(("q: %p\n", query));
|
PRINT(("q: %p\n", query));
|
||||||
if (!query)
|
if (!query)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dent = fs_read_query(query);
|
dent = fs_read_query(query);
|
||||||
if (!dent) {
|
if (!dent) {
|
||||||
fs_close_query(query);
|
fs_close_query(query);
|
||||||
@@ -569,7 +571,7 @@ struct passwd *getpwuid(uid_t uid)
|
|||||||
if (err)
|
if (err)
|
||||||
return NULL;
|
return NULL;
|
||||||
return &p->pwent;
|
return &p->pwent;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* by name */
|
/* by name */
|
||||||
@@ -585,12 +587,12 @@ struct passwd *getpwnam(const char *name)
|
|||||||
p = get_pw_tls();
|
p = get_pw_tls();
|
||||||
if (!p) {
|
if (!p) {
|
||||||
/* we are really bork */
|
/* we are really bork */
|
||||||
errno = ENOMEM;
|
__set_errno(ENOMEM);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!name || strlen(name) > PW_MAX_NAME) {
|
if (!name || strlen(name) > PW_MAX_NAME) {
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* reusing path */
|
/* reusing path */
|
||||||
@@ -600,7 +602,7 @@ struct passwd *getpwnam(const char *name)
|
|||||||
PRINT(("q: %p\n", query));
|
PRINT(("q: %p\n", query));
|
||||||
if (!query)
|
if (!query)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dent = fs_read_query(query);
|
dent = fs_read_query(query);
|
||||||
if (!dent) {
|
if (!dent) {
|
||||||
fs_close_query(query);
|
fs_close_query(query);
|
||||||
@@ -617,7 +619,7 @@ struct passwd *getpwnam(const char *name)
|
|||||||
if (err)
|
if (err)
|
||||||
return NULL;
|
return NULL;
|
||||||
return &p->pwent;
|
return &p->pwent;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void __init_pwd_backend(void)
|
void __init_pwd_backend(void)
|
||||||
@@ -631,7 +633,7 @@ void __init_pwd_backend(void)
|
|||||||
/*
|
/*
|
||||||
void __fini_pwd_backend(void)
|
void __fini_pwd_backend(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ sched_get_priority_min(int policy)
|
|||||||
return B_LOW_PRIORITY;
|
return B_LOW_PRIORITY;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,7 +50,7 @@ sched_get_priority_max(int policy)
|
|||||||
return B_URGENT_DISPLAY_PRIORITY;
|
return B_URGENT_DISPLAY_PRIORITY;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
#include <AutoDeleter.h>
|
#include <AutoDeleter.h>
|
||||||
|
#include <errno_private.h>
|
||||||
#include <posix/realtime_sem_defs.h>
|
#include <posix/realtime_sem_defs.h>
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
@@ -22,7 +23,7 @@ sem_t*
|
|||||||
sem_open(const char* name, int openFlags,...)
|
sem_open(const char* name, int openFlags,...)
|
||||||
{
|
{
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
errno = B_BAD_VALUE;
|
__set_errno(B_BAD_VALUE);
|
||||||
return SEM_FAILED;
|
return SEM_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ sem_open(const char* name, int openFlags,...)
|
|||||||
// structure, otherwise we will delete it later.
|
// structure, otherwise we will delete it later.
|
||||||
sem_t* sem = (sem_t*)malloc(sizeof(sem_t));
|
sem_t* sem = (sem_t*)malloc(sizeof(sem_t));
|
||||||
if (sem == NULL) {
|
if (sem == NULL) {
|
||||||
errno = B_NO_MEMORY;
|
__set_errno(B_NO_MEMORY);
|
||||||
return SEM_FAILED;
|
return SEM_FAILED;
|
||||||
}
|
}
|
||||||
MemoryDeleter semDeleter(sem);
|
MemoryDeleter semDeleter(sem);
|
||||||
@@ -56,7 +57,7 @@ sem_open(const char* name, int openFlags,...)
|
|||||||
status_t error = _kern_realtime_sem_open(name, openFlags, mode, semCount,
|
status_t error = _kern_realtime_sem_open(name, openFlags, mode, semCount,
|
||||||
sem, &usedSem);
|
sem, &usedSem);
|
||||||
if (error != B_OK) {
|
if (error != B_OK) {
|
||||||
errno = error;
|
__set_errno(error);
|
||||||
return SEM_FAILED;
|
return SEM_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
#include <AutoDeleter.h>
|
#include <AutoDeleter.h>
|
||||||
|
#include <errno_private.h>
|
||||||
#include <libroot_private.h>
|
#include <libroot_private.h>
|
||||||
#include <RegistrarDefs.h>
|
#include <RegistrarDefs.h>
|
||||||
#include <user_group.h>
|
#include <user_group.h>
|
||||||
@@ -82,7 +83,7 @@ getspent(void)
|
|||||||
int status = getspent_r(&sShadowPwdBuffer, sShadowPwdStringBuffer,
|
int status = getspent_r(&sShadowPwdBuffer, sShadowPwdStringBuffer,
|
||||||
sizeof(sShadowPwdStringBuffer), &result);
|
sizeof(sShadowPwdStringBuffer), &result);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +143,7 @@ getspnam(const char *name)
|
|||||||
int status = getspnam_r(name, &sShadowPwdBuffer, sShadowPwdStringBuffer,
|
int status = getspnam_r(name, &sShadowPwdBuffer, sShadowPwdStringBuffer,
|
||||||
sizeof(sShadowPwdStringBuffer), &result);
|
sizeof(sShadowPwdStringBuffer), &result);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +201,7 @@ sgetspent(const char* line)
|
|||||||
int status = sgetspent_r(line, &sShadowPwdBuffer, sShadowPwdStringBuffer,
|
int status = sgetspent_r(line, &sShadowPwdBuffer, sShadowPwdStringBuffer,
|
||||||
sizeof(sShadowPwdStringBuffer), &result);
|
sizeof(sShadowPwdStringBuffer), &result);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +253,7 @@ fgetspent(FILE* file)
|
|||||||
int status = fgetspent_r(file, &sShadowPwdBuffer, sShadowPwdStringBuffer,
|
int status = fgetspent_r(file, &sShadowPwdBuffer, sShadowPwdStringBuffer,
|
||||||
sizeof(sShadowPwdStringBuffer), &result);
|
sizeof(sShadowPwdStringBuffer), &result);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,7 +266,7 @@ fgetspent_r(FILE* file, struct spwd* spwd, char* buffer, size_t bufferSize,
|
|||||||
|
|
||||||
// read a line
|
// read a line
|
||||||
char lineBuffer[LINE_MAX + 1];
|
char lineBuffer[LINE_MAX + 1];
|
||||||
errno = 0;
|
__set_errno(0);
|
||||||
char* line = fgets(lineBuffer, sizeof(lineBuffer), file);
|
char* line = fgets(lineBuffer, sizeof(lineBuffer), file);
|
||||||
if (line == NULL) {
|
if (line == NULL) {
|
||||||
if (errno != 0)
|
if (errno != 0)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -18,7 +19,7 @@ kill(pid_t pid, int sig)
|
|||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
if (sig < 0) {
|
if (sig < 0) {
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ kill(pid_t pid, int sig)
|
|||||||
if (status == B_BAD_THREAD_ID || status == B_BAD_TEAM_ID)
|
if (status == B_BAD_THREAD_ID || status == B_BAD_TEAM_ID)
|
||||||
status = ESRCH;
|
status = ESRCH;
|
||||||
|
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
killpg(pid_t processGroupID, int signal)
|
killpg(pid_t processGroupID, int signal)
|
||||||
@@ -14,7 +16,7 @@ killpg(pid_t processGroupID, int signal)
|
|||||||
if (processGroupID > 1)
|
if (processGroupID > 1)
|
||||||
return kill(-processGroupID, signal);
|
return kill(-processGroupID, signal);
|
||||||
else {
|
else {
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <symbol_versioning.h>
|
#include <symbol_versioning.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <signal_private.h>
|
#include <signal_private.h>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ set_signal_stack(void *ptr, size_t size)
|
|||||||
|
|
||||||
status = _kern_set_signal_stack(&alternateStack, NULL);
|
status = _kern_set_signal_stack(&alternateStack, NULL);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <symbol_versioning.h>
|
#include <symbol_versioning.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <signal_private.h>
|
#include <signal_private.h>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -15,7 +16,7 @@ sigaltstack(const stack_t *alternateStack, stack_t *oldAlternateStack)
|
|||||||
{
|
{
|
||||||
status_t status =_kern_set_signal_stack(alternateStack, oldAlternateStack);
|
status_t status =_kern_set_signal_stack(alternateStack, oldAlternateStack);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <symbol_versioning.h>
|
#include <symbol_versioning.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <signal_private.h>
|
#include <signal_private.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ __signal_beos(int signal, __sighandler_t signalHandler)
|
|||||||
{
|
{
|
||||||
// check signal range
|
// check signal range
|
||||||
if (signal < 0 || signal > MAX_SIGNAL_NUMBER_BEOS) {
|
if (signal < 0 || signal > MAX_SIGNAL_NUMBER_BEOS) {
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return SIG_ERR;
|
return SIG_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <symbol_versioning.h>
|
#include <symbol_versioning.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <signal_defs.h>
|
#include <signal_defs.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <symbol_versioning.h>
|
#include <symbol_versioning.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <signal_private.h>
|
#include <signal_private.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +44,7 @@ int
|
|||||||
__sigismember_beos(const sigset_t_beos* set, int signal)
|
__sigismember_beos(const sigset_t_beos* set, int signal)
|
||||||
{
|
{
|
||||||
if (signal <= 0 || signal > MAX_SIGNAL_NUMBER_BEOS) {
|
if (signal <= 0 || signal > MAX_SIGNAL_NUMBER_BEOS) {
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@ int
|
|||||||
__sigaddset_beos(sigset_t_beos* set, int signal)
|
__sigaddset_beos(sigset_t_beos* set, int signal)
|
||||||
{
|
{
|
||||||
if (signal <= 0 || signal > MAX_SIGNAL_NUMBER_BEOS) {
|
if (signal <= 0 || signal > MAX_SIGNAL_NUMBER_BEOS) {
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ int
|
|||||||
__sigdelset_beos(sigset_t_beos* set, int signal)
|
__sigdelset_beos(sigset_t_beos* set, int signal)
|
||||||
{
|
{
|
||||||
if (signal <= 0 || signal > MAX_SIGNAL_NUMBER_BEOS) {
|
if (signal <= 0 || signal > MAX_SIGNAL_NUMBER_BEOS) {
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ int
|
|||||||
__sigismember(const sigset_t* set, int signal)
|
__sigismember(const sigset_t* set, int signal)
|
||||||
{
|
{
|
||||||
if (signal <= 0 || signal > MAX_SIGNAL_NUMBER) {
|
if (signal <= 0 || signal > MAX_SIGNAL_NUMBER) {
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +113,7 @@ int
|
|||||||
__sigaddset(sigset_t* set, int signal)
|
__sigaddset(sigset_t* set, int signal)
|
||||||
{
|
{
|
||||||
if (signal <= 0 || signal > MAX_SIGNAL_NUMBER) {
|
if (signal <= 0 || signal > MAX_SIGNAL_NUMBER) {
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +126,7 @@ int
|
|||||||
__sigdelset(sigset_t* set, int signal)
|
__sigdelset(sigset_t* set, int signal)
|
||||||
{
|
{
|
||||||
if (signal <= 0 || signal > MAX_SIGNAL_NUMBER) {
|
if (signal <= 0 || signal > MAX_SIGNAL_NUMBER) {
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include <symbol_versioning.h>
|
#include <symbol_versioning.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <signal_private.h>
|
#include <signal_private.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ __sigsuspend_beos(const sigset_t_beos* beosMask)
|
|||||||
int
|
int
|
||||||
__sigsuspend(const sigset_t* mask)
|
__sigsuspend(const sigset_t* mask)
|
||||||
{
|
{
|
||||||
errno = _kern_sigsuspend(mask);
|
__set_errno(_kern_sigsuspend(mask));
|
||||||
|
|
||||||
pthread_testcancel();
|
pthread_testcancel();
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <signal_defs.h>
|
#include <signal_defs.h>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ static char rcsid[] = "$OpenBSD: fclose.c,v 1.2 1996/08/19 08:32:19 tholo Exp $"
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
#include "local.h"
|
#include "local.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -50,7 +53,7 @@ fclose(fp)
|
|||||||
register int r;
|
register int r;
|
||||||
|
|
||||||
if (fp->_flags == 0) { /* not open! */
|
if (fp->_flags == 0) { /* not open! */
|
||||||
errno = EBADF;
|
__set_errno(EBADF);
|
||||||
return (EOF);
|
return (EOF);
|
||||||
}
|
}
|
||||||
r = fp->_flags & __SWR ? __sflush(fp) : 0;
|
r = fp->_flags & __SWR ? __sflush(fp) : 0;
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ static char rcsid[] = "$OpenBSD: fflush.c,v 1.2 1996/08/19 08:32:26 tholo Exp $"
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
#include "local.h"
|
#include "local.h"
|
||||||
|
|
||||||
/* Flush a single file, or (if fp is NULL) all files. */
|
/* Flush a single file, or (if fp is NULL) all files. */
|
||||||
@@ -50,7 +53,7 @@ fflush(fp)
|
|||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return (_fwalk(__sflush));
|
return (_fwalk(__sflush));
|
||||||
if ((fp->_flags & (__SWR | __SRW)) == 0) {
|
if ((fp->_flags & (__SWR | __SRW)) == 0) {
|
||||||
errno = EBADF;
|
__set_errno(EBADF);
|
||||||
return (EOF);
|
return (EOF);
|
||||||
}
|
}
|
||||||
return (__sflush(fp));
|
return (__sflush(fp));
|
||||||
|
|||||||
@@ -41,6 +41,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
#include "local.h"
|
#include "local.h"
|
||||||
#include "glue.h"
|
#include "glue.h"
|
||||||
|
|
||||||
@@ -55,7 +57,7 @@ int __sdidinit;
|
|||||||
* must be cast to any desired pointer type.
|
* must be cast to any desired pointer type.
|
||||||
*/
|
*/
|
||||||
#define ALIGNBYTES (sizeof(int) - 1)
|
#define ALIGNBYTES (sizeof(int) - 1)
|
||||||
#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
|
#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
|
||||||
|
|
||||||
#define NDYNAMIC 10 /* add ten more whenever necessary */
|
#define NDYNAMIC 10 /* add ten more whenever necessary */
|
||||||
|
|
||||||
|
|||||||
@@ -39,9 +39,10 @@
|
|||||||
//#include <sys/file.h>
|
//#include <sys/file.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
#include "local.h"
|
#include "local.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -77,7 +78,7 @@ __sflags(mode, optr)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default: /* illegal mode */
|
default: /* illegal mode */
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
#include "local.h"
|
#include "local.h"
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
@@ -63,7 +65,7 @@ fopen(file, mode)
|
|||||||
if ((f = open(file, oflags, DEFFILEMODE)) < 0) {
|
if ((f = open(file, oflags, DEFFILEMODE)) < 0) {
|
||||||
fp->_flags = 0; /* release */
|
fp->_flags = 0; /* release */
|
||||||
/* XXX - temporary hack */
|
/* XXX - temporary hack */
|
||||||
errno = f;
|
__set_errno(f);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
fp->_file = f;
|
fp->_file = f;
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ static char rcsid[] = "$OpenBSD: fputc.c,v 1.4 2001/07/09 06:57:44 deraadt Exp $
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
#include "local.h"
|
#include "local.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -48,7 +51,7 @@ fputc(c, fp)
|
|||||||
register FILE *fp;
|
register FILE *fp;
|
||||||
{
|
{
|
||||||
if (cantwrite(fp)) {
|
if (cantwrite(fp)) {
|
||||||
errno = EBADF;
|
__set_errno(EBADF);
|
||||||
return (EOF);
|
return (EOF);
|
||||||
}
|
}
|
||||||
return (putc(c, fp));
|
return (putc(c, fp));
|
||||||
|
|||||||
@@ -40,6 +40,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
#include "local.h"
|
#include "local.h"
|
||||||
|
|
||||||
#define POS_ERR (-(fpos_t)1)
|
#define POS_ERR (-(fpos_t)1)
|
||||||
@@ -68,7 +71,7 @@ fseeko(fp, offset, whence)
|
|||||||
* Have to be able to seek.
|
* Have to be able to seek.
|
||||||
*/
|
*/
|
||||||
if ((seekfn = fp->_seek) == NULL) {
|
if ((seekfn = fp->_seek) == NULL) {
|
||||||
errno = ESPIPE; /* historic practice */
|
__set_errno(ESPIPE); /* historic practice */
|
||||||
return (EOF);
|
return (EOF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +114,7 @@ fseeko(fp, offset, whence)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return (EOF);
|
return (EOF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
#include "local.h"
|
#include "local.h"
|
||||||
#include "fvwrite.h"
|
#include "fvwrite.h"
|
||||||
|
|
||||||
@@ -64,7 +67,7 @@ __sfvwrite(fp, uio)
|
|||||||
}
|
}
|
||||||
/* make sure we can write */
|
/* make sure we can write */
|
||||||
if (cantwrite(fp)) {
|
if (cantwrite(fp)) {
|
||||||
errno = EBADF;
|
__set_errno(EBADF);
|
||||||
return (EOF);
|
return (EOF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ static char rcsid[] = "$OpenBSD: fwalk.c,v 1.3 2001/07/09 06:57:44 deraadt Exp $
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
#include "local.h"
|
#include "local.h"
|
||||||
#include "glue.h"
|
#include "glue.h"
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,9 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
#include "local.h"
|
#include "local.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -51,7 +54,7 @@ putc_unlocked(c, fp)
|
|||||||
register FILE *fp;
|
register FILE *fp;
|
||||||
{
|
{
|
||||||
if (cantwrite(fp)) {
|
if (cantwrite(fp)) {
|
||||||
errno = EBADF;
|
__set_errno(EBADF);
|
||||||
return (EOF);
|
return (EOF);
|
||||||
}
|
}
|
||||||
return (__sputc(c, fp));
|
return (__sputc(c, fp));
|
||||||
|
|||||||
@@ -38,6 +38,9 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
#include "local.h"
|
#include "local.h"
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -72,7 +75,7 @@ __srefill(fp)
|
|||||||
/* if not already reading, have to be reading and writing */
|
/* if not already reading, have to be reading and writing */
|
||||||
if ((fp->_flags & __SRD) == 0) {
|
if ((fp->_flags & __SRD) == 0) {
|
||||||
if ((fp->_flags & __SRW) == 0) {
|
if ((fp->_flags & __SRW) == 0) {
|
||||||
errno = EBADF;
|
__set_errno(EBADF);
|
||||||
fp->_flags |= __SERR;
|
fp->_flags |= __SERR;
|
||||||
return (EOF);
|
return (EOF);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@ remove(const char* path)
|
|||||||
status = _kern_remove_dir(-1, path);
|
status = _kern_remove_dir(-1, path);
|
||||||
|
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2009, Axel Dörfler, axeld@pinc-software.de.
|
* Copyright 2004-2009, Axel Dörfler, axeld@pinc-software.de.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
rewind(fp)
|
rewind(fp)
|
||||||
@@ -44,5 +46,5 @@ rewind(fp)
|
|||||||
{
|
{
|
||||||
(void) fseek(fp, 0L, SEEK_SET);
|
(void) fseek(fp, 0L, SEEK_SET);
|
||||||
//clearerr(fp);
|
//clearerr(fp);
|
||||||
errno = 0; /* not required, but seems reasonable */
|
__set_errno(0); /* not required, but seems reasonable */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,8 +53,10 @@
|
|||||||
# include <varargs.h>
|
# include <varargs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "local.h"
|
#include <errno_private.h>
|
||||||
#include "fvwrite.h"
|
|
||||||
|
#include "local.h"
|
||||||
|
#include "fvwrite.h"
|
||||||
|
|
||||||
static void __find_arguments (const char *fmt0, va_list ap,
|
static void __find_arguments (const char *fmt0, va_list ap,
|
||||||
va_list **argtable);
|
va_list **argtable);
|
||||||
@@ -254,7 +256,7 @@ vfprintf(FILE *fp, const char *fmt0, va_list ap)
|
|||||||
flags&LONGINT ? GETARG(u_long) : \
|
flags&LONGINT ? GETARG(u_long) : \
|
||||||
flags&SHORTINT ? (u_long)(u_short)GETARG(int) : \
|
flags&SHORTINT ? (u_long)(u_short)GETARG(int) : \
|
||||||
(u_long)GETARG(u_int))
|
(u_long)GETARG(u_int))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get * arguments, including the form *nn$. Preserve the nextarg
|
* Get * arguments, including the form *nn$. Preserve the nextarg
|
||||||
* that the argument can be gotten once the type is determined.
|
* that the argument can be gotten once the type is determined.
|
||||||
@@ -289,10 +291,10 @@ vfprintf(FILE *fp, const char *fmt0, va_list ap)
|
|||||||
#define GETARG(type) \
|
#define GETARG(type) \
|
||||||
(((argtable != NULL) ? (void)(ap = argtable[nextarg]) : (void)0), \
|
(((argtable != NULL) ? (void)(ap = argtable[nextarg]) : (void)0), \
|
||||||
nextarg++, va_arg(ap, type))
|
nextarg++, va_arg(ap, type))
|
||||||
|
|
||||||
/* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
|
/* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
|
||||||
if (cantwrite(fp)) {
|
if (cantwrite(fp)) {
|
||||||
errno = EBADF;
|
__set_errno(EBADF);
|
||||||
return (EOF);
|
return (EOF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,7 +414,7 @@ reswitch: switch (ch) {
|
|||||||
__find_arguments(fmt0, orgap,
|
__find_arguments(fmt0, orgap,
|
||||||
&argtable);
|
&argtable);
|
||||||
}
|
}
|
||||||
goto rflag;
|
goto rflag;
|
||||||
}
|
}
|
||||||
width = n;
|
width = n;
|
||||||
goto reswitch;
|
goto reswitch;
|
||||||
@@ -494,7 +496,7 @@ reswitch: switch (ch) {
|
|||||||
ch = (ch == 'g') ? 'e' : 'E';
|
ch = (ch == 'g') ? 'e' : 'E';
|
||||||
else
|
else
|
||||||
ch = 'g';
|
ch = 'g';
|
||||||
}
|
}
|
||||||
if (ch <= 'e') { /* 'e' or 'E' fmt */
|
if (ch <= 'e') { /* 'e' or 'E' fmt */
|
||||||
--expt;
|
--expt;
|
||||||
expsize = exponent(expstr, expt, ch);
|
expsize = exponent(expstr, expt, ch);
|
||||||
@@ -792,7 +794,7 @@ error:
|
|||||||
* table, indexed by argument number, of pointers to each arguments. The
|
* table, indexed by argument number, of pointers to each arguments. The
|
||||||
* initial argument table should be an array of STATIC_ARG_TBL_SIZE entries.
|
* initial argument table should be an array of STATIC_ARG_TBL_SIZE entries.
|
||||||
* It will be replaces with a malloc-ed on if it overflows.
|
* It will be replaces with a malloc-ed on if it overflows.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
__find_arguments(const char *fmt0, va_list ap, va_list **argtable)
|
__find_arguments(const char *fmt0, va_list ap, va_list **argtable)
|
||||||
@@ -847,7 +849,7 @@ __find_arguments(const char *fmt0, va_list ap, va_list **argtable)
|
|||||||
fmt = (char *)fmt0;
|
fmt = (char *)fmt0;
|
||||||
typetable = stattypetable;
|
typetable = stattypetable;
|
||||||
tablesize = STATIC_ARG_TBL_SIZE;
|
tablesize = STATIC_ARG_TBL_SIZE;
|
||||||
tablemax = 0;
|
tablemax = 0;
|
||||||
nextarg = 1;
|
nextarg = 1;
|
||||||
memset(typetable, T_UNUSED, STATIC_ARG_TBL_SIZE);
|
memset(typetable, T_UNUSED, STATIC_ARG_TBL_SIZE);
|
||||||
|
|
||||||
@@ -1092,7 +1094,7 @@ __grow_type_table(unsigned char **typetable, int *tablesize)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef FLOATING_POINT
|
#ifdef FLOATING_POINT
|
||||||
|
|
||||||
extern char *__dtoa __P((double, int, int, int *, int *, char **));
|
extern char *__dtoa __P((double, int, int, int *, int *, char **));
|
||||||
@@ -1106,8 +1108,8 @@ cvt(double value, int ndigits, int flags, char *sign, int *decpt, int ch, int *l
|
|||||||
if (ch == 'f') {
|
if (ch == 'f') {
|
||||||
mode = 3; /* ndigits after the decimal point */
|
mode = 3; /* ndigits after the decimal point */
|
||||||
} else {
|
} else {
|
||||||
/* To obtain ndigits after the decimal point for the 'e'
|
/* To obtain ndigits after the decimal point for the 'e'
|
||||||
* and 'E' formats, round to ndigits + 1 significant
|
* and 'E' formats, round to ndigits + 1 significant
|
||||||
* figures.
|
* figures.
|
||||||
*/
|
*/
|
||||||
if (ch == 'e' || ch == 'E') {
|
if (ch == 'e' || ch == 'E') {
|
||||||
|
|||||||
@@ -36,6 +36,9 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
#include "local.h"
|
#include "local.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -59,7 +62,7 @@ __swbuf(c, fp)
|
|||||||
*/
|
*/
|
||||||
fp->_w = fp->_lbfsize;
|
fp->_w = fp->_lbfsize;
|
||||||
if (cantwrite(fp)) {
|
if (cantwrite(fp)) {
|
||||||
errno = EBADF;
|
__set_errno(EBADF);
|
||||||
return (EOF);
|
return (EOF);
|
||||||
}
|
}
|
||||||
c = (unsigned char)c;
|
c = (unsigned char)c;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||||
** Distributed under the terms of the Haiku License.
|
** Distributed under the terms of the Haiku License.
|
||||||
*/
|
*/
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
|
|
||||||
/** This is the BeOS compatible atfork() function; since it's not part of POSIX,
|
/** This is the BeOS compatible atfork() function; since it's not part of POSIX,
|
||||||
* it should probably go away over time.
|
* it should probably go away over time.
|
||||||
@@ -20,7 +22,7 @@ atfork(void (*function)(void))
|
|||||||
{
|
{
|
||||||
status_t status = __register_atfork(NULL, NULL, function);
|
status_t status = __register_atfork(NULL, NULL, function);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <libroot_private.h>
|
#include <libroot_private.h>
|
||||||
#include <locks.h>
|
#include <locks.h>
|
||||||
#include <runtime_loader.h>
|
#include <runtime_loader.h>
|
||||||
@@ -249,7 +250,7 @@ setenv(const char *name, const char *value, int overwrite)
|
|||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
if (name == NULL || name[0] == '\0' || strchr(name, '=') != NULL) {
|
if (name == NULL || name[0] == '\0' || strchr(name, '=') != NULL) {
|
||||||
errno = B_BAD_VALUE;
|
__set_errno(B_BAD_VALUE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,7 +269,7 @@ unsetenv(const char *name)
|
|||||||
char *env;
|
char *env;
|
||||||
|
|
||||||
if (name == NULL || name[0] == '\0' || strchr(name, '=') != NULL) {
|
if (name == NULL || name[0] == '\0' || strchr(name, '=') != NULL) {
|
||||||
errno = B_BAD_VALUE;
|
__set_errno(B_BAD_VALUE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,8 +286,8 @@ unsetenv(const char *name)
|
|||||||
free(env);
|
free(env);
|
||||||
memmove(environ + index, environ + index + 1,
|
memmove(environ + index, environ + index + 1,
|
||||||
sizeof(char *) * (count_variables() - index));
|
sizeof(char *) * (count_variables() - index));
|
||||||
|
|
||||||
// search possible another occurence, introduced via putenv()
|
// search possible another occurence, introduced via putenv()
|
||||||
// and renamed since
|
// and renamed since
|
||||||
env = find_variable(name, length, &index);
|
env = find_variable(name, length, &index);
|
||||||
}
|
}
|
||||||
@@ -303,7 +304,7 @@ putenv(const char *string)
|
|||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
errno = B_BAD_VALUE;
|
__set_errno(B_BAD_VALUE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ static char sccsid[] = "@(#)heapsort.c 8.1 (Berkeley) 6/4/93";
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Swap two areas of size number of bytes. Although qsort(3) permits random
|
* Swap two areas of size number of bytes. Although qsort(3) permits random
|
||||||
* blocks of memory to be sorted, sorting pointers is almost certainly the
|
* blocks of memory to be sorted, sorting pointers is almost certainly the
|
||||||
@@ -156,7 +158,7 @@ heapsort(void *vbase, size_t nmemb, size_t size, int (*compar)(void const *, voi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!size) {
|
if (!size) {
|
||||||
// errno = EINVAL;
|
// __set_errno(EINVAL);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94";
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
static void setup(u_char *, u_char *, size_t, size_t, int (*)());
|
static void setup(u_char *, u_char *, size_t, size_t, int (*)());
|
||||||
static void insertionsort(u_char *, size_t, size_t, int (*)());
|
static void insertionsort(u_char *, size_t, size_t, int (*)());
|
||||||
|
|
||||||
@@ -116,7 +118,7 @@ mergesort(void *base, size_t nmemb, size_t size, int (*cmp)(void const *, void c
|
|||||||
u_char **p1;
|
u_char **p1;
|
||||||
|
|
||||||
if (size < PSIZE / 2) { /* Pointers must fit into 2 * size. */
|
if (size < PSIZE / 2) { /* Pointers must fit into 2 * size. */
|
||||||
// errno = EINVAL;
|
// __set_errno(EINVAL);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
|
|
||||||
static int _gettemp(char *, int *, int, int);
|
static int _gettemp(char *, int *, int, int);
|
||||||
|
|
||||||
@@ -96,7 +98,7 @@ _gettemp(char *path, int *doopen, int domkdir, int slen)
|
|||||||
int rval;
|
int rval;
|
||||||
|
|
||||||
if (doopen != NULL && domkdir) {
|
if (doopen != NULL && domkdir) {
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +109,7 @@ _gettemp(char *path, int *doopen, int domkdir, int slen)
|
|||||||
suffp = trv;
|
suffp = trv;
|
||||||
--trv;
|
--trv;
|
||||||
if (trv < path) {
|
if (trv < path) {
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +132,7 @@ _gettemp(char *path, int *doopen, int domkdir, int slen)
|
|||||||
if (rval != 0)
|
if (rval != 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (!S_ISDIR(sbuf.st_mode)) {
|
if (!S_ISDIR(sbuf.st_mode)) {
|
||||||
errno = ENOTDIR;
|
__set_errno(ENOTDIR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ static char sccsid[] = "@(#)radixsort.c 8.2 (Berkeley) 4/28/95";
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const u_char **sa;
|
const u_char **sa;
|
||||||
int sn, si;
|
int sn, si;
|
||||||
@@ -80,7 +82,7 @@ static void r_sort_b(u_char const **, u_char const **, int, int, u_char const *,
|
|||||||
endch = tab[endch]; \
|
endch = tab[endch]; \
|
||||||
tr = tab; \
|
tr = tab; \
|
||||||
if (endch != 0 && endch != 255) { \
|
if (endch != 0 && endch != 255) { \
|
||||||
/* errno = EINVAL; */ \
|
/* __set_errno(EINVAL); */ \
|
||||||
return (-1); \
|
return (-1); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
@@ -299,7 +301,7 @@ void
|
|||||||
simplesort(u_char const **a, int n, int b, u_char const *tr, u_int endch) /* insertion sort */
|
simplesort(u_char const **a, int n, int b, u_char const *tr, u_int endch) /* insertion sort */
|
||||||
{
|
{
|
||||||
u_char ch;
|
u_char ch;
|
||||||
u_char const **ak;
|
u_char const **ak;
|
||||||
u_char const **ai;
|
u_char const **ai;
|
||||||
u_char const *s;
|
u_char const *s;
|
||||||
u_char const *t;
|
u_char const *t;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -17,7 +18,7 @@ realpath(const char* path, char* resolved)
|
|||||||
{
|
{
|
||||||
status_t status = _kern_normalize_path(path, true, resolved);
|
status_t status = _kern_normalize_path(path, true, resolved);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
|
|
||||||
/* internal flags */
|
/* internal flags */
|
||||||
#define NEED_GROUPING 0x01 /* print digits grouped (default) */
|
#define NEED_GROUPING 0x01 /* print digits grouped (default) */
|
||||||
@@ -384,11 +386,11 @@ strfmon(char *s, size_t maxsize, const char *format,
|
|||||||
return dst - s - 1; /* return size of put data except trailing '\0' */
|
return dst - s - 1; /* return size of put data except trailing '\0' */
|
||||||
|
|
||||||
e2big_error:
|
e2big_error:
|
||||||
errno = E2BIG;
|
__set_errno(E2BIG);
|
||||||
goto end_error;
|
goto end_error;
|
||||||
|
|
||||||
format_error:
|
format_error:
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
|
|
||||||
end_error:
|
end_error:
|
||||||
sverrno = errno;
|
sverrno = errno;
|
||||||
@@ -396,7 +398,7 @@ end_error:
|
|||||||
free(asciivalue);
|
free(asciivalue);
|
||||||
if (currency_symbol != NULL)
|
if (currency_symbol != NULL)
|
||||||
free(currency_symbol);
|
free(currency_symbol);
|
||||||
errno = sverrno;
|
__set_errno(sverrno);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,6 +157,8 @@ typedef u_int32_t ULong;
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
#ifdef Bad_float_h
|
#ifdef Bad_float_h
|
||||||
#undef __STDC__
|
#undef __STDC__
|
||||||
#ifdef IEEE_BIG_ENDIAN
|
#ifdef IEEE_BIG_ENDIAN
|
||||||
@@ -1306,7 +1308,7 @@ strtod(const char * __restrict s00, char ** __restrict se)
|
|||||||
if ( (e1 &= ~15) ) {
|
if ( (e1 &= ~15) ) {
|
||||||
if (e1 > DBL_MAX_10_EXP) {
|
if (e1 > DBL_MAX_10_EXP) {
|
||||||
ovfl:
|
ovfl:
|
||||||
errno = ERANGE;
|
__set_errno(ERANGE);
|
||||||
rv = HUGE_VAL;
|
rv = HUGE_VAL;
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
@@ -1348,7 +1350,7 @@ strtod(const char * __restrict s00, char ** __restrict se)
|
|||||||
if (!rv) {
|
if (!rv) {
|
||||||
undfl:
|
undfl:
|
||||||
rv = 0.;
|
rv = 0.;
|
||||||
errno = ERANGE;
|
__set_errno(ERANGE);
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
word0(rv) = Tiny0;
|
word0(rv) = Tiny0;
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a string to a long integer.
|
* Convert a string to a long integer.
|
||||||
@@ -125,10 +127,10 @@ strtol(const char * __restrict nptr, char ** __restrict endptr, int base)
|
|||||||
}
|
}
|
||||||
if (any < 0) {
|
if (any < 0) {
|
||||||
acc = neg ? LONG_MIN : LONG_MAX;
|
acc = neg ? LONG_MIN : LONG_MAX;
|
||||||
errno = ERANGE;
|
__set_errno(ERANGE);
|
||||||
} else if (!any) {
|
} else if (!any) {
|
||||||
noconv:
|
noconv:
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
} else if (neg)
|
} else if (neg)
|
||||||
acc = -acc;
|
acc = -acc;
|
||||||
if (endptr != NULL)
|
if (endptr != NULL)
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a string to a long long integer.
|
* Convert a string to a long long integer.
|
||||||
@@ -126,10 +128,10 @@ strtoll(const char * __restrict nptr, char ** __restrict endptr, int base)
|
|||||||
}
|
}
|
||||||
if (any < 0) {
|
if (any < 0) {
|
||||||
acc = neg ? LONGLONG_MIN : LONGLONG_MAX;
|
acc = neg ? LONGLONG_MIN : LONGLONG_MAX;
|
||||||
errno = ERANGE;
|
__set_errno(ERANGE);
|
||||||
} else if (!any) {
|
} else if (!any) {
|
||||||
noconv:
|
noconv:
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
} else if (neg)
|
} else if (neg)
|
||||||
acc = -acc;
|
acc = -acc;
|
||||||
if (endptr != NULL)
|
if (endptr != NULL)
|
||||||
|
|||||||
@@ -38,6 +38,9 @@
|
|||||||
//#include <limits.h>
|
//#include <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
|
|
||||||
#define QUAD_MIN (-0x7fffffffffffffffLL - 1)
|
#define QUAD_MIN (-0x7fffffffffffffffLL - 1)
|
||||||
#define QUAD_MAX 0x7fffffffffffffffLL
|
#define QUAD_MAX 0x7fffffffffffffffLL
|
||||||
/*
|
/*
|
||||||
@@ -126,7 +129,7 @@ strtoq(nptr, endptr, base)
|
|||||||
if (acc < cutoff || (acc == cutoff && c > cutlim)) {
|
if (acc < cutoff || (acc == cutoff && c > cutlim)) {
|
||||||
any = -1;
|
any = -1;
|
||||||
acc = QUAD_MIN;
|
acc = QUAD_MIN;
|
||||||
errno = ERANGE;
|
__set_errno(ERANGE);
|
||||||
} else {
|
} else {
|
||||||
any = 1;
|
any = 1;
|
||||||
acc *= base;
|
acc *= base;
|
||||||
@@ -136,7 +139,7 @@ strtoq(nptr, endptr, base)
|
|||||||
if (acc > cutoff || (acc == cutoff && c > cutlim)) {
|
if (acc > cutoff || (acc == cutoff && c > cutlim)) {
|
||||||
any = -1;
|
any = -1;
|
||||||
acc = QUAD_MAX;
|
acc = QUAD_MAX;
|
||||||
errno = ERANGE;
|
__set_errno(ERANGE);
|
||||||
} else {
|
} else {
|
||||||
any = 1;
|
any = 1;
|
||||||
acc *= base;
|
acc *= base;
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a string to an unsigned long integer.
|
* Convert a string to an unsigned long integer.
|
||||||
@@ -104,10 +106,10 @@ strtoul(const char * __restrict nptr, char ** __restrict endptr, int base)
|
|||||||
}
|
}
|
||||||
if (any < 0) {
|
if (any < 0) {
|
||||||
acc = ULONG_MAX;
|
acc = ULONG_MAX;
|
||||||
errno = ERANGE;
|
__set_errno(ERANGE);
|
||||||
} else if (!any) {
|
} else if (!any) {
|
||||||
noconv:
|
noconv:
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
} else if (neg)
|
} else if (neg)
|
||||||
acc = -acc;
|
acc = -acc;
|
||||||
if (endptr != NULL)
|
if (endptr != NULL)
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a string to an unsigned long long integer.
|
* Convert a string to an unsigned long long integer.
|
||||||
@@ -104,10 +106,10 @@ strtoull(const char * __restrict nptr, char ** __restrict endptr, int base)
|
|||||||
}
|
}
|
||||||
if (any < 0) {
|
if (any < 0) {
|
||||||
acc = ULONGLONG_MAX;
|
acc = ULONGLONG_MAX;
|
||||||
errno = ERANGE;
|
__set_errno(ERANGE);
|
||||||
} else if (!any) {
|
} else if (!any) {
|
||||||
noconv:
|
noconv:
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
} else if (neg)
|
} else if (neg)
|
||||||
acc = -acc;
|
acc = -acc;
|
||||||
if (endptr != NULL)
|
if (endptr != NULL)
|
||||||
|
|||||||
@@ -38,6 +38,9 @@
|
|||||||
//#include <limits.h>
|
//#include <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
|
|
||||||
#define UQUAD_MAX 0xffffffffffffffffULL
|
#define UQUAD_MAX 0xffffffffffffffffULL
|
||||||
/*
|
/*
|
||||||
* Convert a string to an unsigned quad integer.
|
* Convert a string to an unsigned quad integer.
|
||||||
@@ -66,7 +69,7 @@ strtouq(nptr, endptr, base)
|
|||||||
if (c == '-') {
|
if (c == '-') {
|
||||||
neg = 1;
|
neg = 1;
|
||||||
c = *s++;
|
c = *s++;
|
||||||
} else {
|
} else {
|
||||||
neg = 0;
|
neg = 0;
|
||||||
if (c == '+')
|
if (c == '+')
|
||||||
c = *s++;
|
c = *s++;
|
||||||
@@ -96,7 +99,7 @@ strtouq(nptr, endptr, base)
|
|||||||
if (acc > cutoff || (acc == cutoff && c > cutlim)) {
|
if (acc > cutoff || (acc == cutoff && c > cutlim)) {
|
||||||
any = -1;
|
any = -1;
|
||||||
acc = UQUAD_MAX;
|
acc = UQUAD_MAX;
|
||||||
errno = ERANGE;
|
__set_errno(ERANGE);
|
||||||
} else {
|
} else {
|
||||||
any = 1;
|
any = 1;
|
||||||
acc *= (uint64)base;
|
acc *= (uint64)base;
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
SubDir HAIKU_TOP src system libroot posix string ;
|
SubDir HAIKU_TOP src system libroot posix string ;
|
||||||
|
|
||||||
UsePrivateHeaders [ FDirName libroot locale ] ;
|
UsePrivateHeaders
|
||||||
|
[ FDirName libroot ]
|
||||||
|
[ FDirName libroot locale ]
|
||||||
|
;
|
||||||
|
|
||||||
MergeObject posix_string.o :
|
MergeObject posix_string.o :
|
||||||
bcmp.c
|
bcmp.c
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include "LocaleBackend.h"
|
#include "LocaleBackend.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ strcoll(const char *a, const char *b)
|
|||||||
status_t status = gLocaleBackend->Strcoll(a, b, result);
|
status_t status = gLocaleBackend->Strcoll(a, b, result);
|
||||||
|
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include "LocaleBackend.h"
|
#include "LocaleBackend.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ strxfrm(char *out, const char *in, size_t size)
|
|||||||
status_t status = gLocaleBackend->Strxfrm(out, in, size, outSize);
|
status_t status = gLocaleBackend->Strxfrm(out, in, size, outSize);
|
||||||
|
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
errno = EINVAL;
|
__set_errno(EINVAL);
|
||||||
|
|
||||||
return outSize;
|
return outSize;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <NodeMonitor.h>
|
#include <NodeMonitor.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@ flock(int fd, int op)
|
|||||||
pthread_testcancel();
|
pthread_testcancel();
|
||||||
|
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
errno = status;
|
__set_errno(status);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
getrusage(int who, struct rusage *rusage)
|
getrusage(int who, struct rusage *rusage)
|
||||||
@@ -15,7 +17,7 @@ getrusage(int who, struct rusage *rusage)
|
|||||||
team_usage_info info;
|
team_usage_info info;
|
||||||
|
|
||||||
if (get_team_usage_info(B_CURRENT_TEAM, who, &info) != B_OK) {
|
if (get_team_usage_info(B_CURRENT_TEAM, who, &info) != B_OK) {
|
||||||
errno = B_BAD_VALUE;
|
__set_errno(B_BAD_VALUE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
|
|
||||||
#include <user_timer_defs.h>
|
#include <user_timer_defs.h>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
#include <umask.h>
|
#include <umask.h>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
#include <vm_defs.h>
|
#include <vm_defs.h>
|
||||||
@@ -90,7 +91,7 @@ mmap(void* address, size_t length, int protection, int flags, int fd,
|
|||||||
{
|
{
|
||||||
// offset and length must be page-aligned
|
// offset and length must be page-aligned
|
||||||
if (length == 0 || offset % B_PAGE_SIZE != 0) {
|
if (length == 0 || offset % B_PAGE_SIZE != 0) {
|
||||||
errno = B_BAD_VALUE;
|
__set_errno(B_BAD_VALUE);
|
||||||
return MAP_FAILED;
|
return MAP_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,13 +99,13 @@ mmap(void* address, size_t length, int protection, int flags, int fd,
|
|||||||
if ((flags & MAP_ANONYMOUS) != 0) {
|
if ((flags & MAP_ANONYMOUS) != 0) {
|
||||||
fd = -1;
|
fd = -1;
|
||||||
} else if (fd < 0) {
|
} else if (fd < 0) {
|
||||||
errno = EBADF;
|
__set_errno(EBADF);
|
||||||
return MAP_FAILED;
|
return MAP_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// either MAP_SHARED or MAP_PRIVATE must be specified
|
// either MAP_SHARED or MAP_PRIVATE must be specified
|
||||||
if (((flags & MAP_SHARED) != 0) == ((flags & MAP_PRIVATE) != 0)) {
|
if (((flags & MAP_SHARED) != 0) == ((flags & MAP_PRIVATE) != 0)) {
|
||||||
errno = B_BAD_VALUE;
|
__set_errno(B_BAD_VALUE);
|
||||||
return MAP_FAILED;
|
return MAP_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +129,7 @@ mmap(void* address, size_t length, int protection, int flags, int fd,
|
|||||||
area_id area = _kern_map_file("mmap area", &address, addressSpec,
|
area_id area = _kern_map_file("mmap area", &address, addressSpec,
|
||||||
length, areaProtection, mapping, true, fd, offset);
|
length, areaProtection, mapping, true, fd, offset);
|
||||||
if (area < 0) {
|
if (area < 0) {
|
||||||
errno = area;
|
__set_errno(area);
|
||||||
return MAP_FAILED;
|
return MAP_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,12 @@
|
|||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
|
|
||||||
#define RETURN_AND_SET_ERRNO(err) \
|
#define RETURN_AND_SET_ERRNO(err) \
|
||||||
if (err < 0) { \
|
if (err < 0) { \
|
||||||
errno = err; \
|
__set_errno(err); \
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <symbol_versioning.h>
|
#include <symbol_versioning.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <compat/sys/stat.h>
|
#include <compat/sys/stat.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
#include <symbol_versioning.h>
|
#include <symbol_versioning.h>
|
||||||
#include <syscall_utils.h>
|
#include <syscall_utils.h>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <symbol_versioning.h>
|
#include <symbol_versioning.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
#include <time_private.h>
|
#include <time_private.h>
|
||||||
#include <times_private.h>
|
#include <times_private.h>
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ times_common(struct tms* buffer, bigtime_t microSecondsPerClock)
|
|||||||
|
|
||||||
if ((err = get_team_usage_info(B_CURRENT_TEAM, RUSAGE_SELF, &info))
|
if ((err = get_team_usage_info(B_CURRENT_TEAM, RUSAGE_SELF, &info))
|
||||||
!= B_OK) {
|
!= B_OK) {
|
||||||
errno = err;
|
__set_errno(err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ times_common(struct tms* buffer, bigtime_t microSecondsPerClock)
|
|||||||
|
|
||||||
if ((err = get_team_usage_info(B_CURRENT_TEAM, RUSAGE_CHILDREN, &info))
|
if ((err = get_team_usage_info(B_CURRENT_TEAM, RUSAGE_CHILDREN, &info))
|
||||||
!= B_OK) {
|
!= B_OK) {
|
||||||
errno = err;
|
__set_errno(err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,12 @@
|
|||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <errno_private.h>
|
||||||
|
|
||||||
|
|
||||||
#define RETURN_AND_SET_ERRNO(err) \
|
#define RETURN_AND_SET_ERRNO(err) \
|
||||||
if (err < 0) { \
|
if (err < 0) { \
|
||||||
errno = err; \
|
__set_errno(err); \
|
||||||
return -1; \
|
return -1; \
|
||||||
} \
|
} \
|
||||||
return err;
|
return err;
|
||||||
@@ -32,7 +34,7 @@ readv_pos(int fd, off_t pos, const struct iovec *vecs, size_t count)
|
|||||||
{
|
{
|
||||||
ssize_t bytes;
|
ssize_t bytes;
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
errno = B_BAD_VALUE;
|
__set_errno(B_BAD_VALUE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
bytes = _kern_readv(fd, pos, vecs, count);
|
bytes = _kern_readv(fd, pos, vecs, count);
|
||||||
@@ -55,7 +57,7 @@ writev_pos(int fd, off_t pos, const struct iovec *vecs, size_t count)
|
|||||||
{
|
{
|
||||||
ssize_t bytes;
|
ssize_t bytes;
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
errno = B_BAD_VALUE;
|
__set_errno(B_BAD_VALUE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
bytes = _kern_writev(fd, pos, vecs, count);
|
bytes = _kern_writev(fd, pos, vecs, count);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user