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";
619#if defined(R__MACOSX)
623#elif defined(HAVE_DLADDR)
682 Warning(
"SetDisplay",
"DISPLAY not set, setting it to %s",
disp.Data());
699 Warning(
"SetDisplay",
"DISPLAY not set, setting it to %s",
708 Error(
"SetDisplay",
"Can't figure out DISPLAY, set it manually\n"
709 "In case you run a remote ssh session, restart your ssh session with:\n"
710 "=========> ssh -Y");
725#if defined(R__SOLARIS) || defined (R__LINUX) || defined(R__AIX) || \
726 defined(R__FBSD) || defined(R__OBSD) || defined(R__HURD)
730 return Form(
"errno out of range %d", err);
742#if defined(R__ARC4_STDLIB) || defined(R__ARC4_BSDLIB)
745#elif defined(R__GETRANDOM_CLIB)
747#elif defined(R__USE_URANDOM)
748 std::ifstream
urandom{
"/dev/urandom"};
751 urandom.read(
reinterpret_cast<char *
>(buf),
len);
754#error "Reliable cryptographic random function not defined"
766#if defined(R__SOLARIS)
789 if (
h->HasReadInterest()) {
793 if (
h->HasWriteInterest()) {
806 if (!
h)
return nullptr;
819 int fd = th->
GetFd();
851 if (!
h)
return nullptr;
862 if (
hs->GetSignal() ==
h->GetSignal())
920#if defined(R__LINUX) && !defined(__powerpc__)
921#if defined(__GLIBC__) && (__GLIBC__>2 || __GLIBC__==2 && __GLIBC_MINOR__>=1)
923#if __GLIBC_MINOR__>=3
948#if defined(R__MACOSX) && defined(__SSE2__)
959#if defined(R__MACOSX) && !defined(__SSE2__) && \
960 (defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__))
966#elif defined(__arm64__)
979#if defined(R__MACOSX) && !defined(__SSE2__) && !defined(__xlC__) && \
980 !defined(__i386__) && !defined(__x86_64__) && !defined(__arm__) && \
1005#if defined(R__LINUX) && !defined(__powerpc__)
1006#if defined(__GLIBC__) && (__GLIBC__>2 || __GLIBC__==2 && __GLIBC_MINOR__>=1)
1016#if __GLIBC_MINOR__>=3
1038#if defined(R__MACOSX) && defined(__SSE2__)
1050#if defined(R__MACOSX) && !defined(__SSE2__) && \
1051 (defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__))
1063#elif defined(__arm64__)
1071#if defined(R__MACOSX) && !defined(__SSE2__) && !defined(__xlC__) && \
1072 !defined(__i386__) && !defined(__x86_64__) && !defined(__arm__) && \
1159 for (fd = 0; fd <
mxfd; fd++) {
1163 if (
rc < 0 &&
rc != -2) {
1164 SysError(
"DispatchOneEvent",
"select: read error on %d", fd);
1170 if (
rc < 0 &&
rc != -2) {
1171 SysError(
"DispatchOneEvent",
"select: write error on %d", fd);
1191 select(0,
nullptr,
nullptr,
nullptr, &
tv);
1213 if (
h->HasReadInterest()) {
1217 if (
h->HasWriteInterest()) {
1221 h->ResetReadyMask();
1260 if (
h->HasReadInterest())
1262 if (
h->HasWriteInterest())
1264 h->ResetReadyMask();
1325 if (
pty->GetPid() == pid) {
1346 (
fddone == fd && read)) {
1357 (
fddone == fd && !read)) {
1467 return std::string(
cwd);
1476 Error(
"WorkingDirectory",
"getcwd() failed");
1495 if (res)
return std::string(res);
1496 else return std::string();
1533 char *arg =
StrDup(base);
1544 SysError(
"TempFileName",
"converting filedescriptor (%d)", fd);
1554 if (
name.IsNull() ||
name ==
".") {
1557 if (dir[
strlen(dir) - 1] !=
'/')
1563 if (!dir || !dir[0])
1565 else if (dir[
strlen(dir) - 1] !=
'/')
1647 return helper->IsPathLocal(path);
1662 return helper->GetPathInfo(path, buf);
1688 return ::link(from, to);
1698 return ::symlink((
char*)from, (
char*)to);
1700 return ::symlink(from, to);
1714#if defined(R__SEEK64)
1724 return ::rmdir(
name);
1726 return ::unlink(
name);
1751 const char *
p, *
patbuf = (
const char *)path;
1855 if (cnt == 0 && ch ==
EOF)
goto again;
1861 if (ch ==
' ' || ch ==
'\t') {
1895 return ::chmod(file,
mode);
1903 return ::umask(
mask);
1916 t.actime = (time_t)
actime;
1917 t.modtime = (time_t)modtime;
1918 return ::utime(file, &t);
1931 show.Form(
"Which: %s =",
wfil.Data());
1935 if (
wfil[0] ==
'/') {
1936#if defined(R__SEEK64)
1938 if (access(
wfil.Data(),
mode) == 0 &&
1942 if (access(
wfil.Data(),
mode) == 0 &&
1960 for (
const char* ptr =
search; *ptr;) {
1962 if (*ptr !=
'/' && *ptr !=
'$' && *ptr !=
'~')
1973 if (!
name.EndsWith(
"/"))
1978#if defined(R__SEEK64)
1980 if (access(
name.Data(),
mode) == 0 &&
1984 if (access(
name.Data(),
mode) == 0 &&
2007 if (!user || !user[0])
2012 return apwd->pw_uid;
2068 ug->fUser =
apwd->pw_name;
2069 ug->fPasswd =
apwd->pw_passwd;
2070 ug->fRealName =
apwd->pw_gecos;
2071 ug->fShell =
apwd->pw_shell;
2073 if (
gr)
ug->fGroup =
gr->fGroup;
2105 gr->fGid =
grp->gr_gid;
2106 gr->fGroup =
grp->gr_name;
2139 return ::getenv(
name);
2173 return ::pclose(
pipe);
2211#include <mach/mach.h>
2235 return ref.csCppData || ref.csCppObj;
2257 printf(
"[<unknown binary>]");
2271 printf(
" (no debug info)");
2316 const char *message =
" Generating stack trace...\n";
2318 if (fd && message) { }
2323#if defined(USE_GDB_STACK_TRACE)
2326 fprintf(
stderr,
"gdb not found, need it for stack trace\n");
2351#elif defined(R__AIX)
2356#elif defined(R__SOLARIS)
2367#elif defined(HAVE_BACKTRACE_SYMBOLS_FD) && defined(HAVE_DLADDR)
2375 const char *
cppfilt =
"c++filt";
2378 const char *
format1 =
" 0x%016lx in %.200s %s 0x%lx from %.200s\n";
2380 const char *
format2 =
" 0x%016lx in %.200s\n";
2382 const char *
format2 =
" 0x%016lx in %.200s at %.200s from %.200s\n";
2384 const char *
format3 =
" 0x%016lx in %.200s from %.200s\n";
2385 const char *
format4 =
" 0x%016lx in <unknown function>\n";
2387 const char *
format1 =
" 0x%08lx in %.200s %s 0x%lx from %.200s\n";
2389 const char *
format2 =
" 0x%08lx in %.200s\n";
2391 const char *
format2 =
" 0x%08lx in %.200s at %.200s from %.200s\n";
2393 const char *
format3 =
" 0x%08lx in %.200s from %.200s\n";
2394 const char *
format4 =
" 0x%08lx in <unknown function>\n";
2406 while (help.
Gets(
p)) {
2410 }
else if (help.
Index(
"gnu-new-abi") !=
kNPOS) {
2420#if (defined(R__LINUX) && !defined(R__WINGCC))
2423#ifdef PR_SET_PTRACER
2460 if (write(fd, message,
strlen(message)) < 0)
2466 std::ofstream
file1;
2472 Error(
"StackTrace",
"could not open file %s",
tmpf1.Data());
2493 info.dli_sname :
"<unknown>";
2502#if defined(MAC_OS_X_VERSION_10_10)
2504#elif defined(MAC_OS_X_VERSION_10_9)
2554 if (write(fd, buffer,
::strlen(buffer)) < 0)
2570 if (write(fd,
line.Data(),
line.Length()) < 0)
2581#elif defined(HAVE_EXCPT_H) && defined(HAVE_PDSC_H) && \
2582 defined(HAVE_RLD_INTERFACE_H)
2592 while (!
rc && context.sc_pc) {
2598 const char *
name =
"<unknown function>";
2599 sprintf(buffer,
" 0x%012lx %.200s + 0x%lx\n",
2600 context.sc_pc,
name, context.sc_pc -
addr);
2601 write(fd, buffer,
::strlen(buffer));
2696 if (
xh->fStdOutTty.IsNull()) {
2699 xh->fStdOutTty =
tty;
2708 if (
xh->fStdErrTty.IsNull()) {
2711 xh->fStdErrTty =
tty;
2716 Warning(
"RedirectOutput",
"could not restore stdout (back to original redirected"
2725 const char *
m = (
mode[0] ==
'a' ||
mode[0] ==
'w') ?
mode :
"a";
2728 xh->fReadOffSet = 0;
2733 xh->fReadOffSet = (
st.fSize > 0) ?
st.fSize :
xh->fReadOffSet;
2751 if (!(
xh->fStdOutTty.IsNull())) {
2756 xh->fStdOutTty =
"";
2760 "problems closing STDOUT_FILENO (%d) before 'dup2' (errno: %d)",
2765 SysError(
"RedirectOutput",
"could not restore stdout (back to original redirected"
2769 if (close(
xh->fStdOutDup) != 0) {
2771 "problems closing temporary 'out' descriptor %d (errno: %d)",
2777 if (!(
xh->fStdErrTty.IsNull())) {
2782 xh->fStdErrTty =
"";
2786 "problems closing STDERR_FILENO (%d) before 'dup2' (errno: %d)",
2791 SysError(
"RedirectOutput",
"could not restore stderr (back to original redirected"
2795 if (close(
xh->fStdErrDup) != 0) {
2797 "problems closing temporary 'err' descriptor %d (errno: %d)",
2842 Error(
"ListSymbols",
"not yet implemented");
2870#if !defined(R__MACOSX)
2876#if defined(R__MACOSX)
2886 if (
dylib.EndsWith(
".dylib") && !
dylib.Contains(
"/libSystem.B.dylib")) {
2897#elif defined(R__LINUX) || defined(R__SOLARIS) || defined(R__AIX)
2898#if defined(R__WINGCC )
2899 const char *
cLDD=
"cygcheck";
2900 const char *
cSOEXT=
".dll";
2910 #error "unsupported platform, fix memory leak to use it"
2914 const char *
cLDD=
"ldd";
2919 const char *
cSOEXT=
".so";
2926 while (
ldd.Gets(
p)) {
2943 solib.Remove(idx+3);
3020 if (!
ti)
return nullptr;
3053 hints.ai_socktype = 0;
3054 hints.ai_protocol = 0;
3073 ia.fHostname =
"UnNamedHost";
3076 ia.fHostname =
"UnknownHost";
3089 char tmp[
sizeof(
struct in_addr)];
3098 for (;
rp !=
nullptr;
rp =
rp->ai_next) {
3118 SysError(
"GetSockName",
"getsockname failed");
3123 ia.fFamily =
addr.sa_family;
3130 Error(
"GetSockName",
"getnameinfo failed");
3131 ia.fHostname =
"????";
3148 SysError(
"GetPeerName",
"getpeername failed");
3153 ia.fFamily =
addr.sa_family;
3160 Error(
"GetPeerName",
"getnameinfo failed");
3161 ia.fHostname =
"????";
3176 Error(
"GetServiceByName",
"no service \"%s\" with protocol \"%s\"\n",
3193 return Form(
"%d", port);
3210 if (!
strcmp(protocol,
"udp")){
3287 SysError(
"AcceptConnection",
"accept");
3300 if (sock < 0)
return;
3302#if !defined(R__AIX) || defined(_AIX41) || defined(_AIX43)
3320 if (
UnixRecv(sock, &header,
sizeof(header), 0) > 0) {
3321 int count =
ntohl(header);
3324 Error(
"RecvBuf",
"record header exceeds buffer size");
3326 }
else if (count > 0) {
3327 if (
UnixRecv(sock, buf, count, 0) < 0) {
3328 Error(
"RecvBuf",
"cannot receive buffer");
3345 if (
UnixSend(sock, &header,
sizeof(header), 0) < 0) {
3346 Error(
"SendBuf",
"cannot send header");
3351 Error(
"SendBuf",
"cannot send buffer");
3393 Error(
"RecvRaw",
"cannot receive buffer");
3428 Error(
"SendRaw",
"cannot send buffer");
3439 if (sock < 0)
return -1;
3444 SysError(
"SetSockOpt",
"setsockopt(SO_SNDBUF)");
3450 SysError(
"SetSockOpt",
"setsockopt(SO_RCVBUF)");
3456 SysError(
"SetSockOpt",
"setsockopt(SO_OOBINLINE)");
3462 SysError(
"SetSockOpt",
"setsockopt(SO_KEEPALIVE)");
3468 SysError(
"SetSockOpt",
"setsockopt(SO_REUSEADDR)");
3474 SysError(
"SetSockOpt",
"setsockopt(TCP_NODELAY)");
3480 SysError(
"SetSockOpt",
"ioctl(FIONBIO)");
3487 SysError(
"SetSockOpt",
"ioctl(SIOCSPGRP)");
3491 Error(
"SetSockOpt",
"ioctl(SIOCGPGRP) not supported on cygwin/gcc");
3498 Error(
"SetSockOpt",
"illegal option (%d)", opt);
3509 if (sock < 0)
return -1;
3516 SysError(
"GetSockOpt",
"getsockopt(SO_SNDBUF)");
3522 SysError(
"GetSockOpt",
"getsockopt(SO_RCVBUF)");
3528 SysError(
"GetSockOpt",
"getsockopt(SO_OOBINLINE)");
3534 SysError(
"GetSockOpt",
"getsockopt(SO_KEEPALIVE)");
3540 SysError(
"GetSockOpt",
"getsockopt(SO_REUSEADDR)");
3546 SysError(
"GetSockOpt",
"getsockopt(TCP_NODELAY)");
3553 SysError(
"GetSockOpt",
"fcntl(F_GETFL)");
3559#if !defined(R__LYNXOS) && !defined(R__WINGCC)
3561 SysError(
"GetSockOpt",
"ioctl(SIOCGPGRP)");
3565 Error(
"GetSockOpt",
"ioctl(SIOCGPGRP) not supported on LynxOS and cygwin/gcc");
3570#if !defined(R__LYNXOS)
3572 SysError(
"GetSockOpt",
"ioctl(SIOCATMARK)");
3576 Error(
"GetSockOpt",
"ioctl(SIOCATMARK) not supported on LynxOS");
3581#if !defined(R__LYNXOS)
3583 SysError(
"GetSockOpt",
"ioctl(FIONREAD)");
3587 Error(
"GetSockOpt",
"ioctl(FIONREAD) not supported on LynxOS");
3592 Error(
"GetSockOpt",
"illegal option (%d)", opt);
3613 {
SIGBUS,
nullptr,
nullptr,
"bus error" },
3614 {
SIGSEGV,
nullptr,
nullptr,
"segmentation violation" },
3615 {
SIGSYS,
nullptr,
nullptr,
"bad argument to system call" },
3616 {
SIGPIPE,
nullptr,
nullptr,
"write on a pipe with no one to read it" },
3617 {
SIGILL,
nullptr,
nullptr,
"illegal instruction" },
3618 {
SIGABRT,
nullptr,
nullptr,
"abort" },
3619 {
SIGQUIT,
nullptr,
nullptr,
"quit" },
3620 {
SIGINT,
nullptr,
nullptr,
"interrupt" },
3621 {
SIGWINCH,
nullptr,
nullptr,
"window size change" },
3622 {
SIGALRM,
nullptr,
nullptr,
"alarm clock" },
3623 {
SIGCHLD,
nullptr,
nullptr,
"death of a child" },
3624 {
SIGURG,
nullptr,
nullptr,
"urgent data arrived on an I/O channel" },
3625 {
SIGFPE,
nullptr,
nullptr,
"floating point exception" },
3626 {
SIGTERM,
nullptr,
nullptr,
"termination signal" },
3627 {
SIGUSR1,
nullptr,
nullptr,
"user-defined signal 1" },
3628 {
SIGUSR2,
nullptr,
nullptr,
"user-defined signal 2" }
3686 Break(
"TUnixSystem::DispatchSignals",
"%s: printing stacktrace",
UnixSigname(sig));
3716#elif defined(R__SOLARIS)
3718#elif defined(R__LYNXOS)
3729#if defined(SA_RESTART)
3734 ::SysError(
"TUnixSystem::UnixSignal",
"sigaction");
3753#elif defined(R__SOLARIS)
3761 ::SysError(
"TUnixSystem::UnixIgnoreSignal",
"sigaction");
3764 ::SysError(
"TUnixSystem::UnixIgnoreSignal",
"sigaction");
3783#elif defined(R__SOLARIS)
3785#elif defined(R__LYNXOS)
3797#if defined(SA_INTERRUPT)
3801#if defined(SA_RESTART)
3806 ::SysError(
"TUnixSystem::UnixSigAlarmInterruptsSyscalls",
"sigaction");
3826 ::SysError(
"TUnixSystem::UnixSignal",
"sigaction");
3849 static std::atomic<time_t>
jan95{0};
3861 if ((
int)
jan95 == -1) {
3862 ::SysError(
"TUnixSystem::UnixNow",
"error converting 950001 0:00 to time_t");
3878 itv.it_value.tv_sec = 0;
3879 itv.it_value.tv_usec = 0;
3880 itv.it_interval.tv_sec = 0;
3881 itv.it_interval.tv_usec = 0;
3883 itv.it_value.tv_sec = time_t(ms / 1000);
3884 itv.it_value.tv_usec = time_t((ms % 1000) * 1000);
3888 ::SysError(
"TUnixSystem::UnixSetitimer",
"setitimer");
3962 }
else if (
pw &&
pw->pw_dir) {
3999#if defined(_POSIX_SOURCE)
4002# define REAL_DIR_ENTRY(dp) 1
4004# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
4044#if defined(R__SEEK64)
4053#if defined(R__SEEK64)
4056 if (stat(path, &
sbuf) == -1) {
4087#if (defined(R__SOLARIS) && !defined(R__LINUX))
4157 if (!
addr.IsValid())
return -1;
4169 ::SysError(
"TUnixSystem::UnixTcpConnect",
"socket (%s:%d)",
4183 ::SysError(
"TUnixSystem::UnixTcpConnect",
"connect (%s:%d)",
4208 if (!
addr.IsValid())
return -1;
4220 ::SysError(
"TUnixSystem::UnixUdpConnect",
"socket (%s:%d)",
4229 ::SysError(
"TUnixSystem::UnixUdpConnect",
"connect (%s:%d)",
4252 ::SysError(
"TUnixSystem::UnixUnixConnect",
"socket path undefined");
4261 ::Error(
"TUnixSystem::UnixUnixConnect",
"socket path %s, longer than max allowed length (%u)",
4269 ::SysError(
"TUnixSystem::UnixUnixConnect",
"socket");
4277 ::SysError(
"TUnixSystem::UnixUnixConnect",
"connect");
4304 if (port == 0 &&
reuse) {
4305 ::Error(
"TUnixSystem::UnixTcpService",
"cannot do a port scan while reuse is true");
4317 ::SysError(
"TUnixSystem::UnixTcpService",
"socket");
4338 ::SysError(
"TUnixSystem::UnixTcpService",
"bind");
4350 ::SysError(
"TUnixSystem::UnixTcpService",
"bind (port scan)");
4358 ::SysError(
"TUnixSystem::UnixTcpService",
"listen");
4387 ::SysError(
"TUnixSystem::UnixUdpService",
"socket");
4400 ::SysError(
"TUnixSystem::UnixUdpService",
"bind");
4412 ::SysError(
"TUnixSystem::UnixUdpService",
"bind (port scan)");
4420 ::SysError(
"TUnixSystem::UnixUdpService",
"listen");
4461 ::SysError(
"TUnixSystem::UnixUnixService",
"socket path undefined");
4473 ::Error(
"TUnixSystem::UnixUnixService",
"socket path %s, longer than max allowed length (%u)",
4481 ::SysError(
"TUnixSystem::UnixUnixService",
"socket");
4486 ::SysError(
"TUnixSystem::UnixUnixService",
"bind");
4493 ::SysError(
"TUnixSystem::UnixUnixService",
"listen");
4512 if (sock < 0)
return -1;
4523 char *buf = (
char *)buffer;
4560 if (sock < 0)
return -1;
4569 const char *buf = (
const char *)buffer;
4600 static std::atomic<bool> initialized(
kFALSE);
4613 initialized =
kTRUE;
4640 if (reset || !initialized) {
4649 #if defined (R__AIX)
4651 #elif defined(R__MACOSX)
4676 #if defined(R__WINGCC) || defined(R__MACOSX)
4679 dynpath_syspart +=
"/lib/x86_64-linux-gnu:/usr/local/lib64:/usr/lib64:/lib64:";
4682 std::string
cmd(
"LD_DEBUG=libs LD_PRELOAD=DOESNOTEXIST ls 2>&1");
4691 std::size_t from =
result.find(
"search path=",
result.find(
"(LD_LIBRARY_PATH)"));
4692 std::size_t to =
result.find(
"(system search path)");
4693 if (from != std::string::npos && to != std::string::npos) {
4714 initialized =
kTRUE;
4765 if (res)
sLib = buf;
4771 const char* lib =
sLib.Data();
4784 Error(
"FindDynamicLibrary",
4788 static const char*
exts[] = {
4789 ".so",
".dll",
".dylib",
".sl",
".dl",
".a",
nullptr };
4802 Error(
"FindDynamicLibrary",
4803 "%s[.so | .dll | .dylib | .sl | .dl | .a] does not exist in %s",
4820 "hw.realmem dev.cpu.0.freq",
"r");
4839 Error(
"ListSymbols",
"not yet implemented");
4843#if defined(R__MACOSX)
4844#include <sys/resource.h>
4845#include <mach/mach.h>
4846#include <mach/mach_error.h>
4854 "hw.busfrequency hw.l2cachesize hw.memsize",
"r");
4893 ticks[0] = ticks[1] = ticks[2] = ticks[3] = 0;
4915 ::Error(
"TUnixSystem::GetDarwinCpuInfo",
"getloadavg failed");
5010#define vm_region vm_region_64
5014#define GLOBAL_SHARED_TEXT_SEGMENT 0x90000000U
5015#define GLOBAL_SHARED_DATA_SEGMENT 0xA0000000U
5016#define SHARED_TEXT_REGION_SIZE 0x10000000
5017#define SHARED_DATA_REGION_SIZE 0x10000000
5021 ::SysError(
"TUnixSystem::GetDarwinProcInfo",
"getrusage failed");
5024 ((
Float_t)(
ru.ru_utime.tv_usec) / 1000000.);
5026 ((
Float_t)(
ru.ru_stime.tv_usec) / 1000000.);
5049 for (address = 0; ; address +=
size) {
5082 switch (
info.share_mode) {
5084 if (
info.ref_count == 1) {
5106#if defined(R__LINUX)
5137 f =
fopen(
"/proc/meminfo",
"r");
5164 ticks[0] = ticks[1] = ticks[2] = ticks[3] = 0;
5171 sscanf(s.
Data(),
"%*s %ld %ld %ld %ld", &ticks[0], &ticks[3], &ticks[1], &ticks[2]);
5184 ::Error(
"TUnixSystem::GetLinuxCpuInfo",
"getloadavg failed");
5290 ::SysError(
"TUnixSystem::GetLinuxProcInfo",
"getrusage failed");
5293 ((
Float_t)(
ru.ru_utime.tv_usec) / 1000000.);
5295 ((
Float_t)(
ru.ru_stime.tv_usec) / 1000000.);
5320 if (!
info)
return -1;
5325#if defined(R__MACOSX)
5327#elif defined(R__LINUX)
5329#elif defined(R__FBSD)
5346 if (!
info)
return -1;
5348#if defined(R__MACOSX)
5350#elif defined(R__LINUX)
5352#elif defined(R__FBSD)
5365 if (!
info)
return -1;
5367#if defined(R__MACOSX)
5369#elif defined(R__LINUX)
5382 if (!
info)
return -1;
5384#if defined(R__MACOSX)
5386#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
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
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
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 utility function.
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. Static utility function.
Regular expression class.
Bool_t Notify() override
Notify when signal occurs.
ESignals GetSignal() const
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. User must delete returned string.
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 AnnounceUdpService(int port, int backlog) override
Announce UDP service.
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 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.
int AnnounceTcpService(int port, Bool_t reuse, int backlog, int tcpwindowsize=-1) override
Announce TCP/IP service.
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.
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 ...
static int UnixUdpService(int port, int backlog)
Open a socket, bind to it and start listening for UDP connections on the port.
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.
static int UnixTcpService(int port, Bool_t reuse, int backlog, int tcpwindowsize)
Open a socket, bind to it and start listening for TCP/IP connections on the port.
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_t GetCryptoRandom(void *buf, Int_t len) override
Return cryptographic random number Fill provided buffer with random values Returns number of bytes wr...
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.
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()
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
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)