/****************************************************************************/ /* */ /* Onions Network Streams Library */ /* */ /* O S - D E P E N D */ /* */ /* C S p e c */ /* */ /* Copyright (C) 1997 Regents of the University of California */ /* */ /* Onions is free software; you can redistribute it and/or modify it under */ /* the terms of the GNU General Public License as published by the Free */ /* Software Foundation, with or without the single exception listed below; */ /* either version 2, or (at your option) any later version. Onions is */ /* distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;*/ /* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ /* PARTICULAR PURPOSE. See the GNU General Public License for more details.*/ /* You should have received a copy of the GNU General Public License */ /* distributed with Onions; see the file COPYING. If not, write to the */ /* Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA */ /* 02111-1307, USA. */ /* */ /* As a special exception, if other files instantiate generics from this */ /* library, or you link this library with other files to produce an */ /* executable, this library does not by itself cause the resulting */ /* executable to be covered by the GNU General Public License. This */ /* exception does not however invalidate any other reasons why the */ /* executable file might be covered by the GNU General Public License. */ /* */ /* Created in 1997 by Roy T. Fielding */ /****************************************************************************/ /* */ /* This file contains an operating system-independent interface to those */ /* C system library routines and data structures that are often system- */ /* dependent. Since Ada95 has no equivalent to the standard include files */ /* of C, we can't rely on a simple Import to match the C data structure */ /* with our Ada95 equivalent. We thus produce system-independent data */ /* structures here that can be matched (and imported) via onions-os.ads. */ /* */ #ifndef ONIONS_OS_DEPEND_H #define ONIONS_OS_DEPEND_H typedef struct { unsigned long file_mode; /* mode_t */ unsigned long file_ino; /* ino_t */ unsigned long file_dev; /* dev_t */ unsigned long file_nlink; /* nlink_t */ long file_uid; /* uid_t */ long file_gid; /* gid_t */ long file_size; /* off_t */ long file_atime; /* time_t */ long file_mtime; /* time_t */ long file_ctime; /* time_t */ } onions_statrec; int onions_stat (const char *path, onions_statrec *buf); int onions_lstat (const char *path, onions_statrec *buf); int onions_fstat (int fd, onions_statrec *buf); /* Wait up to a given number of milliseconds (0 => forever) for the file * descriptor to become readable (state == 1), writeable (state == 2), * either one, or a fatal error event occurs. Returns * -1 indicating an error, or * 0 indicating the timeout occurred, or * >0 indicating our descriptor is ready. */ int onions_wait_for_fd (int state, int fd, long millisecs); #ifdef HAVE_DIRENT_H # include # define NAMLEN(dirent) strlen((dirent)->d_name) #else # define dirent direct # define NAMLEN(dirent) (dirent)->d_namlen # ifdef HAVE_SYS_NDIR_H # include # endif # ifdef HAVE_SYS_DIR_H # include # endif # ifdef HAVE_NDIR_H # include # endif #endif #ifndef NAME_MAX # define NAME_MAX 511 #endif /* Read the already open directory pointed to by dirp and place the * next filename in the provided buffer of max length buflen. * NOTE: buflen should be at least NAME_MAX + 1. * Returns -1 on error (see errno), 0 on end-of-dir, or the length * of the filename placed in buf. */ ssize_t onions_readdir (DIR *dirp, void *buf, const size_t buflen); #endif /* ONIONS_OS_DEPEND_H */