Ignore:
Timestamp:
Nov 8, 2011, 6:50:31 PM (14 years ago)
Author:
Herwig Bauernfeind
Message:

Samba Server 3.5: Some more work to get high-mem working

Location:
trunk/server/source3/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/source3/lib/os2helper.c

    r655 r656  
    1 /* This file contains helper functions for OS/2 -
    2    do not try to compile on other platforms! */
     1/*  This file contains Samba helper functions for eComStation (OS/2) -
     2 *  do not try to compile on other platforms!
     3 * 
     4 *  Copyright (C) 2007-2011
     5 *                Silvan Scherrer
     6 *                Yuri Dario
     7 *                Paul Smedley
     8 *
     9 *  This program is free software; you can redistribute it and/or modify
     10 *  it under the terms of the GNU General Public License as published by
     11 *  the Free Software Foundation; either version 3 of the License, or
     12 *  (at your option) any later version.
     13 *
     14 *  This program is distributed in the hope that it will be useful,
     15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17 *  GNU General Public License for more details.
     18 *
     19 *  You should have received a copy of the GNU General Public License
     20 *  along with this program; if not, see <http://www.gnu.org/licenses/>.
     21 */
    322
    423#ifdef __OS2__
     
    5170{
    5271        /* We call __libc_Back_ioFileSizeSet directly instead of
    53            ftruncate to force it not to zero expanding files to optimize
    54            samba performance when copying files */
     72           ftruncate to force it not to zero expanding files to
     73           optimize Samba performance when copying files */
    5574
    5675        int rc = __libc_Back_ioFileSizeSet(fd, size, 0);
     
    6584int os2_isattribute(char *path, unsigned short attr)
    6685{
    67     HDIR          hdirFindHandle = HDIR_CREATE;
    68     FILEFINDBUF3  FindBuffer     = {0};      /* Returned from FindFirst/Next */
    69     USHORT        dosattr;                      /* attribute to search for */
    70     ULONG         ulResultBufLen = sizeof(FILEFINDBUF3);
    71     ULONG         ulFindCount    = 1;        /* Look for 1 file at a time    */
    72     APIRET        rc             = NO_ERROR; /* Return code                  */
    73     if (attr==aARCH)
     86        HDIR          hdirFindHandle = HDIR_CREATE;
     87        FILEFINDBUF3  FindBuffer     = {0};      /* Returned from FindFirst/Next */
     88        USHORT        dosattr;                   /* attribute to search for */
     89        ULONG         ulResultBufLen = sizeof(FILEFINDBUF3);
     90        ULONG         ulFindCount    = 1;        /* Look for 1 file at a time    */
     91        APIRET        rc             = NO_ERROR; /* Return code                  */
     92        if (attr == aARCH)
    7493                        dosattr=MUST_HAVE_ARCHIVED;
    75     else if (attr==aRONLY)
     94        else if (attr == aRONLY)
    7695                        dosattr=MUST_HAVE_READONLY;
    77     else if (attr==aSYSTEM)
     96        else if (attr == aSYSTEM)
    7897                        dosattr=MUST_HAVE_SYSTEM;
    79     else if (attr==aHIDDEN)
     98        else if (attr == aHIDDEN)
    8099                        dosattr=MUST_HAVE_HIDDEN;
    81100
    82     rc = DosFindFirst( path,                /* File pattern - all files     */
     101        rc = DosFindFirst( path,                 /* File pattern - all files     */
    83102                       &hdirFindHandle,      /* Directory search handle      */
    84                         dosattr,
     103                       dosattr,
    85104                       &FindBuffer,          /* Result buffer                */
    86105                       ulResultBufLen,       /* Result buffer length         */
     
    88107                       FIL_STANDARD);        /* Return Level 1 file info     */
    89108
    90    if (rc != NO_ERROR) {
    91          rc = DosFindClose(hdirFindHandle);    /* Close our directory handle */
    92        return 1;
    93     } else {
    94          rc = DosFindClose(hdirFindHandle);    /* Close our directory handle */
     109        if (rc != NO_ERROR) {
     110                rc = DosFindClose(hdirFindHandle);    /* Close our directory handle */
     111                return 1;
     112        } else {
     113                rc = DosFindClose(hdirFindHandle);    /* Close our directory handle */
    95114        return 0;
    96     } /* endif */
     115        } /* endif */
    97116}
    98117
     
    157176}
    158177*/
     178
    159179// OS/2 specific socketpair() implementation, as it only works in low mem
    160180int os2_socketpair(int fds[2])
    161181{
    162182        int mypair[2];
    163         int rc = 0;
     183        int rc = 0;
    164184
    165185        rc = socketpair(AF_UNIX, SOCK_STREAM, 0, mypair);
    166         if (rc >= 0) {
    167                 fds[0] = mypair[0];
    168                 fds[1] = mypair[1];
    169         }
     186        if (rc >= 0) {
     187                fds[0] = mypair[0];
     188                fds[1] = mypair[1];
     189        }
    170190
    171191        return rc;
     
    178198void os2_randget(char * buffer, int length)
    179199{
    180     UCHAR randbyte();
    181     unsigned int idx;
    182 
    183     for (idx=0; idx<length; idx++)
     200        UCHAR randbyte();
     201        unsigned int idx;
     202
     203        for (idx=0; idx<length; idx++)
    184204        buffer[idx] = randbyte();
    185205
  • trunk/server/source3/lib/recvfile.c

    r464 r656  
    2525
    2626#include "includes.h"
     27#ifdef __OS2__
     28#define pipe(A) os2_socketpair(A)
     29#endif
    2730
    2831/* Do this on our own in TRANSFER_BUF_SIZE chunks.
     
    174177        }
    175178
    176 #ifndef __OS2__
    177179        if ((pipefd[0] == -1) && (pipe(pipefd) == -1)) {
    178 #else
    179         if ((pipefd[0] == -1) && (socketpair(AF_UNIX, SOCK_STREAM,0, pipefd) == -1)) {
    180 #endif
    181180                try_splice_call = false;
    182181                return default_sys_recvfile(fromfd, tofd, offset, count);
  • trunk/server/source3/lib/select.c

    r593 r656  
    2828   This means all Samba signal handlers should call sys_select_signal().
    2929*/
     30#ifdef __OS2__
     31#define pipe(A) os2_socketpair(A)
     32#endif
    3033
    3134static pid_t initialised;
Note: See TracChangeset for help on using the changeset viewer.