IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6235


Ignore:
Timestamp:
Jan 29, 2006, 8:53:32 AM (20 years ago)
Author:
eugene
Message:

added image lock/unlock functions

Location:
trunk/Ohana/src/libdvo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libdvo/include/dvo.h

    r5945 r6235  
    318318
    319319/*** DVO image db I/O Functions ***/
     320int dvo_image_lock (FITS_DB *db, char *filename, double timeout, int lockstate);
     321int dvo_image_unlock (FITS_DB *db);
    320322int dvo_image_load (FITS_DB *db, int VERBOSE, int FORCE_READ);
    321323int dvo_image_save (FITS_DB *db, int VERBOSE);
  • trunk/Ohana/src/libdvo/src/dvo_image.c

    r5241 r6235  
    11# include <dvo.h>
     2
     3/* lock the image table */
     4int dvo_image_lock (FITS_DB *db, char *filename, double timeout, int lockstate) {
     5
     6  /* lock the image catalog */
     7  _check_permissions (filename);
     8
     9  db[0].lockstate = lockstate;
     10  db[0].timeout   = timeout;
     11  fits_db_init (db);
     12
     13  if (!fits_db_lock (db, filename)) {
     14    fprintf (stderr, "ERROR: can't lock image catalog\n");
     15    return (FALSE);
     16  }
     17  return (TRUE);
     18}
     19
     20int dvo_image_unlock (FITS_DB *db) {
     21
     22  mode_t mode;
     23
     24  fits_db_close (db);
     25
     26  /* force permissions to 666 */
     27  mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
     28  chmod (db[0].filename, mode);
     29  return (TRUE);
     30}
    231
    332/* determine db mode (RAW/MEF) and read the complete table */
Note: See TracChangeset for help on using the changeset viewer.