Changeset 463 for trunk/server


Ignore:
Timestamp:
Jun 10, 2010, 11:16:45 AM (15 years ago)
Author:
Silvan Scherrer
Message:

Samba Server 3.5: included os2helper from 3.3 instead of os2ea & os2path

Location:
trunk/server/source3
Files:
1 deleted
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/server/source3/Makefile.in

    r454 r463  
    391391          $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \
    392392          lib/interface.o lib/pidfile.o \
    393           lib/system.o lib/os2ea.o lib/os2path.o lib/sendfile.o lib/recvfile.o lib/time.o \
     393          lib/system.o lib/os2helper.o lib/sendfile.o lib/recvfile.o lib/time.o \
    394394          lib/username.o \
    395395          ../libds/common/flag_mapping.o \
  • trunk/server/source3/build.cmd

    r456 r463  
    1616    say "      BRAND - create a branded build"
    1717    say "      MAKE  - just compile changed files"
    18     say "      CLUT  - build command line utilities only (N/A)"
    19     say "      WPI   - create WPI archive (N/A)"
    20     say "      ZIP   - create ZIP archive "
    21     say "      ALL   - do just everything (N/A)"
     18    say "      CLUT  - build command line utilities only"
     19    say "      WPI   - create WPI archive"
     20    say "      ZIP   - create ZIP archive"
     21    say "      ALL   - do just everything"
    2222    say
    2323    exit 255
     
    3232
    3333/* defaults */
    34 make  = "CLEAN"
     34make  = ""
    3535libc  = "064x"
    3636brand = "No"
    3737conf  = ""
     38verstring = 'x.x.x-3.x.x.xxx-eCS-'date('S')  /* for packaging if branding is disabled */
    3839
    3940/* Read profile */
     
    4243    opt_line = translate(linein(options))
    4344    interpret opt_line
     45    call charout , opt_line' '
    4446end
     47say
    4548ok = stream(options,'c','close')
    4649
     
    8588if conf = "YES" then do
    8689        address cmd 'SETLOCAL'
    87 /* we do not need that
    8890        address cmd 'SET CFLAGS=-g -Zomf -O1 -march=pentium -mtune=pentium4'
    8991        address cmd 'SET CXXFLAGS=-g -Zomf -O1 -march=pentium -mtune=pentium4'
     
    9193        address cmd 'SET AR=emxomfar'
    9294        address cmd 'SET LIBS=-lsocket -lsyslog'
    93 */
    9495    /* disabled options:
    9596         --enable-developer --enable-socket-wrapper
     
    105106if brand = "YES" then do
    106107    svninfo = ".\svninfo"
    107     address cmd 'svn info | grep "^Revision:" | sed -e "s/Revision: *//">'svninfo
     108    address cmd 'svn status -q -u | grep "^Status against revision:" | sed -e "s/Status against revision: *//">'svninfo
    108109    revision = strip(translate(linein(svninfo)))
    109110    ok = stream(svninfo,'c','close')
     
    111112end
    112113
    113 say build_parms
    114 'make 2>&1 | tee build.log'
     114if make <> "" then do
     115    say build_parms
     116    address cmd 'make 2>&1 | tee build.log'
     117end   
    115118
    116119if pos("ZIP", cmdline) > 0 then do
     120    say 'Creating "samba-'translate(verstring,'-',' ')'.zip"'
     121    ok = SysFileDelete('samba-'translate(verstring,'-',' ')'.zip')
    117122    'cd .\bin'
    118123    'md .\samba'
    119124    'cd .\samba'
    120     'move ..\*.exe'
    121     'move ..\*.dll'
     125    'move ..\*.exe >NUL'
     126    'move ..\*.dll >NUL'
    122127    'cd ..'
    123     'zip -rpmo9 samba-NEW.zip .\samba\*.exe .\samba\*.dll'
     128    'zip -rpo9 samba-'translate(verstring,'-',' ')'.zip .\samba\*.exe .\samba\*.dll'
     129    'cd .\samba'
     130    'move * .. >NUL'
     131    'cd ..'
    124132    'rd .\samba'
    125133    say 'Created ZIP package'
     
    129137exit 0
    130138
    131 brand: procedure
     139brand: procedure expose verstring
    132140    parse arg revision
    133141
    134142    /* eComStation Version file */
    135143    VerFile = "VERSION.ECS"
    136 
    137     /* is the file available */
    138     ok = stream(VerFile, 'c', 'QUERY EXISTS')
    139     if ok = "" then do
    140         say 'Please create a VERSION.ECS based on VERSION.EC_'
    141         exit 0
    142     end
    143144
    144145    /* Samba Version file */
     
    151152        I = I + 1
    152153        eCSVer.I = linein(VerFile)
     154        if left(eCSVer.I,28) = "SAMBA_VERSION_VENDOR_SUFFIX=" then do
     155                    parse var eCSver.I . '='vendor_suffix
     156                    vendor_suffix = strip(vendor_suffix,,'"')
     157                    parse var vendor_suffix vendor suffix
     158        end
    153159    end
    154160    ok = stream(VerFile, 'c', 'close')
     
    161167    do until lines(VERSION) = 0
    162168        verline = linein(VERSION)
     169        if left(Verline,20) = "SAMBA_VERSION_MAJOR=" then do
     170            parse var verline . '='Major
     171        end
     172        if left(Verline,20) = "SAMBA_VERSION_MINOR=" then do
     173            parse var verline . '='Minor
     174        end
     175        if left(Verline,22) = "SAMBA_VERSION_RELEASE=" then do
     176            parse var verline . '='release
     177        end
     178       
    163179        do I = 1 to eCSVer.0
    164180            parse var eCSVer.I tag'='strvalue
     
    173189    ok = stream(Version,'c','close')
    174190    ok = stream(NewVersion,'c','close')
    175     address cmd "ksh ./script/mkversion.sh "NewVersion
     191    address cmd "ksh ./script/mkversion.sh "NewVersion" >NUL"
    176192    ok = SysFileDelete(NewVersion)
    177 return
     193    verstring = suffix'-'Major'.'minor'.'release'.'revision'-'vendor'-'date('S')
     194    say "Samba "verstring
     195return
  • trunk/server/source3/lib/os2helper.c

    r454 r463  
    1 /* This file contains helper functions for OS/2 - don't try and compile on other platforms */
     1/* This file contains helper functions for OS/2 -
     2   do not try to compile on other platforms! */
    23
    34#ifdef __OS2__
     
    1011#define INCL_DOSMODULEMGR
    1112#define INCL_DOSERRORS
    12 //_SMB_H
     13
    1314#include <os2.h>
    1415#include <stdio.h>
     
    1617#include <errno.h>
    1718#include <types.h>
    18 
     19#include <string.h>
    1920//YD for tmalloc
    2021#include <malloc.h>
     
    4243#endif
    4344
    44 #include <string.h>
    45 
    4645#ifndef ENOATTR
    4746#define ENOATTR 22
     
    5049int os2_ftruncate(int fd, off_t size)
    5150{
    52         // We call there __libc_Back_ioFileSizeSet directly instead of
    53         // ftruncate to force it not to zero expanding files to optimize
    54         // samba performance when copying files
     51        /* We call __libc_Back_ioFileSizeSet directly instead of
     52           ftruncate to force it not to zero expanding files to optimize
     53           samba performance when copying files */
     54
    5555        int rc = __libc_Back_ioFileSizeSet(fd, size, 0);
    5656        if (rc < 0)
     
    9090         rc = DosFindClose(hdirFindHandle);    /* Close our directory handle */
    9191       return 1;
    92 
    9392    } else {
    9493         rc = DosFindClose(hdirFindHandle);    /* Close our directory handle */
    9594        return 0;
    96 
    9795    } /* endif */
    98 
    99 }
    100 
    101 /* Functions below are based on APR random code */
    102 /* Licensed to the Apache Software Foundation (ASF) under one or more
    103  * contributor license agreements.  See the NOTICE file distributed with
    104  * this work for additional information regarding copyright ownership.
    105  * The ASF licenses this file to You under the Apache License, Version 2.0
    106  * (the "License"); you may not use this file except in compliance with
    107  * the License.  You may obtain a copy of the License at
    108  *
    109  *     http://www.apache.org/licenses/LICENSE-2.0
    110  *
    111  * Unless required by applicable law or agreed to in writing, software
    112  * distributed under the License is distributed on an "AS IS" BASIS,
    113  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    114  * See the License for the specific language governing permissions and
    115  * limitations under the License.
    116  */
    117 
     96}
     97
     98// we search the path of the .exe and return it
     99int os2_GetExePath(char *buff)
     100{
     101        APIRET rc = NO_ERROR;
     102        PPIB ppib = NULL;
     103        char sExePath [_MAX_PATH];
     104        char sDrive [_MAX_PATH], sDir [_MAX_DIR];
     105
     106        // we search for the infoblock to get the module name
     107        rc = DosGetInfoBlocks(NULL, &ppib);
     108        if (rc != NO_ERROR)
     109        {
     110                return -1;
     111        }
     112
     113        // with the module name we get the path (including the exe name)
     114        rc = DosQueryModuleName(ppib->pib_hmte, sizeof(sExePath), sExePath);
     115        if (rc != NO_ERROR)
     116        {
     117                return -1;
     118        }
     119
     120        // we split to the different values
     121        _splitpath(sExePath, sDrive, sDir, NULL, NULL);
     122        // strcat(sDrive, sDir);
     123        strncat(sDrive, sDir, strlen(sDir) -1);
     124        strcpy(buff, sDrive);
     125
     126        return 0;
     127}
     128
     129/* OS/2-specific random functions. these functions used to be based on APR
     130   random code, but we discovered some nasty problems with it on fast hardware
     131   (especially on quadcore) and decided to rewrite it with libc random() */
     132 
    118133void os2_randget(char * buffer, int length)
    119134{
     
    126141}
    127142
    128 /* A bunch of system information like memory & process stats.
    129  * Not highly random but every bit helps....
    130  */
    131 static UCHAR randbyte_sysinfo()
    132 {
    133     UCHAR byte = 0;
    134     UCHAR SysVars[100];
    135     int b;
    136 
    137     DosQuerySysInfo(1, QSV_FOREGROUND_PROCESS, SysVars, sizeof(SysVars));
    138 
    139     for (b = 0; b < 100; b++) {
    140         byte ^= SysVars[b];
    141     }
    142 
    143     return byte;
    144 }
    145 
    146 
    147 
    148 /* Similar in concept to randbyte_hrtimer() but accesses the CPU's internal
    149  * counters which run at the CPU's MHz speed. We get separate
    150  * idle / busy / interrupt cycle counts which should provide very good
    151  * randomness due to interference of hardware events.
    152  * This only works on newer CPUs (at least PPro or K6) and newer OS/2 versions
    153  * which is why it's run-time linked.
    154  */
    155 
    156 static HMODULE hDoscalls = 0;
    157 #define   CMD_KI_RDCNT    (0x63)
    158 
    159 typedef struct _CPUUTIL {
    160     ULONG ulTimeLow;            /* Low 32 bits of time stamp      */
    161     ULONG ulTimeHigh;           /* High 32 bits of time stamp     */
    162     ULONG ulIdleLow;            /* Low 32 bits of idle time       */
    163     ULONG ulIdleHigh;           /* High 32 bits of idle time      */
    164     ULONG ulBusyLow;            /* Low 32 bits of busy time       */
    165     ULONG ulBusyHigh;           /* High 32 bits of busy time      */
    166     ULONG ulIntrLow;            /* Low 32 bits of interrupt time  */
    167     ULONG ulIntrHigh;           /* High 32 bits of interrupt time */
    168 } CPUUTIL;
    169 
    170 APIRET APIENTRY(*pfnDosPerfSysCall) (ULONG ulCommand, ULONG ulParm1, ULONG ulParm2, ULONG ulParm3) = NULL;
    171 APIRET APIENTRY(*pfnDosQuerySysState) (ULONG func, ULONG arg1, ULONG pid, ULONG _res_, PVOID buf, ULONG bufsz) = NULL;
    172 
    173 static UCHAR randbyte_perf()
    174 {
    175     UCHAR byte = 0;
    176     CPUUTIL util;
    177     int c;
    178 
    179     if (hDoscalls == 0) {
    180         char failed_module[20];
    181         ULONG rc;
    182 
    183         rc = DosLoadModule(failed_module, sizeof(failed_module), "DOSCALLS",
    184                            &hDoscalls);
    185 
    186         if (rc == 0) {
    187             rc = DosQueryProcAddr(hDoscalls, 976, NULL, (PFN *)&pfnDosPerfSysCall);
    188 
    189             if (rc) {
    190                 pfnDosPerfSysCall = NULL;
    191             }
    192         }
    193     }
    194 
    195     if (pfnDosPerfSysCall) {
    196         if ((*pfnDosPerfSysCall) (CMD_KI_RDCNT, (ULONG)&util, 0, 0) == 0) {
    197             for (c = 0; c < sizeof(util); c++) {
    198                 byte ^= ((UCHAR *)&util)[c];
    199             }
    200         }
    201         else {
    202             pfnDosPerfSysCall = NULL;
    203         }
    204     }
    205 
    206     return byte;
    207 }
    208 
    209 
    210 
    211143UCHAR randbyte()
    212144{
    213     return randbyte_sysinfo() ^ randbyte_perf();
     145        int c;
     146        UCHAR byte;
     147        ULONG ulrandom;
     148        ulrandom = random();
     149       
     150        for (c = 0; c < sizeof(ulrandom); c++) {
     151                byte ^= ((UCHAR *)&ulrandom)[c];
     152        }
     153
     154        return byte;
    214155}
    215156
  • trunk/server/source3/lib/select.c

    r454 r463  
    110110        errno = 0;
    111111        ret = select(maxfd,readfds2,writefds,errorfds,tval);
    112 
     112// @todo why are the above fd_set broken
    113113        if (ret <= 0) {
    114114                FD_ZERO(readfds2);
Note: See TracChangeset for help on using the changeset viewer.