xref: /onnv-gate/usr/src/cmd/ssh/include/bsd-misc.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * Copyright (c) 1999-2000 Damien Miller.  All rights reserved.
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
5*0Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
6*0Sstevel@tonic-gate  * are met:
7*0Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
8*0Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
9*0Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
10*0Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
11*0Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
12*0Sstevel@tonic-gate  *
13*0Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14*0Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15*0Sstevel@tonic-gate  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16*0Sstevel@tonic-gate  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17*0Sstevel@tonic-gate  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18*0Sstevel@tonic-gate  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19*0Sstevel@tonic-gate  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20*0Sstevel@tonic-gate  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21*0Sstevel@tonic-gate  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22*0Sstevel@tonic-gate  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*0Sstevel@tonic-gate  */
24*0Sstevel@tonic-gate 
25*0Sstevel@tonic-gate #ifndef	_BSD_MISC_H
26*0Sstevel@tonic-gate #define	_BSD_MISC_H
27*0Sstevel@tonic-gate 
28*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #ifdef __cplusplus
31*0Sstevel@tonic-gate extern "C" {
32*0Sstevel@tonic-gate #endif
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate 
35*0Sstevel@tonic-gate /* $Id: bsd-misc.h,v 1.6 2002/06/13 21:34:58 mouring Exp $ */
36*0Sstevel@tonic-gate 
37*0Sstevel@tonic-gate #include "config.h"
38*0Sstevel@tonic-gate 
39*0Sstevel@tonic-gate char *get_progname(char *argv0);
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate #ifndef HAVE_SETSID
42*0Sstevel@tonic-gate #define setsid() setpgrp(0, getpid())
43*0Sstevel@tonic-gate #endif /* !HAVE_SETSID */
44*0Sstevel@tonic-gate 
45*0Sstevel@tonic-gate #ifndef HAVE_SETENV
46*0Sstevel@tonic-gate int setenv(const char *name, const char *value, int overwrite);
47*0Sstevel@tonic-gate #endif /* !HAVE_SETENV */
48*0Sstevel@tonic-gate 
49*0Sstevel@tonic-gate #ifndef HAVE_SETLOGIN
50*0Sstevel@tonic-gate int setlogin(const char *name);
51*0Sstevel@tonic-gate #endif /* !HAVE_SETLOGIN */
52*0Sstevel@tonic-gate 
53*0Sstevel@tonic-gate #ifndef HAVE_INNETGR
54*0Sstevel@tonic-gate int innetgr(const char *netgroup, const char *host,
55*0Sstevel@tonic-gate             const char *user, const char *domain);
56*0Sstevel@tonic-gate #endif /* HAVE_INNETGR */
57*0Sstevel@tonic-gate 
58*0Sstevel@tonic-gate #if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID)
59*0Sstevel@tonic-gate int seteuid(uid_t euid);
60*0Sstevel@tonic-gate #endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */
61*0Sstevel@tonic-gate 
62*0Sstevel@tonic-gate #if !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID)
63*0Sstevel@tonic-gate int setegid(uid_t egid);
64*0Sstevel@tonic-gate #endif /* !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) */
65*0Sstevel@tonic-gate 
66*0Sstevel@tonic-gate #if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) && defined(HAVE_SYS_NERR)
67*0Sstevel@tonic-gate const char *strerror(int e);
68*0Sstevel@tonic-gate #endif
69*0Sstevel@tonic-gate 
70*0Sstevel@tonic-gate 
71*0Sstevel@tonic-gate #ifndef HAVE_UTIMES
72*0Sstevel@tonic-gate #ifndef HAVE_STRUCT_TIMEVAL
73*0Sstevel@tonic-gate struct timeval {
74*0Sstevel@tonic-gate 	long tv_sec;
75*0Sstevel@tonic-gate 	long tv_usec;
76*0Sstevel@tonic-gate }
77*0Sstevel@tonic-gate #endif /* HAVE_STRUCT_TIMEVAL */
78*0Sstevel@tonic-gate 
79*0Sstevel@tonic-gate int utimes(char *filename, struct timeval *tvp);
80*0Sstevel@tonic-gate #endif /* HAVE_UTIMES */
81*0Sstevel@tonic-gate 
82*0Sstevel@tonic-gate #ifndef HAVE_TRUNCATE
83*0Sstevel@tonic-gate int truncate (const char *path, off_t length);
84*0Sstevel@tonic-gate #endif /* HAVE_TRUNCATE */
85*0Sstevel@tonic-gate 
86*0Sstevel@tonic-gate #if !defined(HAVE_SETGROUPS) && defined(SETGROUPS_NOOP)
87*0Sstevel@tonic-gate int setgroups(size_t size, const gid_t *list);
88*0Sstevel@tonic-gate #endif
89*0Sstevel@tonic-gate 
90*0Sstevel@tonic-gate #ifdef __cplusplus
91*0Sstevel@tonic-gate }
92*0Sstevel@tonic-gate #endif
93*0Sstevel@tonic-gate 
94*0Sstevel@tonic-gate #endif /* _BSD_MISC_H */
95