1 /* $Id: bsd-misc.h,v 1.25 2013/08/04 11:48:41 dtucker Exp $ */ 2 3 /* 4 * Copyright (c) 1999-2004 Damien Miller <djm@mindrot.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #ifndef _BSD_MISC_H 20 #define _BSD_MISC_H 21 22 #include "includes.h" 23 __RCSID("$FreeBSD$"); 24 25 char *ssh_get_progname(char *); 26 27 #ifndef HAVE_SETSID 28 #define setsid() setpgrp(0, getpid()) 29 #endif /* !HAVE_SETSID */ 30 31 #ifndef HAVE_SETENV 32 int setenv(const char *, const char *, int); 33 #endif /* !HAVE_SETENV */ 34 35 #ifndef HAVE_SETLOGIN 36 int setlogin(const char *); 37 #endif /* !HAVE_SETLOGIN */ 38 39 #ifndef HAVE_INNETGR 40 int innetgr(const char *, const char *, const char *, const char *); 41 #endif /* HAVE_INNETGR */ 42 43 #if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) 44 int seteuid(uid_t); 45 #endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */ 46 47 #if !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) 48 int setegid(uid_t); 49 #endif /* !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) */ 50 51 #if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) && defined(HAVE_SYS_NERR) 52 const char *strerror(int); 53 #endif 54 55 #if !defined(HAVE_SETLINEBUF) 56 #define setlinebuf(a) (setvbuf((a), NULL, _IOLBF, 0)) 57 #endif 58 59 #ifndef HAVE_UTIMES 60 #ifndef HAVE_STRUCT_TIMEVAL 61 struct timeval { 62 long tv_sec; 63 long tv_usec; 64 } 65 #endif /* HAVE_STRUCT_TIMEVAL */ 66 67 int utimes(char *, struct timeval *); 68 #endif /* HAVE_UTIMES */ 69 70 #ifndef HAVE_TRUNCATE 71 int truncate (const char *, off_t); 72 #endif /* HAVE_TRUNCATE */ 73 74 #if !defined(HAVE_NANOSLEEP) && !defined(HAVE_NSLEEP) 75 #ifndef HAVE_STRUCT_TIMESPEC 76 struct timespec { 77 time_t tv_sec; 78 long tv_nsec; 79 }; 80 #endif 81 int nanosleep(const struct timespec *, struct timespec *); 82 #endif 83 84 #ifndef HAVE_USLEEP 85 int usleep(unsigned int useconds); 86 #endif 87 88 #ifndef HAVE_TCGETPGRP 89 pid_t tcgetpgrp(int); 90 #endif 91 92 #ifndef HAVE_TCSENDBREAK 93 int tcsendbreak(int, int); 94 #endif 95 96 #ifndef HAVE_UNSETENV 97 int unsetenv(const char *); 98 #endif 99 100 /* wrapper for signal interface */ 101 typedef void (*mysig_t)(int); 102 mysig_t mysignal(int sig, mysig_t act); 103 104 #define signal(a,b) mysignal(a,b) 105 106 #ifndef HAVE_ISBLANK 107 int isblank(int); 108 #endif 109 110 #ifndef HAVE_GETPGID 111 pid_t getpgid(pid_t); 112 #endif 113 114 #ifndef HAVE_ENDGRENT 115 # define endgrent() do { } while (0) 116 #endif 117 118 #ifndef HAVE_KRB5_GET_ERROR_MESSAGE 119 # define krb5_get_error_message krb5_get_err_text 120 #endif 121 122 #ifndef HAVE_KRB5_FREE_ERROR_MESSAGE 123 # define krb5_free_error_message(a,b) do { } while(0) 124 #endif 125 126 #endif /* _BSD_MISC_H */ 127