apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/user/win32 userinfo.c
Date Fri, 28 Dec 2001 23:50:49 GMT
wrowe       01/12/28 15:50:49

  Modified:    dso/win32 dso.c
               file_io/win32 filesys.c flock.c open.c pipe.c readwrite.c
               misc/win32 misc.c
               network_io/win32 sendrecv.c
               threadproc/win32 proc.c
               user/win32 userinfo.c
  Log:
    Substantial optimization of the os_level semantic.  Since this is entirely
    for internal consumption, and apr_initialize must be called, resolve the
    situation once and use the static, shared value for the remainder of the
    program execution.  Next step is to allow conditional builds [excluding
    older 9x paths] if the user has no interest in 9x support.
  
  Revision  Changes    Path
  1.26      +1 -2      apr/dso/win32/dso.c
  
  Index: dso.c
  ===================================================================
  RCS file: /home/cvs/apr/dso/win32/dso.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- dso.c	20 Oct 2001 17:40:31 -0000	1.25
  +++ dso.c	28 Dec 2001 23:50:48 -0000	1.26
  @@ -89,8 +89,7 @@
       UINT em;
   
   #if APR_HAS_UNICODE_FS
  -    apr_oslevel_e os_level;
  -    if (!apr_get_oslevel(ctx, &os_level) && os_level >= APR_WIN_NT) 
  +    if (apr_os_level >= APR_WIN_NT) 
       {
           apr_wchar_t wpath[APR_PATH_MAX];
           if ((rv = utf8_to_unicode_path(wpath, sizeof(wpath) 
  
  
  
  1.5       +5 -10     apr/file_io/win32/filesys.c
  
  Index: filesys.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/filesys.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- filesys.c	11 Oct 2001 13:48:59 -0000	1.4
  +++ filesys.c	28 Dec 2001 23:50:48 -0000	1.5
  @@ -97,8 +97,7 @@
   {
       apr_status_t rv;
   #if APR_HAS_UNICODE_FS
  -    apr_oslevel_e os_level;
  -    if (!apr_get_oslevel(p, &os_level) && os_level >= APR_WIN_NT)
  +    if (apr_os_level >= APR_WIN_NT)
       {
           apr_wchar_t wpath[APR_PATH_MAX];
           if (rv = utf8_to_unicode_path(wpath, sizeof(wpath) 
  @@ -121,8 +120,7 @@
   {
       char path[APR_PATH_MAX];
   #if APR_HAS_UNICODE_FS
  -    apr_oslevel_e os_level;
  -    if (!apr_get_oslevel(p, &os_level) && os_level >= APR_WIN_NT)
  +    if (apr_os_level >= APR_WIN_NT)
       {
           apr_wchar_t *ignored;
           apr_wchar_t wdrive[8];
  @@ -164,8 +162,7 @@
   apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p)
   {
   #if APR_HAS_UNICODE_FS
  -    apr_oslevel_e os_level;
  -    if (!apr_get_oslevel(p, &os_level) && os_level >= APR_WIN_NT)
  +    if (apr_os_level >= APR_WIN_NT)
       {
           apr_wchar_t *ignored;
           apr_wchar_t wpath[APR_PATH_MAX];
  @@ -204,8 +201,7 @@
   {
       char path[APR_PATH_MAX];
   #if APR_HAS_UNICODE_FS
  -    apr_oslevel_e os_level;
  -    if (!apr_get_oslevel(p, &os_level) && os_level >= APR_WIN_NT)
  +    if (apr_os_level >= APR_WIN_NT)
       {
           apr_wchar_t wpath[APR_PATH_MAX];
           apr_status_t rv;
  @@ -235,8 +231,7 @@
                                              apr_pool_t *p)
   {
   #if APR_HAS_UNICODE_FS
  -    apr_oslevel_e os_level;
  -    if (!apr_get_oslevel(p, &os_level) && os_level >= APR_WIN_NT)
  +    if (apr_os_level >= APR_WIN_NT)
       {
           apr_wchar_t wpath[APR_PATH_MAX];
           apr_status_t rv;
  
  
  
  1.7       +2 -6      apr/file_io/win32/flock.c
  
  Index: flock.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/flock.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- flock.c	13 Aug 2001 13:22:30 -0000	1.6
  +++ flock.c	28 Dec 2001 23:50:48 -0000	1.7
  @@ -56,7 +56,6 @@
   
   APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type)
   {
  -    apr_oslevel_e level;
       OVERLAPPED offset;
       DWORD flags, len = 0xffffffff;
   
  @@ -69,8 +68,7 @@
        *     the lock; something needs to be done so an APR app can
        *     recognize this as a try-again situation
        */
  -    apr_get_oslevel(NULL, &level);
  -    if (level >= APR_WIN_NT) {
  +    if (apr_os_level >= APR_WIN_NT) {
           /* Syntax is correct, len is passed for LengthLow and LengthHigh*/
           if (!LockFileEx(thefile->filehand, flags, 0, len, len, &offset))
               return apr_get_os_error();
  @@ -85,14 +83,12 @@
   
   APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile)
   {
  -    apr_oslevel_e level;
       OVERLAPPED offset;
       DWORD len = 0xffffffff;
   
       memset (&offset, 0, sizeof(offset));
   
  -    apr_get_oslevel(NULL, &level);
  -    if (level >= APR_WIN_NT) {
  +    if (apr_os_level >= APR_WIN_NT) {
           /* Syntax is correct, len is passed for LengthLow and LengthHigh*/
           if (!UnlockFileEx(thefile->filehand, 0, len, len, &offset))
               return apr_get_os_error();
  
  
  
  1.86      +5 -8      apr/file_io/win32/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/open.c,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- open.c	27 Nov 2001 02:39:19 -0000	1.85
  +++ open.c	28 Dec 2001 23:50:48 -0000	1.86
  @@ -179,7 +179,6 @@
       DWORD createflags = 0;
       DWORD attributes = 0;
       DWORD sharemode = FILE_SHARE_READ | FILE_SHARE_WRITE;
  -    apr_oslevel_e os_level;
       apr_status_t rv;
   
       if (flag & APR_READ) {
  @@ -189,7 +188,7 @@
           oflags |= GENERIC_WRITE;
       }
       
  -    if (!apr_get_oslevel(cont, &os_level) && os_level >= APR_WIN_NT) 
  +    if (apr_os_level >= APR_WIN_NT) 
           sharemode |= FILE_SHARE_DELETE;
   
       if (flag & APR_CREATE) {
  @@ -221,7 +220,7 @@
       if (flag & APR_OPENLINK) {
          attributes |= FILE_FLAG_OPEN_REPARSE_POINT;
       }
  -    if (!(flag & (APR_READ | APR_WRITE)) && (os_level >= APR_WIN_NT)) {
  +    if (!(flag & (APR_READ | APR_WRITE)) && (apr_os_level >= APR_WIN_NT))
{
           /* We once failed here, but this is how one opens 
            * a directory as a file under winnt
            */
  @@ -235,7 +234,7 @@
       }
   
   #if APR_HAS_UNICODE_FS
  -    if (os_level >= APR_WIN_NT) {
  +    if (apr_os_level >= APR_WIN_NT) {
           apr_wchar_t wfname[APR_PATH_MAX];
           if (rv = utf8_to_unicode_path(wfname, sizeof(wfname) 
                                                  / sizeof(apr_wchar_t), fname))
  @@ -326,8 +325,7 @@
   APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *cont)
   {
   #if APR_HAS_UNICODE_FS
  -    apr_oslevel_e os_level;
  -    if (!apr_get_oslevel(cont, &os_level) && os_level >= APR_WIN_NT) 
  +    if (apr_os_level >= APR_WIN_NT) 
       {
           apr_wchar_t wpath[APR_PATH_MAX];
           apr_status_t rv;
  @@ -349,8 +347,7 @@
                                             const char *topath,
                                             apr_pool_t *cont)
   {
  -    apr_oslevel_e os_level;
  -    if (!apr_get_oslevel(cont, &os_level) && os_level >= APR_WIN_NT) 
  +    if (apr_os_level >= APR_WIN_NT) 
       {
   #if APR_HAS_UNICODE_FS
           apr_wchar_t wfrompath[APR_PATH_MAX], wtopath[APR_PATH_MAX];
  
  
  
  1.40      +1 -2      apr/file_io/win32/pipe.c
  
  Index: pipe.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/pipe.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- pipe.c	16 Oct 2001 12:21:53 -0000	1.39
  +++ pipe.c	28 Dec 2001 23:50:48 -0000	1.40
  @@ -148,7 +148,6 @@
                                   BOOLEAN bAsyncRead, BOOLEAN bAsyncWrite, 
                                   apr_pool_t *p)
   {
  -    apr_oslevel_e level;
       SECURITY_ATTRIBUTES sa;
       static unsigned long id = 0;
       DWORD dwPipeMode;
  @@ -185,7 +184,7 @@
       (*out)->direction = 0;
       (*out)->pOverlapped = NULL;
   
  -    if (apr_get_oslevel(p, &level) == APR_SUCCESS && level >= APR_WIN_NT)
{
  +    if (apr_os_level >= APR_WIN_NT) {
           /* Create the read end of the pipe */
           dwOpenMode = PIPE_ACCESS_INBOUND;
           if (bAsyncRead) {
  
  
  
  1.64      +4 -4      apr/file_io/win32/readwrite.c
  
  Index: readwrite.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/readwrite.c,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- readwrite.c	27 Nov 2001 02:39:19 -0000	1.63
  +++ readwrite.c	28 Dec 2001 23:50:48 -0000	1.64
  @@ -137,8 +137,8 @@
                   break;
               }
               if (rv != APR_SUCCESS) {
  -                /* XXX CancelIo is not available on Win95 */
  -                CancelIo(file->filehand);
  +                if (apr_os_level >= APR_WIN_98)
  +                    CancelIo(file->filehand);
               }
           }
           else if (rv == APR_FROM_OS_ERROR(ERROR_BROKEN_PIPE)) {
  @@ -305,8 +305,8 @@
                           break;
                   }
                   if (rv != APR_SUCCESS) {
  -                    /* XXX CancelIo is not available on Win95 */
  -                    CancelIo(thefile->filehand);
  +                    if (apr_os_level >= APR_WIN_98)
  +                        CancelIo(thefile->filehand);
                   }
               }
           }
  
  
  
  1.6       +6 -5      apr/misc/win32/misc.c
  
  Index: misc.c
  ===================================================================
  RCS file: /home/cvs/apr/misc/win32/misc.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- misc.c	27 Nov 2001 02:31:55 -0000	1.5
  +++ misc.c	28 Dec 2001 23:50:49 -0000	1.6
  @@ -59,11 +59,12 @@
   
   apr_status_t apr_get_oslevel(apr_pool_t *cont, apr_oslevel_e *level)
   {
  -    static OSVERSIONINFO oslev;
  -    static unsigned int servpack = 0;
  -    char *pservpack;
  +    if (apr_os_level == APR_WIN_UNK) 
  +    {
  +        static OSVERSIONINFO oslev;
  +        static unsigned int servpack = 0;
  +        char *pservpack;
   
  -    if (apr_os_level == APR_WIN_UNK) {
           oslev.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
           GetVersionEx(&oslev);
           if (oslev.dwPlatformId == VER_PLATFORM_WIN32_NT) {
  @@ -114,7 +115,7 @@
           *level = apr_os_level;
           return APR_SUCCESS;
       }
  -    return APR_EEXIST;
  +    return APR_EGENERAL;
   }
   
   
  
  
  
  1.45      +1 -2      apr/network_io/win32/sendrecv.c
  
  Index: sendrecv.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/win32/sendrecv.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- sendrecv.c	20 Dec 2001 20:22:20 -0000	1.44
  +++ sendrecv.c	28 Dec 2001 23:50:49 -0000	1.45
  @@ -253,9 +253,8 @@
       TRANSMIT_FILE_BUFFERS tfb, *ptfb = NULL;
       int ptr = 0;
       int bytes_to_send = *len;   /* Bytes to send out of the file (not including headers)
*/
  -    apr_oslevel_e os_level;
   
  -    if (!apr_get_oslevel(NULL, &os_level) && os_level < APR_WIN_NT) {
  +    if (apr_os_level < APR_WIN_NT) {
           return APR_ENOTIMPL;
       }
   
  
  
  
  1.60      +4 -7      apr/threadproc/win32/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/win32/proc.c,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- proc.c	23 Oct 2001 17:56:42 -0000	1.59
  +++ proc.c	28 Dec 2001 23:50:49 -0000	1.60
  @@ -137,7 +137,7 @@
       if (original == NULL)
           return APR_SUCCESS;
   
  -    /* Can't use apr_file_dup here because it creates a non-inhertible 
  +    /* XXX: Can't use apr_file_dup here because it creates a non-inhertible 
        * handle, and apr_open_file'd apr_file_t's are non-inheritable,
        * so we must assume we need to make an inheritable handle.
        */
  @@ -290,7 +290,6 @@
                                             apr_pool_t *cont)
   {
       apr_status_t rv;
  -    apr_oslevel_e os_level;
       apr_size_t i;
       char *cmdline;
       char *pEnvBlock;
  @@ -301,8 +300,6 @@
       new->err = attr->parent_err;
       new->out = attr->parent_out;
   
  -    (void) apr_get_oslevel(cont, &os_level);
  -
       if (attr->detached) {
           /* If we are creating ourselves detached, Then we should hide the
            * window we are starting in.  And we had better redfine our
  @@ -311,7 +308,7 @@
            * not manage the stdio handles properly when running old 16
            * bit executables if the detached attribute is set.
            */
  -        if (os_level >= APR_WIN_NT) {
  +        if (apr_os_level >= APR_WIN_NT) {
               /* 
                * XXX DETACHED_PROCESS won't on Win9x at all; on NT/W2K 
                * 16 bit executables fail (MS KB: Q150956)
  @@ -389,7 +386,7 @@
               ++iEnvBlockLen;
   
   #if APR_HAS_UNICODE_FS
  -        if (os_level >= APR_WIN_NT) {
  +        if (apr_os_level >= APR_WIN_NT) {
               apr_wchar_t *pNext;
               pEnvBlock = (char *)apr_palloc(cont, iEnvBlockLen * 2);
               dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT;
  @@ -430,7 +427,7 @@
       } 
   
   #if APR_HAS_UNICODE_FS
  -    if (os_level >= APR_WIN_NT)
  +    if (apr_os_level >= APR_WIN_NT)
       {
           STARTUPINFOW si;
           apr_size_t nprg = strlen(progname) + 1;
  
  
  
  1.16      +2 -3      apr/user/win32/userinfo.c
  
  Index: userinfo.c
  ===================================================================
  RCS file: /home/cvs/apr/user/win32/userinfo.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- userinfo.c	27 Jul 2001 07:11:07 -0000	1.15
  +++ userinfo.c	28 Dec 2001 23:50:49 -0000	1.16
  @@ -103,7 +103,6 @@
    */
   APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, const char *username,
apr_pool_t *p)
   {
  -    apr_oslevel_e os_level;
       apr_status_t rv;
       char regkey[MAX_PATH * 2];
       char *fixch;
  @@ -111,7 +110,7 @@
       DWORD type;
       HKEY key;
   
  -    if (apr_get_oslevel(p, &os_level) || os_level >= APR_WIN_NT) {
  +    if (apr_os_level >= APR_WIN_NT) {
           apr_uid_t uid;
           apr_gid_t gid;
       
  @@ -136,7 +135,7 @@
           return APR_FROM_OS_ERROR(rv);
   
   #if APR_HAS_UNICODE_FS
  -    if (apr_get_oslevel(p, &os_level) || os_level >= APR_WIN_NT) {
  +    if (apr_os_level >= APR_WIN_NT) {
   
           keylen = sizeof(regkey);
           rv = RegQueryValueExW(key, L"ProfileImagePath", NULL, &type,
  
  
  

Mime
View raw message