diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | archival/libarchive/get_header_tar.c | 2 | ||||
-rw-r--r-- | include/bb_e2fs_defs.h | 20 | ||||
-rw-r--r-- | miscutils/man.c | 14 | ||||
-rw-r--r-- | networking/ifupdown.c | 20 | ||||
-rw-r--r-- | procps/ps.c | 40 | ||||
-rw-r--r-- | shell/ash.c | 3 | ||||
-rw-r--r-- | util-linux/mkfs_ext2.c | 11 |
8 files changed, 71 insertions, 41 deletions
@@ -1,6 +1,6 @@ | |||
1 | VERSION = 1 | 1 | VERSION = 1 |
2 | PATCHLEVEL = 20 | 2 | PATCHLEVEL = 20 |
3 | SUBLEVEL = 1 | 3 | SUBLEVEL = 2 |
4 | EXTRAVERSION = | 4 | EXTRAVERSION = |
5 | NAME = Unnamed | 5 | NAME = Unnamed |
6 | 6 | ||
diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c index 80a709144..b168653d8 100644 --- a/archival/libarchive/get_header_tar.c +++ b/archival/libarchive/get_header_tar.c | |||
@@ -84,7 +84,7 @@ static unsigned long long getOctal(char *str, int len) | |||
84 | first >>= 1; /* now 7th bit = 6th bit */ | 84 | first >>= 1; /* now 7th bit = 6th bit */ |
85 | v = first; /* sign-extend 8 bits to 64 */ | 85 | v = first; /* sign-extend 8 bits to 64 */ |
86 | while (--len != 0) | 86 | while (--len != 0) |
87 | v = (v << 8) + (unsigned char) *str++; | 87 | v = (v << 8) + (uint8_t) *++str; |
88 | } | 88 | } |
89 | return v; | 89 | return v; |
90 | } | 90 | } |
diff --git a/include/bb_e2fs_defs.h b/include/bb_e2fs_defs.h index 7974497ca..3edff8377 100644 --- a/include/bb_e2fs_defs.h +++ b/include/bb_e2fs_defs.h | |||
@@ -422,9 +422,27 @@ struct ext2_super_block { | |||
422 | uint16_t s_reserved_word_pad; | 422 | uint16_t s_reserved_word_pad; |
423 | uint32_t s_default_mount_opts; | 423 | uint32_t s_default_mount_opts; |
424 | uint32_t s_first_meta_bg; /* First metablock group */ | 424 | uint32_t s_first_meta_bg; /* First metablock group */ |
425 | /* ext3 additions */ | ||
425 | uint32_t s_mkfs_time; /* When the filesystem was created */ | 426 | uint32_t s_mkfs_time; /* When the filesystem was created */ |
426 | uint32_t s_jnl_blocks[17]; /* Backup of the journal inode */ | 427 | uint32_t s_jnl_blocks[17]; /* Backup of the journal inode */ |
427 | uint32_t s_reserved[172]; /* Padding to the end of the block */ | 428 | /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */ |
429 | /*150*/ uint32_t s_blocks_count_hi; /* Blocks count */ | ||
430 | uint32_t s_r_blocks_count_hi; /* Reserved blocks count */ | ||
431 | uint32_t s_free_blocks_count_hi; /* Free blocks count */ | ||
432 | uint16_t s_min_extra_isize; /* All inodes have at least # bytes */ | ||
433 | uint16_t s_want_extra_isize; /* New inodes should reserve # bytes */ | ||
434 | uint32_t s_flags; /* Miscellaneous flags */ | ||
435 | uint16_t s_raid_stride; /* RAID stride */ | ||
436 | uint16_t s_mmp_interval; /* # seconds to wait in MMP checking */ | ||
437 | uint64_t s_mmp_block; /* Block for multi-mount protection */ | ||
438 | uint32_t s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ | ||
439 | uint8_t s_log_groups_per_flex; /* FLEX_BG group size */ | ||
440 | uint8_t s_reserved_char_pad2; | ||
441 | uint16_t s_reserved_pad; | ||
442 | uint32_t s_reserved[162]; /* Padding to the end of the block */ | ||
443 | }; | ||
444 | struct BUG_ext2_super_block { | ||
445 | char bug[sizeof(struct ext2_super_block) == 1024 ? 1 : -1]; | ||
428 | }; | 446 | }; |
429 | 447 | ||
430 | /* | 448 | /* |
diff --git a/miscutils/man.c b/miscutils/man.c index 611466349..e380fdaba 100644 --- a/miscutils/man.c +++ b/miscutils/man.c | |||
@@ -129,27 +129,21 @@ static int show_manpage(const char *pager, char *man_filename, int man, int leve | |||
129 | #endif | 129 | #endif |
130 | #if ENABLE_FEATURE_SEAMLESS_XZ | 130 | #if ENABLE_FEATURE_SEAMLESS_XZ |
131 | strcpy(ext, "xz"); | 131 | strcpy(ext, "xz"); |
132 | if (run_pipe(pager, man_filename, man, level)) | 132 | if (run_pipe(pager, filename_with_zext, man, level)) |
133 | return 1; | 133 | return 1; |
134 | #endif | 134 | #endif |
135 | #if ENABLE_FEATURE_SEAMLESS_BZ2 | 135 | #if ENABLE_FEATURE_SEAMLESS_BZ2 |
136 | strcpy(ext, "bz2"); | 136 | strcpy(ext, "bz2"); |
137 | if (run_pipe(pager, man_filename, man, level)) | 137 | if (run_pipe(pager, filename_with_zext, man, level)) |
138 | return 1; | 138 | return 1; |
139 | #endif | 139 | #endif |
140 | #if ENABLE_FEATURE_SEAMLESS_GZ | 140 | #if ENABLE_FEATURE_SEAMLESS_GZ |
141 | strcpy(ext, "gz"); | 141 | strcpy(ext, "gz"); |
142 | if (run_pipe(pager, man_filename, man, level)) | 142 | if (run_pipe(pager, filename_with_zext, man, level)) |
143 | return 1; | 143 | return 1; |
144 | #endif | 144 | #endif |
145 | 145 | ||
146 | #if SEAMLESS_COMPRESSION | 146 | return run_pipe(pager, man_filename, man, level); |
147 | ext[-1] = '\0'; | ||
148 | #endif | ||
149 | if (run_pipe(pager, man_filename, man, level)) | ||
150 | return 1; | ||
151 | |||
152 | return 0; | ||
153 | } | 147 | } |
154 | 148 | ||
155 | int man_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 149 | int man_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index dfda20670..9b3498696 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -140,8 +140,6 @@ static const char keywords_up_down[] ALIGN1 = | |||
140 | "up\0" | 140 | "up\0" |
141 | "down\0" | 141 | "down\0" |
142 | "pre-up\0" | 142 | "pre-up\0" |
143 | "pre-down\0" | ||
144 | "post-up\0" | ||
145 | "post-down\0" | 143 | "post-down\0" |
146 | ; | 144 | ; |
147 | 145 | ||
@@ -895,6 +893,11 @@ static struct interfaces_file_t *read_interfaces(const char *filename) | |||
895 | if (rest_of_line[0] == '\0') | 893 | if (rest_of_line[0] == '\0') |
896 | bb_error_msg_and_die("option with empty value \"%s\"", buf); | 894 | bb_error_msg_and_die("option with empty value \"%s\"", buf); |
897 | 895 | ||
896 | if (strcmp(first_word, "post-up") == 0) | ||
897 | first_word += 5; /* "up" */ | ||
898 | else if (strcmp(first_word, "pre-down") == 0) | ||
899 | first_word += 4; /* "down" */ | ||
900 | |||
898 | /* If not one of "up", "down",... words... */ | 901 | /* If not one of "up", "down",... words... */ |
899 | if (index_in_strings(keywords_up_down, first_word) < 0) { | 902 | if (index_in_strings(keywords_up_down, first_word) < 0) { |
900 | int i; | 903 | int i; |
@@ -963,7 +966,7 @@ static char *setlocalenv(const char *format, const char *name, const char *value | |||
963 | return result; | 966 | return result; |
964 | } | 967 | } |
965 | 968 | ||
966 | static void set_environ(struct interface_defn_t *iface, const char *mode) | 969 | static void set_environ(struct interface_defn_t *iface, const char *mode, const char *opt) |
967 | { | 970 | { |
968 | int i; | 971 | int i; |
969 | char **pp; | 972 | char **pp; |
@@ -976,7 +979,7 @@ static void set_environ(struct interface_defn_t *iface, const char *mode) | |||
976 | } | 979 | } |
977 | 980 | ||
978 | /* note: last element will stay NULL: */ | 981 | /* note: last element will stay NULL: */ |
979 | G.my_environ = xzalloc(sizeof(char *) * (iface->n_options + 6)); | 982 | G.my_environ = xzalloc(sizeof(char *) * (iface->n_options + 7)); |
980 | pp = G.my_environ; | 983 | pp = G.my_environ; |
981 | 984 | ||
982 | for (i = 0; i < iface->n_options; i++) { | 985 | for (i = 0; i < iface->n_options; i++) { |
@@ -990,6 +993,7 @@ static void set_environ(struct interface_defn_t *iface, const char *mode) | |||
990 | *pp++ = setlocalenv("%s=%s", "ADDRFAM", iface->address_family->name); | 993 | *pp++ = setlocalenv("%s=%s", "ADDRFAM", iface->address_family->name); |
991 | *pp++ = setlocalenv("%s=%s", "METHOD", iface->method->name); | 994 | *pp++ = setlocalenv("%s=%s", "METHOD", iface->method->name); |
992 | *pp++ = setlocalenv("%s=%s", "MODE", mode); | 995 | *pp++ = setlocalenv("%s=%s", "MODE", mode); |
996 | *pp++ = setlocalenv("%s=%s", "PHASE", opt); | ||
993 | if (G.startup_PATH) | 997 | if (G.startup_PATH) |
994 | *pp++ = setlocalenv("%s=%s", "PATH", G.startup_PATH); | 998 | *pp++ = setlocalenv("%s=%s", "PATH", G.startup_PATH); |
995 | } | 999 | } |
@@ -1044,21 +1048,21 @@ static int check(char *str) | |||
1044 | static int iface_up(struct interface_defn_t *iface) | 1048 | static int iface_up(struct interface_defn_t *iface) |
1045 | { | 1049 | { |
1046 | if (!iface->method->up(iface, check)) return -1; | 1050 | if (!iface->method->up(iface, check)) return -1; |
1047 | set_environ(iface, "start"); | 1051 | set_environ(iface, "start", "pre-up"); |
1048 | if (!execute_all(iface, "pre-up")) return 0; | 1052 | if (!execute_all(iface, "pre-up")) return 0; |
1049 | if (!iface->method->up(iface, doit)) return 0; | 1053 | if (!iface->method->up(iface, doit)) return 0; |
1054 | set_environ(iface, "start", "post-up"); | ||
1050 | if (!execute_all(iface, "up")) return 0; | 1055 | if (!execute_all(iface, "up")) return 0; |
1051 | if (!execute_all(iface, "post-up")) return 0; | ||
1052 | return 1; | 1056 | return 1; |
1053 | } | 1057 | } |
1054 | 1058 | ||
1055 | static int iface_down(struct interface_defn_t *iface) | 1059 | static int iface_down(struct interface_defn_t *iface) |
1056 | { | 1060 | { |
1057 | if (!iface->method->down(iface,check)) return -1; | 1061 | if (!iface->method->down(iface,check)) return -1; |
1058 | set_environ(iface, "stop"); | 1062 | set_environ(iface, "stop", "pre-down"); |
1059 | if (!execute_all(iface, "pre-down")) return 0; | ||
1060 | if (!execute_all(iface, "down")) return 0; | 1063 | if (!execute_all(iface, "down")) return 0; |
1061 | if (!iface->method->down(iface, doit)) return 0; | 1064 | if (!iface->method->down(iface, doit)) return 0; |
1065 | set_environ(iface, "stop", "post-down"); | ||
1062 | if (!execute_all(iface, "post-down")) return 0; | 1066 | if (!execute_all(iface, "post-down")) return 0; |
1063 | return 1; | 1067 | return 1; |
1064 | } | 1068 | } |
diff --git a/procps/ps.c b/procps/ps.c index 4727b218b..3a5af7c18 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -69,6 +69,31 @@ | |||
69 | /* Absolute maximum on output line length */ | 69 | /* Absolute maximum on output line length */ |
70 | enum { MAX_WIDTH = 2*1024 }; | 70 | enum { MAX_WIDTH = 2*1024 }; |
71 | 71 | ||
72 | #if ENABLE_FEATURE_PS_TIME || ENABLE_FEATURE_PS_LONG | ||
73 | static long get_uptime(void) | ||
74 | { | ||
75 | #ifdef __linux__ | ||
76 | struct sysinfo info; | ||
77 | if (sysinfo(&info) < 0) | ||
78 | return 0; | ||
79 | return info.uptime; | ||
80 | #elif 1 | ||
81 | char buf[64]; | ||
82 | long uptime; | ||
83 | if (open_read_close("/proc/uptime", buf, sizeof(buf)) <= 0) | ||
84 | bb_perror_msg_and_die("can't read %s", "/proc/uptime"); | ||
85 | buf[sizeof(buf)-1] = '\0'; | ||
86 | sscanf(buf, "%l", &uptime); | ||
87 | return uptime; | ||
88 | #else | ||
89 | struct timespec ts; | ||
90 | if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) | ||
91 | return 0; | ||
92 | return ts.tv_sec; | ||
93 | #endif | ||
94 | } | ||
95 | #endif | ||
96 | |||
72 | #if ENABLE_DESKTOP | 97 | #if ENABLE_DESKTOP |
73 | 98 | ||
74 | #include <sys/times.h> /* for times() */ | 99 | #include <sys/times.h> /* for times() */ |
@@ -197,8 +222,6 @@ static inline unsigned get_HZ_by_waiting(void) | |||
197 | 222 | ||
198 | static unsigned get_kernel_HZ(void) | 223 | static unsigned get_kernel_HZ(void) |
199 | { | 224 | { |
200 | //char buf[64]; | ||
201 | struct sysinfo info; | ||
202 | 225 | ||
203 | if (kernel_HZ) | 226 | if (kernel_HZ) |
204 | return kernel_HZ; | 227 | return kernel_HZ; |
@@ -208,12 +231,7 @@ static unsigned get_kernel_HZ(void) | |||
208 | if (kernel_HZ == (unsigned)-1) | 231 | if (kernel_HZ == (unsigned)-1) |
209 | kernel_HZ = get_HZ_by_waiting(); | 232 | kernel_HZ = get_HZ_by_waiting(); |
210 | 233 | ||
211 | //if (open_read_close("/proc/uptime", buf, sizeof(buf)) <= 0) | 234 | seconds_since_boot = get_uptime(); |
212 | // bb_perror_msg_and_die("can't read %s", "/proc/uptime"); | ||
213 | //buf[sizeof(buf)-1] = '\0'; | ||
214 | ///sscanf(buf, "%llu", &seconds_since_boot); | ||
215 | sysinfo(&info); | ||
216 | seconds_since_boot = info.uptime; | ||
217 | 235 | ||
218 | return kernel_HZ; | 236 | return kernel_HZ; |
219 | } | 237 | } |
@@ -635,7 +653,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
635 | }; | 653 | }; |
636 | #if ENABLE_FEATURE_PS_LONG | 654 | #if ENABLE_FEATURE_PS_LONG |
637 | time_t now = now; | 655 | time_t now = now; |
638 | struct sysinfo info; | 656 | long uptime; |
639 | #endif | 657 | #endif |
640 | int opts = 0; | 658 | int opts = 0; |
641 | /* If we support any options, parse argv */ | 659 | /* If we support any options, parse argv */ |
@@ -695,7 +713,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
695 | puts("S UID PID PPID VSZ RSS TTY STIME TIME CMD"); | 713 | puts("S UID PID PPID VSZ RSS TTY STIME TIME CMD"); |
696 | #if ENABLE_FEATURE_PS_LONG | 714 | #if ENABLE_FEATURE_PS_LONG |
697 | now = time(NULL); | 715 | now = time(NULL); |
698 | sysinfo(&info); | 716 | uptime = get_uptime(); |
699 | #endif | 717 | #endif |
700 | } | 718 | } |
701 | else { | 719 | else { |
@@ -727,7 +745,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
727 | char tty[2 * sizeof(int)*3 + 2]; | 745 | char tty[2 * sizeof(int)*3 + 2]; |
728 | char *endp; | 746 | char *endp; |
729 | unsigned sut = (p->stime + p->utime) / 100; | 747 | unsigned sut = (p->stime + p->utime) / 100; |
730 | unsigned elapsed = info.uptime - (p->start_time / 100); | 748 | unsigned elapsed = uptime - (p->start_time / 100); |
731 | time_t start = now - elapsed; | 749 | time_t start = now - elapsed; |
732 | struct tm *tm = localtime(&start); | 750 | struct tm *tm = localtime(&start); |
733 | 751 | ||
diff --git a/shell/ash.c b/shell/ash.c index d197fa19a..d025da40c 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -6846,8 +6846,7 @@ evalvar(char *p, int flags, struct strlist *var_str_list) | |||
6846 | patloc = expdest - (char *)stackblock(); | 6846 | patloc = expdest - (char *)stackblock(); |
6847 | if (NULL == subevalvar(p, /* varname: */ NULL, patloc, subtype, | 6847 | if (NULL == subevalvar(p, /* varname: */ NULL, patloc, subtype, |
6848 | startloc, varflags, | 6848 | startloc, varflags, |
6849 | //TODO: | EXP_REDIR too? All other such places do it too | 6849 | /* quotes: */ flags & (EXP_FULL | EXP_CASE | EXP_REDIR), |
6850 | /* quotes: */ flags & (EXP_FULL | EXP_CASE), | ||
6851 | var_str_list) | 6850 | var_str_list) |
6852 | ) { | 6851 | ) { |
6853 | int amount = expdest - ( | 6852 | int amount = expdest - ( |
diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c index 69b25c946..3258d7eee 100644 --- a/util-linux/mkfs_ext2.c +++ b/util-linux/mkfs_ext2.c | |||
@@ -53,11 +53,6 @@ | |||
53 | #define ENABLE_FEATURE_MKFS_EXT2_RESERVED_GDT 0 | 53 | #define ENABLE_FEATURE_MKFS_EXT2_RESERVED_GDT 0 |
54 | #define ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX 1 | 54 | #define ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX 1 |
55 | 55 | ||
56 | // from e2fsprogs | ||
57 | #define s_reserved_gdt_blocks s_padding1 | ||
58 | #define s_mkfs_time s_reserved[0] | ||
59 | #define s_flags s_reserved[22] | ||
60 | |||
61 | #define EXT2_HASH_HALF_MD4 1 | 56 | #define EXT2_HASH_HALF_MD4 1 |
62 | #define EXT2_FLAGS_SIGNED_HASH 0x0001 | 57 | #define EXT2_FLAGS_SIGNED_HASH 0x0001 |
63 | #define EXT2_FLAGS_UNSIGNED_HASH 0x0002 | 58 | #define EXT2_FLAGS_UNSIGNED_HASH 0x0002 |
@@ -482,8 +477,10 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv) | |||
482 | STORE_LE(sb->s_magic, EXT2_SUPER_MAGIC); | 477 | STORE_LE(sb->s_magic, EXT2_SUPER_MAGIC); |
483 | STORE_LE(sb->s_inode_size, inodesize); | 478 | STORE_LE(sb->s_inode_size, inodesize); |
484 | // set "Required extra isize" and "Desired extra isize" fields to 28 | 479 | // set "Required extra isize" and "Desired extra isize" fields to 28 |
485 | if (inodesize != sizeof(*inode)) | 480 | if (inodesize != sizeof(*inode)) { |
486 | STORE_LE(sb->s_reserved[21], 0x001C001C); | 481 | STORE_LE(sb->s_min_extra_isize, 0x001c); |
482 | STORE_LE(sb->s_want_extra_isize, 0x001c); | ||
483 | } | ||
487 | STORE_LE(sb->s_first_ino, EXT2_GOOD_OLD_FIRST_INO); | 484 | STORE_LE(sb->s_first_ino, EXT2_GOOD_OLD_FIRST_INO); |
488 | STORE_LE(sb->s_log_block_size, blocksize_log2 - EXT2_MIN_BLOCK_LOG_SIZE); | 485 | STORE_LE(sb->s_log_block_size, blocksize_log2 - EXT2_MIN_BLOCK_LOG_SIZE); |
489 | STORE_LE(sb->s_log_frag_size, blocksize_log2 - EXT2_MIN_BLOCK_LOG_SIZE); | 486 | STORE_LE(sb->s_log_frag_size, blocksize_log2 - EXT2_MIN_BLOCK_LOG_SIZE); |