diff options
| author | Ron Yorston <rmy@pobox.com> | 2025-08-15 09:00:13 +0100 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2025-08-15 09:00:13 +0100 |
| commit | 01ff9c492111cf7d51ad074629d6e72bc69fc149 (patch) | |
| tree | 394973e4e5f25dcd638185be75b84430c39ebab2 /include | |
| parent | 9a2d9345377d38c428df6d3e0887956d359807ab (diff) | |
| parent | 8bde71eb1502a5cdf186769b47d470038f99bc95 (diff) | |
| download | busybox-w32-01ff9c492111cf7d51ad074629d6e72bc69fc149.tar.gz busybox-w32-01ff9c492111cf7d51ad074629d6e72bc69fc149.tar.bz2 busybox-w32-01ff9c492111cf7d51ad074629d6e72bc69fc149.zip | |
Merge branch 'busybox' into merge
Diffstat (limited to 'include')
| -rw-r--r-- | include/libbb.h | 68 | ||||
| -rw-r--r-- | include/platform.h | 2 |
2 files changed, 39 insertions, 31 deletions
diff --git a/include/libbb.h b/include/libbb.h index 8dc4e4992..60037ed3d 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
| @@ -1224,6 +1224,22 @@ char *bin2hex(char *dst, const char *src, int count) FAST_FUNC; | |||
| 1224 | /* Reverse */ | 1224 | /* Reverse */ |
| 1225 | char* hex2bin(char *dst, const char *src, int count) FAST_FUNC; | 1225 | char* hex2bin(char *dst, const char *src, int count) FAST_FUNC; |
| 1226 | 1226 | ||
| 1227 | /* Returns strlen as a bonus */ | ||
| 1228 | //size_t replace_char(char *s, char what, char with) FAST_FUNC; | ||
| 1229 | static inline size_t replace_char(char *str, char from, char to) | ||
| 1230 | { | ||
| 1231 | char *p = str; | ||
| 1232 | while (*p) { | ||
| 1233 | if (*p == from) | ||
| 1234 | *p = to; | ||
| 1235 | p++; | ||
| 1236 | } | ||
| 1237 | return p - str; | ||
| 1238 | } | ||
| 1239 | |||
| 1240 | extern const char c_escape_conv_str00[]; | ||
| 1241 | #define c_escape_conv_str07 (c_escape_conv_str00+3) | ||
| 1242 | |||
| 1227 | void FAST_FUNC xorbuf_3(void *dst, const void *src1, const void *src2, unsigned count); | 1243 | void FAST_FUNC xorbuf_3(void *dst, const void *src1, const void *src2, unsigned count); |
| 1228 | void FAST_FUNC xorbuf(void* buf, const void* mask, unsigned count); | 1244 | void FAST_FUNC xorbuf(void* buf, const void* mask, unsigned count); |
| 1229 | void FAST_FUNC xorbuf16_aligned_long(void* buf, const void* mask); | 1245 | void FAST_FUNC xorbuf16_aligned_long(void* buf, const void* mask); |
| @@ -2225,33 +2241,6 @@ enum { COMM_LEN = 16 }; | |||
| 2225 | # endif | 2241 | # endif |
| 2226 | #endif | 2242 | #endif |
| 2227 | 2243 | ||
| 2228 | struct smaprec { | ||
| 2229 | unsigned long mapped_rw; | ||
| 2230 | unsigned long mapped_ro; | ||
| 2231 | unsigned long shared_clean; | ||
| 2232 | unsigned long shared_dirty; | ||
| 2233 | unsigned long private_clean; | ||
| 2234 | unsigned long private_dirty; | ||
| 2235 | unsigned long stack; | ||
| 2236 | unsigned long smap_pss, smap_swap; | ||
| 2237 | unsigned long smap_size; | ||
| 2238 | // For mixed 32/64 userspace, 32-bit pmap still needs | ||
| 2239 | // 64-bit field here to correctly show 64-bit processes: | ||
| 2240 | unsigned long long smap_start; | ||
| 2241 | // (strictly speaking, other fields need to be wider too, | ||
| 2242 | // but they are in kbytes, not bytes, and they hold sizes, | ||
| 2243 | // not start addresses, sizes tend to be less than 4 terabytes) | ||
| 2244 | char smap_mode[5]; | ||
| 2245 | char *smap_name; | ||
| 2246 | }; | ||
| 2247 | |||
| 2248 | #if !ENABLE_PMAP | ||
| 2249 | #define procps_read_smaps(pid, total, cb, data) \ | ||
| 2250 | procps_read_smaps(pid, total) | ||
| 2251 | #endif | ||
| 2252 | int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total, | ||
| 2253 | void (*cb)(struct smaprec *, void *), void *data); | ||
| 2254 | |||
| 2255 | typedef struct procps_status_t { | 2244 | typedef struct procps_status_t { |
| 2256 | #if !ENABLE_PLATFORM_MINGW32 | 2245 | #if !ENABLE_PLATFORM_MINGW32 |
| 2257 | DIR *dir; | 2246 | DIR *dir; |
| @@ -2287,7 +2276,13 @@ typedef struct procps_status_t { | |||
| 2287 | #endif | 2276 | #endif |
| 2288 | unsigned tty_major,tty_minor; | 2277 | unsigned tty_major,tty_minor; |
| 2289 | #if ENABLE_FEATURE_TOPMEM | 2278 | #if ENABLE_FEATURE_TOPMEM |
| 2290 | struct smaprec smaps; | 2279 | unsigned long mapped_rw; |
| 2280 | unsigned long mapped_ro; | ||
| 2281 | unsigned long shared_clean; | ||
| 2282 | unsigned long shared_dirty; | ||
| 2283 | unsigned long private_clean; | ||
| 2284 | unsigned long private_dirty; | ||
| 2285 | unsigned long stack; | ||
| 2291 | #endif | 2286 | #endif |
| 2292 | char state[4]; | 2287 | char state[4]; |
| 2293 | /* basename of executable in exec(2), read from /proc/N/stat | 2288 | /* basename of executable in exec(2), read from /proc/N/stat |
| @@ -2336,11 +2331,15 @@ void free_procps_scan(procps_status_t* sp) FAST_FUNC; | |||
| 2336 | procps_status_t* procps_scan(procps_status_t* sp, int flags) FAST_FUNC; | 2331 | procps_status_t* procps_scan(procps_status_t* sp, int flags) FAST_FUNC; |
| 2337 | /* Format cmdline (up to col chars) into char buf[size] */ | 2332 | /* Format cmdline (up to col chars) into char buf[size] */ |
| 2338 | /* Puts [comm] if cmdline is empty (-> process is a kernel thread) */ | 2333 | /* Puts [comm] if cmdline is empty (-> process is a kernel thread) */ |
| 2339 | void read_cmdline(char *buf, int size, unsigned pid, const char *comm) FAST_FUNC; | 2334 | int read_cmdline(char *buf, int size, unsigned pid, const char *comm) FAST_FUNC; |
| 2340 | pid_t *find_pid_by_name(const char* procName) FAST_FUNC; | 2335 | pid_t *find_pid_by_name(const char* procName) FAST_FUNC; |
| 2341 | pid_t *pidlist_reverse(pid_t *pidList) FAST_FUNC; | 2336 | pid_t *pidlist_reverse(pid_t *pidList) FAST_FUNC; |
| 2342 | int starts_with_cpu(const char *str) FAST_FUNC; | 2337 | int starts_with_cpu(const char *str) FAST_FUNC; |
| 2343 | unsigned get_cpu_count(void) FAST_FUNC; | 2338 | unsigned get_cpu_count(void) FAST_FUNC; |
| 2339 | /* Some internals reused by pmap: */ | ||
| 2340 | unsigned long FAST_FUNC fast_strtoul_10(char **endptr); | ||
| 2341 | unsigned long long FAST_FUNC fast_strtoull_16(char **endptr); | ||
| 2342 | char* FAST_FUNC skip_fields(char *str, int count); | ||
| 2344 | 2343 | ||
| 2345 | 2344 | ||
| 2346 | /* Use strict=1 if you process input from untrusted source: | 2345 | /* Use strict=1 if you process input from untrusted source: |
| @@ -2375,8 +2374,9 @@ enum { | |||
| 2375 | MD5_OUTSIZE = 16, | 2374 | MD5_OUTSIZE = 16, |
| 2376 | SHA1_OUTSIZE = 20, | 2375 | SHA1_OUTSIZE = 20, |
| 2377 | SHA256_OUTSIZE = 32, | 2376 | SHA256_OUTSIZE = 32, |
| 2377 | SHA384_OUTSIZE = 48, | ||
| 2378 | SHA512_OUTSIZE = 64, | 2378 | SHA512_OUTSIZE = 64, |
| 2379 | SHA3_OUTSIZE = 28, | 2379 | //SHA3-224_OUTSIZE = 28, |
| 2380 | /* size of input block */ | 2380 | /* size of input block */ |
| 2381 | SHA2_INSIZE = 64, | 2381 | SHA2_INSIZE = 64, |
| 2382 | }; | 2382 | }; |
| @@ -2390,6 +2390,7 @@ struct bcrypt_hash_ctx_t { | |||
| 2390 | typedef struct bcrypt_hash_ctx_t md5_ctx_t; | 2390 | typedef struct bcrypt_hash_ctx_t md5_ctx_t; |
| 2391 | typedef struct bcrypt_hash_ctx_t sha1_ctx_t; | 2391 | typedef struct bcrypt_hash_ctx_t sha1_ctx_t; |
| 2392 | typedef struct bcrypt_hash_ctx_t sha256_ctx_t; | 2392 | typedef struct bcrypt_hash_ctx_t sha256_ctx_t; |
| 2393 | typedef struct bcrypt_hash_ctx_t sha384_ctx_t; | ||
| 2393 | typedef struct bcrypt_hash_ctx_t sha512_ctx_t; | 2394 | typedef struct bcrypt_hash_ctx_t sha512_ctx_t; |
| 2394 | typedef struct sha3_ctx_t { | 2395 | typedef struct sha3_ctx_t { |
| 2395 | uint64_t state[25]; | 2396 | uint64_t state[25]; |
| @@ -2399,16 +2400,19 @@ typedef struct sha3_ctx_t { | |||
| 2399 | void md5_begin(struct bcrypt_hash_ctx_t *ctx) FAST_FUNC; | 2400 | void md5_begin(struct bcrypt_hash_ctx_t *ctx) FAST_FUNC; |
| 2400 | void sha1_begin(struct bcrypt_hash_ctx_t *ctx) FAST_FUNC; | 2401 | void sha1_begin(struct bcrypt_hash_ctx_t *ctx) FAST_FUNC; |
| 2401 | void sha256_begin(struct bcrypt_hash_ctx_t *ctx) FAST_FUNC; | 2402 | void sha256_begin(struct bcrypt_hash_ctx_t *ctx) FAST_FUNC; |
| 2403 | void sha384_begin(struct bcrypt_hash_ctx_t *ctx) FAST_FUNC; | ||
| 2402 | void sha512_begin(struct bcrypt_hash_ctx_t *ctx) FAST_FUNC; | 2404 | void sha512_begin(struct bcrypt_hash_ctx_t *ctx) FAST_FUNC; |
| 2403 | void generic_hash(struct bcrypt_hash_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC; | 2405 | void generic_hash(struct bcrypt_hash_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC; |
| 2404 | unsigned generic_end(struct bcrypt_hash_ctx_t *ctx, void *resbuf) FAST_FUNC; | 2406 | unsigned generic_end(struct bcrypt_hash_ctx_t *ctx, void *resbuf) FAST_FUNC; |
| 2405 | # define md5_hash generic_hash | 2407 | # define md5_hash generic_hash |
| 2406 | # define sha1_hash generic_hash | 2408 | # define sha1_hash generic_hash |
| 2407 | # define sha256_hash generic_hash | 2409 | # define sha256_hash generic_hash |
| 2410 | # define sha384_hash generic_hash | ||
| 2408 | # define sha512_hash generic_hash | 2411 | # define sha512_hash generic_hash |
| 2409 | # define md5_end generic_end | 2412 | # define md5_end generic_end |
| 2410 | # define sha1_end generic_end | 2413 | # define sha1_end generic_end |
| 2411 | # define sha256_end generic_end | 2414 | # define sha256_end generic_end |
| 2415 | # define sha384_end generic_end | ||
| 2412 | # define sha512_end generic_end | 2416 | # define sha512_end generic_end |
| 2413 | #else | 2417 | #else |
| 2414 | typedef struct md5_ctx_t { | 2418 | typedef struct md5_ctx_t { |
| @@ -2424,6 +2428,7 @@ typedef struct sha512_ctx_t { | |||
| 2424 | uint64_t hash[8]; | 2428 | uint64_t hash[8]; |
| 2425 | uint8_t wbuffer[128]; /* always correctly aligned for uint64_t */ | 2429 | uint8_t wbuffer[128]; /* always correctly aligned for uint64_t */ |
| 2426 | } sha512_ctx_t; | 2430 | } sha512_ctx_t; |
| 2431 | typedef struct sha512_ctx_t sha384_ctx_t; | ||
| 2427 | typedef struct sha3_ctx_t { | 2432 | typedef struct sha3_ctx_t { |
| 2428 | uint64_t state[25]; | 2433 | uint64_t state[25]; |
| 2429 | unsigned bytes_queued; | 2434 | unsigned bytes_queued; |
| @@ -2441,6 +2446,9 @@ void sha256_begin(sha256_ctx_t *ctx) FAST_FUNC; | |||
| 2441 | void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC; | 2446 | void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC; |
| 2442 | void sha512_hash(sha512_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC; | 2447 | void sha512_hash(sha512_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC; |
| 2443 | unsigned sha512_end(sha512_ctx_t *ctx, void *resbuf) FAST_FUNC; | 2448 | unsigned sha512_end(sha512_ctx_t *ctx, void *resbuf) FAST_FUNC; |
| 2449 | void sha384_begin(sha384_ctx_t *ctx) FAST_FUNC; | ||
| 2450 | #define sha384_hash sha512_hash | ||
| 2451 | unsigned sha384_end(sha384_ctx_t *ctx, void *resbuf) FAST_FUNC; | ||
| 2444 | #endif | 2452 | #endif |
| 2445 | void sha3_begin(sha3_ctx_t *ctx) FAST_FUNC; | 2453 | void sha3_begin(sha3_ctx_t *ctx) FAST_FUNC; |
| 2446 | void sha3_hash(sha3_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC; | 2454 | void sha3_hash(sha3_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC; |
diff --git a/include/platform.h b/include/platform.h index 5795a0cf3..0b88f990b 100644 --- a/include/platform.h +++ b/include/platform.h | |||
| @@ -208,7 +208,7 @@ | |||
| 208 | #elif defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN | 208 | #elif defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN |
| 209 | # define BB_BIG_ENDIAN 0 | 209 | # define BB_BIG_ENDIAN 0 |
| 210 | # define BB_LITTLE_ENDIAN 1 | 210 | # define BB_LITTLE_ENDIAN 1 |
| 211 | #elif defined(__386__) | 211 | #elif defined(__i386__) |
| 212 | # define BB_BIG_ENDIAN 0 | 212 | # define BB_BIG_ENDIAN 0 |
| 213 | # define BB_LITTLE_ENDIAN 1 | 213 | # define BB_LITTLE_ENDIAN 1 |
| 214 | #else | 214 | #else |
