From owner-freebsd-questions@FreeBSD.ORG Fri Dec 14 09:45:51 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 66522231 for ; Fri, 14 Dec 2012 09:45:51 +0000 (UTC) (envelope-from jack.mclauren@yahoo.com) Received: from nm29.bullet.mail.bf1.yahoo.com (nm29.bullet.mail.bf1.yahoo.com [98.139.212.188]) by mx1.freebsd.org (Postfix) with ESMTP id 0002E8FC18 for ; Fri, 14 Dec 2012 09:45:50 +0000 (UTC) Received: from [98.139.212.153] by nm29.bullet.mail.bf1.yahoo.com with NNFMP; 14 Dec 2012 09:45:44 -0000 Received: from [98.139.212.244] by tm10.bullet.mail.bf1.yahoo.com with NNFMP; 14 Dec 2012 09:45:44 -0000 Received: from [127.0.0.1] by omp1053.mail.bf1.yahoo.com with NNFMP; 14 Dec 2012 09:45:44 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 94515.64270.bm@omp1053.mail.bf1.yahoo.com Received: (qmail 31370 invoked by uid 60001); 14 Dec 2012 09:45:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1355478344; bh=Ei4JTFOYr3cgTCrejQxW6pWhFC/tsUYf6xpuOchE0x0=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=sNxKk/CsV4tvw65VF4XyuTwTqV0suk51EUfR8QEn/05OAEvuq0JqmllXCtDu4ZM8k1ZREsO6JZ9Vk7gEnxGk+5g5crnpGNEMmc66kuw0Mlo/+S8pJ2258VT6UU7rzINl8lo+61SEhRTt6rzzYDPaez2aEmrBCro6hRNy3KI2aqQ= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=uj/XSNqkOZ7XeCe9FqZjhfHyMc7vGUXz3FsEt5Sc+9+nuvJK/E2TKpSKqJkWn19r6xxHSWL7c3/Nbmkv2uRvdfuSOexJYn3I/9bNM92gFBOCV6dBxxIikUylvl68fKFUFov0prA+eG6uAuhh5y091bVaaZGySzfj0gZLJ5pbyBE=; X-YMail-OSG: oq26M4gVM1lwoy3NcYxeMAF8AU7DUbTIda6mCmsw01zWvWg HrNY9ZbuMM7i54u3T0_mPTaXM69ZzPRJRV_xYQtti5oOHonXyj07GoNyO7T0 nEcX0VqGUfEklfaDXPeJtLCCvuFWpyEzctwRKPDICPyb9996etFV1Z_lgU7x u2q6376kYhci28CgpajjUlOER7OH8hsq0fan02.khS04owtqsqvlOzWG6TmK HE5Emqp9G2QngHmnLpUvHjnCKlavLKqWrpcbEMn8KXp4u0mlJTQ3BQXVHUqI qEpNKbR9DNrwJI1QYTqnGq.cQyRhO7.zYBmZWnSQ8dz1ULwmMwpl88mC8xi4 6627.Fxz4LUcb20ZBbSmY_o1AvALB0TtDTVl07q8nTjeoDBDIKfo64RRuM1g 0kjxrgtXMYci03MJt2sG0RcweqyRl38G_sSp0Gd5WR0Wp2mXfp3r96Q-- Received: from [2.180.75.37] by web160106.mail.bf1.yahoo.com via HTTP; Fri, 14 Dec 2012 01:45:43 PST X-Rocket-MIMEInfo: 001.001, SGkgYWxsCkkgd2FudCB0byBtb25pdG9yIGZpbGVzIGFjY2VzcyBhbmQgY2hhbmdlIHRpbWUuIEhvdyBjYW4gSSBsaXN0ZW4gdG8gc3BlY2lmaWMgZmlsZSBvcsKgZGlyZWN0b3J5IHRvIG1vbml0b3IgPyBJJ20gY29kaW5nIHdpdGggYy4KClRoYW5rcyBJbiBhZHZhbmNlIC4uLiDCoMKgATABAQEB X-Mailer: YahooMailWebService/0.8.128.478 Message-ID: <1355478343.11175.YahooMailNeo@web160106.mail.bf1.yahoo.com> Date: Fri, 14 Dec 2012 01:45:43 -0800 (PST) From: Jack Mc Lauren Subject: Listen to file changes To: "freebsd-questions@freebsd.org" MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Jack Mc Lauren List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Dec 2012 09:45:51 -0000 Hi all=0AI want to monitor files access and change time. How can I listen t= o specific file or=A0directory to monitor ? I'm coding with c.=0A=0AThanks = In advance ... =A0=A0 From owner-freebsd-questions@FreeBSD.ORG Fri Dec 14 10:34:57 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7F2DAAA9 for ; Fri, 14 Dec 2012 10:34:57 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) by mx1.freebsd.org (Postfix) with ESMTP id 3B1A18FC08 for ; Fri, 14 Dec 2012 10:34:57 +0000 (UTC) Received: from r56.edvax.de (port-92-195-51-39.dynamic.qsc.de [92.195.51.39]) by mx02.qsc.de (Postfix) with ESMTP id 09F0E25400; Fri, 14 Dec 2012 11:34:55 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id qBEAYvVd002723; Fri, 14 Dec 2012 11:34:57 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Fri, 14 Dec 2012 11:34:57 +0100 From: Polytropon To: Jack Mc Lauren Subject: Re: Listen to file changes Message-Id: <20121214113457.970f6759.freebsd@edvax.de> In-Reply-To: <1355478343.11175.YahooMailNeo@web160106.mail.bf1.yahoo.com> References: <1355478343.11175.YahooMailNeo@web160106.mail.bf1.yahoo.com> Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "freebsd-questions@freebsd.org" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Dec 2012 10:34:57 -0000 On Fri, 14 Dec 2012 01:45:43 -0800 (PST), Jack Mc Lauren wrote: > Hi all > I want to monitor files access and change time. How can I > listen to specific file or=A0directory to monitor ? I'm coding with c. If I remember correctly, what you're searching for does already exist: FAM - the File Alteration Monitor. It's in the ports collection (/usr/ports/devel/fam). There are also C++ and Ruby bindings, maybe you can also interface with C... For C: Maybe using readdir() et al. could be useful? Also see "man 5 inode", "man 5 dir" and "man 3 readdir" for more info. And struct ufs2_dinode in /usr/include/ufs/ufs/dinode.h should have the information you need to parse for; maybe also check the FILE type in /usr/include/stdio.h for access flags. --=20 Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...