4 * Compatibility functions for different OSes (prototypes)
6 * $Id: compat.h,v 1.5 2005/01/05 11:01:51 quozl Exp $
9 #ifndef _PPTPD_COMPAT_H
10 #define _PPTPD_COMPAT_H
17 #define SETSIDPGRP setsid
19 #define SETSIDPGRP setpgrp
22 #include <sys/types.h>
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 */
32 extern void *memmove(void *dst
, const void *src
, size_t size
);
33 #endif /* !HAVE_MEMMOVE */
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"
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 */
57 extern char *strerror(int);
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 */
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) */
77 /* read and return the pending signal from the pipe */
82 #endif /* !_PPTPD_COMPAT_H */