/usr/src/condor/chirp/chirp_client.h is in htcondor 8.6.8~dfsg.1-2.
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 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | /***************************************************************
*
* Copyright (C) 1990-2007, Condor Team, Computer Sciences Department,
* University of Wisconsin-Madison, WI.
*
* 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.
*
***************************************************************/
/*
Chirp C Client
*/
#include <sys/types.h>
#include <sys/stat.h>
#ifndef CHIRP_CLIENT_H
#define CHIRP_CLIENT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Dll Export */
#if defined(WIN32) && defined(CHIRP_DLL)
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
#endif
/*
Error codes:
-1 NOT_AUTHENTICATED The client has not authenticated its identity.
-2 NOT_AUTHORIZED The client is not authorized to perform that action.
-3 DOESNT_EXIST There is no object by that name.
-4 ALREADY_EXISTS There is already an object by that name.
-5 TOO_BIG That request is too big to execute.
-6 NO_SPACE There is not enough space to store that.
-7 NO_MEMORY The server is out of memory.
-8 INVALID_REQUEST The form of the request is invalid.
-9 TOO_MANY_OPEN There are too many resources in use.
-10 BUSY That object is in use by someone else.
-11 TRY_AGAIN A temporary condition prevented the request.
-12 BAD_FD: The file descriptor requested is invalid.
-13 IS_DIR A file-only operation was attempted on a directory.
-14 NOT_DIR A directory operation was attempted on a file.
-15 NOT_EMPTY A directory cannot be removed because it is not empty.
-16 CROSS_DEVICE_LINK A hard link was attempted across devices.
-17 OFFLINE The requested resource is temporarily not available.
-127 UNKNOWN An unknown error occurred.
*/
struct chirp_stat {
long cst_dev;
long cst_ino;
long cst_mode;
long cst_nlink;
long cst_uid;
long cst_gid;
long cst_rdev;
long cst_size;
long cst_blksize;
long cst_blocks;
long cst_atime;
long cst_mtime;
long cst_ctime;
};
struct chirp_statfs {
long f_type;
long f_bsize;
long f_blocks;
long f_bfree;
long f_bavail;
long f_files;
long f_ffree;
};
int get_stat( const char *line, struct chirp_stat *info );
int get_statfs( const char *line, struct chirp_statfs *info );
DLLEXPORT struct chirp_client * chirp_client_connect_default(void);
/*chirp_client_connect_default()
Opens connection to the default chirp server. The default connection
information is determined by reading ./.chirp.config. Under Condor,
the starter can automatically create this file if you specify
+WantIOProxy=True in the submit file.
*/
DLLEXPORT struct chirp_client * chirp_client_connect( const char *host, int port );
/*chirp_client_connect()
Connect to a chirp server at the specified address.
*/
DLLEXPORT struct chirp_client * chirp_client_connect_url( const char *url, const char **path_part);
/*
chirp_client_connect_url()
Sets path_part to the position of the start of the path information
in the URL and connects to the specified Chirp server.
URL format:
chirp:host.name:port/path (absolute path)
chirp:host.name:port./path (relative path)
chirp:/path (absolute path)
chirp:./path (relative path)
chirp:path (sloppy relative path)
Note that the initial part of a sloppy relative path can be confused
for a host:port specification if it happens to look like one. Example:
'chirp:strange:1/file'. For this reason, it is better to use one of
the non-sloppy formats.
In all of the above URL formats, any number of extra connection
parameters may be inserted before the path part (including the leading
'/' or '.'). These are of the form ";parameter=value" where parameter
and value are encoded using the standard Mime type
application/x-www-form-url encoded, just like the parameters in a typical
HTTP GET CGI request, but using ';' instead of '&' as the delimiter.
At this time, no connection parameters are defined, and any that
are supplied are simply ignored.
*/
DLLEXPORT void chirp_client_disconnect( struct chirp_client *c );
/*chirp_client_disconnect()
Closes the connection to a chirp server.
*/
DLLEXPORT int chirp_client_cookie( struct chirp_client *c, const char *cookie );
/*chirp_client_cookie
Authenticate with the server using the specified cookie.
*/
DLLEXPORT int chirp_client_login( struct chirp_client *c, const char *name, const char *password );
/*chirp_client_login
*/
DLLEXPORT int chirp_client_lookup( struct chirp_client *c, const char *logical_name, char **url );
/*chirp_client_lookup()
Ask the chirp server to translate the filename "logical_name". This is
done internally on any filename presented to chirp_client_open(). Under
Condor, the shadow may translate the path using the same mechanisms
available to redirect paths in Standard Universe.
*/
DLLEXPORT int chirp_client_constrain( struct chirp_client *c, const char *expr );
/*chirp_client_constrain()
When running under Condor, set the job's requirement expression.
*/
DLLEXPORT int chirp_client_get_job_attr( struct chirp_client *c, const char *name, char **expr );
/*chirp_client_get_job_attr()
When running under Condor, obtain the value of a job ClassAd attribute.
*/
DLLEXPORT int chirp_client_get_job_attr_delayed( struct chirp_client *c, const char *name, char **expr );
/*chirp_client_get_job_attr_delayed()
When running under Condor, obtain the value of a job ClassAd attribute from the local starter.
This may differ from the value in the schedd!
*/
DLLEXPORT int chirp_client_set_job_attr( struct chirp_client *c, const char *name, const char *expr );
/*chirp_client_set_job_attr()
When running under Condor, set the value of a job ClassAd attribute.
*/
DLLEXPORT int chirp_client_set_job_attr_delayed( struct chirp_client *c, const char *name, const char *expr );
/*chirp_client_set_job_attr_delayed()
When running under HTCondor, set the value of a job ClassAd attribute to a given expression.
This variant of set_job_attr will not push the update immediately, but rather as a non-durable
update during the next communication between starter and shadow.
*/
DLLEXPORT int chirp_client_open( struct chirp_client *c, const char *path, const char *flags, int mode );
/*chirp_client_open()
Open a file through the chirp server. Note that if you want to create a
new file, you _must_ include "c" or "x" in the flags. The mode is the same
as in the POSIX open() call.
Flags:
r - open for reading
w - open for writing
a - force all writes to append
t - truncate before use
c - create if it doesn't exist
x - fail if 'c' is given and the file already exists
Returns an integer file handle to be used in future chirp_client() functions.
On error, returns a value less than 0.
*/
DLLEXPORT int chirp_client_close( struct chirp_client *c, int fd );
/*chirp_client_close()
Closes a file opened via chirp_client_open().
*/
DLLEXPORT int chirp_client_read( struct chirp_client *c, int fd, void *buffer, int length );
/*chirp_client_read()
Reads from a file and puts the result in a buffer. The number of bytes
actually read is returned.
*/
DLLEXPORT int chirp_client_write( struct chirp_client *c, int fd, const void *buffer, int length );
/*chirp_client_write()
Writes from a buffer into a file. On success, returns the number of
bytes written, which will always be the number of bytes requested.
On error, returns a negative error code.
*/
DLLEXPORT int chirp_client_unlink( struct chirp_client *c, const char *path );
/*chirp_client_unlink()
Removes a file.
*/
DLLEXPORT int chirp_client_rename( struct chirp_client *c, const char *oldpath, const char *newpath );
/*chirp_client_rename()
Renames a file.
*/
DLLEXPORT int chirp_client_fsync( struct chirp_client *c, int fd );
/*chirp_client_fsync()
Flushes any buffered data to disk.
*/
DLLEXPORT int chirp_client_lseek( struct chirp_client *c, int fd, int offset, int whence );
/*chirp_client_lseek()
Changes the read/write file offset. The values for whence are the same
as for the POSIX lseek() call.
*/
DLLEXPORT int chirp_client_mkdir( struct chirp_client *c, char const *name, int mode );
/*chirp_client_mkdir()
Create a directory with the specified mode.
*/
DLLEXPORT int chirp_client_rmdir( struct chirp_client *c, char const *name );
/*chirp_client_rmdir()
Removes an empty directory.
*/
DLLEXPORT int chirp_client_ulog( struct chirp_client *c, char const *message );
/*chirp_client_ulog()
logs a generic string to the user log
*/
DLLEXPORT int chirp_client_phase( struct chirp_client *c, char const *phase );
/*chirp_client_phase()
tells condor the job is changing phases
*/
DLLEXPORT int chirp_client_pread( struct chirp_client *c, int fd, void *buffer,
int length, int offset);
/*chirp_client_pread
Reads from a file starting at the offset and puts the result in a buffer.
The number of bytes actually read is returned, or -1 on error.
*/
DLLEXPORT int chirp_client_pwrite( struct chirp_client *c, int fd,
const void *buffer, int length, int offset );
/*chirp_client_pwrite
Writes from a buffer into a file at the given offset. The number of bytes
actually written is returned, or -1 on error.
*/
DLLEXPORT int chirp_client_sread( struct chirp_client *c, int fd, void *buffer,
int length, int offset, int stride_length, int stride_skip );
/*chirp_client_sread
Reads from a file starting at the offset, reading stride_length bytes every
stride_skip bytes. Puts the result in a buffer. The number of bytes actually
read is returned, or -1 on error.
*/
DLLEXPORT int chirp_client_swrite( struct chirp_client *c, int fd,
const void *buffer, int length, int offset, int stride_length,
int stride_skip );
/*chirp_client_swrite
Writes from a buffer into a file starting at the given offset. Writes
stride_length bytes every stride_skip bytes. The total number of bytes
written is returned, or -1 on error.
*/
DLLEXPORT int chirp_client_rmall( struct chirp_client *c, const char *path );
/*chirp_client_rmall
Recursively deletes a directory. Returns 0 on success, -1 on failure.
*/
DLLEXPORT int chirp_client_fstat( struct chirp_client *c, int fd,
struct chirp_stat *buf );
/*chirp_client_fstat
Gets metadata. Returns 0 on success, -1 on failure.
*/
DLLEXPORT int chirp_client_fstatfs( struct chirp_client *c, int fd,
struct chirp_statfs *buf);
/*chirp_client_fstatfs
Gets filesystem metadata. Returns 0 on success, -1 on failure.
*/
DLLEXPORT int chirp_client_fchown( struct chirp_client *c, int fd, int uid,
int gid );
/*chirp_client_fchown
Changes ownership of a file. Returns 0 on success, -1 on failure.
*/
DLLEXPORT int chirp_client_fchmod( struct chirp_client *c, int fd,
int mode );
/*chirp_client_fchmod
Changes mode of a file. Returns 0 on success, -1 on failure.
*/
DLLEXPORT int chirp_client_ftruncate( struct chirp_client *c, int fd,
int length );
/*chirp_client_ftruncate
Truncates a file. Returns 0 on success, -1 on failure.
*/
DLLEXPORT int chirp_client_getfile_buffer( struct chirp_client *c,
const char *name, char **buffer );
/*chirp_client_getfile
Retrieves an entire file. Returns number of bytes in the file, or -1 on error.
*/
DLLEXPORT int chirp_client_putfile_buffer( struct chirp_client *c,
const char *path, const char *buffer, int mode, int length );
/*chirp_client_putfile_buffer
Stores an entire file. Returns size of written file, or -1 on failure.
*/
DLLEXPORT int chirp_client_getlongdir( struct chirp_client *c, const char *path,
char **buffer );
/*chirp_client_getlongdir
Gets directory contents and all metadata. Returns size of reply, or -1 on
error.
*/
DLLEXPORT int chirp_client_getdir( struct chirp_client *c, const char *path,
char **buffer );
/*chirp_client_getdir
Gets directory contents. Returns size of reply, or -1 on error.
*/
DLLEXPORT int chirp_client_whoami( struct chirp_client *c, char *buf,
int length);
/*chirp_client_whoami
Get user's identity. Returns size of reply, -1 on failure.
*/
DLLEXPORT int chirp_client_whoareyou( struct chirp_client *c, const char *rhost,
char *buf, int length );
/*chirp_client_whoareyou
Get server's identity with respect to host. Returns 1 on success, -1 on
failure.
*/
DLLEXPORT int chirp_client_link( struct chirp_client *c, const char *path,
const char *newpath );
/*chirp_client_link
Creates a hard link. Returns 0 on success, -1 on failure.
*/
DLLEXPORT int chirp_client_symlink( struct chirp_client *c, const char *path,
const char *newpath );
/*chirp_client_symlink
Creates a symbolic link. Returns 0 on success, -1 on failure.
*/
DLLEXPORT int chirp_client_readlink( struct chirp_client *c, const char *path,
int length, char **buf );
/*chirp_client_readlink
Reads up to length bytes of a symbolic link. Returns number of byes read, or
-1 on error.
*/
DLLEXPORT int chirp_client_stat( struct chirp_client *c, const char *path,
struct chirp_stat *buf );
/*chirp_client_stat
Get metadata. Returns 0 on success, -1 on failure.
*/
DLLEXPORT int chirp_client_lstat( struct chirp_client *c, const char *path,
struct chirp_stat *buf );
/*chirp_client_lstat
Get metadata. For symbolic links, examine the link itself. Returns 0 on success,
-1 on failure.
*/
DLLEXPORT int chirp_client_statfs( struct chirp_client *c, const char *path,
struct chirp_statfs *buf );
/*chirp_client_statfs
Gets filesystem metadata. Returns 0 on success, -1 on failure.
*/
DLLEXPORT int chirp_client_access( struct chirp_client *c, const char *path,
int mode );
/*chirp_client_access
Checks access permissions. Returns 0 on success, -1 on failure.
*/
DLLEXPORT int chirp_client_chmod( struct chirp_client *c, const char *path,
int mode );
/*chirp_client_chmod
Changes mode of a file. Returns 0 on success, -1 on failure.
*/
DLLEXPORT int chirp_client_chown( struct chirp_client *c, const char *path,
int uid, int gid );
/*chirp_client_chown
Changes the ownership of a file. Returns 0 on success, -1 on failure.
*/
DLLEXPORT int chirp_client_lchown( struct chirp_client *c, const char *path,
int uid, int gid );
/*chirp_client_lchown
Changes the ownership of a file. Returns 0 on success, -1 on failure.
*/
DLLEXPORT int chirp_client_truncate( struct chirp_client *c, const char *path,
int length );
/*chirp_client_truncate
Truncates a file. Returns 0 on success, -1 on failure.
*/
DLLEXPORT int chirp_client_utime( struct chirp_client *c, const char *path,
int actime, int modtime );
/*chirp_client_utime
Changes the access and modification times of a file. Returns 0 on success,
-1 on failure.
*/
#ifdef __cplusplus
}
#endif
#endif
|