[BACK]Return to compat.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / sudo

Diff for /src/usr.bin/sudo/Attic/compat.h between version 1.7 and 1.8

version 1.7, 2003/04/19 21:57:17 version 1.8, 2004/09/28 15:10:50
Line 1 
Line 1 
 /*  /*
  * Copyright (c) 1996, 1998-2003 Todd C. Miller <Todd.Miller@courtesan.com>   * Copyright (c) 1996, 1998-2004 Todd C. Miller <Todd.Miller@courtesan.com>
  * All rights reserved.  
  *   *
  * Redistribution and use in source and binary forms, with or without   * Permission to use, copy, modify, and distribute this software for any
  * modification, are permitted provided that the following conditions   * purpose with or without fee is hereby granted, provided that the above
  * are met:   * copyright notice and this permission notice appear in all copies.
  *   *
  * 1. Redistributions of source code must retain the above copyright   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  *    notice, this list of conditions and the following disclaimer.   * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
    * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *   *
  * 2. Redistributions in binary form must reproduce the above copyright  
  *    notice, this list of conditions and the following disclaimer in the  
  *    documentation and/or other materials provided with the distribution.  
  *  
  * 3. The name of the author may not be used to endorse or promote products  
  *    derived from this software without specific prior written permission.  
  *  
  * 4. Products derived from this software may not be called "Sudo" nor  
  *    may "Sudo" appear in their names without specific prior written  
  *    permission from the author.  
  *  
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,  
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY  
  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL  
  * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  
  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  
  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;  
  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,  
  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR  
  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF  
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
  *  
  * Sponsored in part by the Defense Advanced Research Projects   * Sponsored in part by the Defense Advanced Research Projects
  * Agency (DARPA) and Air Force Research Laboratory, Air Force   * Agency (DARPA) and Air Force Research Laboratory, Air Force
  * Materiel Command, USAF, under agreement number F39502-99-1-0512.   * Materiel Command, USAF, under agreement number F39502-99-1-0512.
  *   *
  * $Sudo: compat.h,v 1.67 2003/04/16 00:42:09 millert Exp $   * $Sudo: compat.h,v 1.80 2004/09/10 16:31:15 millert Exp $
  */   */
   
 #ifndef _SUDO_COMPAT_H  #ifndef _SUDO_COMPAT_H
Line 55 
Line 37 
 #endif /* __P */  #endif /* __P */
   
 /*  /*
  * Some systems (ie ISC V/386) do not define MAXPATHLEN even in param.h   * Some systems lack full limit definitions.
  */   */
 #ifndef MAXPATHLEN  #ifndef OPEN_MAX
 # define MAXPATHLEN             1024  # define OPEN_MAX       256
 #endif  #endif
   
 /*  #ifndef INT_MAX
  * Some systems do not define MAXHOSTNAMELEN.  # define INT_MAX        0x7fffffff
  */  #endif
   
   #ifndef PATH_MAX
   # ifdef MAXPATHLEN
   #  define PATH_MAX              MAXPATHLEN
   # else
   #  ifdef _POSIX_PATH_MAX
   #   define PATH_MAX             _POSIX_PATH_MAX
   #  else
   #   define PATH_MAX             1024
   #  endif
   # endif
   #endif
   
 #ifndef MAXHOSTNAMELEN  #ifndef MAXHOSTNAMELEN
 # define MAXHOSTNAMELEN         64  # define MAXHOSTNAMELEN         64
 #endif  #endif
   
 /*  /*
  * 4.2BSD lacks FD_* macros (we only use FD_SET and FD_ZERO)  
  */  
 #ifndef FD_SETSIZE  
 # define FD_SET(fd, fds)        ((fds) -> fds_bits[0] |= (1 << (fd)))  
 # define FD_ZERO(fds)           ((fds) -> fds_bits[0] = 0)  
 #endif /* !FD_SETSIZE */  
   
 /*  
  * Posix versions for those without...   * Posix versions for those without...
  */   */
 #ifndef _S_IFMT  #ifndef _S_IFMT
Line 106 
Line 93 
 #endif /* S_IRWXU */  #endif /* S_IRWXU */
   
 /*  /*
  * In case this is not defined in <sys/types.h> or <sys/select.h>  
  */  
 #ifndef howmany  
 # define howmany(x, y)  (((x) + ((y) - 1)) / (y))  
 #endif  
   
 /*  
  * These should be defined in <unistd.h> but not everyone has them.   * These should be defined in <unistd.h> but not everyone has them.
  */   */
 #ifndef STDIN_FILENO  #ifndef STDIN_FILENO
Line 224 
Line 204 
 #endif  #endif
   
 /*  /*
  * HP-UX 9.x has RLIMIT_* but no RLIM_INFINITY.   * If dirfd() does not exists, hopefully dd_fd does.
  * Using -1 works because we only check for RLIM_INFINITY and do not set it.  
  */   */
 #ifndef RLIM_INFINITY  #if !defined(HAVE_DIRFD) && defined(HAVE_DD_FD)
 # define RLIM_INFINITY  (-1)  # define dirfd(_d)      ((_d)->dd_fd)
   # define HAVE_DIRFD
 #endif  #endif
   
 /*  /*
    * Define futimes() in terms of futimesat() if needed.
    */
   #if !defined(HAVE_FUTIMES) && defined(HAVE_FUTIMESAT)
   # define futimes(_f, _tv)       futimesat(_f, NULL, _tv)
   # define HAVE_FUTIMES
   #endif
   
   /*
  * If we lack getprogname(), emulate with __progname if possible.   * If we lack getprogname(), emulate with __progname if possible.
  * Otherwise, add a prototype for use with our own getprogname.c.   * Otherwise, add a prototype for use with our own getprogname.c.
  */   */
Line 243 
Line 231 
 const char *getprogname __P((void));  const char *getprogname __P((void));
 #endif /* HAVE___PROGNAME */  #endif /* HAVE___PROGNAME */
 #endif /* !HAVE_GETPROGNAME */  #endif /* !HAVE_GETPROGNAME */
   
   #ifndef HAVE_TIMESPEC
   struct timespec {
       time_t      tv_sec;
       long        tv_nsec;
   };
   #endif /* !HAVE_TIMESPEC */
   
   #ifndef timespecclear
   # define timespecclear(ts)      (ts)->tv_sec = (ts)->tv_nsec = 0
   #endif
   #ifndef timespecisset
   # define timespecisset(ts)      ((ts)->tv_sec || (ts)->tv_nsec)
   #endif
   #ifndef timespecsub
   # define timespecsub(minuend, subrahend, difference)                           \
       do {                                                                       \
               (difference)->tv_sec = (minuend)->tv_sec - (subrahend)->tv_sec;    \
               (difference)->tv_nsec = (minuend)->tv_nsec - (subrahend)->tv_nsec; \
               if ((difference)->tv_nsec < 0) {                                   \
                       (difference)->tv_nsec += 1000000000L;                      \
                       (difference)->tv_sec--;                                    \
               }                                                                  \
       } while (0)
   #endif
   
 #endif /* _SUDO_COMPAT_H */  #endif /* _SUDO_COMPAT_H */

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8