Exemplo n.º 1
0
/* background daemon for timing out transactions */
static void*
BKGLoop(void *unused)
{
    struct timeval tv;
    int loop = 0;

    afs_pthread_setname_self("vol bkg");
    while (1) {
	tv.tv_sec = GCWAKEUP;
	tv.tv_usec = 0;
#ifdef AFS_PTHREAD_ENV
#ifdef AFS_NT40_ENV
        Sleep(GCWAKEUP * 1000);
#else
        select(0, 0, 0, 0, &tv);
#endif
#else
	(void)IOMGR_Select(0, 0, 0, 0, &tv);
#endif
	GCTrans();
	TryUnlock();
	loop++;
	if (loop == 10) {	/* reopen log every 5 minutes */
	    loop = 0;
	    ReOpenLog();
	}
    }

    AFS_UNREACHED(return(NULL));
}
Exemplo n.º 2
0
/*!
 * Handle requests to reopen the log.
 *
 * This signal handler will reopen the log file. A new, empty log file
 * will be created if the log file does not already exist.
 *
 * External log rotation programs may rotate a server log file by
 * renaming the existing server log file and then immediately sending a
 * signal to the corresponding server process.  Server log messages will
 * continue to be appended to the renamed server log file until the
 * server log is reopened.  After this signal handler completes, server
 * log messages will be written to the new log file.  This allows
 * external log rotation programs to rotate log files without
 * messages being dropped.
 */
void
ReOpenLog_Signal(int signo)
{
    ReOpenLog();
    if (resetSignals) {
	(void)signal(signo, ReOpenLog_Signal);
    }
}
Exemplo n.º 3
0
static void *
FiveMinuteCheckLWP(void *unused)
{

    printf("start 5 min check lwp\n");

    while (1) {
	IOMGR_Sleep(fiveminutes);
	/* close the log so it can be removed */
	ReOpenLog(AFSDIR_SERVER_KALOG_FILEPATH);	/* no trunc, just append */
    }
    return NULL;
}
Exemplo n.º 4
0
/* background daemon for timing out transactions */
static void*
BKGLoop(void *unused)
{
    struct timeval tv;
    time_t now;
    afs_int32 sleepseconds;
    int loop = 0;

    while (1) {
        now = FT_ApproxTime();
        sleepseconds =
                GCWAKEUP - (now % GCWAKEUP); /* synchronize with wall clock */
        tv.tv_sec = sleepseconds;
	tv.tv_usec = 0;
#ifdef AFS_PTHREAD_ENV
#ifdef AFS_NT40_ENV
        Sleep(GCWAKEUP * 1000);
#else
        select(0, 0, 0, 0, &tv);
#endif
#else
	(void)IOMGR_Select(0, 0, 0, 0, &tv);
#endif
	TransferRate();
	GCTrans();
	TryUnlock();
	loop++;
	if (loop == 10) {	/* reopen log every 5 minutes */
	    loop = 0;
	    ReOpenLog(AFSDIR_SERVER_VOLSERLOG_FILEPATH);
	    if (osdvol)
                (osdvol->op_osd_5min_check)();
#ifdef AFS_DEMAND_ATTACH_FS
	    if (VInit >= 2) { /* look for newly mounted partitions */
		VAttachPartitions();
		VInitAttachVolumes(fileServer);
	    }
#endif
	}
    }

    return NULL;
}