コード例 #1
0
ファイル: os_os2.c プロジェクト: soubok/libset
/*
** Make sure all writes to a particular file are committed to disk.
*/
int os2Sync( sqlite3_file *id, int flags ){
  os2File *pFile = (os2File*)id;
  OSTRACE3( "SYNC %d lock=%d\n", pFile->h, pFile->locktype );
#ifdef SQLITE_TEST
  if( flags & SQLITE_SYNC_FULL){
    sqlite3_fullsync_count++;
  }
  sqlite3_sync_count++;
#endif
  return DosResetBuffer( pFile->h ) == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;
}
コード例 #2
0
ファイル: os2io.c プロジェクト: Akin-Net/mozilla-central
PRInt32
_PR_MD_FSYNC(PRFileDesc *fd)
{
    PRInt32 rc = DosResetBuffer((HFILE)fd->secret->md.osfd);

    if (rc != NO_ERROR) {
   	if (rc != ERROR_ACCESS_DENIED) {	
   			_PR_MD_MAP_FSYNC_ERROR(rc);
   	    return -1;
   	}
    }
    return 0;
}
コード例 #3
0
/*
** Make sure all writes to a particular file are committed to disk.
*/
static int os2Sync( sqlite3_file *id, int flags ){
  os2File *pFile = (os2File*)id;
  OSTRACE3( "SYNC %d lock=%d\n", pFile->h, pFile->locktype );
#ifdef SQLITE_TEST
  if( flags & SQLITE_SYNC_FULL){
    sqlite3_fullsync_count++;
  }
  sqlite3_sync_count++;
#endif
  /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a
  ** no-op
  */
#ifdef SQLITE_NO_SYNC
  UNUSED_PARAMETER(pFile);
  return SQLITE_OK;
#else
  return DosResetBuffer( pFile->h ) == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;
#endif
}
コード例 #4
0
VOID Installer_ExecuteScript( VOID )
{
 // Задаем приложение и команду для него.
 CHAR Rexx_script[ SIZE_OF_PATH ] = "";
 strcpy( Rexx_script, Installer_Thread.Current_directory );
 strcat( Rexx_script, "\\Install\\Script.cmd" );

 // Проверяем существование приложения.
 if( !FileExists( Rexx_script ) ) return;

 // Запускаем приложение.
 {
  CHAR Rexx_parameters[ SIZE_OF_PATH ] = "";

  if( Installer_Thread.Install_Enhancer ) strcat( Rexx_parameters, " --action=install" );
  if( Installer_Thread.Uninstall_Enhancer ) strcat( Rexx_parameters, " --action=uninstall" );
  if( Installer.Code_page == RUSSIAN ) strcat( Rexx_parameters, " --language=russian" );

  {
   CHAR Rexx_launcher[] = "Cmd.exe";
   CHAR Launcher_parameters[ SIZE_OF_PATH ] = "";

   strcpy( Launcher_parameters, Rexx_launcher );   strcat( Launcher_parameters, "|" );
   strcat( Launcher_parameters, "/C" );            strcat( Launcher_parameters, " \"" );
   strcat( Launcher_parameters, Rexx_script );     strcat( Launcher_parameters, " " );
   strcat( Launcher_parameters, Rexx_parameters ); strcat( Launcher_parameters, "\"" );
   strchg( Launcher_parameters, '|', 0x00 );

   CHAR Error_string[ 1 ] = ""; RESULTCODES Return_codes;
   CHAR Path[ SIZE_OF_PATH ] = "";
   strcpy( Path, Installer_Thread.Current_directory );
   strcat( Path, "\\Install" );

   DosSetCurrentDir( Path );
   DosResetBuffer( -1 ); DosExecPgm( Error_string, sizeof( Error_string ), EXEC_SYNC, Launcher_parameters, NULL, &Return_codes, Rexx_launcher );
   DosSetCurrentDir( Installer_Thread.Current_directory );
  }
 }

 // Возврат.
 return;
}
コード例 #5
0
ファイル: os_os2.c プロジェクト: 3rdexp/jezzitest
/*
** Make sure all writes to a particular file are committed to disk.
*/
int os2Sync( OsFile *id, int dataOnly ){
  assert( id!=0 );
  OSTRACE3( "SYNC %d lock=%d\n", ((os2File*)id)->h, ((os2File*)id)->locktype );
  return DosResetBuffer( ((os2File*)id)->h ) == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;
}
コード例 #6
0
int main(VOID) {

   HFILE  hfFileHandle   = 0L;     /* Handle for file being manipulated */

   ULONG  ulAction       = 0;      /* Action taken by DosOpen */

   FHLOCK FileHandleLock = 0;      /* File handle lock   */



   ULONG  ulWrote        = 0;      /* Number of bytes written by DosWrite */

   UCHAR  uchFileName[20]  = "dospman.dat",     /* Name of file */

          uchFileData[4]   = "DATA";            /* Data to write to file */

   APIRET rc             = NO_ERROR;            /* Return code */



   /* Open the file dosman.dat.  Use an existing file or create a new */

   /* one if it doesn't exist.                                      */

   rc = DosProtectOpen(uchFileName, &hfFileHandle, &ulAction, 4L,

              FILE_ARCHIVED | FILE_NORMAL,

              OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,

              OPEN_FLAGS_NOINHERIT | OPEN_SHARE_DENYNONE  |

              OPEN_ACCESS_READWRITE, 0L, &FileHandleLock);

   if (rc != NO_ERROR) {

      printf("DosOpen error: return code = %u\n", rc);

      return 1;

   }



   rc = DosProtectWrite (hfFileHandle, (PVOID) uchFileData,

                  sizeof (uchFileData), &ulWrote, FileHandleLock);

   if (rc != NO_ERROR) {

      printf("DosWrite error: return code = %u\n", rc);

      return 1;

   }



   rc = DosResetBuffer (hfFileHandle);

   if (rc != NO_ERROR) {

      printf("DosResetBuffer error: return code = %u\n", rc);

      return 1;

   } /* endif */



   rc = DosProtectSetFileSize (hfFileHandle, 8L, FileHandleLock);

   if (rc != NO_ERROR) {

      printf("DosSetFileSize error: return code = %u\n", rc);

      return 1;

   }



   return NO_ERROR;

}
コード例 #7
0
ファイル: os2.c プロジェクト: UIKit0/paragui
int __PHYSFS_platformFlush(void *opaque)
{
    return(os2err(DosResetBuffer((HFILE) opaque) == NO_ERROR));
} /* __PHYSFS_platformFlush */
コード例 #8
0
ファイル: toollog.c プロジェクト: OS2World/DEV-UTIL-OS2Tools
APIRET TOOLAPI _Export LogPrint (UCHAR ucLogLevel,
                                PSZ   pszApp,
                                PSZ   pszFormat,
                                ...)
{
  va_list ap;
  time_t  timeSystem;
  struct  tm *tmTime;                               /* mapped time structure */

  char    szBuf[512];      /* local buffer for the line to write to the file */
  PSZ     pszBufEnd;                           /* points to the buffer's end */
  PSZ     pszLog;          /* local buffer for the line to write to the file */
  ULONG   ulBytesWritten;           /* dummy for the number of bytes written */
  APIRET  rc;                                              /* API returncode */


  if (Globals.hLogFile == 0)                         /* Parameter�berpr�fung */
    return (ERROR_INVALID_HANDLE);

                /* if logging system has not been properly initialized, quit */

  if (pszFormat == NULL)               /* In diesem Falle wird abgebrochen ! */
    return (ERROR_INVALID_PARAMETER);               /* raise error condition */


  if (ucLogLevel & Globals.ucLoggingLevel)                /* if levels match */
  {
    switch (ucLogLevel)                                   /* Klassifizierung */
    {
      case LOG_SYSTEM:    pszLog = "SYS"; break;
      case LOG_ERRORS:    pszLog = "ERR"; break;
      case LOG_CRITICALS: pszLog = "CRT"; break;
      case LOG_DEBUG:     pszLog = "DBG"; break;
      case LOG_WARNINGS:  pszLog = "WRN"; break;
      case LOG_INFOS:     pszLog = "INF"; break;
      default:            pszLog = "???";
    }

    timeSystem = time(NULL);                     /* Datum und Zeit schreiben */
    tmTime = localtime(&timeSystem);                         /* map the time */
    if (tmTime == NULL)                                  /* check for errors */
      return (ERROR_SYS_INTERNAL);                       /* raise error code */

    if (pszApp == NULL)                             /* NULL-Pointer abfangen */
      pszApp = "----";
    
    // stupid fix for Y2K-Bug in IBM CRT
    if (tmTime->tm_year >= 100)
      tmTime->tm_year %= 100;

    sprintf(szBuf,
            "\r\n%02u/%02u/%02u %02u:%02u:%02u�%3s %4s�",
            tmTime->tm_year,
            tmTime->tm_mon + 1,
            tmTime->tm_mday,
            tmTime->tm_hour,
            tmTime->tm_min,
            tmTime->tm_sec,
            pszLog,
            pszApp);
    pszBufEnd = szBuf + strlen(szBuf);          /* points to the buffers end */


    va_start(ap,
             pszFormat);                            /* Den Eintrag schreiben */

    vsprintf(pszBufEnd,
             pszFormat,
             ap);
    pszBufEnd = pszBufEnd + strlen(pszBufEnd);  /* points to the buffers end */

    va_end(ap);

    rc = DosWrite (Globals.hLogFile,                    /* write to the file */
                   szBuf,
                   strlen(szBuf),
                   &ulBytesWritten);
#if 0
    if (rc == NO_ERROR)                            /* if the write succeeded */
      DosResetBuffer(Globals.hLogFile);                  /* flush the buffer */
#endif
  }
  else
    rc = NO_ERROR;                                      /* ignore this write */

  return (rc);                                         /* deliver returncode */
}
コード例 #9
0
VOID main( VOID )
{
 // ********************************************************** //

 // Можно создать приложение, *.dll или *.obj.
 CHAR Target[] = "/Ge+ /Ss+";    // Приложение.
 // CHAR Target[] = "/C /Ss+";   // Object.
 // CHAR Target[] = "/Ge- /Ss+"; // Library.

 // Процессор - Pentium.
 CHAR Processor[] = "/G5 /Gf+ /Gi+";

 // Оптимизация - по скорости.
 CHAR Optimization[] = "/Gs+ /O+ /Oi+";

 // Размер стека - как и у всех потоков.
 CHAR Stack_size[] = "/B\"/ST:32768\"";

 // Имена файлов.
 CHAR CPP_Name[] = "Nice-os2.cpp";
 CHAR DEF_Name[] = "Nice-os2.def";
 CHAR LIB_Name[] = "..\\Shared\\DosCalls\\Doscalls.lib";

 CHAR RC_Name[] =  "Resources\\Resources.rc";
 CHAR RES_Name[] = "Resources\\Resources.res";

 CHAR OBJ_Name[] = "Nice-os2.obj";
 CHAR TGT_Name[] = "Nice-os2.exe ";

 // ********************************************************** //

 // Задаем параметры.
 CHAR Compiler[] = "Icc.exe"; CHAR Parameters[ 255 ] = "";
 strcpy( Parameters, Compiler );     strcat( Parameters, "|" );
 strcat( Parameters, Target );       strcat( Parameters, " " );
 strcat( Parameters, CPP_Name );     strcat( Parameters, " " );
 strcat( Parameters, DEF_Name );     strcat( Parameters, " " );
 strcat( Parameters, LIB_Name );     strcat( Parameters, " " );
 strcat( Parameters, Processor );    strcat( Parameters, " " );
 strcat( Parameters, Optimization ); strcat( Parameters, " " );
 strcat( Parameters, Stack_size );
 strchg( Parameters, '|', 0x00 );

 // Удаляем файлы, которые требуется получить.
 DosForceDelete( TGT_Name );

 // Вызываем IBM VA C++.
 CHAR Error_string[ 1 ]; RESULTCODES Return_codes;
 DosResetBuffer( -1 ); DosExecPgm( Error_string, sizeof( Error_string ), EXEC_SYNC, Parameters, NULL, &Return_codes, Compiler );

 // Задаем параметры для Resource Compiler.
 // RC.exe - 16-разрядное приложение, и его надо вызвать как "Cmd /C RC.exe".
 CHAR RC_starter[] = "Cmd.exe"; Parameters[ 0 ] = 0;
 strcpy( Parameters, RC_starter );   strcat( Parameters, "|" );
 strcat( Parameters, "/C RC.exe" );  strcat( Parameters, " " );
 strcat( Parameters, RC_Name );      strcat( Parameters, " " );
 strcat( Parameters, TGT_Name );
 strchg( Parameters, '|', 0x00 );

 // Вызываем Resource Compiler.
 DosResetBuffer( -1 ); DosExecPgm( Error_string, sizeof( Error_string ), EXEC_SYNC, Parameters, NULL, &Return_codes, RC_starter );

 // Удаляем временные файлы.
 DosForceDelete( OBJ_Name ); DosForceDelete( RES_Name );

 // Звук.
 WinAlarm( HWND_DESKTOP, WA_NOTE );

 // Выход.
 return;
}