[complement-svn] SF.net SVN: complement: [1940] trunk/complement/explore/lib/mt
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2008-07-02 09:28:17
|
Revision: 1940 http://complement.svn.sourceforge.net/complement/?rev=1940&view=rev Author: complement Date: 2008-07-02 02:28:14 -0700 (Wed, 02 Jul 2008) Log Message: ----------- Merge branch 'master' of /export/hostel/pub/scm/complement Conflicts: complement/explore/lib/mt/ChangeLog complement/explore/lib/mt/uid.cc complement/explore/lib/mt/ut/mt_test_suite.cc complement/explore/lib/mt/ut/mt_test_wg21.cc complement/explore/lib/mt/ut/mt_test_wg21.h complement/explore/lib/mt/ut/shm_test.cc Modified Paths: -------------- trunk/complement/explore/lib/mt/ChangeLog trunk/complement/explore/lib/mt/uid.cc trunk/complement/explore/lib/mt/ut/mt_test_suite.cc trunk/complement/explore/lib/mt/ut/mt_test_wg21.cc trunk/complement/explore/lib/mt/ut/mt_test_wg21.h trunk/complement/explore/lib/mt/ut/shm_test.cc Modified: trunk/complement/explore/lib/mt/ChangeLog =================================================================== --- trunk/complement/explore/lib/mt/ChangeLog 2008-07-02 05:36:38 UTC (rev 1939) +++ trunk/complement/explore/lib/mt/ChangeLog 2008-07-02 09:28:14 UTC (rev 1940) @@ -1,5 +1,7 @@ 2008-07-02 Petr Ovtchenkov <pt...@is...> + * uid.cc: fix wrong type cast; + * uid.cc: fix generation of uids; * mt_test_suite.cc, mt_test_wg21.cc, mt_test_wg21.h: test Modified: trunk/complement/explore/lib/mt/uid.cc =================================================================== --- trunk/complement/explore/lib/mt/uid.cc 2008-07-02 05:36:38 UTC (rev 1939) +++ trunk/complement/explore/lib/mt/uid.cc 2008-07-02 09:28:14 UTC (rev 1940) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/07/02 08:56:16 ptr> +// -*- C++ -*- Time-stamp: <08/07/02 13:15:01 yeti> /* * Copyright (c) 2006, 2008 @@ -71,22 +71,10 @@ << _host_id_str[34] << _host_id_str[35]; s >> hex - >> reinterpret_cast<unsigned&>(_host_id.u.b[0]) - >> reinterpret_cast<unsigned&>(_host_id.u.b[1]) - >> reinterpret_cast<unsigned&>(_host_id.u.b[2]) - >> reinterpret_cast<unsigned&>(_host_id.u.b[3]) - >> reinterpret_cast<unsigned&>(_host_id.u.b[4]) - >> reinterpret_cast<unsigned&>(_host_id.u.b[5]) - >> reinterpret_cast<unsigned&>(_host_id.u.b[6]) - >> reinterpret_cast<unsigned&>(_host_id.u.b[7]) - >> reinterpret_cast<unsigned&>(_host_id.u.b[8]) - >> reinterpret_cast<unsigned&>(_host_id.u.b[9]) - >> reinterpret_cast<unsigned&>(_host_id.u.b[10]) - >> reinterpret_cast<unsigned&>(_host_id.u.b[11]) - >> reinterpret_cast<unsigned&>(_host_id.u.b[12]) - >> reinterpret_cast<unsigned&>(_host_id.u.b[13]) - >> reinterpret_cast<unsigned&>(_host_id.u.b[14]) - >> reinterpret_cast<unsigned&>(_host_id.u.b[15]); + >> _host_id.u.b[0] >> _host_id.u.b[1] >> _host_id.u.b[2] >> _host_id.u.b[3] + >> _host_id.u.b[4] >> _host_id.u.b[5] >> _host_id.u.b[6] >> _host_id.u.b[7] + >> _host_id.u.b[8] >> _host_id.u.b[9] >> _host_id.u.b[10] >> _host_id.u.b[11] + >> _host_id.u.b[12] >> _host_id.u.b[13] >> _host_id.u.b[14] >> _host_id.u.b[15]; } __uuid_init::__uuid_init() @@ -99,6 +87,16 @@ ::close( fd ); } +__uuid_init::__uuid_init() +{ + fd = ::open( "/proc/sys/kernel/random/uuid", O_RDONLY ); +} + +__uuid_init::~__uuid_init() +{ + ::close( fd ); +} + } // namespace detail using namespace std; @@ -151,22 +149,10 @@ << tmp[34] << tmp[35]; s >> hex - >> reinterpret_cast<unsigned&>(id.u.b[0]) - >> reinterpret_cast<unsigned&>(id.u.b[1]) - >> reinterpret_cast<unsigned&>(id.u.b[2]) - >> reinterpret_cast<unsigned&>(id.u.b[3]) - >> reinterpret_cast<unsigned&>(id.u.b[4]) - >> reinterpret_cast<unsigned&>(id.u.b[5]) - >> reinterpret_cast<unsigned&>(id.u.b[6]) - >> reinterpret_cast<unsigned&>(id.u.b[7]) - >> reinterpret_cast<unsigned&>(id.u.b[8]) - >> reinterpret_cast<unsigned&>(id.u.b[9]) - >> reinterpret_cast<unsigned&>(id.u.b[10]) - >> reinterpret_cast<unsigned&>(id.u.b[11]) - >> reinterpret_cast<unsigned&>(id.u.b[12]) - >> reinterpret_cast<unsigned&>(id.u.b[13]) - >> reinterpret_cast<unsigned&>(id.u.b[14]) - >> reinterpret_cast<unsigned&>(id.u.b[15]); + >> id.u.b[0] >> id.u.b[1] >> id.u.b[2] >> id.u.b[3] + >> id.u.b[4] >> id.u.b[5] >> id.u.b[6] >> id.u.b[7] + >> id.u.b[8] >> id.u.b[9] >> id.u.b[10] >> id.u.b[11] + >> id.u.b[12] >> id.u.b[13] >> id.u.b[14] >> id.u.b[15]; return id; } Modified: trunk/complement/explore/lib/mt/ut/mt_test_suite.cc =================================================================== --- trunk/complement/explore/lib/mt/ut/mt_test_suite.cc 2008-07-02 05:36:38 UTC (rev 1939) +++ trunk/complement/explore/lib/mt/ut/mt_test_suite.cc 2008-07-02 09:28:14 UTC (rev 1940) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/07/02 09:24:48 ptr> +// -*- C++ -*- Time-stamp: <08/07/02 13:01:53 yeti> /* * Copyright (c) 2006-2008 @@ -81,8 +81,10 @@ uid_test_wg21 test_wg21_uid; - t.add( &uid_test_wg21::uid, test_wg21_uid, "uid_test_wg21::uid" ); - t.add( &uid_test_wg21::hostid, test_wg21_uid, "uid_test_wg21::hostid" ); + t.add( &uid_test_wg21::uid, test_wg21_uid, "uid_test_wg21::uid", + t.add( &uid_test_wg21::uidstr, test_wg21_uid, "uid_test_wg21::uidstr" ) ); + t.add( &uid_test_wg21::hostid, test_wg21_uid, "uid_test_wg21::hostid", + t.add( &uid_test_wg21::hostidstr, test_wg21_uid, "uid_test_wg21::hostidstr" ) ); Opts opts; Modified: trunk/complement/explore/lib/mt/ut/mt_test_wg21.cc =================================================================== --- trunk/complement/explore/lib/mt/ut/mt_test_wg21.cc 2008-07-02 05:36:38 UTC (rev 1939) +++ trunk/complement/explore/lib/mt/ut/mt_test_wg21.cc 2008-07-02 09:28:14 UTC (rev 1940) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/07/02 09:21:04 ptr> +// -*- C++ -*- Time-stamp: <08/07/02 13:00:38 yeti> /* * Copyright (c) 2006-2008 @@ -318,7 +318,7 @@ return EXAM_RESULT; } -int EXAM_IMPL(uid_test_wg21::uid) +int EXAM_IMPL(uid_test_wg21::uidstr) { std::string u1 = xmt::uid_str(); @@ -337,7 +337,7 @@ return EXAM_RESULT; } -int EXAM_IMPL(uid_test_wg21::hostid) +int EXAM_IMPL(uid_test_wg21::hostidstr) { std::string u1 = xmt::hostid_str(); @@ -354,3 +354,22 @@ return EXAM_RESULT; } +int EXAM_IMPL(uid_test_wg21::hostid) +{ + xmt::uuid_type u1 = xmt::hostid(); + xmt::uuid_type u2 = xmt::hostid(); + + EXAM_CHECK( u1 == u2 ); + + return EXAM_RESULT; +} + +int EXAM_IMPL(uid_test_wg21::uid) +{ + xmt::uuid_type u1 = xmt::uid(); + xmt::uuid_type u2 = xmt::uid(); + + EXAM_CHECK( u1 != u2 ); + + return EXAM_RESULT; +} Modified: trunk/complement/explore/lib/mt/ut/mt_test_wg21.h =================================================================== --- trunk/complement/explore/lib/mt/ut/mt_test_wg21.h 2008-07-02 05:36:38 UTC (rev 1939) +++ trunk/complement/explore/lib/mt/ut/mt_test_wg21.h 2008-07-02 09:28:14 UTC (rev 1940) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/07/02 09:27:26 ptr> +// -*- C++ -*- Time-stamp: <08/07/02 12:59:27 yeti> /* * Copyright (c) 2006-2008 @@ -33,7 +33,9 @@ class uid_test_wg21 { public: + int EXAM_DECL(uidstr); int EXAM_DECL(uid); + int EXAM_DECL(hostidstr); int EXAM_DECL(hostid); }; Modified: trunk/complement/explore/lib/mt/ut/shm_test.cc =================================================================== --- trunk/complement/explore/lib/mt/ut/shm_test.cc 2008-07-02 05:36:38 UTC (rev 1939) +++ trunk/complement/explore/lib/mt/ut/shm_test.cc 2008-07-02 09:28:14 UTC (rev 1940) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/07/02 08:58:02 ptr> +// -*- C++ -*- Time-stamp: <08/07/02 13:05:03 yeti> /* * Copyright (c) 2006-2008 @@ -336,7 +336,13 @@ seg1.allocate( fname1, 4*4096, xmt::shm_base::create | xmt::shm_base::exclusive, 0660 ); } catch ( xmt::shm_bad_alloc& err ) { - EXAM_ERROR_ASYNC( err.what() ); + try { + seg1.allocate( fname1, 4*4096, 0, 0660 ); + } + catch ( xmt::shm_bad_alloc& err2 ) { + EXAM_ERROR_ASYNC( err2.what() ); + unlink( fname1 ); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |