X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0a7de7458d150b5d4dffc935ba399be265ef0a1a..eb6b6ca394357805f2bdba989abae309f718b4d8:/bsd/libkern/libkern.h diff --git a/bsd/libkern/libkern.h b/bsd/libkern/libkern.h index 9a4ecb489..b95c70e3c 100644 --- a/bsd/libkern/libkern.h +++ b/bsd/libkern/libkern.h @@ -144,9 +144,9 @@ ulmin(u_int32_t a, u_int32_t b) /* Prototypes for non-quad routines. */ -extern int ffs(int); +extern int ffs(unsigned int); extern int ffsll(unsigned long long); -extern int fls(int); +extern int fls(unsigned int); extern int flsll(unsigned long long); extern u_int32_t random(void); extern int scanc(u_int, u_char *, const u_char *, int); @@ -159,7 +159,13 @@ extern char *strsep(char **, const char *); extern void *memchr(const void *, int, size_t); extern void url_decode(char *str); +/* + * NOTE: snprintf() returns the full length of the formatted string even if it + * couldn't fit in the supplied buffer. + * Use scnprintf() if you need the actual number of bytes (minus the \0) + */ int snprintf(char *, size_t, const char *, ...) __printflike(3, 4); +int scnprintf(char *, size_t, const char *, ...) __printflike(3, 4); /* sprintf() is being deprecated. Please use snprintf() instead. */ int sprintf(char *bufp, const char *, ...) __deprecated __printflike(2, 3); @@ -194,19 +200,25 @@ __nosan_crc16(uint16_t crc, const void *bufp, size_t len) #endif int copystr(const void *kfaddr, void *kdaddr, size_t len, size_t *done); -int copyinstr(const user_addr_t uaddr, void *kaddr, size_t len, size_t *done); +int copyinstr(const user_addr_t uaddr, void *kaddr, size_t len, size_t *done) OS_WARN_RESULT; int copyoutstr(const void *kaddr, user_addr_t udaddr, size_t len, size_t *done); #if XNU_KERNEL_PRIVATE -extern int copyin_word(const user_addr_t user_addr, uint64_t *kernel_addr, vm_size_t nbytes); +int copyin_atomic32(const user_addr_t user_addr, uint32_t *u32); +int copyin_atomic32_wait_if_equals(const user_addr_t user_addr, uint32_t u32); +int copyin_atomic64(const user_addr_t user_addr, uint64_t *u64); +int copyout_atomic32(uint32_t u32, user_addr_t user_addr); +int copyout_atomic64(uint64_t u64, user_addr_t user_addr); +int copyoutstr_prevalidate(const void *kaddr, user_addr_t uaddr, size_t len); #endif int vsscanf(const char *, char const *, va_list); extern int vprintf(const char *, va_list) __printflike(1, 0); extern int vsnprintf(char *, size_t, const char *, va_list) __printflike(3, 0); +extern int vscnprintf(char *, size_t, const char *, va_list) __printflike(3, 0); #if XNU_KERNEL_PRIVATE -extern int vprintf_log_locked(const char *, va_list) __printflike(1, 0); +extern int vprintf_log_locked(const char *, va_list, bool addcr) __printflike(1, 0); extern void osobject_retain(void * object); extern void osobject_release(void * object); #endif