os.h revision 87e0da4e1eabf35b0b2a48a9290c5e725854de8f
b5d34bc3082c1164ce20df48567d192e3e9f229fjim/* ====================================================================
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * The Apache Software License, Version 1.1
b5d34bc3082c1164ce20df48567d192e3e9f229fjim *
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * Copyright (c) 2000 The Apache Software Foundation. All rights
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * reserved.
b5d34bc3082c1164ce20df48567d192e3e9f229fjim *
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * Redistribution and use in source and binary forms, with or without
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * modification, are permitted provided that the following conditions
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * are met:
b5d34bc3082c1164ce20df48567d192e3e9f229fjim *
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * 1. Redistributions of source code must retain the above copyright
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * notice, this list of conditions and the following disclaimer.
b5d34bc3082c1164ce20df48567d192e3e9f229fjim *
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * 2. Redistributions in binary form must reproduce the above copyright
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * notice, this list of conditions and the following disclaimer in
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * the documentation and/or other materials provided with the
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * distribution.
b5d34bc3082c1164ce20df48567d192e3e9f229fjim *
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * 3. The end-user documentation included with the redistribution,
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * if any, must include the following acknowledgment:
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * "This product includes software developed by the
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * Apache Software Foundation (http://www.apache.org/)."
a231b4cbdf1bd3d65dc13ead8d8a4f7e8b307314pquerna * Alternately, this acknowledgment may appear in the software itself,
a231b4cbdf1bd3d65dc13ead8d8a4f7e8b307314pquerna * if and wherever such third-party acknowledgments normally appear.
a231b4cbdf1bd3d65dc13ead8d8a4f7e8b307314pquerna *
a231b4cbdf1bd3d65dc13ead8d8a4f7e8b307314pquerna * 4. The names "Apache" and "Apache Software Foundation" must
a231b4cbdf1bd3d65dc13ead8d8a4f7e8b307314pquerna * not be used to endorse or promote products derived from this
a231b4cbdf1bd3d65dc13ead8d8a4f7e8b307314pquerna * software without prior written permission. For written
a231b4cbdf1bd3d65dc13ead8d8a4f7e8b307314pquerna * permission, please contact apache@apache.org.
b5d34bc3082c1164ce20df48567d192e3e9f229fjim *
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * 5. Products derived from this software may not be called "Apache",
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * nor may "Apache" appear in their name, without prior written
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * permission of the Apache Software Foundation.
b5d34bc3082c1164ce20df48567d192e3e9f229fjim *
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * SUCH DAMAGE.
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * ====================================================================
b5d34bc3082c1164ce20df48567d192e3e9f229fjim *
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * This software consists of voluntary contributions made by many
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * individuals on behalf of the Apache Software Foundation. For more
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * information on the Apache Software Foundation, please see
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * <http://www.apache.org/>.
b5d34bc3082c1164ce20df48567d192e3e9f229fjim *
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * Portions of this software are based upon public domain software
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * originally written at the National Center for Supercomputing Applications,
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * University of Illinois, Urbana-Champaign.
b5d34bc3082c1164ce20df48567d192e3e9f229fjim */
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#ifndef APACHE_OS_H
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define APACHE_OS_H
b5d34bc3082c1164ce20df48567d192e3e9f229fjim/*
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * Compile the server including all the Windows NT 4.0 header files by
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * default. We still want the server to run on Win95/98 so use
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * runtime checks before calling NT specific functions to verify we are
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * really running on an NT system.
b5d34bc3082c1164ce20df48567d192e3e9f229fjim *
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * Delegate windows include to the apr.h header, if USER or GDI declarations
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * are required (for a window rather than console application), include
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * windows.h prior to any other Apache header files.
b5d34bc3082c1164ce20df48567d192e3e9f229fjim */
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#ifndef _WIN32
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define _WIN32
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#endif
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#include "apr_general.h"
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#include <process.h>
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#include <malloc.h>
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#include <io.h>
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#include <fcntl.h>
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define PLATFORM "Win32"
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim/*
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * This file in included in all Apache source code. It contains definitions
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * of facilities available on _this_ operating system (HAVE_* macros),
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * and prototypes of OS specific functions defined in os.c
b5d34bc3082c1164ce20df48567d192e3e9f229fjim */
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim/* temporarily replace crypt */
b5d34bc3082c1164ce20df48567d192e3e9f229fjim/* char *crypt(const char *pw, const char *salt); */
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define crypt(buf,salt) (buf)
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim/* Although DIR_TYPE is dirent (see nt/readdir.h) we need direct.h for
b5d34bc3082c1164ce20df48567d192e3e9f229fjim chdir() */
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#include <direct.h>
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define STATUS
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#ifndef STRICT
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define STRICT
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#endif
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define CASE_BLIND_FILESYSTEM
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define NO_WRITEV
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define NO_USE_SIGACTION
b5d34bc3082c1164ce20df48567d192e3e9f229fjim/* #undef HAVE_TIMES */
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define USE_LONGJMP
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define HAVE_MMAP
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define USE_MMAP_SCOREBOARD
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define HAVE_CANONICAL_FILENAME
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define HAVE_DRIVE_LETTERS
a84a6c5a1f176c4fc6ccbc1183dc7c9f401e18f1pquerna#define HAVE_SENDFILE
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjimtypedef int uid_t;
b5d34bc3082c1164ce20df48567d192e3e9f229fjimtypedef int gid_t;
b5d34bc3082c1164ce20df48567d192e3e9f229fjimtypedef int pid_t;
b5d34bc3082c1164ce20df48567d192e3e9f229fjimtypedef int mode_t;
b5d34bc3082c1164ce20df48567d192e3e9f229fjimtypedef char * caddr_t;
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define HAVE_MEMMOVE
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define HAVE_STRCASECMP
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define HAVE_STRNCASECMP
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define HAVE_STRERROR
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define HAVE_STRDUP
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define HAVE_STRSTR
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define strcasecmp(s1, s2) stricmp(s1, s2)
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define HAVE_SYS_STAT_H
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define lstat(x, y) stat(x, y)
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define S_ISLNK(m) (0)
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define S_ISREG(m) ((m & _S_IFREG) == _S_IFREG)
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#ifndef S_ISDIR
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define S_ISDIR(m) (((m) & S_IFDIR) == S_IFDIR)
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#endif
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define STDIN_FILENO 0
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define STDOUT_FILENO 1
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define STDERR_FILENO 2
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define JMP_BUF jmp_buf
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define O_CREAT _O_CREAT
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define O_RDWR _O_RDWR
b5d34bc3082c1164ce20df48567d192e3e9f229fjim/* Seems Windows is not a subgenius */
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define NO_SLACK
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#include <stddef.h>
a84a6c5a1f176c4fc6ccbc1183dc7c9f401e18f1pquerna
b5d34bc3082c1164ce20df48567d192e3e9f229fjim__inline int ap_os_is_path_absolute(const char *file)
b5d34bc3082c1164ce20df48567d192e3e9f229fjim{
b5d34bc3082c1164ce20df48567d192e3e9f229fjim /* For now, just do the same check that http_request.c and mod_alias.c
b5d34bc3082c1164ce20df48567d192e3e9f229fjim * do.
b5d34bc3082c1164ce20df48567d192e3e9f229fjim */
b5d34bc3082c1164ce20df48567d192e3e9f229fjim return file[0] == '/' || file[1] == ':';
b5d34bc3082c1164ce20df48567d192e3e9f229fjim}
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim/* OS-dependent filename routines in util_win32.c */
b5d34bc3082c1164ce20df48567d192e3e9f229fjimAPI_EXPORT(char *) ap_os_canonical_filename(ap_pool_t *p, const char *file);
b5d34bc3082c1164ce20df48567d192e3e9f229fjimAPI_EXPORT(char *) ap_os_case_canonical_filename(ap_pool_t *pPool, const char *szFile);
b5d34bc3082c1164ce20df48567d192e3e9f229fjimAPI_EXPORT(char *) ap_os_systemcase_filename(ap_pool_t *pPool, const char *szFile);
b5d34bc3082c1164ce20df48567d192e3e9f229fjimAPI_EXPORT(int) ap_os_is_filename_valid(const char *file);
b5d34bc3082c1164ce20df48567d192e3e9f229fjimAPI_EXPORT(int) os_strftime(char *, size_t , const char *, const struct tm *);
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define ap_os_dso_error() "" /* for now */
b5d34bc3082c1164ce20df48567d192e3e9f229fjim/* Other ap_os_ routines not used by this platform */
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#define ap_os_kill(pid, sig) kill(pid, sig)
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjimtypedef void thread;
b5d34bc3082c1164ce20df48567d192e3e9f229fjimtypedef void event;
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim
b5d34bc3082c1164ce20df48567d192e3e9f229fjim#endif /* ! APACHE_OS_H */
b5d34bc3082c1164ce20df48567d192e3e9f229fjim