unistd.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* Generic unistd.h */
  2. /* $OpenLDAP$ */
  3. /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  4. *
  5. * Copyright 1998-2024 The OpenLDAP Foundation.
  6. * All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted only as authorized by the OpenLDAP
  10. * Public License.
  11. *
  12. * A copy of this license is available in file LICENSE in the
  13. * top-level directory of the distribution or, alternatively, at
  14. * <http://www.OpenLDAP.org/license.html>.
  15. */
  16. #ifndef _AC_UNISTD_H
  17. #define _AC_UNISTD_H
  18. #ifdef HAVE_SYS_TYPES_H
  19. # include <sys/types.h>
  20. #endif
  21. #ifdef HAVE_UNISTD_H
  22. # include <unistd.h>
  23. #endif
  24. #ifdef HAVE_PROCESS_H
  25. # include <process.h>
  26. #endif
  27. /* note: callers of crypt(3) should include <ac/crypt.h> */
  28. #if defined(HAVE_GETPASSPHRASE)
  29. LDAP_LIBC_F(char*)(getpassphrase)();
  30. #else
  31. #define getpassphrase(p) lutil_getpass(p)
  32. LDAP_LUTIL_F(char*)(lutil_getpass) LDAP_P((const char *getpass));
  33. #endif
  34. /* getopt() defines may be in separate include file */
  35. #ifdef HAVE_GETOPT_H
  36. # include <getopt.h>
  37. #elif !defined(HAVE_GETOPT)
  38. /* no getopt, assume we need getopt-compat.h */
  39. # error #include <getopt-compat.h>
  40. #else
  41. /* assume we need to declare these externs */
  42. LDAP_LIBC_V (char *) optarg;
  43. LDAP_LIBC_V (int) optind, opterr, optopt;
  44. #endif
  45. /* use lutil file locking */
  46. #define ldap_lockf(x) lutil_lockf(x)
  47. #define ldap_unlockf(x) lutil_unlockf(x)
  48. #include <lutil_lockf.h>
  49. /*
  50. * Windows: although sleep() will be resolved by both MSVC and Mingw GCC
  51. * linkers, the function is not declared in header files. This is
  52. * because Windows' version of the function is called Sleep(), and it
  53. * is declared in windows.h
  54. */
  55. #ifdef _WIN32
  56. #define sleep(x) Sleep((x) * 1000)
  57. #endif
  58. #endif /* _AC_UNISTD_H */