Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754679AbYAHKiB (ORCPT ); Tue, 8 Jan 2008 05:38:01 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753897AbYAHKgO (ORCPT ); Tue, 8 Jan 2008 05:36:14 -0500 Received: from ms1.nttdata.co.jp ([163.135.193.232]:40593 "EHLO ms1.nttdata.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753591AbYAHKgF (ORCPT ); Tue, 8 Jan 2008 05:36:05 -0500 X-Greylist: delayed 2759 seconds by postgrey-1.27 at vger.kernel.org; Tue, 08 Jan 2008 05:35:56 EST Message-Id: <20080108095001.192442277@nttdata.co.jp> References: <20080108094903.484613061@nttdata.co.jp> User-Agent: quilt/0.46-1 Date: Tue, 08 Jan 2008 18:49:13 +0900 From: Kentaro Takeda To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Kentaro Takeda , Tetsuo Handa Subject: [TOMOYO #6 10/21] Auditing interface. X-OriginalArrivalTime: 08 Jan 2008 09:50:01.0287 (UTC) FILETIME=[D62AB570:01C851DB] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="boundary-1" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 9535 Lines: 131 --boundary-1 Content-Disposition: inline; filename="tomoyo-audit.patch" Content-Type: application/octect-stream Content-Transfer-Encoding: base64 VE9NT1lPIExpbnV4IHVzZXMgL3N5cy9rZXJuZWwvc2VjdXJpdHkvdG9tb3lvLyBpbnRlcmZhY2UN CmZvciByZXBvcnRpbmcgYWNjZXNzIGxvZ3MgaW4gZG9tYWluIHBvbGljeSBmb3JtYXQuDQpPbmUg aXMgJ2dyYW50X2xvZycsIHVzZWQgZm9yIGF1ZGl0aW5nIGFjY2Vzc2VzIHdoaWNoIGFyZQ0KZ3Jh bnRlZCBpbiB0aGUgVE9NT1lPIExpbnV4IH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k7DQorCWlmIChyZWplY3RfbG9nX2NvdW50KQ0KKwkJcmV0dXJuIFBPTExJTiB8IFBPTExSRE5P Uk07DQorCXJldHVybiAwOw0KK30NCg0KLS0gDQo= --boundary-1-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/