TPFxd_sync: Verify queued information
This function is used to ensure that any information queued to the external device has successfully been written to the device. Before a TPFxd_sync request, any data may still reside in a host or device buffer.
Format
#include <tpf/c_tpxd.h>
int TPFxd_sync (TPFxd_extToken *token); - token
- The returned token from the TPFxd_archiveStart or TPFxd_open request.
Normal return
A return code of 1 indicates a normal return.
Error return
An error return is indicated by a negative return code. For a list of error codes applicable to this function, see Error codes.
Programming considerations
- The TPFxd_open function must be called before this request.
- If the TPFxd_sync function returns a TPFxd_ERROR_EOVwarning return code, the request will cause the tape to be closed and removed. A subsequent TPFxd_open request will result in a new tape being mounted and, consequently, the volume serial number (VOLSER) would be changed.
Examples
The following example writes an
object to an external device and then issues a TPFxd_sync request to ensure
that the object was successfully written to the device and does not
reside in a hardware or software buffer.
#include <tpf/c_tpxd.h>
int example()
{
TPFxd_extToken *token;
TPFxd_locationMap wherefirst;
TPFxd_location whereIwas;
enum tpxd_mode mode;
enum tpxd_opts access;
int howbigitis;
int howlongtowait;
char *message;
int returncode;
char *stufftowrite;
howlongtowait = 60;
howbigitis = 32000;
message = NULL;
token = NULL;
mode = WT;
access = IMMEDIATE;
TPFxd_archiveStart (&token, mode, access);
TPFxd_open (&token,
&wherefirst,
howbigitis,
howlongtowait,
message,
mode );
stufftowrite = malloc(howbigitis);
TPFxd_write(token,stufftowrite,&howbigitis);
returncode = TPFxd_sync (token);
printf("sync complete with return code %i\n",returncode);
free(stufftowrite);
⋮
}Related information
See External device support overview for more information about this function and z/TPF C/C++ language support.