Esempio n. 1
0
/* user interface */
void* server_mgr(void* args)
{
	char buf[128];

	while (1) {
		printf(">>");
		fgets(buf, 128, stdin);
		trim(buf);
		if (strncmp(buf, "add ", 4) == 0)
			mgr_add(buf+4);

		else if (strcmp(buf, "count current") == 0) {
			printf("There are %d user(s) now.\n", mgr_cntcur());
		}
		else if (strcmp(buf, "count all") == 0) {
			printf("There are %d visitor(s) in history.\n", mgr_cntall());
		}
		else if (strncmp(buf, "kill ", 5) == 0)
			thread_kill(buf+5);
		else if (strcmp(buf, "stat all") == 0)
			mgr_statall();
		else if (strncmp(buf, "stat ", 5) == 0)
			mgr_stat(buf+5);

		else 
			printf("Error Command\n");

	}
}
Esempio n. 2
0
void    hs_stat(HStore *store, uint64_t *total, uint64_t *avail)
{
    uint64_t used = 0;
    *total = 0;
    int i;
    for (i=0; i<store->count; i++) {
        bc_stat(store->bitcasks[i], &used);
        *total += used; 
    }
     
    uint64_t total_space;
    mgr_stat(store->mgr, &total_space, avail);
}