~ubuntu-branches/ubuntu/lucid/boinc/lucid

« back to all changes in this revision

Viewing changes to lib/shmem.C

  • Committer: Bazaar Package Importer
  • Author(s): Frank S. Thomas, Frank S. Thomas
  • Date: 2007-10-25 20:54:09 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20071025205409-ib4417foffej3s4s
Tags: 5.10.27-1
[ Frank S. Thomas ]
* New upstream release. (closes: #447929)
  - Handles change in /proc/cpuinfo on powerpc introduced in Linux 2.6.23.
    Thanks to Thibaut VARENE <varenet@debian.org> for the patch.
    (closes: #437459)
  - Allows to set arbitrary many alternate platforms in the client's config
    file cc_config.xml with the <alt_platform> element which is a direct
    child of the <options> element. (closes: #437326)
  - BOINC Manager: At account creation check if wxGetUserName() returned an
    empty string and if it did use the output of wxGetUserId() instead.
    Thanks to Morita Sho <morita-pub-en-debian@inz.sakura.ne.jp> for the
    excellent bug report. (closes: #447320)
* debian/control:
  - Moved Homepage pseudo field in the long descriptions to the source stanza
    because this is now a propper debian/control field supported by dpkg.
  - Removed XS- prefix from Vcs fields since they are now officially
    supported by dpkg.
* debian/boinc-client.init: Print the scheduling status of boinc_client's
  children only if there are any present, otherwise schedtool would be
  called without arguments and would print its usage text.
* debian/icons/: Use icons with transparent background.
* debian/boinc-manager.desktop:
  - Addded Portuguese translations for GenericName and Comment, thanks to
    Marco Rodrigues <gothicx@sapo.pt>.
  - Monitor is a subcategory of the System main category, so use System
    instead of Utility.
  - Removed the Encoding key since it is deprecated in the Desktop Entry
    Specification 1.0 and added the Version key.

Show diffs side-by-side

added added

removed removed

Lines of Context:
200
200
    return attach_shmem(key, pp);
201
201
}
202
202
 
 
203
// Mark the shared memory segment so it will be released after 
 
204
// the last attached process detaches or exits.
 
205
// On Mac OS X and some other systems, not doing this causes 
 
206
// shared memory leaks if BOINC crashes or exits suddenly.
 
207
// On Mac OS X and some other systems, this command also 
 
208
// prevents any more processes from attaching (by clearing 
 
209
// the key in the shared memory structure), so BOINC does it 
 
210
// only after we are completey done with the segment.
203
211
int destroy_shmem(key_t key){
204
212
    struct shmid_ds buf;
205
213
    int id, retval;
260
268
    return 0;
261
269
}
262
270
 
 
271
// For debugging shared memory logic
 
272
// For testing on Apple, Linux, UNIX systems with limited number 
 
273
// of shared memory segments per process and / or system-wide
 
274
// Mac OS X has a default limit of 8 segments per process, 32 system-wide
 
275
// If 
 
276
void stress_shmem(short reduce_by) {
 
277
    int retval;
 
278
    void * shmaddr[16];
 
279
    key_t key[] = {
 
280
        'BNC0', 'BNC1', 'BNC2', 'BNC3', 'BNC4', 'BNC5', 'BNC6', 'BNC7',
 
281
        'BNC8', 'BNC9', 'BNCA', 'BNCB', 'BNCC', 'BNCD', 'BNCE', 'BNCF' 
 
282
    };
 
283
    int i, id;
 
284
    
 
285
    if (reduce_by > 16) reduce_by = 16;
 
286
    
 
287
    // Tie up 5 of the 8 shared memory segments each process may have
 
288
    for (i=0; i<reduce_by; i++) {
 
289
        retval = create_shmem(key[i], 1024, 0, &shmaddr[i]);
 
290
        id = shmget(key[i], 0, 0);
 
291
        // Mark it for automatic destruction when BOINC exits
 
292
        if (id >= 0) {
 
293
            retval = shmctl(id, IPC_RMID, 0);
 
294
        }
 
295
    }
 
296
}
 
297
 
263
298
#endif
264
299
 
265
 
const char *BOINC_RCSID_f835f078de = "$Id: shmem.C 12138 2007-02-22 09:33:08Z ballen $";
 
300
const char *BOINC_RCSID_f835f078de = "$Id: shmem.C 13053 2007-06-29 23:47:41Z charlief $";