bsd-misc.h revision 126274
126683Sbde/* $Id: bsd-misc.h,v 1.14 2004/02/17 05:49:55 djm Exp $ */
253550Sdillon
353550Sdillon/*
41558Srgrimes * Copyright (c) 1999-2004 Damien Miller <djm@mindrot.org>
51558Srgrimes *
653550Sdillon * Permission to use, copy, modify, and distribute this software for any
774815Sru * purpose with or without fee is hereby granted, provided that the above
81558Srgrimes * copyright notice and this permission notice appear in all copies.
926683Sbde *
1053550Sdillon * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1153550Sdillon * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1287325Sobrien * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1353550Sdillon * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1426683Sbde * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
151558Srgrimes * 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
24char *ssh_get_progname(char *);
25
26#ifndef HAVE_SETSID
27#define setsid() setpgrp(0, getpid())
28#endif /* !HAVE_SETSID */
29
30#ifndef HAVE_SETENV
31int setenv(const char *, const char *, int);
32#endif /* !HAVE_SETENV */
33
34#ifndef HAVE_SETLOGIN
35int setlogin(const char *);
36#endif /* !HAVE_SETLOGIN */
37
38#ifndef HAVE_INNETGR
39int innetgr(const char *, const char *, const char *, const char *);
40#endif /* HAVE_INNETGR */
41
42#if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID)
43int seteuid(uid_t);
44#endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */
45
46#if !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID)
47int setegid(uid_t);
48#endif /* !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) */
49
50#if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) && defined(HAVE_SYS_NERR)
51const char *strerror(int);
52#endif
53
54
55#ifndef HAVE_UTIMES
56#ifndef HAVE_STRUCT_TIMEVAL
57struct timeval {
58	long tv_sec;
59	long tv_usec;
60}
61#endif /* HAVE_STRUCT_TIMEVAL */
62
63int utimes(char *, struct timeval *);
64#endif /* HAVE_UTIMES */
65
66#ifndef HAVE_TRUNCATE
67int truncate (const char *, off_t);
68#endif /* HAVE_TRUNCATE */
69
70#if !defined(HAVE_SETGROUPS) && defined(SETGROUPS_NOOP)
71int setgroups(size_t, const gid_t *);
72#endif
73
74#if !defined(HAVE_NANOSLEEP) && !defined(HAVE_NSLEEP)
75#ifndef HAVE_STRUCT_TIMESPEC
76struct timespec {
77	time_t	tv_sec;
78	long	tv_nsec;
79};
80#endif
81int nanosleep(const struct timespec *, struct timespec *);
82#endif
83
84#ifndef HAVE_TCGETPGRP
85pid_t tcgetpgrp(int);
86#endif
87
88#ifndef HAVE_TCSENDBREAK
89int tcsendbreak(int, int);
90#endif
91
92/* wrapper for signal interface */
93typedef void (*mysig_t)(int);
94mysig_t mysignal(int sig, mysig_t act);
95
96#define signal(a,b) mysignal(a,b)
97
98#endif /* _BSD_MISC_H */
99