20#include "RConfigure.h"
51#if defined(R__SUN) || defined(R__AIX) || \
52 defined(R__LINUX) || defined(R__SOLARIS) || \
53 defined(R__FBSD) || defined(R__OBSD) || \
54 defined(R__MACOSX) || defined(R__HURD)
62#if defined(ULTRIX) || defined(R__SUN)
65#if defined(R__AIX) || defined(R__LINUX) || \
66 defined(R__FBSD) || defined(R__OBSD) || \
67 defined(R__LYNXOS) || defined(R__MACOSX) || defined(R__HURD)
68# include <sys/ioctl.h>
70#if defined(R__AIX) || defined(R__SOLARIS)
71# include <sys/select.h>
74# include <mach-o/dyld.h>
75# include <sys/mount.h>
76 extern "C" int statfs(
const char *file,
struct statfs *buffer);
77#elif defined(R__LINUX) || defined(R__HURD)
79#elif defined(R__FBSD) || defined(R__OBSD)
80# include <sys/param.h>
81# include <sys/mount.h>
84# include <sys/types.h>
85# include <sys/param.h>
86# include <sys/queue.h>
87# include <libprocstat.h>
91# include <sys/statfs.h>
103#include <sys/resource.h>
108#include <sys/socket.h>
109#include <netinet/in.h>
110#include <netinet/tcp.h>
112# define _XOPEN_EXTENDED_SOURCE
113# include <arpa/inet.h>
114# undef _XOPEN_EXTENDED_SOURCE
115# if !defined(_AIX41) && !defined(_AIX43)
117# define HASNOT_INETATON
120# include <arpa/inet.h>
125#if defined(R__SOLARIS)
126# include <sys/systeminfo.h>
127# include <sys/filio.h>
128# include <sys/sockio.h>
129# define HASNOT_INETATON
131# define INADDR_NONE (UInt_t)-1
135#if defined(R__SOLARIS)
140#if defined(MAC_OS_X_VERSION_10_5)
146# include <sys/param.h>
147# if __FreeBSD_version >= 900007
152#if defined(R__AIX) || defined(R__FBSD) || \
153 defined(R__OBSD) || defined(R__LYNXOS) || \
154 (defined(R__MACOSX) && !defined(MAC_OS_X_VERSION_10_5))
158#if defined(R__LYNXOS)
160 extern int putenv(
const char *);
165#if defined(R__ARC4_STDLIB)
167#elif defined(R__ARC4_BSDLIB)
168#include <bsd/stdlib.h>
169#elif defined(R__GETRANDOM_CLIB)
170#include <sys/random.h>
175#define STRUCT_UTMP struct utmpx
178#define STRUCT_UTMP struct utmp
180#if !defined(UTMP_FILE) && defined(_PATH_UTMP)
181#define UTMP_FILE _PATH_UTMP
183#if defined(UTMPX_FILE)
185#define UTMP_FILE UTMPX_FILE
188#define UTMP_FILE "/etc/utmp"
192#if (defined(R__LINUX) || defined(R__HURD)) && !defined(R__WINGCC)
193# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 1
194# define HAVE_BACKTRACE_SYMBOLS_FD
198#if defined(R__MACOSX) || defined(R__FBSD)
199# define HAVE_BACKTRACE_SYMBOLS_FD
203#ifdef HAVE_BACKTRACE_SYMBOLS_FD
204# include <execinfo.h>
213#ifdef HAVE_BACKTRACE_SYMBOLS_FD
220#if (defined(R__LINUX) && !defined(R__WINGCC))
222#include <sys/prctl.h>
225#if defined(R__MACOSX) && defined(__SSE2__)
226#include <xmmintrin.h>
229#if defined(R__MACOSX) && !defined(__SSE2__) && !defined(__xlC__) && \
230 !defined(__i386__) && !defined(__x86_64__) && !defined(__arm__) && \
237#include <mach/thread_status.h>
239#define fegetenvd(x) asm volatile("mffs %0" : "=f" (x));
240#define fesetenvd(x) asm volatile("mtfsf 255,%0" : : "f" (x));
252#if defined(R__MACOSX) && !defined(__SSE2__) && \
253 (defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__))
265 template<
typename U = T,
typename std::enable_if<std::is_member_po
inter<decltype(&U::ut_name)>::value,
int>::type = 0>
267 return ue->ut_name[0];
270 template<
typename U = T,
typename std::enable_if<std::is_member_po
inter<decltype(&U::ut_user)>::value,
int>::type = 0>
272 return ue->ut_user[0];
278 return ut_name<STRUCT_UTMP>::getValue(
ue, 0);
357# define HOWMANY(x, y) (((x)+((y)-1))/(y))
419#if defined(R__MACOSX)
421#elif defined(R__LINUX) || defined(R__SOLARIS) || defined(R__FBSD)
427#elif defined(R__SOLARIS)
429#elif defined(R__FBSD)
449 if (
p.BeginsWith(
"/"))
451 else if (
p.Contains(
"/")) {
467#if defined(HAVE_DLADDR) && !defined(R__MACOSX)
481 ::SysError(
"TUnixSystem::SetRootSys",
"error getting realpath of libCore, please set ROOTSYS in the shell");
493#if defined(R__MACOSX)
513 TRegexp sovers =
"libCore\\.[0-9]+\\.*[0-9]*\\.*[0-9]*\\.so";
514 TRegexp dyvers =
"libCore\\.[0-9]+\\.*[0-9]*\\.*[0-9]*\\.dylib";
524 ::SysError(
"TUnixSystem::DylibAdded",
"error getting realpath of libCore, please set ROOTSYS in the shell");
538 if (lib.
EndsWith(
"/libSystem.B.dylib")) {
550 sovers =
"\\.[0-9]+\\.*[0-9]*\\.so";
556 dyvers =
"\\.[0-9]+\\.*[0-9]*\\.dylib";
618#if defined(R__MACOSX)
622#elif defined(HAVE_DLADDR)
681 Warning(
"SetDisplay",
"DISPLAY not set, setting it to %s",
disp.Data());
698 Warning(
"SetDisplay",
"DISPLAY not set, setting it to %s",
706 if (!
gROOT->IsBatch() && !std::getenv(
"DISPLAY")) {
707 Error(
"SetDisplay",
"Can't figure out DISPLAY, set it manually\n"
708 "In case you run a remote ssh session, restart your ssh session with:\n"
709 "=========> ssh -Y");
724#if defined(R__SOLARIS) || defined (R__LINUX) || defined(R__AIX) || \
725 defined(R__FBSD) || defined(R__OBSD) || defined(R__HURD)
729 return Form(
"errno out of range %d", err);
741#if defined(R__SOLARIS)
764 if (
h->HasReadInterest()) {
768 if (
h->HasWriteInterest()) {
781 if (!
h)
return nullptr;
794 int fd = th->
GetFd();
826 if (!
h)
return nullptr;
837 if (
hs->GetSignal() ==
h->GetSignal())
895#if defined(R__LINUX) && !defined(__powerpc__)
896#if defined(__GLIBC__) && (__GLIBC__>2 || __GLIBC__==2 && __GLIBC_MINOR__>=1)
898#if __GLIBC_MINOR__>=3
923#if defined(R__MACOSX) && defined(__SSE2__)
934#if defined(R__MACOSX) && !defined(__SSE2__) && \
935 (defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__))
941#elif defined(__arm64__)
954#if defined(R__MACOSX) && !defined(__SSE2__) && !defined(__xlC__) && \
955 !defined(__i386__) && !defined(__x86_64__) && !defined(__arm__) && \
980#if defined(R__LINUX) && !defined(__powerpc__)
981#if defined(__GLIBC__) && (__GLIBC__>2 || __GLIBC__==2 && __GLIBC_MINOR__>=1)
991#if __GLIBC_MINOR__>=3
1013#if defined(R__MACOSX) && defined(__SSE2__)
1025#if defined(R__MACOSX) && !defined(__SSE2__) && \
1026 (defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__))
1038#elif defined(__arm64__)
1046#if defined(R__MACOSX) && !defined(__SSE2__) && !defined(__xlC__) && \
1047 !defined(__i386__) && !defined(__x86_64__) && !defined(__arm__) && \
1134 for (fd = 0; fd <
mxfd; fd++) {
1138 if (
rc < 0 &&
rc != -2) {
1139 SysError(
"DispatchOneEvent",
"select: read error on %d", fd);
1145 if (
rc < 0 &&
rc != -2) {
1146 SysError(
"DispatchOneEvent",
"select: write error on %d", fd);
1166 select(0,
nullptr,
nullptr,
nullptr, &
tv);
1188 if (
h->HasReadInterest()) {
1192 if (
h->HasWriteInterest()) {
1196 h->ResetReadyMask();
1235 if (
h->HasReadInterest())
1237 if (
h->HasWriteInterest())
1239 h->ResetReadyMask();
1269 if (
sync ==
sh->IsSync()) {
1300 if (
pty->GetPid() == pid) {
1321 (
fddone == fd && read)) {
1332 (
fddone == fd && !read)) {
1442 return std::string(
cwd);
1451 Error(
"WorkingDirectory",
"getcwd() failed");
1470 if (res)
return std::string(res);
1471 else return std::string();
1508 char *arg =
StrDup(base);
1519 SysError(
"TempFileName",
"converting filedescriptor (%d)", fd);
1529 if (
name.IsNull() ||
name ==
".") {
1532 if (dir[
strlen(dir) - 1] !=
'/')
1538 if (!dir || !dir[0])
1540 else if (dir[
strlen(dir) - 1] !=
'/')
1622 return helper->IsPathLocal(path);
1637 return helper->GetPathInfo(path, buf);
1663 return ::link(from, to);
1673 return ::symlink((
char*)from, (
char*)to);
1675 return ::symlink(from, to);
1689#if defined(R__SEEK64)
1699 return ::rmdir(
name);
1701 return ::unlink(
name);
1726 const char *
p, *
patbuf = (
const char *)path;
1830 if (cnt == 0 && ch ==
EOF)
goto again;
1836 if (ch ==
' ' || ch ==
'\t') {
1870 return ::chmod(file,
mode);
1878 return ::umask(
mask);
1891 t.actime = (time_t)
actime;
1892 t.modtime = (time_t)modtime;
1893 return ::utime(file, &t);
1909 show.Form(
"Which: %s =",
wfil.Data());
1913 if (
wfil[0] ==
'/') {
1914#if defined(R__SEEK64)
1916 if (access(
wfil.Data(),
mode) == 0 &&
1920 if (access(
wfil.Data(),
mode) == 0 &&
1938 for (
const char* ptr =
search; *ptr;) {
1940 if (*ptr !=
'/' && *ptr !=
'$' && *ptr !=
'~')
1951 if (!
name.EndsWith(
"/"))
1956#if defined(R__SEEK64)
1958 if (access(
name.Data(),
mode) == 0 &&
1962 if (access(
name.Data(),
mode) == 0 &&
1985 if (!user || !user[0])
1990 return apwd->pw_uid;
2046 ug->fUser =
apwd->pw_name;
2047 ug->fPasswd =
apwd->pw_passwd;
2048 ug->fRealName =
apwd->pw_gecos;
2049 ug->fShell =
apwd->pw_shell;
2051 if (
gr)
ug->fGroup =
gr->fGroup;
2083 gr->fGid =
grp->gr_gid;
2084 gr->fGroup =
grp->gr_name;
2117 return std::getenv(
name);
2151 return ::pclose(
pipe);
2189#include <mach/mach.h>
2213 return ref.csCppData ||
ref.csCppObj;
2235 printf(
"[<unknown binary>]");
2249 printf(
" (no debug info)");
2294 const char *message =
" Generating stack trace...\n";
2296 if (fd && message) { }
2301#if defined(USE_GDB_STACK_TRACE)
2304 fprintf(
stderr,
"gdb not found, need it for stack trace\n");
2329#elif defined(R__AIX)
2334#elif defined(R__SOLARIS)
2345#elif defined(HAVE_BACKTRACE_SYMBOLS_FD) && defined(HAVE_DLADDR)
2353 const char *
cppfilt =
"c++filt";
2356 const char *
format1 =
" 0x%016lx in %.200s %s 0x%lx from %.200s\n";
2358 const char *
format2 =
" 0x%016lx in %.200s\n";
2360 const char *
format2 =
" 0x%016lx in %.200s at %.200s from %.200s\n";
2362 const char *
format3 =
" 0x%016lx in %.200s from %.200s\n";
2363 const char *
format4 =
" 0x%016lx in <unknown function>\n";
2365 const char *
format1 =
" 0x%08lx in %.200s %s 0x%lx from %.200s\n";
2367 const char *
format2 =
" 0x%08lx in %.200s\n";
2369 const char *
format2 =
" 0x%08lx in %.200s at %.200s from %.200s\n";
2371 const char *
format3 =
" 0x%08lx in %.200s from %.200s\n";
2372 const char *
format4 =
" 0x%08lx in <unknown function>\n";
2384 while (help.
Gets(
p)) {
2388 }
else if (help.
Index(
"gnu-new-abi") !=
kNPOS) {
2398#if (defined(R__LINUX) && !defined(R__WINGCC))
2401#ifdef PR_SET_PTRACER
2438 if (write(fd, message,
strlen(message)) < 0)
2444 std::ofstream
file1;
2450 Error(
"StackTrace",
"could not open file %s",
tmpf1.Data());
2471 info.dli_sname :
"<unknown>";
2480#if defined(MAC_OS_X_VERSION_10_10)
2482#elif defined(MAC_OS_X_VERSION_10_9)
2532 if (write(fd, buffer,
::strlen(buffer)) < 0)
2548 if (write(fd,
line.Data(),
line.Length()) < 0)
2559#elif defined(HAVE_EXCPT_H) && defined(HAVE_PDSC_H) && \
2560 defined(HAVE_RLD_INTERFACE_H)
2570 while (!
rc && context.sc_pc) {
2576 const char *
name =
"<unknown function>";
2577 sprintf(buffer,
" 0x%012lx %.200s + 0x%lx\n",
2578 context.sc_pc,
name, context.sc_pc -
addr);
2579 write(fd, buffer,
::strlen(buffer));
2674 if (
xh->fStdOutTty.IsNull()) {
2677 xh->fStdOutTty =
tty;
2686 if (
xh->fStdErrTty.IsNull()) {
2689 xh->fStdErrTty =
tty;
2694 Warning(
"RedirectOutput",
"could not restore stdout (back to original redirected"
2703 const char *
m = (
mode[0] ==
'a' ||
mode[0] ==
'w') ?
mode :
"a";
2706 xh->fReadOffSet = 0;
2711 xh->fReadOffSet = (
st.fSize > 0) ?
st.fSize :
xh->fReadOffSet;
2729 if (!(
xh->fStdOutTty.IsNull())) {
2734 xh->fStdOutTty =
"";
2738 "problems closing STDOUT_FILENO (%d) before 'dup2' (errno: %d)",
2743 SysError(
"RedirectOutput",
"could not restore stdout (back to original redirected"
2747 if (close(
xh->fStdOutDup) != 0) {
2749 "problems closing temporary 'out' descriptor %d (errno: %d)",
2755 if (!(
xh->fStdErrTty.IsNull())) {
2760 xh->fStdErrTty =
"";
2764 "problems closing STDERR_FILENO (%d) before 'dup2' (errno: %d)",
2769 SysError(
"RedirectOutput",
"could not restore stderr (back to original redirected"
2773 if (close(
xh->fStdErrDup) != 0) {
2775 "problems closing temporary 'err' descriptor %d (errno: %d)",
2820 Error(
"ListSymbols",
"not yet implemented");
2848#if !defined(R__MACOSX)
2854#if defined(R__MACOSX)
2864 if (
dylib.EndsWith(
".dylib") && !
dylib.Contains(
"/libSystem.B.dylib")) {
2875#elif defined(R__LINUX) || defined(R__SOLARIS) || defined(R__AIX)
2876#if defined(R__WINGCC )
2877 const char *
cLDD=
"cygcheck";
2878 const char *
cSOEXT=
".dll";
2888 #error "unsupported platform, fix memory leak to use it"
2892 const char *
cLDD=
"ldd";
2897 const char *
cSOEXT=
".so";
2904 while (
ldd.Gets(
p)) {
2921 solib.Remove(idx+3);
2998 if (!
ti)
return nullptr;
3031 hints.ai_socktype = 0;
3032 hints.ai_protocol = 0;
3051 ia.fHostname =
"UnNamedHost";
3054 ia.fHostname =
"UnknownHost";
3067 char tmp[
sizeof(
struct in_addr)];
3076 for (;
rp !=
nullptr;
rp =
rp->ai_next) {
3096 SysError(
"GetSockName",
"getsockname failed");
3101 ia.fFamily =
addr.sa_family;
3108 Error(
"GetSockName",
"getnameinfo failed");
3109 ia.fHostname =
"????";
3126 SysError(
"GetPeerName",
"getpeername failed");
3131 ia.fFamily =
addr.sa_family;
3138 Error(
"GetPeerName",
"getnameinfo failed");
3139 ia.fHostname =
"????";
3154 Error(
"GetServiceByName",
"no service \"%s\" with protocol \"%s\"\n",
3171 return Form(
"%d", port);
3188 if (!
strcmp(protocol,
"udp")){
3265 SysError(
"AcceptConnection",
"accept");
3278 if (sock < 0)
return;
3280#if !defined(R__AIX) || defined(_AIX41) || defined(_AIX43)
3298 if (
UnixRecv(sock, &header,
sizeof(header), 0) > 0) {
3299 int count =
ntohl(header);
3302 Error(
"RecvBuf",
"record header exceeds buffer size");
3304 }
else if (count > 0) {
3305 if (
UnixRecv(sock, buf, count, 0) < 0) {
3306 Error(
"RecvBuf",
"cannot receive buffer");
3323 if (
UnixSend(sock, &header,
sizeof(header), 0) < 0) {
3324 Error(
"SendBuf",
"cannot send header");
3329 Error(
"SendBuf",
"cannot send buffer");
3371 Error(
"RecvRaw",
"cannot receive buffer");
3406 Error(
"SendRaw",
"cannot send buffer");
3417 if (sock < 0)
return -1;
3422 SysError(
"SetSockOpt",
"setsockopt(SO_SNDBUF)");
3428 SysError(
"SetSockOpt",
"setsockopt(SO_RCVBUF)");
3434 SysError(
"SetSockOpt",
"setsockopt(SO_OOBINLINE)");
3440 SysError(
"SetSockOpt",
"setsockopt(SO_KEEPALIVE)");
3446 SysError(
"SetSockOpt",
"setsockopt(SO_REUSEADDR)");
3452 SysError(
"SetSockOpt",
"setsockopt(TCP_NODELAY)");
3458 SysError(
"SetSockOpt",
"ioctl(FIONBIO)");
3465 SysError(
"SetSockOpt",
"ioctl(SIOCSPGRP)");
3469 Error(
"SetSockOpt",
"ioctl(SIOCGPGRP) not supported on cygwin/gcc");
3476 Error(
"SetSockOpt",
"illegal option (%d)", opt);
3487 if (sock < 0)
return -1;
3494 SysError(
"GetSockOpt",
"getsockopt(SO_SNDBUF)");
3500 SysError(
"GetSockOpt",
"getsockopt(SO_RCVBUF)");
3506 SysError(
"GetSockOpt",
"getsockopt(SO_OOBINLINE)");
3512 SysError(
"GetSockOpt",
"getsockopt(SO_KEEPALIVE)");
3518 SysError(
"GetSockOpt",
"getsockopt(SO_REUSEADDR)");
3524 SysError(
"GetSockOpt",
"getsockopt(TCP_NODELAY)");
3531 SysError(
"GetSockOpt",
"fcntl(F_GETFL)");
3537#if !defined(R__LYNXOS) && !defined(R__WINGCC)
3539 SysError(
"GetSockOpt",
"ioctl(SIOCGPGRP)");
3543 Error(
"GetSockOpt",
"ioctl(SIOCGPGRP) not supported on LynxOS and cygwin/gcc");
3548#if !defined(R__LYNXOS)
3550 SysError(
"GetSockOpt",
"ioctl(SIOCATMARK)");
3554 Error(
"GetSockOpt",
"ioctl(SIOCATMARK) not supported on LynxOS");
3559#if !defined(R__LYNXOS)
3561 SysError(
"GetSockOpt",
"ioctl(FIONREAD)");
3565 Error(
"GetSockOpt",
"ioctl(FIONREAD) not supported on LynxOS");
3570 Error(
"GetSockOpt",
"illegal option (%d)", opt);
3591 {
SIGBUS,
nullptr,
nullptr,
"bus error" },
3592 {
SIGSEGV,
nullptr,
nullptr,
"segmentation violation" },
3593 {
SIGSYS,
nullptr,
nullptr,
"bad argument to system call" },
3594 {
SIGPIPE,
nullptr,
nullptr,
"write on a pipe with no one to read it" },
3595 {
SIGILL,
nullptr,
nullptr,
"illegal instruction" },
3596 {
SIGABRT,
nullptr,
nullptr,
"abort" },
3597 {
SIGQUIT,
nullptr,
nullptr,
"quit" },
3598 {
SIGINT,
nullptr,
nullptr,
"interrupt" },
3599 {
SIGWINCH,
nullptr,
nullptr,
"window size change" },
3600 {
SIGALRM,
nullptr,
nullptr,
"alarm clock" },
3601 {
SIGCHLD,
nullptr,
nullptr,
"death of a child" },
3602 {
SIGURG,
nullptr,
nullptr,
"urgent data arrived on an I/O channel" },
3603 {
SIGFPE,
nullptr,
nullptr,
"floating point exception" },
3604 {
SIGTERM,
nullptr,
nullptr,
"termination signal" },
3605 {
SIGUSR1,
nullptr,
nullptr,
"user-defined signal 1" },
3606 {
SIGUSR2,
nullptr,
nullptr,
"user-defined signal 2" }
3664 Break(
"TUnixSystem::DispatchSignals",
"%s: printing stacktrace",
UnixSigname(sig));
3694#elif defined(R__SOLARIS)
3696#elif defined(R__LYNXOS)
3707#if defined(SA_RESTART)
3712 ::SysError(
"TUnixSystem::UnixSignal",
"sigaction");
3731#elif defined(R__SOLARIS)
3739 ::SysError(
"TUnixSystem::UnixIgnoreSignal",
"sigaction");
3742 ::SysError(
"TUnixSystem::UnixIgnoreSignal",
"sigaction");
3761#elif defined(R__SOLARIS)
3763#elif defined(R__LYNXOS)
3775#if defined(SA_INTERRUPT)
3779#if defined(SA_RESTART)
3784 ::SysError(
"TUnixSystem::UnixSigAlarmInterruptsSyscalls",
"sigaction");
3804 ::SysError(
"TUnixSystem::UnixSignal",
"sigaction");
3827 static std::atomic<time_t>
jan95{0};
3839 if ((
int)
jan95 == -1) {
3840 ::SysError(
"TUnixSystem::UnixNow",
"error converting 950001 0:00 to time_t");
3856 itv.it_value.tv_sec = 0;
3857 itv.it_value.tv_usec = 0;
3858 itv.it_interval.tv_sec = 0;
3859 itv.it_interval.tv_usec = 0;
3861 itv.it_value.tv_sec = time_t(ms / 1000);
3862 itv.it_value.tv_usec = time_t((ms % 1000) * 1000);
3866 ::SysError(
"TUnixSystem::UnixSetitimer",
"setitimer");
3940 }
else if (
pw &&
pw->pw_dir) {
3977#if defined(_POSIX_SOURCE)
3980# define REAL_DIR_ENTRY(dp) 1
3982# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
4022#if defined(R__SEEK64)
4031#if defined(R__SEEK64)
4034 if (stat(path, &
sbuf) == -1) {
4065#if (defined(R__SOLARIS) && !defined(R__LINUX))
4135 if (!
addr.IsValid())
return -1;
4147 ::SysError(
"TUnixSystem::UnixTcpConnect",
"socket (%s:%d)",
4161 ::SysError(
"TUnixSystem::UnixTcpConnect",
"connect (%s:%d)",
4186 if (!
addr.IsValid())
return -1;
4198 ::SysError(
"TUnixSystem::UnixUdpConnect",
"socket (%s:%d)",
4207 ::SysError(
"TUnixSystem::UnixUdpConnect",
"connect (%s:%d)",
4230 ::SysError(
"TUnixSystem::UnixUnixConnect",
"socket path undefined");
4239 ::Error(
"TUnixSystem::UnixUnixConnect",
"socket path %s, longer than max allowed length (%u)",
4247 ::SysError(
"TUnixSystem::UnixUnixConnect",
"socket");
4255 ::SysError(
"TUnixSystem::UnixUnixConnect",
"connect");
4284 if (port == 0 &&
reuse) {
4285 ::Error(
"TUnixSystem::UnixTcpService",
"cannot do a port scan while reuse is true");
4297 ::SysError(
"TUnixSystem::UnixTcpService",
"socket");
4318 ::SysError(
"TUnixSystem::UnixTcpService",
"bind");
4330 ::SysError(
"TUnixSystem::UnixTcpService",
"bind (port scan)");
4338 ::SysError(
"TUnixSystem::UnixTcpService",
"listen");
4369 ::SysError(
"TUnixSystem::UnixUdpService",
"socket");
4382 ::SysError(
"TUnixSystem::UnixUdpService",
"bind");
4394 ::SysError(
"TUnixSystem::UnixUdpService",
"bind (port scan)");
4402 ::SysError(
"TUnixSystem::UnixUdpService",
"listen");
4443 ::SysError(
"TUnixSystem::UnixUnixService",
"socket path undefined");
4455 ::Error(
"TUnixSystem::UnixUnixService",
"socket path %s, longer than max allowed length (%u)",
4463 ::SysError(
"TUnixSystem::UnixUnixService",
"socket");
4468 ::SysError(
"TUnixSystem::UnixUnixService",
"bind");
4475 ::SysError(
"TUnixSystem::UnixUnixService",
"listen");
4494 if (sock < 0)
return -1;
4505 char *buf = (
char *)buffer;
4542 if (sock < 0)
return -1;
4551 const char *buf = (
const char *)buffer;
4588 static std::atomic<bool> initialized(
kFALSE);
4601 initialized =
kTRUE;
4628 if (reset || !initialized) {
4637 #if defined (R__AIX)
4639 #elif defined(R__MACOSX)
4664 #if defined(R__WINGCC) || defined(R__MACOSX)
4667 dynpath_syspart +=
"/lib/x86_64-linux-gnu:/usr/local/lib64:/usr/lib64:/lib64:";
4675 const auto ldsyspath = std::getenv(
"ROOT_LDSYSPATH");
4680 std::string
cmd(
"LD_DEBUG=libs LD_PRELOAD=DOESNOTEXIST ls 2>&1");
4685 if (
fgets(buffer, 128,
pf) !=
nullptr)
4689 std::size_t from =
result.find(
"search path=",
result.find(
"(LD_LIBRARY_PATH)"));
4690 std::size_t to =
result.find(
"(system search path)");
4691 if (from != std::string::npos && to != std::string::npos) {
4713 initialized =
kTRUE;
4764 if (res)
sLib = buf;
4770 const char* lib =
sLib.Data();
4783 Error(
"FindDynamicLibrary",
4787 static const char*
exts[] = {
4788 ".so",
".dll",
".dylib",
".sl",
".dl",
".a",
nullptr };
4801 Error(
"FindDynamicLibrary",
4802 "%s[.so | .dll | .dylib | .sl | .dl | .a] does not exist in %s",
4819 "hw.realmem dev.cpu.0.freq",
"r");
4838 Error(
"ListSymbols",
"not yet implemented");
4842#if defined(R__MACOSX)
4843#include <sys/resource.h>
4844#include <mach/mach.h>
4845#include <mach/mach_error.h>
4853 "hw.busfrequency hw.l2cachesize hw.memsize",
"r");
4892 ticks[0] = ticks[1] = ticks[2] = ticks[3] = 0;
4914 ::Error(
"TUnixSystem::GetDarwinCpuInfo",
"getloadavg failed");
5009#define vm_region vm_region_64
5013#define GLOBAL_SHARED_TEXT_SEGMENT 0x90000000U
5014#define GLOBAL_SHARED_DATA_SEGMENT 0xA0000000U
5015#define SHARED_TEXT_REGION_SIZE 0x10000000
5016#define SHARED_DATA_REGION_SIZE 0x10000000
5020 ::SysError(
"TUnixSystem::GetDarwinProcInfo",
"getrusage failed");
5023 ((
Float_t)(
ru.ru_utime.tv_usec) / 1000000.);
5025 ((
Float_t)(
ru.ru_stime.tv_usec) / 1000000.);
5048 for (address = 0; ; address +=
size) {
5081 switch (
info.share_mode) {
5083 if (
info.ref_count == 1) {
5105#if defined(R__LINUX)
5141 f =
fopen(
"/proc/meminfo",
"r");
5166 ticks[0] = ticks[1] = ticks[2] = ticks[3] = 0;
5173 sscanf(s.
Data(),
"%*s %ld %ld %ld %ld", &ticks[0], &ticks[3], &ticks[1], &ticks[2]);
5186 ::Error(
"TUnixSystem::GetLinuxCpuInfo",
"getloadavg failed");
5263 ::SysError(
"TUnixSystem::GetLinuxProcInfo",
"getrusage failed");
5266 ((
Float_t)(
ru.ru_utime.tv_usec) / 1000000.);
5268 ((
Float_t)(
ru.ru_stime.tv_usec) / 1000000.);
5293 if (!
info)
return -1;
5298#if defined(R__MACOSX)
5300#elif defined(R__LINUX)
5302#elif defined(R__FBSD)
5319 if (!
info)
return -1;
5321#if defined(R__MACOSX)
5323#elif defined(R__LINUX)
5325#elif defined(R__FBSD)
5338 if (!
info)
return -1;
5340#if defined(R__MACOSX)
5342#elif defined(R__LINUX)
5355 if (!
info)
return -1;
5357#if defined(R__MACOSX)
5359#elif defined(R__LINUX)
The file contains utilities which are foundational and could be used across the core component of ROO...
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Boolean (0=false, 1=true) (bool)
int Int_t
Signed integer 4 bytes (int)
int Ssiz_t
String size (currently int)
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
float Float_t
Float 4 bytes (float)
double Double_t
Double 8 bytes.
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
long long Long64_t
Portable signed long integer 8 bytes.
R__EXTERN TApplication * gApplication
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void SysError(const char *location, const char *msgfmt,...)
Use this function in case a system (OS or GUI) related error occurred.
void Break(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
R__EXTERN TExceptionHandler * gExceptionHandler
static unsigned int total
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t org
R__EXTERN TInterpreter * gCling
Int_t gDebug
Global variable setting the debug level. Set to 0 to disable, increase it in steps of 1 to increase t...
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
char * StrDup(const char *str)
Duplicate the string str.
int EscChar(const char *src, char *dst, int dstlen, char *specchars, char escchar)
Escape specchars in src with escchar and copy to dst.
@ kSigSegmentationViolation
R__EXTERN const char * gProgName
R__EXTERN TVirtualMutex * gSystemMutex
R__EXTERN const char * gRootDir
ESocketBindOption
Options for binging the sockets created.
@ kInaddrAny
Any address for socket binding.
R__EXTERN TSystem * gSystem
R__EXTERN TFileHandler * gXDisplay
R__EXTERN const char * gProgPath
static void sighandler(int sig)
Call the signal handler associated with the signal.
static const char * DynamicPath(const char *newpath=nullptr, Bool_t reset=kFALSE)
Get shared library search path.
static void SigHandler(ESignals sig)
Unix signal handler.
#define REAL_DIR_ENTRY(dp)
const char * kProtocolName
static struct Signalmap_t gSignalMap[kMAXSIGNALS]
static const char * GetExePath()
void(* SigHandler_t)(ESignals)
#define R__LOCKGUARD2(mutex)
const_iterator begin() const
const_iterator end() const
virtual void HandleException(Int_t sig)
Handle exceptions (kSigBus, kSigSegmentationViolation, kSigIllegalInstruction and kSigFloatingExcepti...
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
virtual void HandleException(int sig)=0
TFdSet & operator=(const TFdSet &rhs)
ULong_t fds_bits[(((kFDSETSIZE)+((kNFDBITS) -1))/(kNFDBITS))]
TFdSet(const TFdSet &org)
virtual Bool_t HasReadInterest()
True if handler is interested in read events.
virtual Bool_t WriteNotify()
Notify when something can be written to the descriptor associated with this handler.
virtual Bool_t HasWriteInterest()
True if handler is interested in write events.
virtual Bool_t ReadNotify()
Notify when something can be read from the descriptor associated with this handler.
Bool_t Notify() override
Notify when event occurred on descriptor associated with this handler.
This class represents an Internet Protocol (IP) address.
virtual const char * GetSTLIncludePath() const
TObject * Next() override
Return next object in the list. Returns 0 when no more objects in list.
Collectable string class.
virtual const char * GetName() const
Returns name of object.
virtual void SysError(const char *method, const char *msgfmt,...) const
Issue system error message.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Iterator of ordered collection.
TObject * Next() override
Return next object in collection.
Int_t Substitute(TString &s, const TString &replace, const TString &mods="", Int_t start=0, Int_t nMatchMax=10)
Substitute replaces the string s by a new string in which matching patterns are replaced by the repla...
static void ShutDown()
Shut down ROOT.
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
static const TString & GetLibDir()
Get the library directory in the installation.
Regular expression class.
Int_t Atoi() const
Return integer value of string.
Bool_t Gets(FILE *fp, Bool_t chop=kTRUE)
Read one line from the stream, including the \n, or until EOF.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Long64_t Atoll() const
Return long long value of string.
Abstract base class defining a generic interface to the underlying Operating System.
virtual void Unload(const char *module)
Unload a shared library.
TSeqCollection * fFileHandler
virtual void AddFileHandler(TFileHandler *fh)
Add a file handler to the list of system file handlers.
TString & GetLastErrorString()
Return the thread local storage for the custom last error message.
virtual Func_t DynFindSymbol(const char *module, const char *entry)
Find specific entry point in specified library.
static void ResetErrno()
Static function resetting system error number.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
static Int_t GetErrno()
Static function returning system error number.
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
virtual int GetPid()
Get process id.
virtual Long_t NextTimeOut(Bool_t mode)
Time when next timer of mode (synchronous=kTRUE or asynchronous=kFALSE) will time-out (in ms).
virtual int SetSockOpt(int sock, int kind, int val)
Set socket option.
virtual const char * Getenv(const char *env)
Get environment variable.
TFdSet * fWritemask
Files that should be checked for read events.
TFdSet * fSignals
Files with writes waiting.
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name.
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
virtual const char * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
virtual const char * ExpandFileName(const char *fname)
Expand a pathname getting rid of special shell characters like ~.
virtual TFileHandler * RemoveFileHandler(TFileHandler *fh)
Remove a file handler from the list of file handlers.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
virtual void ListLibraries(const char *regexp="")
List the loaded shared libraries.
virtual FILE * OpenPipe(const char *command, const char *mode)
Open a pipe.
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual Bool_t Init()
Initialize the OS interface.
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
TFdSet * fWriteready
Files with reads waiting.
virtual int ClosePipe(FILE *pipe)
Close the pipe.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual void AddSignalHandler(TSignalHandler *sh)
Add a signal handler to list of system signal handlers.
TSeqCollection * fSignalHandler
TFdSet * fReadready
Files that should be checked for write events.
TSystem * FindHelper(const char *path, void *dirptr=nullptr)
Create helper TSystem to handle file and directory operations that might be special for remote file a...
Int_t fNfd
Signals that were trapped.
std::atomic< Bool_t > fInsideNotify
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual const char * WorkingDirectory()
Return working directory.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual TInetAddress GetHostByName(const char *server)
Get Internet Protocol (IP) address of host.
virtual TSignalHandler * RemoveSignalHandler(TSignalHandler *sh)
Remove a signal handler from list of signal handlers.
virtual void Setenv(const char *name, const char *value)
Set environment variable.
static const char * StripOffProto(const char *path, const char *proto)
Strip off protocol string from specified path.
virtual TTimer * RemoveTimer(TTimer *t)
Remove timer from list of system timers.
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
Basic time type with millisecond precision.
Handles synchronous and a-synchronous timer events.
Bool_t CheckTimer(const TTime &now)
Check if timer timed out.
void AddTimer(TTimer *ti) override
Add timer to list of system timers.
int RecvRaw(int sock, void *buffer, int length, int flag) override
Receive exactly length bytes into buffer.
int OpenConnection(const char *server, int port, int tcpwindowsize=-1, const char *protocol="tcp") override
Open a connection to a service on a server.
int GetMemInfo(MemInfo_t *info) const override
Returns ram and swap memory usage info into the MemInfo_t structure.
Bool_t IsPathLocal(const char *path) override
Returns TRUE if the url in 'path' points to the local file system.
int Symlink(const char *from, const char *to) override
Create a symlink from file1 to file2.
const char * HomeDirectory(const char *userName=nullptr) override
Return the user's home directory.
Int_t GetGid(const char *group=nullptr) override
Returns the group's id. If group = 0, returns current user's group.
static int UnixUdpConnect(const char *hostname, int port)
Creates a UDP socket connection Is called via the TSocket constructor.
int CopyFile(const char *from, const char *to, Bool_t overwrite=kFALSE) override
Copy a file.
TTimer * RemoveTimer(TTimer *ti) override
Remove timer from list of system timers.
int AnnounceUnixService(int port, int backlog) override
Announce unix domain service on path "kServerPath/<port>".
static int UnixTcpConnect(const char *hostname, int port, int tcpwindowsize)
Open a TCP/IP connection to server and connect to a service (i.e.
Int_t SetFPEMask(Int_t mask=kDefaultMask) override
Set which conditions trigger a floating point exception.
static const char * UnixGetdirentry(void *dir)
Returns the next directory entry.
void Setenv(const char *name, const char *value) override
Set environment variable.
int ConnectService(const char *server, int port, int tcpwindowsize, const char *protocol="tcp")
Connect to service servicename on server servername.
Bool_t ChangeDirectory(const char *path) override
Change directory. Returns kTRUE in case of success, kFALSE otherwise.
static int UnixTcpService(int port, Bool_t reuse, int backlog, int tcpwindowsize, ESocketBindOption socketBindOption)
Open a socket, bind to it and start listening for TCP/IP connections on the port.
static const char * UnixHomedirectory(const char *user=nullptr)
Returns the user's home directory.
char * GetServiceByPort(int port) override
Get name of internet service.
Bool_t CheckSignals(Bool_t sync)
Check if some signals were raised and call their Notify() member.
static int UnixMakedir(const char *name)
Make a Unix file system directory.
static void UnixSigAlarmInterruptsSyscalls(Bool_t set)
When the argument is true the SIGALRM signal handler is set so that interrupted syscalls will not be ...
Int_t GetFPEMask() override
Return the bitmap of conditions that trigger a floating point exception.
static int UnixUnixConnect(int port)
Connect to a Unix domain socket.
int GetSysInfo(SysInfo_t *info) const override
Returns static system info, like OS type, CPU type, number of CPUs RAM size, etc into the SysInfo_t s...
void Exit(int code, Bool_t mode=kTRUE) override
Exit the application.
void AddDynamicPath(const char *lib) override
Add a new directory to the dynamic path.
void SetDynamicPath(const char *lib) override
Set the dynamic path to a new value.
int ClosePipe(FILE *pipe) override
Close the pipe.
std::string GetHomeDirectory(const char *userName=nullptr) const override
Return the user's home directory.
Int_t Select(TList *active, Long_t timeout) override
Select on file descriptors.
void Unsetenv(const char *name) override
Unset environment variable.
virtual ~TUnixSystem()
Reset to original state.
void Abort(int code=0) override
Abort the application.
void Syslog(ELogLevel level, const char *mess) override
Send mess to syslog daemon.
int AnnounceTcpService(int port, Bool_t reuse, int backlog, int tcpwindowsize=-1, ESocketBindOption socketBindOption=ESocketBindOption::kInaddrAny) override
Announce TCP/IP service.
UserGroup_t * GetGroupInfo(Int_t gid) override
Returns all group info in the UserGroup_t structure.
Int_t GetUid(const char *user=nullptr) override
Returns the user's id. If user = 0, returns current user's id.
Bool_t ExpandPathName(TString &patbuf) override
Expand a pathname getting rid of special shell characters like ~.
void Openlog(const char *name, Int_t options, ELogFacility facility) override
Open connection to system log daemon.
int AcceptConnection(int sock) override
Accept a connection.
TTime Now() override
Get current time in milliseconds since 0:00 Jan 1 1995.
static void UnixResetSignal(ESignals sig)
Restore old signal handler for specified signal.
int GetServiceByName(const char *service) override
Get port # of internet service.
const char * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists) override
Find location of file "wfil" in a search path.
void SigAlarmInterruptsSyscalls(Bool_t set) override
When the argument is true the SIGALRM signal handler is set so that interrupted syscalls will not be ...
int Utime(const char *file, Long_t modtime, Long_t actime) override
Set a files modification and access times.
const char * GetLinkedLibraries() override
Get list of shared libraries loaded at the start of the executable.
const char * GetError() override
Return system error string.
std::string GetWorkingDirectory() const override
Return working directory.
Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists) override
Returns FALSE if one can access a file using the specified access mode.
FILE * TempFileName(TString &base, const char *dir=nullptr, const char *suffix=nullptr) override
Create a secure temporary file by appending a unique 6 letter string to base.
void DispatchOneEvent(Bool_t pendingOnly=kFALSE) override
Dispatch a single event.
int Chmod(const char *file, UInt_t mode) override
Set the file permission bits. Returns -1 in case or error, 0 otherwise.
const char * PrependPathName(const char *dir, TString &name) override
Concatenate a directory and a file name.
Bool_t DispatchTimers(Bool_t mode)
Handle and dispatch timers.
void IgnoreSignal(ESignals sig, Bool_t ignore=kTRUE) override
If ignore is true ignore the specified signal, else restore previous behaviour.
void ListSymbols(const char *module, const char *re="") override
List symbols in a shared library.
int Load(const char *module, const char *entry="", Bool_t system=kFALSE) override
Load a shared library.
void StackTrace() override
Print a stack trace.
TInetAddress GetHostByName(const char *server) override
Get Internet Protocol (IP) address of host.
int SendBuf(int sock, const void *buffer, int length) override
Send a buffer headed by a length indicator.
const char * HostName() override
Return the system's host name.
void CheckChilds()
Check if children have finished.
int RecvBuf(int sock, void *buffer, int length) override
Receive a buffer headed by a length indicator.
static int UnixUnixService(int port, int backlog)
Open a socket, bind to it and start listening for Unix domain connections to it.
UserGroup_t * GetUserInfo(Int_t uid) override
Returns all user info in the UserGroup_t structure.
void SetDisplay() override
Set DISPLAY environment variable based on utmp entry. Only for UNIX.
TFileHandler * RemoveFileHandler(TFileHandler *fh) override
Remove a file handler from the list of file handlers.
static const char * UnixSigname(ESignals sig)
Return the signal name associated with a signal.
static Long64_t UnixNow()
Get current time in milliseconds since 0:00 Jan 1 1995.
static int UnixFSstat(const char *path, Long_t *id, Long_t *bsize, Long_t *blocks, Long_t *bfree)
Get info about a file system: id, bsize, bfree, blocks.
void ResetSignals() override
Reset signals handlers to previous behaviour.
TInetAddress GetSockName(int sock) override
Get Internet Protocol (IP) address of host and port #.
int Link(const char *from, const char *to) override
Create a link from file1 to file2.
int GetProcInfo(ProcInfo_t *info) const override
Returns cpu and memory used by this process into the ProcInfo_t structure.
int SetSockOpt(int sock, int option, int val) override
Set socket option.
static int UnixSetitimer(Long_t ms)
Set interval timer to time-out in ms milliseconds.
static int UnixSend(int sock, const void *buf, int len, int flag)
Send exactly length bytes from buffer.
TInetAddress GetPeerName(int sock) override
Get Internet Protocol (IP) address of remote host and port #.
static void UnixIgnoreSignal(ESignals sig, Bool_t ignore)
If ignore is true ignore the specified signal, else restore previous behaviour.
void DispatchSignals(ESignals sig)
Handle and dispatch signals.
void AddFileHandler(TFileHandler *fh) override
Add a file handler to the list of system file handlers.
int AnnounceUdpService(int port, int backlog, ESocketBindOption socketBindOption=ESocketBindOption::kInaddrAny) override
Announce UDP service.
void * OpenDirectory(const char *name) override
Open a Unix file system directory. Returns 0 if directory does not exist.
int Rename(const char *from, const char *to) override
Rename a file. Returns 0 when successful, -1 in case of failure.
const char * Getenv(const char *name) override
Get environment variable.
int GetPathInfo(const char *path, FileStat_t &buf) override
Get info about a file.
Int_t GetEffectiveGid() override
Returns the effective group id.
static int UnixSelect(Int_t nfds, TFdSet *readready, TFdSet *writeready, Long_t timeout)
Wait for events on the file descriptors specified in the readready and writeready masks or for timeou...
int GetPid() override
Get process id.
Int_t Exec(const char *shellcmd) override
Execute a command.
void ResetTimer(TTimer *ti) override
Reset a-sync timer.
TSignalHandler * RemoveSignalHandler(TSignalHandler *sh) override
Remove a signal handler from list of signal handlers.
static void UnixSignal(ESignals sig, SigHandler_t h)
Set a signal handler for a signal.
void CloseConnection(int sock, Bool_t force=kFALSE) override
Close socket.
Bool_t CheckDescriptors()
Check if there is activity on some file descriptors and call their Notify() member.
Bool_t Init() override
Initialize Unix system interface.
void Unload(const char *module) override
Unload a shared library.
int Umask(Int_t mask) override
Set the process file creation mode mask.
static int UnixFilestat(const char *path, FileStat_t &buf)
Get info about a file.
static int UnixRecv(int sock, void *buf, int len, int flag)
Receive exactly length bytes into buffer.
Int_t GetEffectiveUid() override
Returns the effective user id.
void FillWithCwd(char *cwd) const
Fill buffer with current working directory.
static int UnixWaitchild()
Wait till child is finished.
int Unlink(const char *name) override
Unlink, i.e.
void ListLibraries(const char *regexp="") override
List all loaded shared libraries.
void Closelog() override
Close connection to system log daemon.
Int_t RedirectOutput(const char *name, const char *mode="a", RedirectHandle_t *h=nullptr) override
Redirect standard output (stdout, stderr) to the specified file.
void Sleep(UInt_t milliSec) override
Sleep milliSec milliseconds.
void ResetSignal(ESignals sig, Bool_t reset=kTRUE) override
If reset is true reset the signal handler for the specified signal to the default handler,...
const char * TempDirectory() const override
Return a user configured or systemwide directory to create temporary files in.
Func_t DynFindSymbol(const char *module, const char *entry) override
dynamic linking of module
const char * GetDynamicPath() override
Return the dynamic path (used to find shared libraries).
FILE * OpenPipe(const char *shellcmd, const char *mode) override
Open a pipe.
void FreeDirectory(void *dirp) override
Close a Unix file system directory.
static void UnixResetSignals()
Restore old signal handlers.
int GetCpuInfo(CpuInfo_t *info, Int_t sampleTime=1000) const override
Returns cpu load average and load info into the CpuInfo_t structure.
void AddSignalHandler(TSignalHandler *sh) override
Add a signal handler to list of system signal handlers.
static void * UnixOpendir(const char *name)
Open a directory.
int SendRaw(int sock, const void *buffer, int length, int flag) override
Send exactly length bytes from buffer.
const char * WorkingDirectory() override
Return working directory.
int GetSockOpt(int sock, int option, int *val) override
Get socket option.
const char * FindDynamicLibrary(TString &lib, Bool_t quiet=kFALSE) override
Returns the path of a shared library (searches for library in the shared library search path).
void SetProgname(const char *name) override
Set the application name (from command line, argv[0]) and copy it in gProgName.
const char * GetDirEntry(void *dirp) override
Get next Unix file system directory entry. Returns 0 if no more entries.
int MakeDirectory(const char *name) override
Make a Unix file system directory.
static int UnixUdpService(int port, int backlog, ESocketBindOption socketBindOption)
Open a socket, bind to it and start listening for UDP connections on the port.
int GetFsInfo(const char *path, Long_t *id, Long_t *bsize, Long_t *blocks, Long_t *bfree) override
Get info about a file system: id, bsize, bfree, blocks.
const std::string & GetFallbackRootSys()
const char * GetExePath()
Returns the executable path name, used e.g. by SetRootSys().
void SetRootSys()
Set the ROOTSYS env var based on the executable location.
struct sigaction * fOldHandler
struct utmp * fUtmpContents
struct utmp * SearchUtmpEntry(const char *tty)