Lines Matching refs:status

103 static rotate_status_t status;
232 static void checkRotate(rotate_config_t *config, rotate_status_t *status)
234 if (status->current.fd == NULL) {
235 status->rotateReason = ROTATE_NEW;
241 if (apr_file_info_get(&finfo, APR_FINFO_SIZE, status->current.fd) == APR_SUCCESS) {
246 status->rotateReason = ROTATE_SIZE;
249 if (get_now(config, NULL) >= status->tLogEnd) {
250 status->rotateReason = ROTATE_TIME;
255 if (get_now(config, NULL) >= status->tLogEnd) {
256 status->rotateReason = ROTATE_TIME;
264 if (status->rotateReason != ROTATE_NONE && config->verbose) {
265 fprintf(stderr, "File rotation needed, reason: %s\n", ROTATE_REASONS[status->rotateReason]);
273 rotate_config_t *config, rotate_status_t *status)
325 if (status->current.fd) {
326 argv[2] = status->current.name;
348 static void truncate_and_write_error(rotate_status_t *status, const char *message)
352 if (apr_file_trunc(status->current.fd, 0) != APR_SUCCESS) {
353 fprintf(stderr, "Error truncating the file %s\n", status->current.name);
356 if (apr_file_write_full(status->current.fd, message, buflen, NULL) != APR_SUCCESS) {
358 message, status->current.name);
374 static void doRotate(rotate_config_t *config, rotate_status_t *status)
385 status->rotateReason = ROTATE_NONE;
397 if (tLogStart < status->tLogEnd) {
400 status->tLogEnd = tLogEnd;
425 if (status->fileNum == -1 || status->fileNum == (config->num_files - 1)) {
430 thisLogNum = status->fileNum + 1;
439 apr_pool_create(&newlog.pool, status->pool);
461 | (config->truncate || (config->num_files > 0 && status->current.fd) ? APR_TRUNCATE : 0),
465 post_rotate(newlog.pool, &newlog, config, status);
467 status->fileNum = thisLogNum;
469 if (status->current.fd) {
470 close_logfile(config, &status->current);
474 status->current = newlog;
483 if (status->current.fd == NULL) {
493 status->nMessCount, error);
495 truncate_and_write_error(status, message);
501 status->nMessCount = 0;
580 memset(&status, 0, sizeof status);
581 status.rotateReason = ROTATE_NONE;
583 apr_pool_create(&status.pool, NULL);
584 apr_getopt_init(&opt, status.pool, argc, argv);
626 status.fileNum = -1;
645 APR_FILEPATH_TRUENAME, status.pool);
665 if (status.fileNum == -1 && config.num_files < 1) {
670 if (apr_file_open_stdin(&f_stdin, status.pool) != APR_SUCCESS) {
675 if (apr_file_open_stdout(&f_stdout, status.pool) != APR_SUCCESS) {
689 pollfd.p = status.pool;
701 doRotate(&config, &status);
708 polltimeout = status.tLogEnd ? status.tLogEnd - get_now(&config, NULL) : config.tRotation;
742 checkRotate(&config, &status);
743 if (status.rotateReason != ROTATE_NONE) {
744 doRotate(&config, &status);
748 rv = apr_file_write_full(status.current.fd, buf, nWrite, &nWrite);
755 if (apr_file_seek(status.current.fd, APR_CUR, &cur_offset) != APR_SUCCESS) {
758 status.nMessCount++;
759 apr_pool_create(&pool, status.pool);
762 rv, cur_offset, status.nMessCount, &rv);
764 truncate_and_write_error(&status, error);
768 status.nMessCount++;