summaryrefslogtreecommitdiffstats
path: root/src/common/SubProcess.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* common: implement win32 subprocess helpersLucian Petrut2020-08-311-1/+19
| | | | | | | | | | | | This change adds a Windows implementation for the SubProcess class. We're also implementing "run_command" for Windows, re-using the SubProcess class. It might be seen as just a convenience wrapper on top of that. At the moment, the Linux bits are left unchanged, although the same implementation might be used for all platforms. Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
* common: stub certain modules and functions on WindowsLucian Petrut2020-06-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're going to stub certain modules and functions for Windows builds. Some of them will be implemented in subsequent commits, some are platform specific and will be skipped. Modules: * module.c * subprocess.cc * blkdev.cc * dns_resolve.cc * numa.cc * syslog.h * statvfs.h * libblk * neorados Functions: x signal functions x fork x chown * socketpair_cloexec * dump_open_fds * run_cmd * is_symlink * CInode::d_type * nbd commands Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com> Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
* common: SubProcess needs SIGTERM, from the includesWillem Jan Withagen2018-07-141-0/+4
| | | | Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
* common: extract SubProcess impl into .ccKefu Chai2018-07-121-375/+1
| | | | | | cleanup the header dependencies and speed-up the compiling Signed-off-by: Kefu Chai <kchai@redhat.com>
* os,common: check __APPLE__ for osx not DARWINKefu Chai2017-09-161-1/+1
| | | | Signed-off-by: Kefu Chai <kchai@redhat.com>
* build/include: Redo som includes for FreeBSDWillem Jan Withagen2017-05-281-0/+4
| | | | | | | | | - During include cleanup just a too bit much was removed for FreeBSD to get things compiled. This redoes some of the includes. Tracker: http://tracker.ceph.com/issues/19883 Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
* common: Remove redundant includesJos Collin2017-05-171-10/+0
| | | | | | Fixes: http://tracker.ceph.com/issues/19883 (Partially) Signed-off-by: Jos Collin <jcollin@redhat.com>
* common: add override in header fileliuchang08122017-03-031-1/+1
| | | | Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
* assert(0) -> ceph_abort()Sage Weil2016-11-221-3/+3
| | | | Signed-off-by: Sage Weil <sage@redhat.com>
* SubProcess: Avoid buffer corruption when calling err()Erwan Velu2016-03-141-3/+3
| | | | | | | | | | | | | | | | | | | | | Some code like crush/CrushTester.cc, uses err() to get the output status of a spawned command. As per reported in bug #15011, some tests were failing because of some utf8 decoding issues. The implied buffers were generated by the output of err() function of SubProcess. err() is returning the str().c_str() value of 'errstr' object which is not living much longer that the function itself. This patch returns a std::string to avoid the temporary allocation and fixes the associated err() calls accordingly. Since this commit, the make check is now passing everytime. Fixes: #15011 Signed-off-by: Erwan Velu <erwan@redhat.com>
* SubProcess: fix multiple definition bugYunchuan Wen2015-12-041-18/+18
| | | | | | | | | | | | | | | | | | | | | | In current implementation, the declare of the SubProcess class was seperate from the implementation, like this: class SubProcess { SubProcess(); }; SubProcess::SubProcess() .... This will cause the 'multiple definition of XXX' bug when more than one source files linked together if they are all include SubProcess.h. So, this patch fix it. Signed-off-by: Yunchuan Wen <yunchuan.wen@kylin-cloud.com>
* SubProcess: include iostreamYunchuan Wen2015-11-211-0/+1
| | | | | | | The class SubProcess will use std::cerr, but not include the header. Signed-off-by: Yunchuan Wen <yunchuan.wen@kylin-cloud.com>
* SubProcess: allow CLOSE/PIPE/KEEP parent std fdYunchuan Wen2015-11-211-27/+35
| | | | Signed-off-by: Yunchuan Wen <yunchuan.wen@kylin-cloud.com>
* stdin/stdout/stderr clash with standard definition, renamed to getter/setterRohan Mars2015-11-131-12/+13
| | | | Signed-off-by: Rohan Mars <code@rohanmars.com>
* Merge pull request #5693 from tchaikov/wip-12730Loic Dachary2015-09-021-20/+37
|\ | | | | | | | | | | common/SubProcess: silence compiler warnings Reviewed-by: Loic Dachary <ldachary@redhat.com>
| * common/SubProcess: silence compiler warningsKefu Chai2015-08-281-20/+37
| | | | | | | | | | | | | | | | | | | | | | * the STD{IN,OUT,ERR}_FILENO are closed when being dup2'ed so we can not write to cout or cerr in child processes, as these fstream are still holding the old references. * to silence every write(2) call is tedious. better off overwriting the raw buffer in cerr and cout ostreams Fixes: #12730 Signed-off-by: Kefu Chai <kchai@redhat.com>
* | common/SubProcess: fix build on DARWINDennis Schafroth2015-08-311-0/+1
|/ | | | | | include <signal.h> to avoid errors/warnings on missing functions Signed-off-by: Dennis Schafroth <dennis@schafroth.com>
* common: SubProcess: timeout supportMykola Golub2015-03-271-0/+137
| | | | Signed-off-by: Mykola Golub <mgolub@mirantis.com>
* common: SubProcess: helper class to spawn subprocessMykola Golub2015-03-271-0/+329
Signed-off-by: Mykola Golub <mgolub@mirantis.com>