bsd-misc.h revision 323136
198937Sdes/* 2126274Sdes * Copyright (c) 1999-2004 Damien Miller <djm@mindrot.org> 398937Sdes * 4126274Sdes * Permission to use, copy, modify, and distribute this software for any 5126274Sdes * purpose with or without fee is hereby granted, provided that the above 6126274Sdes * copyright notice and this permission notice appear in all copies. 798937Sdes * 8126274Sdes * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9126274Sdes * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10126274Sdes * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11126274Sdes * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12126274Sdes * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13126274Sdes * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14126274Sdes * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1598937Sdes */ 1698937Sdes 1798937Sdes#ifndef _BSD_MISC_H 1898937Sdes#define _BSD_MISC_H 1998937Sdes 20124208Sdes#include "includes.h" 2198937Sdes 22124208Sdeschar *ssh_get_progname(char *); 2398937Sdes 2498937Sdes#ifndef HAVE_SETSID 2598937Sdes#define setsid() setpgrp(0, getpid()) 2698937Sdes#endif /* !HAVE_SETSID */ 2798937Sdes 2898937Sdes#ifndef HAVE_SETENV 29124208Sdesint setenv(const char *, const char *, int); 3098937Sdes#endif /* !HAVE_SETENV */ 3198937Sdes 3298937Sdes#ifndef HAVE_SETLOGIN 33124208Sdesint setlogin(const char *); 3498937Sdes#endif /* !HAVE_SETLOGIN */ 3598937Sdes 3698937Sdes#ifndef HAVE_INNETGR 37124208Sdesint innetgr(const char *, const char *, const char *, const char *); 3898937Sdes#endif /* HAVE_INNETGR */ 3998937Sdes 4098937Sdes#if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) 41124208Sdesint seteuid(uid_t); 4298937Sdes#endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */ 4398937Sdes 4498937Sdes#if !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) 45124208Sdesint setegid(uid_t); 4698937Sdes#endif /* !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) */ 4798937Sdes 4898937Sdes#if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) && defined(HAVE_SYS_NERR) 49124208Sdesconst char *strerror(int); 50323134Sdes#endif 5198937Sdes 52240075Sdes#if !defined(HAVE_SETLINEBUF) 53240075Sdes#define setlinebuf(a) (setvbuf((a), NULL, _IOLBF, 0)) 54240075Sdes#endif 5598937Sdes 5698937Sdes#ifndef HAVE_UTIMES 5798937Sdes#ifndef HAVE_STRUCT_TIMEVAL 5898937Sdesstruct timeval { 5998937Sdes long tv_sec; 6098937Sdes long tv_usec; 6198937Sdes} 6298937Sdes#endif /* HAVE_STRUCT_TIMEVAL */ 6398937Sdes 64124208Sdesint utimes(char *, struct timeval *); 6598937Sdes#endif /* HAVE_UTIMES */ 6698937Sdes 6798937Sdes#ifndef HAVE_TRUNCATE 68124208Sdesint truncate (const char *, off_t); 6998937Sdes#endif /* HAVE_TRUNCATE */ 7098937Sdes 71113908Sdes#if !defined(HAVE_NANOSLEEP) && !defined(HAVE_NSLEEP) 72113908Sdes#ifndef HAVE_STRUCT_TIMESPEC 73113908Sdesstruct timespec { 74113908Sdes time_t tv_sec; 75113908Sdes long tv_nsec; 76113908Sdes}; 77113908Sdes#endif 78124208Sdesint nanosleep(const struct timespec *, struct timespec *); 79113908Sdes#endif 8098937Sdes 81248619Sdes#ifndef HAVE_USLEEP 82248619Sdesint usleep(unsigned int useconds); 83248619Sdes#endif 84248619Sdes 85124208Sdes#ifndef HAVE_TCGETPGRP 86124208Sdespid_t tcgetpgrp(int); 87124208Sdes#endif 88124208Sdes 89124208Sdes#ifndef HAVE_TCSENDBREAK 90124208Sdesint tcsendbreak(int, int); 91124208Sdes#endif 92124208Sdes 93128456Sdes#ifndef HAVE_UNSETENV 94240075Sdesint unsetenv(const char *); 95128456Sdes#endif 96128456Sdes 97124208Sdes/* wrapper for signal interface */ 98124208Sdestypedef void (*mysig_t)(int); 99124208Sdesmysig_t mysignal(int sig, mysig_t act); 100124208Sdes 101124208Sdes#define signal(a,b) mysignal(a,b) 102124208Sdes 103221420Sdes#ifndef HAVE_ISBLANK 104221420Sdesint isblank(int); 105221420Sdes#endif 106221420Sdes 107248619Sdes#ifndef HAVE_GETPGID 108248619Sdespid_t getpgid(pid_t); 109248619Sdes#endif 110248619Sdes 111255767Sdes#ifndef HAVE_ENDGRENT 112294336Sdes# define endgrent() do { } while(0) 113255767Sdes#endif 114255767Sdes 115255767Sdes#ifndef HAVE_KRB5_GET_ERROR_MESSAGE 116255767Sdes# define krb5_get_error_message krb5_get_err_text 117255767Sdes#endif 118255767Sdes 119255767Sdes#ifndef HAVE_KRB5_FREE_ERROR_MESSAGE 120255767Sdes# define krb5_free_error_message(a,b) do { } while(0) 121255767Sdes#endif 122255767Sdes 123296633Sdes#ifndef HAVE_PLEDGE 124296633Sdesint pledge(const char *promises, const char *paths[]); 125296633Sdes#endif 126296633Sdes 127323129Sdes/* bsd-err.h */ 128323129Sdes#ifndef HAVE_ERR 129323129Sdesvoid err(int, const char *, ...) __attribute__((format(printf, 2, 3))); 130323129Sdes#endif 131323129Sdes#ifndef HAVE_ERRX 132323129Sdesvoid errx(int, const char *, ...) __attribute__((format(printf, 2, 3))); 133323129Sdes#endif 134323129Sdes#ifndef HAVE_WARN 135323129Sdesvoid warn(const char *, ...) __attribute__((format(printf, 1, 2))); 136323129Sdes#endif 137323129Sdes 138323136Sdes#ifndef HAVE_LLABS 139323136Sdeslong long llabs(long long); 140323136Sdes#endif 141323136Sdes 14298937Sdes#endif /* _BSD_MISC_H */ 143