X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=stat.c;h=0306cba4b2432ba7c09a0310d6ef762d581843a6;hp=89a1f49b9f823120c36e8c3f29922d45497a9225;hb=745667ae4887ebe0e25a4b9085556ac6ed56b246;hpb=7d912dbad687503f2a8d4895b0e48b4584b4940b diff --git a/stat.c b/stat.c index 89a1f49b..0306cba4 100644 --- a/stat.c +++ b/stat.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2007 Andre Noll + * Copyright (C) 2005-2009 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -35,7 +35,7 @@ struct stat_client { /** The stat client's file descriptor. */ int fd; /** Bitmask of those status items the client is interested in. */ - long unsigned item_mask; + uint64_t item_mask; /** Its entry in the list of stat clients. */ struct list_head node; }; @@ -68,7 +68,7 @@ static void dump_stat_client_list(void) * \return Positive value on success, or -E_TOO_MANY_CLIENTS if * the number of connected clients exceeds #MAX_STAT_CLIENTS. */ -int stat_client_add(int fd, long unsigned mask) +int stat_client_add(int fd, uint64_t mask) { struct stat_client *new_client; @@ -103,22 +103,18 @@ void stat_client_write(const char *msg, int itemnum) { struct stat_client *sc, *tmp; size_t len = strlen(msg); - struct timeval tv = {0 , 0}; + const uint64_t one = 1; if (!initialized || !len) return; list_for_each_entry_safe(sc, tmp, &client_list, node) { int fd = sc->fd, ret; - fd_set wfds; - if (!((1 << itemnum) & sc->item_mask)) + if (!((one << itemnum) & sc->item_mask)) continue; - FD_ZERO(&wfds); - FD_SET(fd, &wfds); - ret = para_select(fd + 1, NULL, &wfds, &tv); - if (ret > 0) { + if (write_ok(fd) > 0) { ret = write(fd, msg, len); - PARA_DEBUG_LOG("dumped %s to fd %d, ret = %d\n", msg, fd, ret); + // PARA_DEBUG_LOG("dumped %s to fd %d, ret = %d\n", msg, fd, ret); if (ret == len) continue; } @@ -130,7 +126,8 @@ void stat_client_write(const char *msg, int itemnum) free(sc); dump_stat_client_list(); } - PARA_DEBUG_LOG("%d client(s)\n", num_clients); +// if (num_clients) +// PARA_DEBUG_LOG("%d client(s)\n", num_clients); } /**