* in the compressed file.
*/
- /* configuration */
+/* configuration */
typedef struct dirent dir_type;
//if (opt & 0x400) // -9
//if (opt & 0x800) // -q
//if (opt & 0x1000) // -v
- if (ENABLE_GUNZIP && (opt & 0x2000)) { // -d
+#if ENABLE_GUNZIP /* gunzip_main may not be visible... */
+ if (opt & 0x2000) { // -d
/* FIXME: getopt32 should not depend on optind */
optind = 1;
return gunzip_main(argc, argv);
}
+#endif
foreground = signal(SIGINT, SIG_IGN) != SIG_IGN;
if (foreground) {
#include "busybox.h"
+/* FIXME - move to .h */
+extern int chown_main(int argc, char **argv);
+
int chgrp_main(int argc, char **argv)
{
/* "chgrp [opts] abc file(s)" == "chown [opts] :abc file(s)" */
char *start, *label[2];
struct stat stb1, stb2;
char **dl;
-static int dl_count;
+USE_FEATURE_DIFF_DIR(static int dl_count;)
struct cand {
int x;
static unsigned num_matches;
static regex_t pattern;
static unsigned pattern_valid;
+#else
+enum { pattern_valid = 0 };
#endif
static struct termios term_orig, term_vi;
{
#define readbuf bb_common_bufsiz1
char *current_line, *p;
- unsigned old_max_fline = max_fline;
+ USE_FEATURE_LESS_REGEXP(unsigned old_max_fline = max_fline;)
int w = width;
char last_terminated = terminated;
"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x40\x4b\x4c\x4d\x4e\x4f"
"\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f";
+#if ENABLE_FEATURE_LESS_REGEXP
static void print_found(const char *line)
{
int match_status;
printf(CLEAR_2_EOL"%s%s\n", growline, str);
free(growline);
}
+#else
+void print_found(const char *line);
+#endif
static void print_ascii(const char *str)
{
}
}
+#if ENABLE_FEATURE_LESS_REGEXP
static int normalize_match_pos(int match)
{
match_pos = match;
return match_pos;
}
-#if ENABLE_FEATURE_LESS_REGEXP
static void goto_match(int match)
{
if (num_matches)
#include "busybox.h"
#include <sched.h>
-#include <unistd.h>
#include <getopt.h> /* optind */
#if ENABLE_FEATURE_TASKSET_FANCY
#define TASKSET_PRINTF_MASK "%s"
#define from_cpuset(x) __from_cpuset(&x)
/* craft a string from the mask */
-static char *__from_cpuset(cpu_set_t *mask) {
+static char *__from_cpuset(cpu_set_t *mask)
+{
int i;
char *ret = 0, *str = xzalloc(9);
}
#else
#define TASKSET_PRINTF_MASK "%x"
-#define from_cpuset(mask) mask
+/* (void*) cast is for battling gcc: */
+/* "dereferencing type-punned pointer will break strict-aliasing rules" */
+#define from_cpuset(mask) (*(unsigned*)(void*)&(mask))
#endif
-#define TASKSET_OPT_p (1)
+#define OPT_p 1
int taskset_main(int argc, char** argv)
{
cpu_set_t mask, new_mask;
pid_t pid = 0;
- unsigned long ul;
+ unsigned opt;
const char *state = "current\0new";
char *p_opt = NULL, *aff = NULL;
- ul = getopt32(argc, argv, "+p:", &p_opt);
+ opt = getopt32(argc, argv, "+p:", &p_opt);
- if (ul & TASKSET_OPT_p) {
+ if (opt & OPT_p) {
if (argc == optind+1) { /* -p <aff> <pid> */
aff = p_opt;
p_opt = argv[optind];
}
}
- if (ul & TASKSET_OPT_p) {
-print_aff:
- if (sched_getaffinity(pid, sizeof (mask), &mask) < 0)
- bb_perror_msg_and_die("Failed to %cet pid %d's affinity", 'g', pid);
+ if (opt & OPT_p) {
+ print_aff:
+ if (sched_getaffinity(pid, sizeof(mask), &mask) < 0)
+ bb_perror_msg_and_die("failed to %cet pid %d's affinity", 'g', pid);
printf("pid %d's %s affinity mask: "TASKSET_PRINTF_MASK"\n",
pid, state, from_cpuset(mask));
if (!*argv) /* no new affinity given or we did print already, done. */
return EXIT_SUCCESS;
}
- if (sched_setaffinity(pid, sizeof (new_mask), &new_mask))
- bb_perror_msg_and_die("Failed to %cet pid %d's affinity", 's', pid);
- if (ul & TASKSET_OPT_p) {
+ if (sched_setaffinity(pid, sizeof(new_mask), &new_mask))
+ bb_perror_msg_and_die("failed to %cet pid %d's affinity", 's', pid);
+ if (opt & OPT_p) {
state += 8;
++argv;
goto print_aff;
execvp(*argv, argv);
bb_perror_msg_and_die("%s", *argv);
}
-#undef TASKSET_OPT_p
+#undef OPT_p
#undef TASKSET_PRINTF_MASK
#undef from_cpuset
#include <sys/utsname.h>
#if !ENABLE_FEATURE_2_4_MODULES && !ENABLE_FEATURE_2_6_MODULES
+#undef ENABLE_FEATURE_2_4_MODULES
#define ENABLE_FEATURE_2_4_MODULES 1
#endif
return 0;
}
-#if ENABLE_FEATURE_HTTPD_BASIC_AUTH || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
+#if ENABLE_FEATURE_HTTPD_BASIC_AUTH \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
static void free_config_lines(Htaccess **pprev)
{
Htaccess *prev = *pprev;
{
FILE *f;
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
- Htaccess *prev, *cur;
-#elif ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
+ Htaccess *prev;
+#endif
+#if ENABLE_FEATURE_HTTPD_BASIC_AUTH \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
Htaccess *cur;
#endif
config->flg_deny_all = 0;
-#if ENABLE_FEATURE_HTTPD_BASIC_AUTH || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
+#if ENABLE_FEATURE_HTTPD_BASIC_AUTH \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
/* retain previous auth and mime config only for subdir parse */
if (flag != SUBDIR_PARSE) {
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
}
#endif
-#if ENABLE_FEATURE_HTTPD_BASIC_AUTH || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
+#if ENABLE_FEATURE_HTTPD_BASIC_AUTH \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES \
+ || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
/* storing current config line */
cur = calloc(1, sizeof(Htaccess) + strlen(p0));
if (cur) {
/* This could stand some work */
for (cur = config->ip_a_d; cur; cur = cur->next) {
- if (DEBUG)
- fprintf(stderr, "checkPermIP: '%s' ? ", config->rmt_ip_str);
+#if DEBUG
+ fprintf(stderr, "checkPermIP: '%s' ? ", config->rmt_ip_str);
+#endif
if (DEBUG)
fprintf(stderr, "'%u.%u.%u.%u/%u.%u.%u.%u'\n",
(unsigned char)(cur->ip >> 24),
/* extra read only for POST */
if (prequest != request_GET) {
test = buf + sizeof("Content-length:")-1;
- if (!test[0]) goto bail_out;
+ if (!test[0])
+ goto bail_out;
errno = 0;
/* not using strtoul: it ignores leading munis! */
length = strtol(test, &test, 10);
config->ContentLength = -1;
} while (0);
+#if ENABLE_FEATURE_HTTPD_CGI
bail_out:
+#endif
if (DEBUG)
fprintf(stderr, "closing socket\n\n");
#if ENABLE_FEATURE_HTTPD_SETUID
if (opt & OPT_SETUID) {
- char *e;
- // FIXME: what the default group should be?
- ugid.gid = -1;
- ugid.uid = bb_strtoul(s_ugid, &e, 0);
- if (*e == ':') {
- e++;
- ugid.gid = bb_strtoul(e, NULL, 0);
- }
- if (errno) {
- /* not integer */
- if (!uidgid_get(&ugid, s_ugid))
- bb_error_msg_and_die("unrecognized user[:group] "
+ if (!get_uidgid(&ugid, s_ugid, 1))
+ bb_error_msg_and_die("unrecognized user[:group] "
"name '%s'", s_ugid);
- }
}
#endif
unsigned long ticks;
unsigned pid;
};
+#if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
static struct save_hist *prev_hist;
static int prev_hist_count;
/* static int hist_iterations; */
static unsigned total_pcpu;
/* static unsigned long total_rss; */
-
+#endif
#define OPT_BATCH_MODE (option_mask32 & 0x4)
top[n].pid = p->pid;
top[n].ppid = p->ppid;
top[n].rss = p->rss;
+#if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
top[n].ticks = p->stime + p->utime;
+#endif
top[n].uid = p->uid;
strcpy(top[n].state, p->state);
strcpy(top[n].comm, p->comm);
lib-$(CONFIG_SV) += sv.o runit_lib.o
lib-$(CONFIG_SVLOGD) += svlogd.o runit_lib.o
lib-$(CONFIG_CHPST) += chpst.o
+
+lib-$(CONFIG_ENVDIR) += chpst.o
+lib-$(CONFIG_ENVUIDGID) += chpst.o
+lib-$(CONFIG_SETUIDGID) += chpst.o
+lib-$(CONFIG_SOFTLIMIT) += chpst.o
{
char *str_b, *str_C, *str_H, *str_S;
unsigned opt;
- int c;
/*
* fdisk -v
* fdisk -l [-b sectorsize] [-u] device ...
}
while (1) {
+ int c;
putchar('\n');
c = tolower(read_nonempty(_("Command (m for help): ")));
switch (c) {
if (dind)
write_block(dind, (char *) dind_block);
}
+#else
+void make_bad_inode2(void);
#endif
static void make_root_inode(void)
inode->i_gid = GETGID;
write_block(inode->i_zone[0], root_block);
}
+#else
+void make_root_inode2(void);
#endif
static void setup_tables(void)