Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 27 Nov 2001 18:50:13 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 27 Nov 2001 18:50:05 -0500 Received: from pixpat.austin.ibm.com ([192.35.232.241]:57820 "EHLO lazy.austin.ibm.com") by vger.kernel.org with ESMTP id ; Tue, 27 Nov 2001 18:49:59 -0500 Date: Tue, 27 Nov 2001 17:36:40 -0600 (CST) From: Manoj Iyer X-X-Sender: To: ltp , kernelmailinglist Subject: shmat issue. Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1335955103-1006904200=:29924" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --8323328-1335955103-1006904200=:29924 Content-Type: TEXT/PLAIN; charset=US-ASCII Is it possible to do a shared memory attach where the attaching address is an address where a file was mmapped as MAP_SHARED?? I am attaching a testcase that will do this. I was under the impression that shmat will attach only unmapped memory. compile the test as cc -oshm_test shm_test.c Thanks Manoj ******************************************************************************* The greatest risk is not taking one. ******************************************************************************* --8323328-1335955103-1006904200=:29924 Content-Type: TEXT/x-csrc; name="shm_test.c" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: shmat test Content-Disposition: attachment; filename="shm_test.c" I2luY2x1ZGUgPHB0aHJlYWQuaD4JLyogcmVxdWlyZWQgYnkgcHRocmVhZCBm dW5jdGlvbnMJCSAgICAgICovDQojaW5jbHVkZSA8c3RkaW8uaD4JLyogcmVx dWlyZWQgYnkgZnByaW50ZigpCQkJICAgICAgKi8NCiNpbmNsdWRlIDxzdGRs aWIuaD4JLyogcmVxdWlyZWQgYnkgZXhpdCgpLCBhdG9pKCkJCQkgICAgICAq Lw0KI2luY2x1ZGUgPHN0cmluZy5oPiAgICAgLyogcmVxdWlyZWQgYnkgc3Ry bmNweSgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8NCiNpbmNs dWRlIDx1bmlzdGQuaD4JLyogcmVxdWlyZWQgYnkgZ2V0b3B0KCksIG1tYXAo KQkJCSAgICAgICovDQojaW5jbHVkZSA8c3lzL3R5cGVzLmg+ICAvKiByZXF1 aXJlZCBieSBvcGVuKCksIHNobWF0KCksIHNobWR0KCkJCSAgICAgICovDQoj aW5jbHVkZSA8c3lzL3N0YXQuaD4gICAvKiByZXF1aXJlZCBieSBvcGVuKCkJ CQkJICAgICAgKi8NCiNpbmNsdWRlIDxzeXMvaXBjLmg+ICAgIC8qIHJlcXVp cmVkIGJ5IHNobWF0KCkgc2htZHQoKSwgc2htY3RsKCkgICAgICAgICAgICAg ICovDQojaW5jbHVkZSA8c3lzL3NobS5oPiAgICAvKiByZXF1aXJlZCBieSBz aG1hdCgpIHNobWR0KCksIHNobWN0bCgpICAgICAgICAgICAgICAqLw0KI2lu Y2x1ZGUgPHN5cy9tbWFuLmg+ICAgLyogcmVxdWlyZWQgYnkgbW1hcCgpICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8NCiNpbmNsdWRlIDxm Y250bC5oPgkvKiByZXF1aXJlZCBieSBvcGVuKCkJCQkJICAgICAgKi8NCg0K I2RlZmluZSBkcHJ0CXByaW50Zg0KDQojZGVmaW5lIFJFUEVBVCAxMDANCg0K DQovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLw0KLyoJCQkJ CQkJCSAJICAgICAgKi8NCi8qIEZ1bmN0aW9uOgl1c2FnZQkJCQkJCQkgICAg ICAqLw0KLyoJCQkJCQkJCQkgICAgICAqLw0KLyogRGVzY3JpcHRpb246CVBy aW50IHRoZSB1c2FnZSBtZXNzYWdlLgkJCQkgICAgICAqLw0KLyoJCQkJCQkJ CQkgICAgICAqLw0KLyogUmV0dXJuOglleGl0cyB3aXRoIC0xCQkJCQkJICAg ICAgKi8NCi8qCQkJCQkJCQkJICAgICAgKi8NCi8qKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKiovDQpzdGF0aWMgdm9pZA0KdXNhZ2UoY2hhciAq cHJvZ25hbWUpICAgICAgICAgICAvKiBuYW1lIG9mIHRoaXMgcHJvZ3JhbSAg ICAgICAgICAgICAgICAgICAgICAgKi97DQogICAgZnByaW50ZihzdGRlcnIs IA0KICAgICAgICAgICAgICAgIlVzYWdlOiAlcyAtZCBOVU1ESVIgLWYgTlVN RklMRVMgLWggLXQgTlVNVEhSRFxuIg0KICAgICAgICAgICAgICAgIlx0IC1o IEhlbHAhXG4iDQogICAgICAgICAgICAgICAiXHQgLWwgTnVtYmVyIG9mIHJl cGF0ZXRpb25zIHRvIGV4ZWN1dGU6ICAgICAgIERlZmF1bHQ6IDEwMDBcbiIN CiAgICAgICAgICAgICAgICJcdCAtdCBOdW1iZXIgb2YgdGhyZWFkcyB0byBn ZW5lcmF0ZTogICAgICAgICAgRGVmYXVsdDogMzBcbiIsDQogICAgICAgICAg ICAgICAgICAgIHByb2duYW1lKTsNCiAgICBleGl0KC0xKTsNCn0NCi8qKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKiovDQovKgkJCQkJCQkJIAkg ICAgICAqLw0KLyogRnVuY3Rpb246CW1hcGZpbGUJCQkJCQkJICAgICAgKi8N Ci8qCQkJCQkJCQkJICAgICAgKi8NCi8qIERlc2NyaXB0aW9uOglUaGlzIGZp bGUgY3JlYXRlcyBhIGZpbGUgb2Ygc2l6ZSBlcXVhbCB0byBtdWx0aXBsZSBv ZiBwYWdlc2l6ZSovDQovKgkgICAgICAgIGFuZCBtYXBzIHRoZSBmaWxlIGlu dG8gbWVtb3J5LgkJCQkgICAgICAqLw0KLyoJCQkJCQkJCQkgICAgICAqLw0K LyogSW5wdXQ6CW1hcF9hZGRyZXNzIC0gcG9pbnRlciB0byB0aGUgYWRkcmVz cwkJCSAgICAgICovDQovKgkJbWFwX3NpemUgICAgLSBwb2ludGVyIHRvIHNp emUgb2YgdGhlIGZpbGUgbWFwcGVkLiAgICAgICAgICAgICAqLw0KLyoJCQkJ CQkJCQkgICAgICAqLw0KLyogT3V0cHV0OgltYXBfYWRkcmVzcyAtIGNvbnRh aW5zIHRoZSBhZGRyZXNzIGluIG1lbW9yeSBvZiBmaWxlIG1hcHBlZC4gICov DQovKgkJbWFwX3NpemUgICAgLSBjb250YWlucyB0aGUgc2l6ZSBvZiB0aGUg ZmlsZSB0aGF0IGlzIG1hcHBlZC4gICAqLw0KLyoJCQkJCQkJCQkgICAgICAq Lw0KLyogUmV0dXJuOglleGl0cyB3aXRoIC0xIG9uIGVycm9yLCAwIG9uIHN1 Y2Nlc3MgICAgICAgICAgICAgICAgICAgICAgICAgICovDQovKgkJCQkJCQkJ CSAgICAgICovDQovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq Lw0Kc3RhdGljIGludA0KbWFwZmlsZShsb25nICoqYWRkcmVzcywJCS8qIG91 dHB1dCBwYXJhbWV0ZXIgLSAgYWRkciBvZiB0aGUgbWFwcGVkIGZpbGUqLw0K ICAgICAgICBpbnQgIHNpemUpCQkvKiBzaXplIG9mIHRoaXMgbWFwcGVkIGZp bGUgICAgICAgICAgICAgICAgICAgKi8NCnsNCiAgICBpbnQgICAgIGZkID0g MDsJCS8qIGZpbGUgZGVzY3JpcHRvciBvZiB0bXAgZmlsZSAgICAgICAgICAg ICAgICAqLw0KICAgIGludCAgICAgd3JpdGVfaW5kZXggPSAwOyAgICAvKiBp bmRleCB0byBudW1iZXIgb2YgNDA5NiBibG9ja3Mgd3JpdHRlbiAgICAgKi8N CiAgICBjaGFyICAgICpmaWxlbmFtZTsJCS8qIG5hbWUgb2YgdGhlIHRlbXBv cmFyeSBmaWxlICAgICAgICAgICAgICAgICAqLw0KICAgIGNoYXIgICAgYnVm Zls0MDk2XTsJCS8qIGJ1ZmZlciB0aGF0IHdpbGwgZSB3cml0dGVuIHRvIHRo ZSBmaWxlICAgICAqLw0KDQogICAgbWVtc2V0KGJ1ZmYsICdhJywgNDA5Nik7 DQogICAgZmlsZW5hbWUgPSAoY2hhciAqKXRlbXBuYW0oIi4iLCAidG1wZmls ZSIpOw0KICAgIGlmICgoZmQgPSBvcGVuKGZpbGVuYW1lLCBPX0NSRUFUIHwg T19FWENMIHwgT19SRFdSLCAwNzc3KSkgPT0gLTEpDQogICAgeyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICANCiAgICAgICAgcGVycm9yKCJtYXBm aWxlKCk6IG9wZW4oKSIpOw0KICAgICAgICByZXR1cm4gLTE7ICAgICAgICAg ICAgICAgIA0KICAgIH0gICAgICAgICAgICANCiAgICBlbHNlDQogICAgeyAg IA0KICAgICAgICAvKiBpZiB0aGUgcHJvZ3JhbSBkaWVzIHByZW1hdHVyZWx5 LCBjbGVhbiB1cCB0ZW1wZmlsZXMgdXBmcm9udC4gKi8NCiAgICAgICAgaWYg KHVubGluayhmaWxlbmFtZSkgPT0gLTEpDQogICAgICAgIHsNCiAgICAgICAg ICAgIHBlcnJvcigibWFwZmlsZSgpOiB1bmxpbmsoKSIpOw0KICAgICAgICAg ICAgcmV0dXJuIC0xOw0KICAgICAgICB9DQogICAgfQ0KDQogICAgZHBydCgi cGlkeyVkXTogbWFwZmlsZSgpOiBzaXplID0gJWRcbiIsIGdldHBpZCgpLCBz aXplKTsNCiAgICB3aGlsZSAod3JpdGVfaW5kZXggPCBzaXplKQ0KICAgIHsN CiAgICAgICAgd3JpdGVfaW5kZXggKz0gNDA5NjsNCiAgICAgICAgaWYgKHdy aXRlKGZkLCBidWZmLCA0MDk2KSA9PSAtMSkNCiAgICAgICAgew0KICAgICAg ICAgICAgcGVycm9yKCJtYXBmaWxlKCk6IHdyaXRlKCkiKTsNCiAgICAgICAg ICAgIHJldHVybiAtMTsNCiAgICAgICAgfQ0KICAgIH0NCg0KICAgIGlmIChm c3luYyhmZCkgPT0gLTEpDQogICAgew0KICAgICAgICBwZXJyb3IoIm1rZmls ZSgpOiBmc3luYygpIik7DQogICAgICAgIHJldHVybiAtMTsNCiAgICB9DQoN CiAgICBpZiAoKCphZGRyZXNzID0gKGNoYXIgKiltbWFwKDAsIHNpemUsIFBS T1RfUkVBRCB8IFBST1RfV1JJVEUsDQogICAgICAgICAgICAgICAgICAgICAg ICAgICBNQVBfU0hBUkVELCBmZCwgMCkpID09IChjaGFyICopLTEpDQogICAg ew0KICAgICAgICBwZXJyb3IoIm1hcGZpbGUoKTogbW1hcCgpIik7DQogICAg ICAgIHJldHVybiAtMTsNCiAgICB9DQogICAgZHBydCgicGlkeyVkXTogbWFw ZmlsZSgpOiBhZGRyZXNzID0gJSN4IHNpemUgPSAlZFxuIiwgZ2V0cGlkKCks IA0KCSAgICAgICAqYWRkcmVzcywgc2l6ZSk7DQogICAgcmV0dXJuIDA7DQp9 DQoNCg0KLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCi8q CQkJCQkJCQkgCSAgICAgICovDQovKiBGdW5jdGlvbjoJcm1fc2hhcmVkX21l bQkJCQkJCSAgICAgICovDQovKgkJCQkJCQkJCSAgICAgICovDQovKiBEZXNj cmlwdGlvbjoJVGhpcyBmdW5jdGlvbiByZW1vdmVzIHRoZSBzaGFyZWQgc2Vn bWVudHMgdGhhdCB3ZXJlIGNyZWF0ZWQgICAqLw0KLyoJCVRoaXMgZnVuY3Rp b24gaXMgY2FsbGVkIHdoZW4gc2htYXQgZmFpbHMgb3IgbG9naWNhbCBlbmQg b2YgICAgKi8NCi8qCQl0aGUgd2hpbGUgbG9vcCBpcyByZWFjaGVkIGluIGRv X3NobWF0X3NobWR0IGZ1bmN0aW9uLiAgICAgICAgICovDQovKgkJCQkJCQkJ CSAgICAgICovDQovKiBJbnB1dDoJc2htX2lkICAgLSBpZCBvZiB0aGUgc2hh cmVkIG1lbW9yeSBzZWdtZW50IHRvIGJlIHJlbW92ZWQgICAgICAqLw0KLyoJ CXNobV9hZGRyIC0gYWRkcmVzcyBvZiB0aGUgc2hhcmVkIG1lbW9yeSBzZWdt ZW50IHRvIGJlIHJlbW92ZWQgKi8NCi8qCQljbWQgICAgICAtIHJlbW92ZSBp ZCBvbmx5IG9yIHJlbW92ZSBpZCBhbmQgZGV0YWNoPz8gICAgICAgICAgICov DQovKgkJCSAgIDAgLSByZW1vdmUgaWQgZG9udCBkZXRhY2ggc2VnbWVudC4g ICAgICAgICAgICAgICAgICovDQovKgkJCSAgIDEgLSByZW1vdmUgaWQgYW5k IGRldGFjaCBzZWdtZW50LiAgICAgICAgICAgICAgICAgICovDQovKgkJCQkJ CQkJCSAgICAgICovDQovKiBPdXRwdXQ6CU5PTkUuICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8N Ci8qCQkJCQkJCQkJICAgICAgKi8NCi8qIFJldHVybjoJZXhpdHMgd2l0aCAt MSBvbiBlcnJvciwgMCBvbiBzdWNjZXNzICAgICAgICAgICAgICAgICAgICAg ICAgICAqLw0KLyoJCQkJCQkJCQkgICAgICAqLw0KLyoqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKi8NCnN0YXRpYyBpbnQNCnJtX3NoYXJlZF9t ZW0oa2V5X3QgIHNobV9pZCwJLyogaWQgb2Ygc2hhcmVkIG1lbW9yeSBzZWdt ZW50IHRvIGJlIHJlbW92ZWQgICovDQoJICAgICAgY2hhciAqc2htX2FkZHIs ICAgLyogYWRkcmVzcyBvZiBzaGFyZWQgbWVtIHNlZyB0byBiZSByZW1vdmVk ICAgICovDQoJICAgICAgaW50ICBjbWQpICAgICAgICAgLyogcmVtb3ZlIGlk IG9ubHkgb3IgcmVtb3ZlIGlkIGFuZCBkZXRhY2ggc2VnICovDQp7DQogICAg c3RydWN0IHNobWlkICpzaG1idWY7CS8qIGluZm8gYWJvdXQgdGhlIHNlZ21l bnQgcG9pbnRlZCBieSBzaG1rZXkgICAqLw0KDQogICAgZHBydCgicGlkWyVk XTogcm1fc2hhcmVkX21lbSgpOiBzaG1faWQgPSAlZCBzaG1fYWRkciA9ICUj eCBjbWQgPSAlZFxuIiwNCiAgICAgICAgZ2V0cGlkKCksIHNobV9pZCwgc2ht X2FkZHIsIGNtZCk7DQogICAgaWYgKHNobWN0bChzaG1faWQsIElQQ19STUlE LCBzaG1idWYpID09IC0xKQ0KICAgIHsNCglkcHJ0KCJwaWRbJWRdOiBybV9z aGFyZWRfbWVtKCk6IHNobWN0bCB1bmFibGUgdG8gcmVtb3ZlIHNobV9pZFsl ZF1cbiIsDQoJICAgIGdldHBpZCgpLCBzaG1faWQpOw0KICAgICAgICBwZXJy b3IoInJtX3NoYXJlZF9tZW0oKTogc2htY3RsKCkiKTsNCiAgICAgICAgcmV0 dXJuIC0xOw0KICAgIH0NCg0KICAgIGlmIChjbWQpDQogICAgew0KICAgICAg ICBpZiAoc2htZHQoKHZvaWQgKilzaG1fYWRkcikgPT0gLTEpDQogICAgICAg IHsNCgkgICAgZHBydCgicGlkWyVkXTpybV9zaGFyZWRfbWVtKCk6IHNobWR0 IHVuYWJsZSB0byBkZXRhY2ggYWRkciA9ICUjeFxuIiwNCgkgICAgICAgIGdl dHBpZCgpLCBzaG1fYWRkcik7DQogICAgICAgICAgICBwZXJyb3IoInJtX3No YXJlZF9tZW0oKTogc2htZHQoKSIpOw0KICAgICAgICAgICAgcmV0dXJuIC0x Ow0KICAgICAgICB9DQogICAgfQ0KICAgIHJldHVybiAwOw0KfQ0KDQoNCi8q KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovDQovKgkJCQkJCQkJ IAkgICAgICAqLw0KLyogRnVuY3Rpb246CWRvX3NobWF0X3NobWF0ZAkJCQkJ CSAgICAgICovDQovKgkJCQkJCQkJCSAgICAgICovDQovKiBEZXNjcmlwdGlv bjoJVGhpcyBmdW5jdGlvbiBhdHRhY2hlcyBhbmQgZGV0YWNoZXMgdGhlIG1l bW9yeSAgICAgICAgICAgICAgICAqLw0KLyoJCXRoYXQgd2FzIG1tYXBlZC4g VGhlIHNpemUgb2YgdGhlIGZpbGUgaXMgYSBtdWx0aXBsZSBvZiBwYWdlICAg Ki8NCi8qCQlzaXplLiBUaGlzIGZ1bmN0aW9uIGV4ZWN1dGVzIGFzIGEgdGhy ZWFkIGZ1bmN0aW9uLiAgICAgICAgICAgICovDQovKgkJCQkJCQkJCSAgICAg ICovDQovKiBJbnB1dDoJVGhlIGFyZ3VtZW50IHBvaW50ZXIgY29udGFpbnMg dGhlIGZvbGxvd2luZy4gICAgICAgICAgICAgICAgICAqLw0KLyoJCWFyZ1sx XSAtIGFkZHJlc3Mgb2YgdGhlIG1lbW9yeSB0aGF0IGlzIHRvIGJlIGF0dGFj aGVkLiAgICAgICAgKi8NCi8qCQlhcmdbMl0gLSBzaXplIG9mIHRoZSBtZW1v cnkgdGhhdCBpcyB0byBiZSBhdHRhY2hlZC4gICAgICAgICAgICovDQovKgkJ CQkJCQkJCSAgICAgICovDQovKiBSZXR1cm46CWV4aXRzIHdpdGggLTEgb24g ZXJyb3IsIDAgb24gc3VjY2VzcyAgICAgICAgICAgICAgICAgICAgICAgICAg Ki8NCi8qCQkJCQkJCQkJICAgICAgKi8NCi8qKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKiovDQpzdGF0aWMgaW50DQpkb19zaG1hdF9zaG1kdChj aGFyICptYXBhZGRyLAkvKiBhZGRyZXNzIG9mIHRoZSBtZW0gYXR0YWNoZWQu ICAgICAgICAgICAgICAgKi8NCiAgICAgICAgICAgICAgIGludCAgIHNpemUp CS8qIHNpemUgb2YgdGhlIGZpbGUgbWFwcGVkLiAgICAgICAgICAgICAgICAg ICAqLw0Kew0KICAgIGludCAgICAgICAgICBzaG1uZHggICA9IDA7CS8qIGlu ZGV4IHRvIHRoZSBudW1iZXIgb2YgYXR0YWNoIGFuZCBkZXRhY2ggICAqLw0K ICAgIGludAkJIGluZGV4ICAgID0gMDsgIC8qIGluZGV4IHRvIHRoZSBudW1i ZXIgb2YgYmxvY2tzIHRvdWNoZWQgICAgICAqLw0KICAgIGtleV90ICAgICAg ICBzaG1rZXkgICA9IDA7CS8qIHNoYXJlZCBtZW1vcnkgaWQJCQkgICAgICAq Lw0KICAgIGNoYXIgICAgICAgICAqc2htYXRfYWRkcjsgICAvKiBhZGRyZXNz IG9mIHRoZSBhdHRhY2hlZCBtZW1vcnkgICAgICAgICAgICAgKi8NCg0KICAg IGRwcnQoInBpZFslZF06ZG9fc2htYXRfc2htZHQoKTogbWFwYWRkciA9ICUj eCwgc2l6ZSA9ICVkXG4iLCBnZXRwaWQoKSwgDQoJbWFwYWRkciwgc2l6ZSk7 DQoNCiAgICBpZiAoKHNobWtleSA9IHNobWdldChJUENfUFJJVkFURSwgKGlu dClzaXplLCBJUENfQ1JFQVQgfCAwNjY2ICkpIA0KICAgICAgICAgICAgICAg ID09IC0xKQ0KICAgIHsNCiAgICAgICAgZHBydCgicGlkWyVkXTogZG9fc2ht YXRfc2htZHQoKTogc2htZ2V0IGZhaWxlZFxuIiwgZ2V0cGlkKCkpOw0KICAg ICAgICBwZXJyb3IoImRvX3NobWF0X3NobWFkdCgpOiBzaG1nZXQoKSIpOw0K ICAgICAgICByZXR1cm4gLTEgOw0KICAgIH0gDQogICAgICAgIA0KICAgIGZw cmludGYoc3Rkb3V0LCAicGlkWyVkXTogZG9fc2htYXRfc2htZHQoKTogc2ht Z2V0KCk6Ig0KCSJzdWNjZXNzIGdvdCBzZWdtZW50IGlkICVkXG4iLA0KICAg ICAgICAgICAgZ2V0cGlkKCksIHNobWtleSk7DQogICAgZHBydCgicGlkWyVk XTogZG9fc2htYXRfc2htZHQoKTogZmlsZSBtYXBwZWQgYXQgPSAlI3hcbiIs IA0KCWdldHBpZCgpLCBtYXBhZGRyKTsNCiAgICBpZiAoKHNobWF0X2FkZHIg PSBzaG1hdChzaG1rZXksICh2b2lkICopbWFwYWRkciwgU0hNX1JORHxTSE1M QkEpKQ0KICAgICAgICAgICAgICAgICAgICA9PSAgKHZvaWQgKiktMSkNCiAg ICB7DQogICAgICAgIHJtX3NoYXJlZF9tZW0oc2hta2V5LCBzaG1hdF9hZGRy LCAwKTsNCiAgICAgICAgZnByaW50ZihzdGRlcnIsICJwaWRbJWRdOiBkb19z aG1hdF9zaG1hZHQoKTogc2htYXRfYWRkciA9ICUjeFxuIiwgDQoJCWdldHBp ZCgpLCBzaG1hdF9hZGRyKTsNCiAgICAgICAgcGVycm9yKCJkb19zaG1hdF9z aG1hZHQoKTogc2htYXQoKSIpOw0KICAgICAgICByZXR1cm4gLTEgOw0KICAg IH0NCiAgICBmcHJpbnRmKHN0ZG91dCwicGlkWyVkXTogZG9fc2htYXRfc2ht YWR0KCk6IHNobWF0IHN1Y2Nlc3MsIGFkZHJlc3MgPSAlI3hcbiIsDQogICAg ICAgICAgICBnZXRwaWQoKSwgc2htYXRfYWRkcik7DQoNCiAgICBpZiAocm1f c2hhcmVkX21lbShzaG1rZXksIHNobWF0X2FkZHIsIDEpID09IC0xKQ0KICAg IHsNCiAgICAgICAgZnByaW50ZihzdGRlcnIsDQogICAgICAgICAgICAicGlk WyVkXTogZG9fc2htYXRfc2htYXRkKCk6IHJtX3NoYXJlZF9tZW0oKTogZmFp bGQgdG8gcm0gaWRcbiIsDQogICAgICAgICAgICAgZ2V0cGlkKCkpOw0KCXJl dHVybiAtMSA7DQogICAgfQ0KDQogICAgcmV0dXJuIDAgOw0KfQ0KDQoNCi8q KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovDQovKgkJCQkJCQkJ IAkgICAgICAqLw0KLyogRnVuY3Rpb246CW1haW4JCQkJCQkJICAgICAgKi8N Ci8qCQkJCQkJCQkJICAgICAgKi8NCi8qIERlc2NyaXB0aW9uOglUaGlzIGlz IHRoZSBlbnRyeSBwb2ludCB0byB0aGUgcHJvZ3JhbS4gVGhpcyBmdW5jdGlv biB3aWxsICAgICovDQovKgkJcGFyc2UgdGhlIGlucHV0IGFyZ3VtZW50cyBh bmQgc2V0IHRoZSB2YWx1ZXMgYWNjb3JkaW5nbHkuIElmICAqLw0KLyoJCW5v IGFyZ3VtZW50cyAob3IgZGVzaXJlZCkgYXJlIHByb3ZpZGVkIGRlZmF1bHQg dmFsdWVzIGFyZSB1c2VkKi8NCi8qCQlyZWZlciB0aGUgdXNhZ2UgZnVuY3Rp b24gZm9yIHRoZSBhcmd1bWVudHMgdGhhdCB0aGlzIHByb2dyYW0gICovDQov KgkJdGFrZXMuIEl0IGFsc28gY3JlYXRlcyB0aGUgdGhyZWFkcyB3aGljaCBk byBtb3N0IG9mIHRoZSBkaXJ0eSAqLw0KLyoJCXdvcmsuIElmIHRoZSB0aHJl YWRzIGV4aXRzIHdpdGggYSB2YWx1ZSAnMCcgdGhlIHByb2dyYW0gZXhpdHMg Ki8NCi8qCQl3aXRoIHN1Y2Nlc3MgJzAnIGVsc2UgaXQgZXhpdHMgd2l0aCBm YWlsdXJlICctMScuICAgICAgICAgICAgICovDQovKgkJCQkJCQkJCSAgICAg ICovDQovKiBSZXR1cm46CS0xIG9uIGZhaWx1cmUJCQkJCQkgICAgICAqLw0K LyoJCSAwIG9uIHN1Y2Nlc3MJCQkJCQkgICAgICAqLw0KLyoJCQkJCQkJCQkg ICAgICAqLw0KLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8N Cm1haW4oaW50CWFyZ2MsCQkvKiBudW1iZXIgb2YgaW5wdXQgcGFyYW1ldGVy cwkJICAgICAgKi8NCiAgICAgY2hhcgkqKmFyZ3YpCQkvKiBwb2ludGVyIHRv IHRoZSBjb21tYW5kIGxpbmUgYXJndW1lbnRzLiAgICAgKi8NCnsNCiAgICBp bnQJCWluZGV4OwkJLyogbnVtYmVyIG9mIHRpbWVzIHRvIHJlcGVhdCB0aGUg bW1hcCAmIHNobWF0ICovDQogICAgaW50CQltYXBfc2l6ZTsJLyogc2l6ZSBv ZiB0aGUgZmlsZSBtYXBwZWQuICAgICAgICAgICAgICAgICAgICovDQogICAg Y2hhciAgICAgICAgKm1hcF9hZGRyZXNzOyAgIC8qIGFkZHJlc3MgaW4gbWVt b3J5IG9mIHRoZSBtYXBwZWQgZmlsZSAgICAgICAqLw0KDQoNCiAgICBmb3Ig KGluZGV4ID0gMDsgaW5kZXggPCBSRVBFQVQ7IGluZGV4KyspDQogICAgew0K ICAgICAgICBzcmFuZCh0aW1lKE5VTEwpJTEwMCk7DQogICAgICAgIG1hcF9z aXplID0gKDEgKyAoaW50KSgxMDAwLjAqcmFuZCgpLyhSQU5EX01BWCsxLjAp KSkgKiA0MDk2Ow0KDQogICAgICAgIGlmIChtYXBmaWxlKCZtYXBfYWRkcmVz cywgbWFwX3NpemUpICE9IDApDQogICAgICAgIHsNCiAgICAgICAgICAgIGZw cmludGYoc3Rkb3V0LCAibWFpbigpOiBtYXBmaWxlKCk6IGZhaWxlZCB0byBt YXAgY3JlYXRlZCBmaWxlXG4iKTsNCiAgICAgICAgICAgIGV4aXQgKC0xKTsN CiAgICAgICAgfQ0KICAgICAgICAgDQoJZHBydCgibWFpbigpOiBtYXBfYWRk cmVzcyA9ICUjeCBtYXBfc2l6ZSA9ICVkXG4iLG1hcF9hZGRyZXNzLCBtYXBf c2l6ZSk7DQoNCiAgICAgICAgaWYgKGRvX3NobWF0X3NobWR0KG1hcF9hZGRy ZXNzLCBtYXBfc2l6ZSkgPT0gLTEpDQogICAgICAgIHsNCiAgICAgICAgICAg IGZwcmludGYoc3RkZXJyLCAibWFpbigpOiBkb19zaG1hdF9zaG1kdCgpOiBm YWlsZWQuXG4iKTsNCiAgICAgICAgICAgIGV4aXQoLTEpOw0KICAgICAgICB9 DQoNCiAgICB9DQogICAgZXhpdCgwKTsNCn0NCg== --8323328-1335955103-1006904200=:29924-- - 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/