bsd-cygwin_util.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (c) 2000, 2001, 2011, 2013 Corinna Vinschen <vinschen@redhat.com>
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. *
  13. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  14. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  15. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  16. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  17. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  18. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  19. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  20. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  21. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  22. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. *
  24. * Created: Sat Sep 02 12:17:00 2000 cv
  25. *
  26. * This file contains functions for forcing opened file descriptors to
  27. * binary mode on Windows systems.
  28. */
  29. #ifndef _BSD_CYGWIN_UTIL_H
  30. #define _BSD_CYGWIN_UTIL_H
  31. #ifdef HAVE_CYGWIN
  32. #undef ERROR
  33. /* Avoid including windows headers. */
  34. typedef void *HANDLE;
  35. #define INVALID_HANDLE_VALUE ((HANDLE) -1)
  36. #define DNLEN 16
  37. #define UNLEN 256
  38. /* Cygwin functions for which declarations are only available when including
  39. windows headers, so we have to define them here explicitly. */
  40. extern HANDLE cygwin_logon_user (const struct passwd *, const char *);
  41. extern void cygwin_set_impersonation_token (const HANDLE);
  42. #include <sys/cygwin.h>
  43. #include <io.h>
  44. #define CYGWIN_SSH_PRIVSEP_USER (cygwin_ssh_privsep_user())
  45. const char *cygwin_ssh_privsep_user();
  46. int binary_open(const char *, int , ...);
  47. int check_ntsec(const char *);
  48. char **fetch_windows_environment(void);
  49. void free_windows_environment(char **);
  50. int cygwin_ug_match_pattern_list(const char *, const char *);
  51. #ifndef NO_BINARY_OPEN
  52. #define open binary_open
  53. #endif
  54. #endif /* HAVE_CYGWIN */
  55. #endif /* _BSD_CYGWIN_UTIL_H */