|
Revision 2501, 1.5 kB
(checked in by dhozac, 2 years ago)
|
Add support for the migration flags.
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
#ifdef HAVE_CONFIG_H |
|---|
| 20 |
# include <config.h> |
|---|
| 21 |
#endif |
|---|
| 22 |
|
|---|
| 23 |
#include <vserver.h> |
|---|
| 24 |
#include <errno.h> |
|---|
| 25 |
#include <unistd.h> |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
bool |
|---|
| 29 |
switchToWatchXid(char const **errptr) |
|---|
| 30 |
{ |
|---|
| 31 |
#if 0 |
|---|
| 32 |
# warning Compiling in debug-code |
|---|
| 33 |
return; |
|---|
| 34 |
#endif |
|---|
| 35 |
if (vc_get_task_xid(0)==1) return true; |
|---|
| 36 |
|
|---|
| 37 |
if (vc_isSupported(vcFEATURE_MIGRATE)) { |
|---|
| 38 |
if (vc_ctx_migrate(1, 0)==-1) { |
|---|
| 39 |
if (errptr) *errptr = "vc_migrate_context()"; |
|---|
| 40 |
return false; |
|---|
| 41 |
} |
|---|
| 42 |
} |
|---|
| 43 |
else { |
|---|
| 44 |
#if VC_ENABLE_API_COMPAT |
|---|
| 45 |
if (vc_new_s_context(1,0,0)==VC_NOCTX) { |
|---|
| 46 |
if (errptr) *errptr = "vc_new_s_context()"; |
|---|
| 47 |
return false; |
|---|
| 48 |
} |
|---|
| 49 |
#else |
|---|
| 50 |
if (errptr) *errptr = "can not change context: migrate kernel feature missing and 'compat' API disabled"; |
|---|
| 51 |
errno = ENOSYS; |
|---|
| 52 |
return false; |
|---|
| 53 |
#endif |
|---|
| 54 |
} |
|---|
| 55 |
|
|---|
| 56 |
return true; |
|---|
| 57 |
} |
|---|
| 58 |
|
|---|