os.h revision 09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#ifndef APACHE_OS_H
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define APACHE_OS_H
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define PLATFORM "Win32"
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive/*
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive * This file in included in all Apache source code. It contains definitions
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive * of facilities available on _this_ operating system (HAVE_* macros),
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars * and prototypes of OS specific functions defined in os.c
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars */
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive/* temporarily replace crypt */
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive/* char *crypt(const char *pw, const char *salt); */
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define crypt(buf,salt) (buf)
6cced120094ad0ee645247fbcdbac5dae2f5da98slive
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive/* Although DIR_TYPE is dirent (see nt/readdir.h) we need direct.h for
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive chdir() */
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#include <direct.h>
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define STATUS
51853aa2ebfdf9903a094467e1d02099f143639daaron/*#define WIN32_LEAN_AND_MEAN Now defined in project files */
51853aa2ebfdf9903a094467e1d02099f143639daaron#ifndef STRICT
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive #define STRICT
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#endif
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define CASE_BLIND_FILESYSTEM
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define NO_WRITEV
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define NO_SETSID
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define NO_USE_SIGACTION
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define NO_TIMES
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define NO_GETTIMEOFDAY
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive//#define NEED_PROCESS_H although we do, this is specially handled in ap_config.h
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define USE_LONGJMP
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define HAVE_MMAP
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define USE_MMAP_SCOREBOARD
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define MULTITHREAD
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars#define HAVE_CANONICAL_FILENAME
4a7e911a2df39170655de6ea32debfcf7e376bfaslive#define HAVE_DRIVE_LETTERS
4a7e911a2df39170655de6ea32debfcf7e376bfaslivetypedef int uid_t;
4a7e911a2df39170655de6ea32debfcf7e376bfaslivetypedef int gid_t;
f6d0bff0e95a7e6dd97f871582a1f091477c45c9larstypedef int pid_t;
f6d0bff0e95a7e6dd97f871582a1f091477c45c9larstypedef int mode_t;
f6d0bff0e95a7e6dd97f871582a1f091477c45c9larstypedef char * caddr_t;
6cced120094ad0ee645247fbcdbac5dae2f5da98slive
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars/*
a27e9e05958bc51ea09edb8d8d862fe8b125313bsliveDefine export types. API_EXPORT_NONSTD is a nasty hack to avoid having to declare
a27e9e05958bc51ea09edb8d8d862fe8b125313bsliveevery configuration function as __stdcall.
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive*/
4a7e911a2df39170655de6ea32debfcf7e376bfaslive
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#ifdef SHARED_MODULE
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive# define API_VAR_EXPORT __declspec(dllimport)
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive# define API_EXPORT(type) __declspec(dllimport) type __stdcall
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive# define API_EXPORT_NONSTD(type) __declspec(dllimport) type
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#else
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive# define API_VAR_EXPORT __declspec(dllexport)
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive# define API_EXPORT(type) __declspec(dllexport) type __stdcall
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive# define API_EXPORT_NONSTD(type) __declspec(dllexport) type
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#endif
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define MODULE_VAR_EXPORT __declspec(dllexport)
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define strcasecmp(s1, s2) stricmp(s1, s2)
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define lstat(x, y) stat(x, y)
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars#define S_ISLNK(m) (0)
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars#define S_ISREG(m) ((m & _S_IFREG) == _S_IFREG)
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars#ifndef S_ISDIR
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars#define S_ISDIR(m) (((m) & S_IFDIR) == S_IFDIR)
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars#endif
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars#ifndef S_ISREG
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive#define S_ISREG(m) (((m)&(S_IFREG)) == (S_IFREG))
6cced120094ad0ee645247fbcdbac5dae2f5da98slive#endif
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars#define STDIN_FILENO 0
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define STDOUT_FILENO 1
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define STDERR_FILENO 2
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define JMP_BUF jmp_buf
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define sleep(t) Sleep(t*1000)
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define O_CREAT _O_CREAT
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars#define O_RDWR _O_RDWR
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define SIGPIPE 17
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive/* Seems Windows is not a subgenius */
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define NO_SLACK
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#include <stddef.h>
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define NO_OTHER_CHILD
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define NO_RELIABLE_PIPED_LOGS
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive__inline int ap_os_is_path_absolute(const char *file)
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive{
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive /* For now, just do the same check that http_request.c and mod_alias.c
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive * do.
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive */
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive return file[0] == '/' || file[1] == ':';
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars}
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars#define stat(f,ps) os_stat(f,ps)
f6d0bff0e95a7e6dd97f871582a1f091477c45c9larsAPI_EXPORT(int) os_stat(const char *szPath,struct stat *pStat);
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars
f6d0bff0e95a7e6dd97f871582a1f091477c45c9larsAPI_EXPORT(int) os_strftime(char *s, size_t max, const char *format, const struct tm *tm);
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive
6cced120094ad0ee645247fbcdbac5dae2f5da98slive#define _spawnv(mode,cmdname,argv) os_spawnv(mode,cmdname,argv)
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars#define spawnv(mode,cmdname,argv) os_spawnv(mode,cmdname,argv)
a27e9e05958bc51ea09edb8d8d862fe8b125313bsliveAPI_EXPORT(int) os_spawnv(int mode,const char *cmdname,const char *const *argv);
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive#define _spawnve(mode,cmdname,argv,envp) os_spawnve(mode,cmdname,argv,envp)
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars#define spawnve(mode,cmdname,argv,envp) os_spawnve(mode,cmdname,argv,envp)
f6d0bff0e95a7e6dd97f871582a1f091477c45c9larsAPI_EXPORT(int) os_spawnve(int mode,const char *cmdname,const char *const *argv,const char *const *envp);
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars#define _spawnle os_spawnle
f6d0bff0e95a7e6dd97f871582a1f091477c45c9lars#define spawnle os_spawnle
a27e9e05958bc51ea09edb8d8d862fe8b125313bsliveAPI_EXPORT(int) os_spawnle(int mode,const char *cmdname,...);
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive/* OS-dependent filename routines in util_win32.c */
a27e9e05958bc51ea09edb8d8d862fe8b125313bslive
a27e9e05958bc51ea09edb8d8d862fe8b125313bsliveAPI_EXPORT(int) ap_os_is_filename_valid(const char *file);
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive/* Abstractions for dealing with shared object files (DLLs on Win32).
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive * These are used by mod_so.c
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive */
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive#define ap_os_dso_handle_t HINSTANCE
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive#define ap_os_dso_init()
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive#define ap_os_dso_load(l) LoadLibraryEx(l, NULL, LOAD_WITH_ALTERED_SEARCH_PATH)
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive#define ap_os_dso_unload(l) FreeLibrary(l)
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive#define ap_os_dso_sym(h,s) GetProcAddress(h,s)
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive#define ap_os_dso_error() "" /* for now */
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive/* Other ap_os_ routines not used by this platform */
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive#define ap_os_kill(pid, sig) kill(pid, sig)
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive#endif /* ! APACHE_OS_H */
222f0f03c2f9ee6343c18f80f0cb6e9aad21bc58slive