Prepare for disk watch thread
This commit is contained in:
26
lib/clcomm.c
26
lib/clcomm.c
@@ -465,6 +465,32 @@ unsigned long sequencer()
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Check enough diskspace.
|
||||
* return 0=No, 1=Yes, 2=Unknown, 3=Error
|
||||
*/
|
||||
int enoughspace(void)
|
||||
{
|
||||
char *buf, *res;
|
||||
int rc = 3;
|
||||
|
||||
buf = calloc(SS_BUFSIZE, sizeof(char));
|
||||
sprintf(buf, "DSPC:0;");
|
||||
|
||||
if (socket_send(buf) == 0) {
|
||||
free(buf);
|
||||
buf = socket_receive();
|
||||
res = strtok(buf, ",");
|
||||
res = strtok(NULL, ";");
|
||||
rc = atoi(res);
|
||||
}
|
||||
|
||||
Syslog('s', "enoughspace() rc=%d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
char *printable(char *s, int l)
|
||||
{
|
||||
int len;
|
||||
|
@@ -1992,6 +1992,7 @@ void UserCity(pid_t, char *, char *);
|
||||
void DoNop(void);
|
||||
void Nopper(void);
|
||||
void Altime(int);
|
||||
int enoughspace(void);
|
||||
unsigned long sequencer(void);
|
||||
char *printable(char *, int);
|
||||
char *printablec(char);
|
||||
|
Reference in New Issue
Block a user