diff options
Diffstat (limited to 'libc')
| -rw-r--r-- | libc/arch-arm/bionic/__get_pc.S | 1 | ||||
| -rw-r--r-- | libc/arch-arm/bionic/__get_sp.S | 1 | ||||
| -rw-r--r-- | libc/arch-arm/bionic/atomics_arm.S | 6 | ||||
| -rw-r--r-- | libc/bionic/logd_write.c | 3 | ||||
| -rw-r--r-- | libc/include/stdio.h | 3 | ||||
| -rw-r--r-- | libc/include/unistd.h | 8 | ||||
| -rw-r--r-- | libc/include/wchar.h | 2 | ||||
| -rw-r--r-- | libc/stdlib/wchar.c | 10 |
8 files changed, 33 insertions, 1 deletions
diff --git a/libc/arch-arm/bionic/__get_pc.S b/libc/arch-arm/bionic/__get_pc.S index d1377c7..4fc8929 100644 --- a/libc/arch-arm/bionic/__get_pc.S +++ b/libc/arch-arm/bionic/__get_pc.S @@ -26,6 +26,7 @@ * SUCH DAMAGE. */ .global __get_pc +.type __get_pc, %function __get_pc: mov r0, pc diff --git a/libc/arch-arm/bionic/__get_sp.S b/libc/arch-arm/bionic/__get_sp.S index 9acaf3d..0a313a3 100644 --- a/libc/arch-arm/bionic/__get_sp.S +++ b/libc/arch-arm/bionic/__get_sp.S @@ -26,6 +26,7 @@ * SUCH DAMAGE. */ .global __get_sp +.type __get_sp, %function __get_sp: mov r0, sp diff --git a/libc/arch-arm/bionic/atomics_arm.S b/libc/arch-arm/bionic/atomics_arm.S index 0cd0b92..55c642f 100644 --- a/libc/arch-arm/bionic/atomics_arm.S +++ b/libc/arch-arm/bionic/atomics_arm.S @@ -28,11 +28,17 @@ #include <sys/linux-syscalls.h> .global __atomic_cmpxchg +.type __atomic_cmpxchg, %function .global __atomic_swap +.type __atomic_swap, %function .global __atomic_dec +.type __atomic_dec, %function .global __atomic_inc +.type __atomic_inc, %function .global __futex_wait +.type __futex_wait, %function .global __futex_wake +.type __futex_wake, %function #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 diff --git a/libc/bionic/logd_write.c b/libc/bionic/logd_write.c index 3336428..2c5bf42 100644 --- a/libc/bionic/logd_write.c +++ b/libc/bionic/logd_write.c @@ -66,7 +66,7 @@ static int __write_to_log_null(log_id_t log_id, struct iovec *vec); static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER; -log_channel_t log_channels[LOG_ID_MAX] = { +static log_channel_t log_channels[LOG_ID_MAX] = { { __write_to_log_null, -1, NULL }, { __write_to_log_init, -1, "/dev/"LOGGER_LOG_MAIN }, { __write_to_log_init, -1, "/dev/"LOGGER_LOG_RADIO } @@ -112,6 +112,7 @@ static int __write_to_log_init(log_id_t log_id, struct iovec *vec) log_channels[log_id].logger = (fd < 0) ? __write_to_log_null : __write_to_log_kernel; + log_channels[log_id].fd = fd; pthread_mutex_unlock(&log_init_lock); diff --git a/libc/include/stdio.h b/libc/include/stdio.h index 79e526b..791b260 100644 --- a/libc/include/stdio.h +++ b/libc/include/stdio.h @@ -112,6 +112,9 @@ struct __sbuf { * that does not match the previous one in _bf. When this happens, * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. + * + * NOTE: if you change this structure, you also need to update the + * std() initializer in findfp.c. */ typedef struct __sFILE { unsigned char *_p; /* current position in (some) buffer */ diff --git a/libc/include/unistd.h b/libc/include/unistd.h index 1ada37e..67cb5fe 100644 --- a/libc/include/unistd.h +++ b/libc/include/unistd.h @@ -185,6 +185,14 @@ extern int cacheflush(long start, long end, long flags); extern pid_t tcgetpgrp(int fd); extern int tcsetpgrp(int fd, pid_t _pid); +/* Used to retry syscalls that can return EINTR. */ +#define TEMP_FAILURE_RETRY(exp) ({ \ + typeof (exp) _rc; \ + do { \ + _rc = (exp); \ + } while (_rc == -1 && errno == EINTR); \ + _rc; }) + __END_DECLS #endif /* _UNISTD_H_ */ diff --git a/libc/include/wchar.h b/libc/include/wchar.h index e2feb60..97e1b5c 100644 --- a/libc/include/wchar.h +++ b/libc/include/wchar.h @@ -100,6 +100,7 @@ extern int mbsinit(const mbstate_t *); extern size_t mbrlen(const char *, size_t, mbstate_t *); extern size_t mbrtowc(wchar_t *, const char *, size_t, mbstate_t *); extern size_t mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *); +extern size_t mbstowcs(wchar_t *, const char *, size_t); extern wint_t putwc(wchar_t, FILE *); extern wint_t putwchar(wchar_t); extern int swprintf(wchar_t *, size_t, const wchar_t *, ...); @@ -130,6 +131,7 @@ extern wchar_t *wcsstr(const wchar_t *, const wchar_t *); extern double wcstod(const wchar_t *, wchar_t **); extern wchar_t *wcstok(wchar_t *, const wchar_t *, wchar_t **); extern long int wcstol(const wchar_t *, wchar_t **, int); +extern size_t wcstombs(char *, const wchar_t *, size_t); extern unsigned long int wcstoul(const wchar_t *, wchar_t **, int); extern wchar_t *wcswcs(const wchar_t *, const wchar_t *); extern int wcswidth(const wchar_t *, size_t); diff --git a/libc/stdlib/wchar.c b/libc/stdlib/wchar.c index d805333..7722b34 100644 --- a/libc/stdlib/wchar.c +++ b/libc/stdlib/wchar.c @@ -227,6 +227,11 @@ size_t mbsrtowcs(wchar_t *dst, const char **src, size_t len, mbstate_t *ps) return len; } +size_t mbstowcs(wchar_t *dst, const char *src, size_t len) +{ + return mbsrtowcs(dst, &src, len, NULL); +} + wint_t putwc(wchar_t wc, FILE *stream) { return fputc((char)wc, stream); @@ -339,6 +344,11 @@ size_t wcsrtombs(char *dst, const wchar_t **src, size_t len, mbstate_t *ps) return len; } +size_t wcstombs(char *dst, const wchar_t *src, size_t len) +{ + return wcsrtombs(dst, &src, len, NULL); +} + size_t wcsspn(const wchar_t *ws1, const wchar_t *ws2) { return strspn( (const char*)ws1, (const char*)ws2 ); |
