Update and clean Tomato RAF files
[tomato.git] / release / src / router / pptpd / compat.h
blobd176f98b26bf9bca1516e5179fbe2e9c68f2ff71
1 /*
2 * compat.h
4 * Compatibility functions for different OSes (prototypes)
6 * $Id: compat.h,v 1.5 2005/01/05 11:01:51 quozl Exp $
7 */
9 #ifndef _PPTPD_COMPAT_H
10 #define _PPTPD_COMPAT_H
12 #if HAVE_CONFIG_H
13 #include "config.h"
14 #endif
16 #if HAVE_SETSID
17 #define SETSIDPGRP setsid
18 #else
19 #define SETSIDPGRP setpgrp
20 #endif
22 #include <sys/types.h>
24 #ifndef HAVE_STRLCPY
25 /* void since to be fast and portable, we use strncpy, but this
26 * means we don't know how many bytes were copied
28 extern void strlcpy(char *dst, const char *src, size_t size);
29 #endif /* !HAVE_STRLCPY */
31 #ifndef HAVE_MEMMOVE
32 extern void *memmove(void *dst, const void *src, size_t size);
33 #endif /* !HAVE_MEMMOVE */
35 #ifndef HAVE_OPENPTY
36 /* Originally from code by C. S. Ananian */
38 /* These are the Linux values - and fairly sane defaults.
39 * Since we search from the start and just skip errors, they'll do.
40 * Note that Unix98 has an openpty() call so we don't need to worry
41 * about the new pty names here.
43 #define PTYDEV "/dev/ptyxx"
44 #define TTYDEV "/dev/ttyxx"
45 #define PTYMAX 11
46 #define TTYMAX 11
47 #define PTYCHAR1 "pqrstuvwxyzabcde"
48 #define PTYCHAR2 "0123456789abcdef"
50 /* Dummy the last 2 args, so we don't have to find the right include
51 * files on every OS to define the needed structures.
53 extern int openpty(int *, int *, char *, void *, void *);
54 #endif /* !HAVE_OPENPTY */
56 #ifndef HAVE_STRERROR
57 extern char *strerror(int);
58 #endif
60 extern void my_setproctitle(int argc, char **argv, const char *format, ...)
61 __attribute__ ((format (printf, 3, 4)));
63 /* signal to pipe delivery implementation */
65 /* create a signal pipe, returns 0 for success, -1 with errno for failure */
66 int sigpipe_create();
68 /* generic handler for signals, writes signal number to pipe */
69 void sigpipe_handler(int signum);
71 /* assign a signal number to the pipe */
72 void sigpipe_assign(int signum);
74 /* return the signal pipe read file descriptor for select(2) */
75 int sigpipe_fd();
77 /* read and return the pending signal from the pipe */
78 int sigpipe_read();
80 void sigpipe_close();
82 #endif /* !_PPTPD_COMPAT_H */