IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 21 years ago

Closed 21 years ago

Last modified 21 years ago

#495 closed defect (fixed)

psFitsOpenFD

Reported by: Paul Price Owned by: jhoblitt
Priority: high Milestone:
Component: PSLib SDRS Version: unspecified
Severity: normal Keywords:
Cc:

Description

As far as I can tell, cfitsio won't give you a FD. It won't even give you a
FILE*, but it does everything internally.

Change History (4)

comment:1 by jhoblitt, 21 years ago

Status: newassigned

"Opens a file descriptor and positions the pointer to the PHU."

That function is to allow you to operate on an already open file handle. It
really doesn't matter if cfitsio supports this or not, IMHO it's a very useful
API. If it has to be implimented by resorting to fstat()* I can live with that.

  • This won't work for stdin/stdout but that case can be tested for.

comment:2 by eugene, 21 years ago

I agree it is useful to be able to pass around fd's rather than just filenames,
so I agree that this would be a useful function, and sufficient to define using
fstat.

If this were implemented with fstat, what should be the disposition of the fd
after the function call? Some options:

  • do nothing
  • leave open and rewind
  • close

it is a bit dangerous to have two open file descriptors to the same file in a
single thread, but only a bit. the first choice above is ambiguous. Any user
would have to reposition after the function call anyway, at least in case the
file shrank. the second leaves two open pointers, and may end up wasting a seek
if the next operation with the fd decides to seek to the end. The third option
would be unambiguous, but might not be desired.

If we define this function using fstat, we can then also define one that takes a
FILE * as an argument (fd = fileno(f); psFitsOpenFD(fd);), which I find useful IMHO.

comment:3 by jhoblitt, 21 years ago

Resolution: fixed
Status: assignedclosed

I added this function to the SDRS:

psFits *psFitsOpenStream(FILE *stream);

comment:4 by Paul Price, 21 years ago

Subsequently removed this.

Note: See TracTickets for help on using tickets.