Xymon Mailing List Archive search

logfetch.status on Darwin clients

list Dominique Frise
Fri, 28 Apr 2006 15:38:32 +0200
Message-Id: <user-f3b7e14081e3@xymon.invalid>

Henrik Stoerner wrote:
On Fri, Apr 28, 2006 at 01:50:05PM +0200, Dominique Frise wrote:
[logfile:/var/log/system.log]
type:100000 (file)
mode:640 (-rw-r-----)
linkcount:1
owner:0 (root)
group:80 (admin)
size:3

zelda2:~ bb$ ls -l /var/log/system.log
-rw-r-----   1 root  admin  3078 Apr 28 08:57 /var/log/system.log

This is bizarre. Just to make sure I'm not crazy, could you compile the
attached little program and run it on the client reporting this:

   gcc -o stat stat.c
   ./stat /var/log/system.log


Henrik


#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <errno.h>

int main(int argc, char *argv[])
{
	int i;
	struct stat st;
	int fd;

	for (i=1; (i<argc); i++) {
		if (stat(argv[i], &st) == 0) {
			printf("stat OK\n");
			printf("- st_size = %u\n", st.st_size);
			printf("- st_size = %u\n", st.st_size);
			printf("- st_blocks = %u\n", st.st_blocks);
			printf("- st_blksize = %u\n", st.st_blksize);
			printf("- st_mtime = %u %s\n", st.st_mtime, asctime(localtime(&st.st_mtime)));
		}
		else printf("stat failed: %s\n", strerror(errno));

		fd = open(argv[i], O_RDONLY);
		if ((fd >= 0) && (fstat(fd, &st) == 0)) {
			printf("fstat OK\n");
			printf("- st_size = %u\n", st.st_size);
			printf("- st_size = %u\n", st.st_size);
			printf("- st_blocks = %u\n", st.st_blocks);
			printf("- st_blksize = %u\n", st.st_blksize);
			printf("- st_mtime = %u %s\n", st.st_mtime, asctime(localtime(&st.st_mtime)));
		}
		else printf("fstat failed: %s\n", strerror(errno));
	}

	return 0;
}

zelda2:~ bb$ ./stat /var/log/system.log
stat OK
- st_size = 0
- st_size = 0
- st_blocks = 0
- st_blksize = 4096
- st_mtime = 1146207446 Fri Apr 28 08:57:26 2006

fstat OK
- st_size = 0
- st_size = 0
- st_blocks = 0
- st_blksize = 4096
- st_mtime = 1146207446 Fri Apr 28 08:57:26 2006


Dominique