Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755291AbYAHKho (ORCPT ); Tue, 8 Jan 2008 05:37:44 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753818AbYAHKgL (ORCPT ); Tue, 8 Jan 2008 05:36:11 -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 S1753556AbYAHKgE (ORCPT ); Tue, 8 Jan 2008 05:36:04 -0500 X-Greylist: delayed 2759 seconds by postgrey-1.27 at vger.kernel.org; Tue, 08 Jan 2008 05:35:56 EST Message-Id: <20080108095004.378718866@nttdata.co.jp> References: <20080108094903.484613061@nttdata.co.jp> User-Agent: quilt/0.46-1 Date: Tue, 08 Jan 2008 18:49:19 +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 16/21] Signal control functions. X-OriginalArrivalTime: 08 Jan 2008 09:50:04.0678 (UTC) FILETIME=[D8302260: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: 9423 Lines: 130 --boundary-1 Content-Disposition: inline; filename="tomoyo-signal.patch" Content-Type: application/octect-stream Content-Transfer-Encoding: base64 VE9NT1lPIExpbnV4IGNoZWNrcyBzZW5kaW5nIHNpZ25hbCBieSBzaWduYWwgbnVtYmVyIGFuZA0K dGhlIGRvbWFpbiBvZiB0YXJnZXQgcHJvY2Vzcy4gSW4gb3JkZXIgdG8gY2hlY2sgc2lnbmFsDQpw ZXJtaXNzaW9uLCBtb2RpZmljYXRpb24gYWdhaW5zdCBrZXJuZWwvc2lnbmFsLmMgaXMgbmVlZGVk Lg0KDQpFYWNoIHBlcm1pc3Npb24gY2FuIGJlIGF1dG9tYXRpY2FsbHkgYWNjdW11bGF0ZWQgaW50 bw0KdGhlIHBvbGljeSBvZiBlYWNoIGRvbWFpbiB1c2luZyAnbGVhcm5pbmcgbW9kZScuDQoNClNp Z25lZC1vZmYtYnk6IEtlbnRhcm8gVGFrZWRhIDx0YWtlZGFrbkBudHRkYXRhLmNvLmpwPg0KU2ln bmVkLW9mZi1ieTogVGV0c3VvIEhhbmRhIDxwZW5ndWluLWtlcm5lbEBJLWxvdmUuU0FLVVJBLm5l LmpwPg0KLS0tDQogc2VjdXJpdHkvdG9tb3lvL3NpZ25hbC5jIHwgIDIyNiArKysrKysrKysrKysr KysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKw0KIDEgZmlsZSBjaGFuZ2VkLCAyMjYg aW5zZXJ0aW9ucygrKQ0KDQotLS0gL2Rldi9udWxsDQorKysgbGludXgtMi42LW1tL3NlY3VyaXR5 L3RvbW95by9zaWduYWwuYw0KQEAgLTAsMCArMSwyMjYgQEANCisvKg0KKyAqIHNlY3VyaXR5L3Rv bW95by9zaWduYWwuYw0KKyAqDQorICogU2lnbmFsIGFjY2VzcyBjb250b2wgZnVuY3Rpb25zIGZv ciBUT01PWU8gTGludXguDQorICovDQorDQorI2luY2x1ZGUgInRvbW95by5oIg0KKyNpbmNsdWRl ICJyZWFscGF0aC5oIg0KKw0KKy8qKioqKioqKioqKioqKioqKioqKioqKioqICBBVURJVCBGVU5D VElPTlMgICoqKioqKioqKioqKioqKioqKioqKioqKiovDQorDQorc3RhdGljIGludCB0bXlfYXVk aXRfc2lnbmFsX2xvZyhjb25zdCBpbnQgc2lnbmFsLA0KKwkJCQljb25zdCBzdHJ1Y3QgcGF0aF9p bmZvICpkZXN0X2RvbWFpbiwNCisJCQkJY29uc3QgYm9vbCBpc19ncmFudGVkLA0KKwkJCQljb25z dCB1OCBwcm9maWxlLA0KKwkJCQljb25zdCB1bnNpZ25lZCBpbnQgbW9kZSkNCit7DQorCWNoYXIg KmJ1ZjsNCisJa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isJcmV0dXJuIDA7DQorfQ0KKw0KKy8qKg0KKyAqIHRt eV9hZGRfc2lnbmFsX3BvbGljeSAtIGFkZCBvciBkZWxldGUgc2lnbmFsIHBvbGljeS4NCisgKiBA ZGF0YTogICAgICBhIGxpbmUgdG8gcGFyc2UuDQorICogQGRvbWFpbjogICAgcG9pbnRlciB0byAi c3RydWN0IGRvbWFpbl9pbmZvIi4NCisgKiBAY29uZDogICAgICBwb2ludGVyIHRvICJzdHJ1Y3Qg Y29uZGl0aW9uX2xpc3QiLiBNYXkgYmUgTlVMTC4NCisgKiBAaXNfZGVsZXRlOiBpcyB0aGlzIGRl bGV0ZSByZXF1ZXN0Pw0KKyAqDQorICogUmV0dXJucyB6ZXJvIG9uIHN1Y2Nlc3MuDQorICogUmV0 dXJucyBub256ZXJvIG9uIGZhaWx1cmUuDQorICovDQoraW50IHRteV9hZGRfc2lnbmFsX3BvbGlj eShjaGFyICpkYXRhLA0KKwkJCSAgc3RydWN0IGRvbWFpbl9pbmZvICpkb21haW4sDQorCQkJICBj b25zdCBzdHJ1Y3QgY29uZGl0aW9uX2xpc3QgKmNvbmQsDQorCQkJICBjb25zdCBib29sIGlzX2Rl bGV0ZSkNCit7DQorCWludCBzaWc7DQorCWNoYXIgKmRvbWFpbm5hbWUgPSBzdHJjaHIoZGF0YSwg JyAnKTsNCisNCisJaWYgKHNzY2FuZihkYXRhLCAiJWQiLCAmc2lnKSA9PSAxICYmIGRvbWFpbm5h bWUgJiYNCisJICAgIHRteV9pc19kb21haW5fZGVmKGRvbWFpbm5hbWUgKyAxKSkNCisJCXJldHVy biB0bXlfYWRkX3NpZ25hbF9lbnRyeShzaWcsIGRvbWFpbm5hbWUgKyAxLCBkb21haW4sDQorCQkJ CQkgICAgY29uZCwgaXNfZGVsZXRlKTsNCisNCisJcmV0dXJuIC1FSU5WQUw7DQorfQ0KDQotLSAN Cg== --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/