mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Fix misuse of static variable in a header.
This commit is contained in:
parent
c90c71782e
commit
93d579a1b8
|
|
@ -48,6 +48,4 @@ extern void zpaq_compress(uchar *c_buf, i64 *c_len, uchar *s_buf, i64 s_len, int
|
||||||
extern void zpaq_decompress(uchar *s_buf, i64 *d_len, uchar *c_buf, i64 c_len,
|
extern void zpaq_decompress(uchar *s_buf, i64 *d_len, uchar *c_buf, i64 c_len,
|
||||||
FILE *msgout, bool progress, long thread);
|
FILE *msgout, bool progress, long thread);
|
||||||
|
|
||||||
static int current_priority;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -412,6 +412,7 @@ struct rzip_control {
|
||||||
i64 max_mmap;
|
i64 max_mmap;
|
||||||
int threads;
|
int threads;
|
||||||
char nice_val; // added for consistency
|
char nice_val; // added for consistency
|
||||||
|
int current_priority;
|
||||||
char major_version;
|
char major_version;
|
||||||
char minor_version;
|
char minor_version;
|
||||||
i64 st_size;
|
i64 st_size;
|
||||||
|
|
|
||||||
10
main.c
10
main.c
|
|
@ -569,19 +569,19 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
/* Set the main nice value to half that of the backend threads since
|
/* Set the main nice value to half that of the backend threads since
|
||||||
* the rzip stage is usually the rate limiting step */
|
* the rzip stage is usually the rate limiting step */
|
||||||
current_priority = getpriority(PRIO_PROCESS, 0);
|
control->current_priority = getpriority(PRIO_PROCESS, 0);
|
||||||
if (!NO_COMPRESS) {
|
if (!NO_COMPRESS) {
|
||||||
/* If niceness can't be set. just reset process priority */
|
/* If niceness can't be set. just reset process priority */
|
||||||
if (unlikely(setpriority(PRIO_PROCESS, 0, control->nice_val/2) == -1)) {
|
if (unlikely(setpriority(PRIO_PROCESS, 0, control->nice_val/2) == -1)) {
|
||||||
print_err("Warning, unable to set nice value %d...Resetting to %d\n",
|
print_err("Warning, unable to set nice value %d...Resetting to %d\n",
|
||||||
control->nice_val, current_priority);
|
control->nice_val, control->current_priority);
|
||||||
setpriority(PRIO_PROCESS, 0, (control->nice_val=current_priority));
|
setpriority(PRIO_PROCESS, 0, (control->nice_val=control->current_priority));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (unlikely(setpriority(PRIO_PROCESS, 0, control->nice_val) == -1)) {
|
if (unlikely(setpriority(PRIO_PROCESS, 0, control->nice_val) == -1)) {
|
||||||
print_err("Warning, unable to set nice value %d...Resetting to %d\n",
|
print_err("Warning, unable to set nice value %d...Resetting to %d\n",
|
||||||
control->nice_val, current_priority);
|
control->nice_val, control->current_priority);
|
||||||
setpriority(PRIO_PROCESS, 0, (control->nice_val=current_priority));
|
setpriority(PRIO_PROCESS, 0, (control->nice_val=control->current_priority));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
stream.c
8
stream.c
|
|
@ -1278,8 +1278,8 @@ static void *compthread(void *data)
|
||||||
ctis = cti->sinfo;
|
ctis = cti->sinfo;
|
||||||
|
|
||||||
if (unlikely(setpriority(PRIO_PROCESS, 0, control->nice_val) == -1)) {
|
if (unlikely(setpriority(PRIO_PROCESS, 0, control->nice_val) == -1)) {
|
||||||
print_err("Warning, unable to set thread nice value %d...Resetting to %d\n", control->nice_val, current_priority);
|
print_err("Warning, unable to set thread nice value %d...Resetting to %d\n", control->nice_val, control->current_priority);
|
||||||
setpriority(PRIO_PROCESS, 0, (control->nice_val=current_priority));
|
setpriority(PRIO_PROCESS, 0, (control->nice_val=control->current_priority));
|
||||||
}
|
}
|
||||||
cti->c_type = CTYPE_NONE;
|
cti->c_type = CTYPE_NONE;
|
||||||
cti->c_len = cti->s_len;
|
cti->c_len = cti->s_len;
|
||||||
|
|
@ -1515,8 +1515,8 @@ static void *ucompthread(void *data)
|
||||||
uci = &ucthread[i];
|
uci = &ucthread[i];
|
||||||
|
|
||||||
if (unlikely(setpriority(PRIO_PROCESS, 0, control->nice_val) == -1)) {
|
if (unlikely(setpriority(PRIO_PROCESS, 0, control->nice_val) == -1)) {
|
||||||
print_err("Warning, unable to set thread nice value %d...Resetting to %d\n", control->nice_val, current_priority);
|
print_err("Warning, unable to set thread nice value %d...Resetting to %d\n", control->nice_val, control->current_priority);
|
||||||
setpriority(PRIO_PROCESS, 0, (control->nice_val=current_priority));
|
setpriority(PRIO_PROCESS, 0, (control->nice_val=control->current_priority));
|
||||||
}
|
}
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue