~ubuntu-branches/ubuntu/lucid/mysql-dfsg-5.1/lucid

« back to all changes in this revision

Viewing changes to mysql-test/lib/My/SafeProcess/safe_process_win.cc

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug, Mathias Gug
  • Date: 2009-08-05 11:40:21 UTC
  • mfrom: (1.1.3 upstream) (0.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20090805114021-59bj0bgfm2ufllbk
Tags: 5.1.37-1ubuntu1
[ Mathias Gug ]
* Merge from debian unstable and 5.0, remaining changes:
  - debian/control:
    + Properly upgrade libmysqlclient16-dev packages to
    libmysqlclient-dev:
      * Make libmysqlclient16-dev a transitional package depending on
        libmysqlclient-dev.
      * Make libmysqlclient-dev replace libmysqlclient16-dev.
    + Don't provide a libmysqlclient15-dev package as long as there are
      packages still build-depending on libmysqlclient15-dev and
      mysql-dsfg-5.0 is in the archive.
    + Lower mailx from a Recommends to a Suggests to avoid pulling in
      a full MTA on all installs of mysql-server. (LP: #259477)
  - debian/rules:
    + added -fno-strict-aliasing to CFLAGS to get around mysql testsuite
      build failures.
  - debian/additions/debian-start.inc.sh: support ANSI mode (LP: #310211)
  - Add AppArmor profile:
    - debian/apparmor-profile: apparmor profile.
    - debian/rules, debian/mysql-server-5.1.files: install apparmor profile.
    - debian/mysql-server-5.1.dirs: add etc/apparmor.d/force-complain
    - debian/mysql-server-5.1.postrm: remove symlink in force-complain/ on
      purge.
    - debian/mysql-server-5.1.README.Debian: add apparmor documentation.
    - debian/additions/my.cnf: Add warning about apparmor. (LP: #201799)
    - debian/mysql-server-5.1.postinst: reload apparmor profiles.
  - debian/additions/my.cnf: remove language option. Error message files are
    located in a different directory in MySQL 5.0. Setting the language
    option to use /usr/share/mysql/english breaks 5.0. Both 5.0 and 5.1
    use a default value that works. (LP: #316974)
  - debian/mysql-server-5.1.mysql.init:
    + Clearly indicate that we do not support running multiple instances
      of mysqld by duplicating the init script.
      (closes: #314785, #324834, #435165, #444216)
    + Properly parameterize all existing references to the mysql config
      file (/etc/mysql/my.cnf).
  - debian/mysql-server-5.1.postinst: Clear out the second password
    when setting up mysql. (LP: #344816)
  - mysql-server-core-5.1 package for files needed by Akonadi:
    + debian/control: create mysql-server-core-5.1 package.
    + debian/mysql-server-core-5.1.files, debian/mysql-server-5.1.files:
      move core mysqld files to mysql-server-core-5.1 package.
* debian/libmysqlclient16.symbols.amd64: remove amd64 symbols as it has
  not been correctly generated in Debian.
* Add Apport hook: (LP: #354188)
  - debian/mysql-server-5.1.py: apport package hook.
  - debian/mysql-server-5.1.files, debian/rules: install apport package
    hook.
* debian/additions/my.cnf: 
  - drop old_password option.
  - fix commented logging options to use general_log and general_log_file.
* Dropped - accepted in Debian:
  - debian/mysql-server-5.1.config:
    + ask for MySQL root password at priority high instead of medium so
      that the password prompt is seen on a default install. (LP: #319843)
    + don't ask for root password when upgrading from a 5.0 install.

Show diffs side-by-side

added added

removed removed

Lines of Context:
259
259
    the JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE flag, making sure it will be
260
260
    terminated when the last handle to it is closed(which is owned by
261
261
    this process).
 
262
 
 
263
    If breakaway from job fails on some reason, fallback is to create a
 
264
    new process group. Process groups also allow to kill process and its 
 
265
    descedants, subject to some restrictions (processes have to run within
 
266
    the same console,and must not ignore CTRL_BREAK)
262
267
  */
263
 
  if (CreateProcess(NULL, (LPSTR)child_args,
 
268
  DWORD create_flags[]= {CREATE_BREAKAWAY_FROM_JOB, CREATE_NEW_PROCESS_GROUP, 0};
 
269
  BOOL process_created= FALSE;
 
270
  BOOL jobobject_assigned= FALSE;
 
271
 
 
272
  for (int i=0; i < sizeof(create_flags)/sizeof(create_flags[0]); i++)
 
273
  { 
 
274
    process_created= CreateProcess(NULL, (LPSTR)child_args,
264
275
                    NULL,
265
276
                    NULL,
266
277
                    TRUE, /* inherit handles */
267
 
                    CREATE_SUSPENDED | CREATE_BREAKAWAY_FROM_JOB,
 
278
                    CREATE_SUSPENDED | create_flags[i],
268
279
                    NULL,
269
280
                    NULL,
270
281
                    &si,
271
 
                    &process_info) == 0)
 
282
                    &process_info);
 
283
    if (process_created)
 
284
    {
 
285
     jobobject_assigned= AssignProcessToJobObject(job_handle, process_info.hProcess);
 
286
     break;
 
287
    }
 
288
  }
 
289
 
 
290
  if (!process_created)
 
291
  {
272
292
    die("CreateProcess failed");
273
 
 
274
 
  if (AssignProcessToJobObject(job_handle, process_info.hProcess) == 0)
275
 
  {
276
 
    TerminateProcess(process_info.hProcess, 200);
277
 
    die("AssignProcessToJobObject failed");
278
293
  }
279
294
  ResumeThread(process_info.hThread);
280
295
  CloseHandle(process_info.hThread);
312
327
    message("TerminateJobObject failed");
313
328
  CloseHandle(job_handle);
314
329
  message("Job terminated and closed");
 
330
 
 
331
  if (!jobobject_assigned)
 
332
  {
 
333
    GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, process_info.dwProcessId);
 
334
    TerminateProcess(process_info.hProcess, 202);
 
335
  }
 
336
 
315
337
  if (wait_res != WAIT_OBJECT_0 + CHILD)
316
338
  {
317
339
    /* The child has not yet returned, wait for it */