os_interface.h

00001 /*<std-header orig-src='shore' incl-file-exclusion='OS_INTERFACE_H'>
00002 
00003  $Id: os_interface.h,v 1.16 2010/05/26 01:21:27 nhall Exp $
00004 
00005 SHORE -- Scalable Heterogeneous Object REpository
00006 
00007 Copyright (c) 1994-99 Computer Sciences Department, University of
00008                       Wisconsin -- Madison
00009 All Rights Reserved.
00010 
00011 Permission to use, copy, modify and distribute this software and its
00012 documentation is hereby granted, provided that both the copyright
00013 notice and this permission notice appear in all copies of the
00014 software, derivative works or modified versions, and any portions
00015 thereof, and that both notices appear in supporting documentation.
00016 
00017 THE AUTHORS AND THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY
00018 OF WISCONSIN - MADISON ALLOW FREE USE OF THIS SOFTWARE IN ITS
00019 "AS IS" CONDITION, AND THEY DISCLAIM ANY LIABILITY OF ANY KIND
00020 FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
00021 
00022 This software was developed with support by the Advanced Research
00023 Project Agency, ARPA order number 018 (formerly 8230), monitored by
00024 the U.S. Army Research Laboratory under contract DAAB07-91-C-Q518.
00025 Further funding for this work was provided by DARPA through
00026 Rome Research Laboratory Contract No. F30602-97-2-0247.
00027 
00028 */
00029 
00030 #ifndef OS_INTERFACE_H
00031 #define OS_INTERFACE_H
00032 
00033 #include "w_defines.h"
00034 
00035 /*  -- do not edit anything above this line --   </std-header>*/
00036 
00037 
00038 /*
00039  *   NewThreads I/O is Copyright 1995, 1996, 1997, 1998 by:
00040  *
00041  *    Josef Burger    <bolo@cs.wisc.edu>
00042  *
00043  *   All Rights Reserved.
00044  *
00045  *   NewThreads I/O may be freely used as long as credit is given
00046  *   to the above author(s) and the above copyright is maintained.
00047  */
00048 
00049 /*
00050  * Yes.  This is a giant mess.  It is a set of macros and
00051  * typedefs to provide compatability with serveral operating
00052  * systems in "Posix" mode.  It is used ONLY in places that
00053  * the details of those operating systems need to be available,
00054  * such as in the guts of the thread package.
00055  */
00056 
00057 /* This preliminary section provides exceptions to the default
00058    values that are needed in each environment. */
00059 
00060 
00061 
00062 /* The following are all the default values for the os_ stuff */
00063 #ifndef os_open
00064 #define    os_open(p,f,m)    open(p,f,m)
00065 #endif
00066 
00067 #ifndef os_close
00068 #define    os_close(d)    close(d)
00069 #endif
00070 
00071 #define    os_read(d,b,c)    read(d,b,c)
00072 #define    os_write(d,b,c)    write(d,b,c)
00073 #define    os_readv(d,v,c)    readv(d,v,c)
00074 #define    os_writev(d,v,c) writev(d,v,c)
00075 #define    os_pread(d,b,c,p)    pread(d,b,c,p)
00076 #define    os_pwrite(d,b,c,p)    pwrite(d,b,c,p)
00077 
00078 #ifndef os_lseek
00079 #define    os_lseek(d,o,w)    lseek(d,o,w)
00080 #endif
00081 
00082 #ifndef os_fstat
00083 #define    os_fstat(d,s)    fstat(d,s)
00084 #endif
00085 
00086 #ifndef os_stat
00087 #define    os_stat(f,s)    stat(f,s)
00088 #endif
00089 
00090 #ifndef os_ftruncate
00091 #define    os_ftruncate(d,s)    ftruncate(d,s)
00092 #endif
00093 
00094 #ifndef os_truncate
00095 #define    os_truncate(f,s)    truncate(f,s)
00096 #endif
00097 #ifndef os_fsync
00098 #define    os_fsync(d)    fsync(d)
00099 #endif
00100 #ifndef os_lockf
00101 #define    os_lockf(d,f,s)    lockf(d,f,s)
00102 #endif
00103 
00104 #ifndef HAVE_OS_STAT_T
00105 typedef struct stat    os_stat_t;
00106 #else
00107 #undef    HAVE_OS_STAT_T
00108 #endif
00109 
00110 
00111 #define    os_opendir(f)    opendir(f)
00112 #define    os_closedir(d)    closedir(d)
00113 
00114 // Use readdir(3).  We should implement an sthread method
00115 // readdir(), which uses readdir_r.  However, for the time being,
00116 // since it is used by the sm only to open the log (1 thread),
00117 // this is not high priority (yet).  No vas should be doing any readdir at
00118 // the same time it's constructing a storage manger. 
00119 // TODO: NANCy document this (above)
00120 #ifndef os_readdir
00121 #define    os_readdir(d)    readdir(d)
00122 #endif
00123 
00124 #ifndef HAVE_OS_DIRENT_T
00125 typedef    struct dirent    os_dirent_t;
00126 #else
00127 #undef    HAVE_OS_DIRENT_T
00128 #endif
00129 
00130 #if HAVE_DIRENT_H
00131     /* XXX something wacked with gcc 3.2 and solaris headers */
00132 #include <dirent.h>        /* XXX unconventional dirent */
00133 #else
00134 struct DIR;
00135 #endif
00136 
00137 typedef    DIR    *os_dir_t;
00138 
00139 
00140 #define    os_getrlimit(l,r)    getrlimit(l,r)
00141 #define    os_setrlimit(l,r)    setrlimit(l,r)
00142 
00143 typedef struct rlimit os_rlimit_t;
00144 
00145 /*<std-footer incl-file-exclusion='OS_INTERFACE_H'>  -- do not edit anything below this line -- */
00146 
00147 #endif          /*</std-footer>*/

Generated on Thu Dec 9 08:42:27 2010 for Shore Storage Manager by  doxygen 1.4.7