26 #include <sys/types.h> 37 p = getpwuid ( getuid () );
38 if ( p && p->pw_name ) {
39 size_t len = strlen ( p->pw_name );
42 if ( len > UINT_MAX || len <= 0 ) {
45 uiLength = (unsigned) len;
47 if ( uiLength + 1 >= bufSizeIn ) {
51 strncpy ( pBuf, p->pw_name, (
size_t) bufSizeIn );
61 (
const char *pProcessName,
const char *pBaseExecutableName)
87 int fd, maxfd = sysconf ( _SC_OPEN_MAX );
88 for ( fd = 0; fd <= maxfd; fd++ ) {
89 if (fd==STDIN_FILENO)
continue;
90 if (fd==STDOUT_FILENO)
continue;
91 if (fd==STDERR_FILENO)
continue;
96 #if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && _POSIX_THREAD_PRIORITY_SCHEDULING > 0 101 struct sched_param p;
103 p.sched_priority = 0;
104 status = sched_setscheduler(0, SCHED_OTHER, &p);
111 status = execlp (pBaseExecutableName, pBaseExecutableName, (
char *)
NULL);
113 fprintf (
stderr,
"**** The executable \"%s\" couldn't be located\n", pBaseExecutableName );
114 fprintf (
stderr,
"**** because of errno = \"%s\".\n", strerror (errno) );
115 fprintf (
stderr,
"**** You may need to modify your PATH environment variable.\n" );
116 fprintf (
stderr,
"**** Unable to start \"%s\" process.\n", pProcessName);
An EPICS-specific replacement for ANSI C's assert.
osiSpawnDetachedProcessReturn
LIBCOM_API osiGetUserNameReturn epicsStdCall osiGetUserName(char *pBuf, unsigned bufSizeIn)
LIBCOM_API osiSpawnDetachedProcessReturn epicsStdCall osiSpawnDetachedProcess(const char *pProcessName, const char *pBaseExecutableName)