- dtucker@cvs.openbsd.org 2010/01/09 05:17:00
[openssh-git.git] / openbsd-compat / bsd-misc.h
blobb61ec42449352e204add4369acdd188961ff656c
1 /* $Id: bsd-misc.h,v 1.18 2005/02/25 23:07:38 dtucker Exp $ */
3 /*
4 * Copyright (c) 1999-2004 Damien Miller <djm@mindrot.org>
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.
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.
19 #ifndef _BSD_MISC_H
20 #define _BSD_MISC_H
22 #include "includes.h"
24 char *ssh_get_progname(char *);
26 #ifndef HAVE_SETSID
27 #define setsid() setpgrp(0, getpid())
28 #endif /* !HAVE_SETSID */
30 #ifndef HAVE_SETENV
31 int setenv(const char *, const char *, int);
32 #endif /* !HAVE_SETENV */
34 #ifndef HAVE_SETLOGIN
35 int setlogin(const char *);
36 #endif /* !HAVE_SETLOGIN */
38 #ifndef HAVE_INNETGR
39 int innetgr(const char *, const char *, const char *, const char *);
40 #endif /* HAVE_INNETGR */
42 #if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID)
43 int seteuid(uid_t);
44 #endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */
46 #if !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID)
47 int setegid(uid_t);
48 #endif /* !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) */
50 #if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) && defined(HAVE_SYS_NERR)
51 const char *strerror(int);
52 #endif
55 #ifndef HAVE_UTIMES
56 #ifndef HAVE_STRUCT_TIMEVAL
57 struct timeval {
58 long tv_sec;
59 long tv_usec;
61 #endif /* HAVE_STRUCT_TIMEVAL */
63 int utimes(char *, struct timeval *);
64 #endif /* HAVE_UTIMES */
66 #ifndef HAVE_TRUNCATE
67 int truncate (const char *, off_t);
68 #endif /* HAVE_TRUNCATE */
70 #if !defined(HAVE_NANOSLEEP) && !defined(HAVE_NSLEEP)
71 #ifndef HAVE_STRUCT_TIMESPEC
72 struct timespec {
73 time_t tv_sec;
74 long tv_nsec;
76 #endif
77 int nanosleep(const struct timespec *, struct timespec *);
78 #endif
80 #ifndef HAVE_TCGETPGRP
81 pid_t tcgetpgrp(int);
82 #endif
84 #ifndef HAVE_TCSENDBREAK
85 int tcsendbreak(int, int);
86 #endif
88 #ifndef HAVE_UNSETENV
89 void unsetenv(const char *);
90 #endif
92 /* wrapper for signal interface */
93 typedef void (*mysig_t)(int);
94 mysig_t mysignal(int sig, mysig_t act);
96 #define signal(a,b) mysignal(a,b)
98 #endif /* _BSD_MISC_H */