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