/usr/include/globus/globus_xio_file_driver.h is in libglobus-xio-dev 3.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | /*
* Copyright 1999-2006 University of Chicago
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef GLOBUS_XIO_FILE_DRIVER_INCLUDE
#define GLOBUS_XIO_FILE_DRIVER_INCLUDE
/**
* @file
* Header file for XIO File Driver
*/
#include "globus_xio_system.h"
/**
* @defgroup file_driver Globus XIO File Driver
* The File I/O driver.
*/
/**
* @defgroup file_driver_instance Opening/Closing
* @ingroup file_driver
*
* An XIO handle with the file driver can be created with
* @ref globus_xio_handle_create()
*
* If there is no handle set on the attr passed to the
* @ref globus_xio_open() call, it performs the equivalent of an
* open() call. In this case, the contact string must contain
* either a pathname or one of stdin://, stdout://, or stderr://. If a
* pathname is used, that path is opened. If one of the schemes are used
* the corresponding stdio handle is used (retrieved with fileno()).
*
* In either of the above cases, it is most efficient to call the blocking
* version of globus_xio_open(). It is also safe to call within a locked
* critical section.
*
* When the XIO handle is closed, the file driver will destroy its internal
* resources and close the fd (unless this fd was set on an attr or converted
* from one of the stdio handles).
*/
/**
* @defgroup file_driver_io Reading/Writing
* @ingroup file_driver
*
* Both the @ref globus_xio_register_read() and
* @ref globus_xio_register_write() calls follow similar semantics as described
* below.
*
* If the waitforbytes parameter is greater than zero, the io will happen
* asynchronously and be completed when at least waitforbytes has been
* read/written.
*
* If the waitforbytes parameter is equal to zero, one of the following
* alternative behaviors occur:
*
* If the length of the buffer is > 0 the read or write happens synchronously.
* If the user is using one of the blocking xio calls, no internal callback
* will occur.
*
* If the length of the buffer is also 0, the call behaves like an asynchronous
* notification of data ready to be either read or written. ie, an
* asynchronous select().
*
* In any case, when an error or EOF occurs before the waitforbytes request
* has been met, the outgoing nbytes is set to the amount of data actually
* read/written before the error or EOF occurred.
*
* You may either use GLOBUS_XIO_FILE_SEEK or GLOBUS_XIO_SEEK to position the
* file pointer before each read or write or you can specify the
* desired offset on a data descriptor with the xio cmd,
* GLOBUS_XIO_DD_SET_OFFSET. simultaneous reading and writing is only
* predictable if the data descriptor method is used.
*/
/**
* @defgroup file_driver_envs Env Variables
* @ingroup file_driver
*
* The file driver uses the following environment variables
* - GLOBUS_XIO_FILE_DEBUG Available if using a debug build. See globus_debug.h
* for format. The File driver defines the levels TRACE for all function
* call tracing and INFO for write buffer sizes
* - GLOBUS_XIO_SYSTEM_DEBUG Available if using a debug build.
* See globus_debug.h for format. The File driver uses globus_xio_system
* (along with the TCP and UDP drivers) which defines the following
* levels: TRACE for all function call tracing, DATA for data read and
* written counts, INFO for some special events, and RAW which dumps the
* raw buffers actually read or written. This can contain binary data,
* so be careful when you enable it.
*/
/**
* @defgroup file_driver_cntls Attributes and Cntls
* @ingroup file_driver
*
* File driver specific attrs and cntls.
*
* @see globus_xio_attr_cntl()
* @see globus_xio_handle_cntl()
*/
/**
* @defgroup file_driver_types Types
* @ingroup file_driver
*/
/**
* @defgroup file_driver_errors Error Types
* @ingroup file_driver
*
* The File driver is very close to the system code, so most errors
* reported by it are converted from the system errno. A few of the exceptions
* are GLOBUS_XIO_ERROR_EOF, GLOBUS_XIO_ERROR_COMMAND,
* GLOBUS_XIO_ERROR_CONTACT_STRING, and GLOBUS_XIO_ERROR_CANCELED
*
* @see globus_error_errno_match()
*/
/**
* Invalid handle type
* @ingroup file_driver_types
* @hideinitializer
* @see GLOBUS_XIO_FILE_SET_HANDLE
*/
#define GLOBUS_XIO_FILE_INVALID_HANDLE GLOBUS_XIO_SYSTEM_INVALID_FILE
/** doxygen varargs filter stuff
* GlobusVarArgDefine(
* attr, globus_result_t, globus_xio_attr_cntl, attr, driver)
* GlobusVarArgDefine(
* handle, globus_result_t, globus_xio_handle_cntl, handle, driver)
*/
/**
* File driver specific cntls
* @ingroup file_driver_cntls
*/
typedef enum
{
/** GlobusVarArgEnum(attr)
* Set the file create mode.
* @ingroup file_driver_cntls
* Use this to set the permissions a non-existent file is created with,
* The default mode is 0644.
*
* @param mode
* A bitwise OR of all the modes desired
*
* @see globus_xio_file_mode_t
*
* string opt: mode=<int>
*/
/* int mode */
GLOBUS_XIO_FILE_SET_MODE,
/** GlobusVarArgEnum(attr)
* Get the file create mode.
* @ingroup file_driver_cntls
*
* @param mode_out
* The current mode will be stored here.
*/
/* int * mode_out */
GLOBUS_XIO_FILE_GET_MODE,
/** GlobusVarArgEnum(attr)
* Set the file open flags.
* @ingroup file_driver_cntls
* The default flags specify to create the file if it doesn't exist,
* open it for reading and writing, and interpret it as a binary file.
*
* @param flags
* A bitwise OR of all the flags desired
*
* @see globus_xio_file_flag_t
*
* string opt: flags=<int>
*/
/* int flags */
GLOBUS_XIO_FILE_SET_FLAGS,
/** GlobusVarArgEnum(attr)
* Get the file open flags.
* @ingroup file_driver_cntls
*
* @param flags_out
* The current flags will be stored here.
*/
/* int * flags_out */
GLOBUS_XIO_FILE_GET_FLAGS,
/** GlobusVarArgEnum(attr)
* Set the file truncate offset.
* @ingroup file_driver_cntls
* Use this in conjunction with the @ref GLOBUS_XIO_FILE_TRUNC flag
* to truncate a file to a non-zero offset. If the file was larger
* than offset bytes, the extra data is lost. If the file was shorter or
* non-existent, it is extended and the extended part reads as zeros.
* (default is 0)
*
* @param offset
* The desired size of the file.
*/
/* globus_off_t offset */
GLOBUS_XIO_FILE_SET_TRUNC_OFFSET,
/** GlobusVarArgEnum(attr)
* Get the file truncate offset.
* @ingroup file_driver_cntls
*
* @param offset_out
* The offset will be stored here.
*/
/* globus_off_t * offset_out */
GLOBUS_XIO_FILE_GET_TRUNC_OFFSET,
/** GlobusVarArgEnum(attr)
* Set the file handle to use.
* @ingroup file_driver_cntls
* Do not open a new file, use this preopened handle instead.
*
* @param handle
* Use this handle (fd or HANDLE) for the file.
* Note: close() will not be called on this handle.
*/
/* globus_xio_system_file_t handle */
GLOBUS_XIO_FILE_SET_HANDLE,
/** GlobusVarArgEnum(attr, handle)
* Get the file handle in use or in attr.
* @ingroup file_driver_cntls
*
* @param handle_out
* The file handle (fd or HANDLE) will be stored here. If none is set,
* GLOBUS_XIO_TCP_INVALID_HANDLE will be set.
*/
/* globus_xio_system_file_t * handle_out */
GLOBUS_XIO_FILE_GET_HANDLE,
/** GlobusVarArgEnum(attr, handle)
* Enable true blocking io when making globus_xio_read/write() calls.
* Note: use with caution. you can deadlock an entire app with this.
* @ingroup file_driver_cntls
*
* @param use_blocking_io
* If GLOBUS_TRUE, true blocking io will be enabled.
* GLOBUS_FALSE will disable it (default);
*/
/* globus_bool_t use_blocking_io */
GLOBUS_XIO_FILE_SET_BLOCKING_IO,
/** GlobusVarArgEnum(attr, handle)
* Get the blocking io status in use or in attr.
* @ingroup file_driver_cntls
*
* @param use_blocking_io_out
* The flag will be set here. GLOBUS_TRUE for enabled.
*
* string opt: blocking=<bool>
*/
/* globus_bool_t * use_blocking_io_out */
GLOBUS_XIO_FILE_GET_BLOCKING_IO,
/** GlobusVarArgEnum(handle)
* Reposition read/write file offset.
* @ingroup file_driver_cntls
*
* @param in_out_offset
* Specify the desired offset (according to whence). On success,
* the actual file offset will be stored here.
*
* @param whence
* Specify how offset should be interpreted.
*
* @see globus_xio_file_whence_t
* @see GLOBUS_XIO_SEEK
*/
/* globus_off_t * in_out_offset,
* globus_xio_file_whence_t whence */
GLOBUS_XIO_FILE_SEEK
} globus_xio_file_attr_cmd_t;
/**
* File driver open flags
* @ingroup file_driver_types
* @hideinitializer
* OR together all the flags you want
* @see GLOBUS_XIO_FILE_SET_FLAGS
*/
typedef enum
{
/** Create a new file if it doesn't exist (default) */
GLOBUS_XIO_FILE_CREAT = O_CREAT,
/** Fail if file already exists */
GLOBUS_XIO_FILE_EXCL = O_EXCL,
/** Open for read only */
GLOBUS_XIO_FILE_RDONLY = O_RDONLY,
/** Open for write only */
GLOBUS_XIO_FILE_WRONLY = O_WRONLY,
/** Open for reading and writing (default) */
GLOBUS_XIO_FILE_RDWR = O_RDWR,
/** Truncate file @see GLOBUS_XIO_FILE_SET_TRUNC_OFFSET */
GLOBUS_XIO_FILE_TRUNC = O_TRUNC,
/** Open file for appending */
GLOBUS_XIO_FILE_APPEND = O_APPEND,
#ifdef TARGET_ARCH_CYGWIN
GLOBUS_XIO_FILE_BINARY = O_BINARY,
GLOBUS_XIO_FILE_TEXT = O_TEXT
#else
/** File is binary (default) */
GLOBUS_XIO_FILE_BINARY = 0,
/** File is text */
GLOBUS_XIO_FILE_TEXT = 0
#endif
} globus_xio_file_flag_t;
/**
* File driver create mode
* @ingroup file_driver_types
* @hideinitializer
* OR these modes together to get the mode you want.
* @see GLOBUS_XIO_FILE_SET_MODE
*
* NOTE: for Win32, you only have a choice between read-only and read-write.
* If the chosen mode does not specify writability, the file will be read only
*/
typedef enum
{
/** User read, write, and execute */
GLOBUS_XIO_FILE_IRWXU = S_IRWXU,
/** User read */
GLOBUS_XIO_FILE_IRUSR = S_IRUSR,
/** User write */
GLOBUS_XIO_FILE_IWUSR = S_IWUSR,
/** User execute */
GLOBUS_XIO_FILE_IXUSR = S_IXUSR,
/** Others read, write, and execute */
GLOBUS_XIO_FILE_IRWXO = S_IRWXO,
/** Others read */
GLOBUS_XIO_FILE_IROTH = S_IROTH,
/** Others write */
GLOBUS_XIO_FILE_IWOTH = S_IWOTH,
/** Others execute */
GLOBUS_XIO_FILE_IXOTH = S_IXOTH,
/** Group read, write, and execute */
GLOBUS_XIO_FILE_IRWXG = S_IRWXG,
/** Group read */
GLOBUS_XIO_FILE_IRGRP = S_IRGRP,
/** Group write */
GLOBUS_XIO_FILE_IWGRP = S_IWGRP,
/** Group execute */
GLOBUS_XIO_FILE_IXGRP = S_IXGRP
} globus_xio_file_mode_t;
/**
* File driver seek options
* @ingroup file_driver_types
* @hideinitializer
* @see GLOBUS_XIO_FILE_SEEK
*/
typedef enum
{
/** set the file pointer at the specified offset */
GLOBUS_XIO_FILE_SEEK_SET = SEEK_SET,
/** set the file pointer at current position + offset */
GLOBUS_XIO_FILE_SEEK_CUR = SEEK_CUR,
/** set the file pointer at size of file + offest */
GLOBUS_XIO_FILE_SEEK_END = SEEK_END
} globus_xio_file_whence_t;
#endif
|