comparison src/sysfile.h @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 8626e4521993
children 2f8bb876ab1d
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
17 along with XEmacs; see the file COPYING. If not, write to 17 along with XEmacs; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */ 19 Boston, MA 02111-1307, USA. */
20 20
21 /* Synched up with: Not really in FSF. */ 21 /* Synched up with: Not really in FSF. */
22
23 #ifndef INCLUDED_sysfile_h_
24 #define INCLUDED_sysfile_h_
22 25
23 #include <errno.h> 26 #include <errno.h>
24 27
25 #ifndef WINDOWSNT 28 #ifndef WINDOWSNT
26 #include <sys/errno.h> /* <errno.h> does not always imply this */ 29 #include <sys/errno.h> /* <errno.h> does not always imply this */
201 #endif 204 #endif
202 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */ 205 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
203 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) 206 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
204 #endif 207 #endif
205 208
206 #if !defined (USG) && !defined (WINDOWSNT)
207 # define HAVE_FSYNC
208 #endif
209
210 #ifndef MAXPATHLEN 209 #ifndef MAXPATHLEN
211 /* in 4.1, param.h fails to define this. */ 210 /* in 4.1, param.h fails to define this. */
212 #define MAXPATHLEN 1024 211 #define MAXPATHLEN 1024
213 #endif /* not MAXPATHLEN */ 212 #endif /* not MAXPATHLEN */
214 213
242 We encapsulate the most common system calls here; we assume their 241 We encapsulate the most common system calls here; we assume their
243 declarations are in one of the standard header files included above. 242 declarations are in one of the standard header files included above.
244 Other encapsulations are declared in the appropriate sys*.h file. */ 243 Other encapsulations are declared in the appropriate sys*.h file. */
245 244
246 #ifdef ENCAPSULATE_READ 245 #ifdef ENCAPSULATE_READ
247 int sys_read (int, void *, size_t); 246 ssize_t sys_read (int, void *, size_t);
248 #endif 247 #endif
249 #if defined (ENCAPSULATE_READ) && !defined (DONT_ENCAPSULATE) 248 #if defined (ENCAPSULATE_READ) && !defined (DONT_ENCAPSULATE)
250 # undef read 249 # undef read
251 # define read sys_read 250 # define read sys_read
252 #endif 251 #endif
253 #if !defined (ENCAPSULATE_READ) && defined (DONT_ENCAPSULATE) 252 #if !defined (ENCAPSULATE_READ) && defined (DONT_ENCAPSULATE)
254 # define sys_read read 253 # define sys_read read
255 #endif 254 #endif
256 255
257 #ifdef ENCAPSULATE_WRITE 256 #ifdef ENCAPSULATE_WRITE
258 int sys_write (int, CONST void *, size_t); 257 ssize_t sys_write (int, const void *, size_t);
259 #endif 258 #endif
260 #if defined (ENCAPSULATE_WRITE) && !defined (DONT_ENCAPSULATE) 259 #if defined (ENCAPSULATE_WRITE) && !defined (DONT_ENCAPSULATE)
261 # undef write 260 # undef write
262 # define write sys_write 261 # define write sys_write
263 #endif 262 #endif
264 #if !defined (ENCAPSULATE_WRITE) && defined (DONT_ENCAPSULATE) 263 #if !defined (ENCAPSULATE_WRITE) && defined (DONT_ENCAPSULATE)
265 # define sys_write write 264 # define sys_write write
266 #endif 265 #endif
267 266
268 #ifdef ENCAPSULATE_OPEN 267 #ifdef ENCAPSULATE_OPEN
269 int sys_open (CONST char *, int, ...); 268 int sys_open (const char *, int, ...);
270 #endif 269 #endif
271 #if defined (ENCAPSULATE_OPEN) && !defined (DONT_ENCAPSULATE) 270 #if defined (ENCAPSULATE_OPEN) && !defined (DONT_ENCAPSULATE)
272 # undef open 271 # undef open
273 # define open sys_open 272 # define open sys_open
274 #endif 273 #endif
299 #if !defined (ENCAPSULATE_FREAD) && defined (DONT_ENCAPSULATE) 298 #if !defined (ENCAPSULATE_FREAD) && defined (DONT_ENCAPSULATE)
300 # define sys_fread fread 299 # define sys_fread fread
301 #endif 300 #endif
302 301
303 #ifdef ENCAPSULATE_FWRITE 302 #ifdef ENCAPSULATE_FWRITE
304 size_t sys_fwrite (CONST void *, size_t, size_t, FILE *); 303 size_t sys_fwrite (const void *, size_t, size_t, FILE *);
305 #endif 304 #endif
306 #if defined (ENCAPSULATE_FWRITE) && !defined (DONT_ENCAPSULATE) 305 #if defined (ENCAPSULATE_FWRITE) && !defined (DONT_ENCAPSULATE)
307 # undef fwrite 306 # undef fwrite
308 # define fwrite sys_fwrite 307 # define fwrite sys_fwrite
309 #endif 308 #endif
310 #if !defined (ENCAPSULATE_FWRITE) && defined (DONT_ENCAPSULATE) 309 #if !defined (ENCAPSULATE_FWRITE) && defined (DONT_ENCAPSULATE)
311 # define sys_fwrite fwrite 310 # define sys_fwrite fwrite
312 #endif 311 #endif
313 312
314 #ifdef ENCAPSULATE_FOPEN 313 #ifdef ENCAPSULATE_FOPEN
315 FILE *sys_fopen (CONST char *, CONST char *); 314 FILE *sys_fopen (const char *, const char *);
316 #endif 315 #endif
317 #if defined (ENCAPSULATE_FOPEN) && !defined (DONT_ENCAPSULATE) 316 #if defined (ENCAPSULATE_FOPEN) && !defined (DONT_ENCAPSULATE)
318 # undef fopen 317 # undef fopen
319 # define fopen sys_fopen 318 # define fopen sys_fopen
320 #endif 319 #endif
335 334
336 335
337 /* encapsulations: file-information calls */ 336 /* encapsulations: file-information calls */
338 337
339 #ifdef ENCAPSULATE_ACCESS 338 #ifdef ENCAPSULATE_ACCESS
340 int sys_access (CONST char *path, int mode); 339 int sys_access (const char *path, int mode);
341 #endif 340 #endif
342 #if defined (ENCAPSULATE_ACCESS) && !defined (DONT_ENCAPSULATE) 341 #if defined (ENCAPSULATE_ACCESS) && !defined (DONT_ENCAPSULATE)
343 # undef access 342 # undef access
344 # define access sys_access 343 # define access sys_access
345 #endif 344 #endif
346 #if !defined (ENCAPSULATE_ACCESS) && defined (DONT_ENCAPSULATE) 345 #if !defined (ENCAPSULATE_ACCESS) && defined (DONT_ENCAPSULATE)
347 # define sys_access access 346 # define sys_access access
348 #endif 347 #endif
349 348
350 #ifdef ENCAPSULATE_EACCESS 349 #ifdef ENCAPSULATE_EACCESS
351 int sys_eaccess (CONST char *path, int mode); 350 int sys_eaccess (const char *path, int mode);
352 #endif 351 #endif
353 #if defined (ENCAPSULATE_EACCESS) && !defined (DONT_ENCAPSULATE) 352 #if defined (ENCAPSULATE_EACCESS) && !defined (DONT_ENCAPSULATE)
354 # undef eaccess 353 # undef eaccess
355 # define eaccess sys_eaccess 354 # define eaccess sys_eaccess
356 #endif 355 #endif
357 #if !defined (ENCAPSULATE_EACCESS) && defined (DONT_ENCAPSULATE) 356 #if !defined (ENCAPSULATE_EACCESS) && defined (DONT_ENCAPSULATE)
358 # define sys_eaccess eaccess 357 # define sys_eaccess eaccess
359 #endif 358 #endif
360 359
361 #ifdef ENCAPSULATE_LSTAT 360 #ifdef ENCAPSULATE_LSTAT
362 int sys_lstat (CONST char *path, struct stat *buf); 361 int sys_lstat (const char *path, struct stat *buf);
363 #endif 362 #endif
364 #if defined (ENCAPSULATE_LSTAT) && !defined (DONT_ENCAPSULATE) 363 #if defined (ENCAPSULATE_LSTAT) && !defined (DONT_ENCAPSULATE)
365 # undef lstat 364 # undef lstat
366 # define lstat sys_lstat 365 # define lstat sys_lstat
367 #endif 366 #endif
368 #if !defined (ENCAPSULATE_LSTAT) && defined (DONT_ENCAPSULATE) 367 #if !defined (ENCAPSULATE_LSTAT) && defined (DONT_ENCAPSULATE)
369 # define sys_lstat lstat 368 # define sys_lstat lstat
370 #endif 369 #endif
371 370
372 #ifdef ENCAPSULATE_READLINK 371 #ifdef ENCAPSULATE_READLINK
373 int sys_readlink (CONST char *path, char *buf, size_t bufsiz); 372 int sys_readlink (const char *path, char *buf, size_t bufsiz);
374 #endif 373 #endif
375 #if defined (ENCAPSULATE_READLINK) && !defined (DONT_ENCAPSULATE) 374 #if defined (ENCAPSULATE_READLINK) && !defined (DONT_ENCAPSULATE)
376 # undef readlink 375 # undef readlink
377 # define readlink sys_readlink 376 # define readlink sys_readlink
378 #endif 377 #endif
379 #if !defined (ENCAPSULATE_READLINK) && defined (DONT_ENCAPSULATE) 378 #if !defined (ENCAPSULATE_READLINK) && defined (DONT_ENCAPSULATE)
380 # define sys_readlink readlink 379 # define sys_readlink readlink
381 #endif 380 #endif
382 381
382 #ifdef ENCAPSULATE_FSTAT
383 int sys_fstat (int fd, struct stat *buf);
384 #endif
385 #if defined (ENCAPSULATE_FSTAT) && !defined (DONT_ENCAPSULATE)
386 # undef fstat
387 /* Need to use arguments to avoid messing with struct stat */
388 # define fstat(fd, buf) sys_fstat (fd, buf)
389 #endif
390 #if !defined (ENCAPSULATE_FSTAT) && defined (DONT_ENCAPSULATE)
391 # define sys_fstat fstat
392 #endif
393
383 #ifdef ENCAPSULATE_STAT 394 #ifdef ENCAPSULATE_STAT
384 int sys_stat (CONST char *path, struct stat *buf); 395 int sys_stat (const char *path, struct stat *buf);
385 #endif 396 #endif
386 #if defined (ENCAPSULATE_STAT) && !defined (DONT_ENCAPSULATE) 397 #if defined (ENCAPSULATE_STAT) && !defined (DONT_ENCAPSULATE)
387 # undef stat 398 # undef stat
388 /* Need to use arguments to avoid messing with struct stat */ 399 /* Need to use arguments to avoid messing with struct stat */
389 # define stat(path, buf) sys_stat (path, buf) 400 # define stat(path, buf) sys_stat (path, buf)
393 #endif 404 #endif
394 405
395 /* encapsulations: file-manipulation calls */ 406 /* encapsulations: file-manipulation calls */
396 407
397 #ifdef ENCAPSULATE_CHMOD 408 #ifdef ENCAPSULATE_CHMOD
398 int sys_chmod (CONST char *path, mode_t mode); 409 int sys_chmod (const char *path, mode_t mode);
399 #endif 410 #endif
400 #if defined (ENCAPSULATE_CHMOD) && !defined (DONT_ENCAPSULATE) 411 #if defined (ENCAPSULATE_CHMOD) && !defined (DONT_ENCAPSULATE)
401 # undef chmod 412 # undef chmod
402 # define chmod sys_chmod 413 # define chmod sys_chmod
403 #endif 414 #endif
404 #if !defined (ENCAPSULATE_CHMOD) && defined (DONT_ENCAPSULATE) 415 #if !defined (ENCAPSULATE_CHMOD) && defined (DONT_ENCAPSULATE)
405 # define sys_chmod chmod 416 # define sys_chmod chmod
406 #endif 417 #endif
407 418
408 #ifdef ENCAPSULATE_CREAT 419 #ifdef ENCAPSULATE_CREAT
409 int sys_creat (CONST char *path, mode_t mode); 420 int sys_creat (const char *path, mode_t mode);
410 #endif 421 #endif
411 #if defined (ENCAPSULATE_CREAT) && !defined (DONT_ENCAPSULATE) 422 #if defined (ENCAPSULATE_CREAT) && !defined (DONT_ENCAPSULATE)
412 # undef creat 423 # undef creat
413 # define creat sys_creat 424 # define creat sys_creat
414 #endif 425 #endif
415 #if !defined (ENCAPSULATE_CREAT) && defined (DONT_ENCAPSULATE) 426 #if !defined (ENCAPSULATE_CREAT) && defined (DONT_ENCAPSULATE)
416 # define sys_creat creat 427 # define sys_creat creat
417 #endif 428 #endif
418 429
419 #ifdef ENCAPSULATE_LINK 430 #ifdef ENCAPSULATE_LINK
420 int sys_link (CONST char *existing, CONST char *new); 431 int sys_link (const char *existing, const char *new);
421 #endif 432 #endif
422 #if defined (ENCAPSULATE_LINK) && !defined (DONT_ENCAPSULATE) 433 #if defined (ENCAPSULATE_LINK) && !defined (DONT_ENCAPSULATE)
423 # undef link 434 # undef link
424 # define link sys_link 435 # define link sys_link
425 #endif 436 #endif
426 #if !defined (ENCAPSULATE_LINK) && defined (DONT_ENCAPSULATE) 437 #if !defined (ENCAPSULATE_LINK) && defined (DONT_ENCAPSULATE)
427 # define sys_link link 438 # define sys_link link
428 #endif 439 #endif
429 440
430 #ifdef ENCAPSULATE_RENAME 441 #ifdef ENCAPSULATE_RENAME
431 int sys_rename (CONST char *old, CONST char *new); 442 int sys_rename (const char *old, const char *new);
432 #endif 443 #endif
433 #if defined (ENCAPSULATE_RENAME) && !defined (DONT_ENCAPSULATE) 444 #if defined (ENCAPSULATE_RENAME) && !defined (DONT_ENCAPSULATE)
434 # undef rename 445 # undef rename
435 # define rename sys_rename 446 # define rename sys_rename
436 #endif 447 #endif
437 #if !defined (ENCAPSULATE_RENAME) && defined (DONT_ENCAPSULATE) 448 #if !defined (ENCAPSULATE_RENAME) && defined (DONT_ENCAPSULATE)
438 # define sys_rename rename 449 # define sys_rename rename
439 #endif 450 #endif
440 451
441 #ifdef ENCAPSULATE_SYMLINK 452 #ifdef ENCAPSULATE_SYMLINK
442 int sys_symlink (CONST char *name1, CONST char *name2); 453 int sys_symlink (const char *name1, const char *name2);
443 #endif 454 #endif
444 #if defined (ENCAPSULATE_SYMLINK) && !defined (DONT_ENCAPSULATE) 455 #if defined (ENCAPSULATE_SYMLINK) && !defined (DONT_ENCAPSULATE)
445 # undef symlink 456 # undef symlink
446 # define symlink sys_symlink 457 # define symlink sys_symlink
447 #endif 458 #endif
448 #if !defined (ENCAPSULATE_SYMLINK) && defined (DONT_ENCAPSULATE) 459 #if !defined (ENCAPSULATE_SYMLINK) && defined (DONT_ENCAPSULATE)
449 # define sys_symlink symlink 460 # define sys_symlink symlink
450 #endif 461 #endif
451 462
452 #ifdef ENCAPSULATE_UNLINK 463 #ifdef ENCAPSULATE_UNLINK
453 int sys_unlink (CONST char *path); 464 int sys_unlink (const char *path);
454 #endif 465 #endif
455 #if defined (ENCAPSULATE_UNLINK) && !defined (DONT_ENCAPSULATE) 466 #if defined (ENCAPSULATE_UNLINK) && !defined (DONT_ENCAPSULATE)
456 # undef unlink 467 # undef unlink
457 # define unlink sys_unlink 468 # define unlink sys_unlink
458 #endif 469 #endif
459 #if !defined (ENCAPSULATE_UNLINK) && defined (DONT_ENCAPSULATE) 470 #if !defined (ENCAPSULATE_UNLINK) && defined (DONT_ENCAPSULATE)
460 # define sys_unlink unlink 471 # define sys_unlink unlink
461 #endif 472 #endif
462 473
463 #ifdef ENCAPSULATE_EXECVP 474 #ifdef ENCAPSULATE_EXECVP
464 int sys_execvp (CONST char *, char * CONST *); 475 int sys_execvp (const char *, char * const *);
465 #endif 476 #endif
466 #if defined (ENCAPSULATE_EXECVP) && !defined (DONT_ENCAPSULATE) 477 #if defined (ENCAPSULATE_EXECVP) && !defined (DONT_ENCAPSULATE)
467 # undef execvp 478 # undef execvp
468 # define execvp sys_execvp 479 # define execvp sys_execvp
469 #endif 480 #endif
470 #if !defined (ENCAPSULATE_EXECVP) && defined (DONT_ENCAPSULATE) 481 #if !defined (ENCAPSULATE_EXECVP) && defined (DONT_ENCAPSULATE)
471 # define sys_execvp execvp 482 # define sys_execvp execvp
472 #endif 483 #endif
484
485 #endif /* INCLUDED_sysfile_h_ */