Completed mbtask new disk watcher

This commit is contained in:
Michiel Broek
2004-03-20 23:00:22 +00:00
parent f2a5b62745
commit f55ff6280f
33 changed files with 132 additions and 126 deletions

View File

@@ -143,8 +143,10 @@ int main(int argc, char **argv)
if (!do_quiet)
printf("\n");
if (!diskfree(CFG.freespace))
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, abort");
die(MBERR_DISK_FULL);
}
if (lockprogram((char *)"mbaff")) {
if (!do_quiet)

View File

@@ -167,8 +167,10 @@ int main(int argc, char **argv)
printf("\n");
}
if (!diskfree(CFG.freespace))
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, abort");
die(MBERR_DISK_FULL);
}
/*
* Extract work directory from the first commandline parameter

View File

@@ -424,8 +424,10 @@ int main(int argc, char **argv)
/*
* Not yet locked, if anything goes wrong, exit with die(MBERR_NO_PROGLOCK)
*/
if (!diskfree(CFG.freespace))
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, abort");
die(MBERR_DISK_FULL);
}
if (do_mail) {
/*
@@ -671,7 +673,8 @@ int TossMail(void)
Syslog('+', "Detected upsalarm semafore, aborting toss");
break;
}
if (!diskfree(CFG.freespace)) {
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, aborting toss");
rc = MBERR_DISK_FULL;
break;
}
@@ -742,8 +745,10 @@ int TossPkts(void)
*/
while ((fname = pull_fdlist(&fdl)) != NULL) {
if (!diskfree(CFG.freespace))
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, abort tossing packet");
return FALSE;
}
packets++;
/*

View File

@@ -234,8 +234,10 @@ int main(int argc, char **argv)
if (!do_quiet)
printf("\n");
if (!diskfree(CFG.freespace))
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, abort");
die(MBERR_DISK_FULL);
}
if (lockprogram((char *)"mbfile")) {
if (!do_quiet)

View File

@@ -173,8 +173,10 @@ void ImportFiles(int Area)
/*
* Check diskspace
*/
if (!diskfree(CFG.freespace))
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, abort");
die(MBERR_DISK_FULL);
}
Files++;
memset(&f_db, 0, sizeof(f_db));

View File

@@ -358,8 +358,10 @@ void ReqIndex(void)
if (area.Available) {
if (!diskfree(CFG.freespace))
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, abort");
die(MBERR_DISK_FULL);
}
if (!do_quiet) {
printf("\r%4ld => %-44s \b\b\b\b", i, area.Name);
@@ -597,8 +599,10 @@ void HtmlIndex(char *Lang)
if (area.Available) {
if (!diskfree(CFG.freespace))
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, abort");
die(MBERR_DISK_FULL);
}
if (!do_quiet) {
printf("\r%4ld => %-44s \b\b\b\b", i, area.Name);

View File

@@ -86,8 +86,10 @@ void Kill(void)
if ((area.Available) && (area.DLdays || area.FDdays) && (!area.CDrom)) {
if (!diskfree(CFG.freespace))
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, abort");
die(MBERR_DISK_FULL);
}
if (!do_quiet) {
printf("\r%4d => %-44s \b\b\b\b", i, area.Name);

View File

@@ -79,8 +79,10 @@ void PackFileBase(void)
if (area.Available && !area.CDrom) {
if (!diskfree(CFG.freespace))
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, abort");
die(MBERR_DISK_FULL);
}
if (!do_quiet) {
printf("\r%4d => %-44s", i, area.Name);

View File

@@ -158,8 +158,10 @@ void SortFileBase(int Area)
if (area.Available) {
if (!diskfree(CFG.freespace))
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, abort");
die(MBERR_DISK_FULL);
}
if (!do_quiet) {
printf("Sorting area %d: %-44s", Area, area.Name);

View File

@@ -177,8 +177,10 @@ int main(int argc,char *argv[])
Syslog(' ', cmd);
free(cmd);
if (!diskfree(CFG.freespace))
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, abort");
die(MBERR_DISK_FULL);
}
if (lockprogram((char *)"mbindex")) {
if (!do_quiet)

View File

@@ -277,8 +277,10 @@ void DoMsgBase()
fread(&msgs, msgshdr.recsize, 1, pAreas);
if (msgs.Active) {
if (!diskfree(CFG.freespace))
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, abort");
die(MBERR_DISK_FULL);
}
if (!do_quiet) {
colour(3, 0);
@@ -306,8 +308,10 @@ void DoMsgBase()
arearec++;
if (msgs.Active) {
if (!diskfree(CFG.freespace))
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, abort");
die(MBERR_DISK_FULL);
}
Nopper();
if (!do_quiet) {

View File

@@ -610,8 +610,10 @@ void flush_queue(void)
DIR *dp;
Syslog('+', "Flushing outbound queue");
if (!diskfree(CFG.freespace))
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, not flushing outbound queue");
return;
}
IsDoing("Flush queue");
if (!do_quiet) {

View File

@@ -76,7 +76,8 @@ int Tic()
}
Syslog('+', "Pass: process ticfiles (%s)", inbound);
if (!diskfree(CFG.freespace)) {
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, abort tic processing");
free(inbound);
return -1;
}
@@ -128,7 +129,8 @@ int Tic()
Syslog('+', "Detected upsalarm semafore, aborting tic processing");
break;
}
if (!diskfree(CFG.freespace)) {
if (enoughspace(CFG.freespace) == 0) {
Syslog('+', "Low diskspace, aborting tic processing");
rc = 0;
break;
}