Refactor to avoid nonnull checks on "this" pointer.
G++ 6.0 asserts that the "this" pointer is non-null for member functions. Refactor methods that check if "this" is non-null to resolve this. winsup/cygwin/ChangeLog: external.cc (cygwin_internal): Check for a null pinfo before calling cmdline. fhandler_dsp.cc (Audio::blockSize): Make static. fhandler_dsp.cc (Audio_in): add default_buf_info. fhandler_dsp.cc (Audio_out): Ditto. fhandler_dsp.cc (Audio_out::buf_info): Refactor method to call default_buf_info if dev_ is null. fhandler_dsp.cc (Audio_in::buf_info): Ditto. fhandler_dsp.cc (fhandler_dev_dsp::_ioctl): Call Audio_out::default_buf_info if audio_out_ is null. fhandler_dsp.cc (fhandler_dev_dsp::_ioctl): Call Audio_in::default_buf_info if audio_in_ is null. fhandler_process.cc (format_process_fd): Check if pinfo is null. fhandler_process.cc (format_process_root): Ditto. fhandler_process.cc (format_process_cwd): Ditto. fhandler_process.cc (format_process_cmdline): Ditto. signal.cc (tty_min::kill_pgrp): Ditto. signal.cc (_pinfo::kill0): Ditto. sigproc.cc (pid_exists): Ditto. sigproc.cc (remove_proc): Ditto. times.cc (clock_gettime): Ditto. times.cc (clock_getcpuclockid): Ditto. path.cc (cwdstuff::override_win32_cwd): Check if old_cwd is null. path.cc (fcwd_access_t::Free): Factor null check of "this" out to caller(s). pinfo.cc (_pinfo::exists): Ditto. pinfo.cc (_pinfo::fd): Ditto. pinfo.cc (_pinfo::fds): Ditto. pinfo.cc (_pinfo::root): Ditto. pinfo.cc (_pinfo::cwd): Ditto. pinfo.cc (_pinfo::cmdline): Ditto. signal.cc (_pinfo::kill): Ditto. pinfo.cc (_pinfo::commune_request): remove non-null check on "this", as this method is only called from pinfo.cc after null checks pinfo.cc (_pinfo::pipe_fhandler): remove non-null check on "this", as this method is only called from pipe.cc (fhandler_pipe::open) after a null check. Signed-off-by: Peter Foley <pefoley2@pefoley.com>
This commit is contained in:
parent
e7e6119241
commit
0008bdea02
@ -342,7 +342,7 @@ cygwin_internal (cygwin_getinfo_types t, ...)
|
|||||||
size_t n;
|
size_t n;
|
||||||
pid_t pid = va_arg (arg, pid_t);
|
pid_t pid = va_arg (arg, pid_t);
|
||||||
pinfo p (pid);
|
pinfo p (pid);
|
||||||
res = (uintptr_t) p->cmdline (n);
|
res = p ? (uintptr_t) p->cmdline (n) : 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CW_CHECK_NTSEC:
|
case CW_CHECK_NTSEC:
|
||||||
|
@ -65,7 +65,7 @@ class fhandler_dev_dsp::Audio
|
|||||||
void convert_S16LE_S16BE (unsigned char *buffer, int size_bytes);
|
void convert_S16LE_S16BE (unsigned char *buffer, int size_bytes);
|
||||||
void fillFormat (WAVEFORMATEX * format,
|
void fillFormat (WAVEFORMATEX * format,
|
||||||
int rate, int bits, int channels);
|
int rate, int bits, int channels);
|
||||||
unsigned blockSize (int rate, int bits, int channels);
|
static unsigned blockSize (int rate, int bits, int channels);
|
||||||
void (fhandler_dev_dsp::Audio::*convert_)
|
void (fhandler_dev_dsp::Audio::*convert_)
|
||||||
(unsigned char *buffer, int size_bytes);
|
(unsigned char *buffer, int size_bytes);
|
||||||
|
|
||||||
@ -117,6 +117,7 @@ class fhandler_dev_dsp::Audio_out: public Audio
|
|||||||
void stop (bool immediately = false);
|
void stop (bool immediately = false);
|
||||||
int write (const char *pSampleData, int nBytes);
|
int write (const char *pSampleData, int nBytes);
|
||||||
void buf_info (audio_buf_info *p, int rate, int bits, int channels);
|
void buf_info (audio_buf_info *p, int rate, int bits, int channels);
|
||||||
|
static void default_buf_info (audio_buf_info *p, int rate, int bits, int channels);
|
||||||
void callback_sampledone (WAVEHDR *pHdr);
|
void callback_sampledone (WAVEHDR *pHdr);
|
||||||
bool parsewav (const char *&pData, int &nBytes,
|
bool parsewav (const char *&pData, int &nBytes,
|
||||||
int rate, int bits, int channels);
|
int rate, int bits, int channels);
|
||||||
@ -151,6 +152,7 @@ public:
|
|||||||
void stop ();
|
void stop ();
|
||||||
bool read (char *pSampleData, int &nBytes);
|
bool read (char *pSampleData, int &nBytes);
|
||||||
void buf_info (audio_buf_info *p, int rate, int bits, int channels);
|
void buf_info (audio_buf_info *p, int rate, int bits, int channels);
|
||||||
|
static void default_buf_info (audio_buf_info *p, int rate, int bits, int channels);
|
||||||
void callback_blockfull (WAVEHDR *pHdr);
|
void callback_blockfull (WAVEHDR *pHdr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -501,11 +503,11 @@ void
|
|||||||
fhandler_dev_dsp::Audio_out::buf_info (audio_buf_info *p,
|
fhandler_dev_dsp::Audio_out::buf_info (audio_buf_info *p,
|
||||||
int rate, int bits, int channels)
|
int rate, int bits, int channels)
|
||||||
{
|
{
|
||||||
p->fragstotal = MAX_BLOCKS;
|
if (dev_)
|
||||||
if (this && dev_)
|
|
||||||
{
|
{
|
||||||
/* If the device is running we use the internal values,
|
/* If the device is running we use the internal values,
|
||||||
possibly set from the wave file. */
|
possibly set from the wave file. */
|
||||||
|
p->fragstotal = MAX_BLOCKS;
|
||||||
p->fragsize = blockSize (freq_, bits_, channels_);
|
p->fragsize = blockSize (freq_, bits_, channels_);
|
||||||
p->fragments = Qisr2app_->query ();
|
p->fragments = Qisr2app_->query ();
|
||||||
if (pHdr_ != NULL)
|
if (pHdr_ != NULL)
|
||||||
@ -516,10 +518,17 @@ fhandler_dev_dsp::Audio_out::buf_info (audio_buf_info *p,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
default_buf_info(p, rate, bits, channels);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void fhandler_dev_dsp::Audio_out::default_buf_info (audio_buf_info *p,
|
||||||
|
int rate, int bits, int channels)
|
||||||
|
{
|
||||||
|
p->fragstotal = MAX_BLOCKS;
|
||||||
p->fragsize = blockSize (rate, bits, channels);
|
p->fragsize = blockSize (rate, bits, channels);
|
||||||
p->fragments = MAX_BLOCKS;
|
p->fragments = MAX_BLOCKS;
|
||||||
p->bytes = p->fragsize * p->fragments;
|
p->bytes = p->fragsize * p->fragments;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is called on an interupt so use locking.. Note Qisr2app_
|
/* This is called on an interupt so use locking.. Note Qisr2app_
|
||||||
@ -953,14 +962,23 @@ fhandler_dev_dsp::Audio_in::waitfordata ()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fhandler_dev_dsp::Audio_in::default_buf_info (audio_buf_info *p,
|
||||||
|
int rate, int bits, int channels)
|
||||||
|
{
|
||||||
|
p->fragstotal = MAX_BLOCKS;
|
||||||
|
p->fragsize = blockSize (rate, bits, channels);
|
||||||
|
p->fragments = 0;
|
||||||
|
p->bytes = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_dev_dsp::Audio_in::buf_info (audio_buf_info *p,
|
fhandler_dev_dsp::Audio_in::buf_info (audio_buf_info *p,
|
||||||
int rate, int bits, int channels)
|
int rate, int bits, int channels)
|
||||||
{
|
{
|
||||||
p->fragstotal = MAX_BLOCKS;
|
if (dev_)
|
||||||
p->fragsize = blockSize (rate, bits, channels);
|
|
||||||
if (this && dev_)
|
|
||||||
{
|
{
|
||||||
|
p->fragstotal = MAX_BLOCKS;
|
||||||
|
p->fragsize = blockSize (rate, bits, channels);
|
||||||
p->fragments = Qisr2app_->query ();
|
p->fragments = Qisr2app_->query ();
|
||||||
if (pHdr_ != NULL)
|
if (pHdr_ != NULL)
|
||||||
p->bytes = pHdr_->dwBytesRecorded - bufferIndex_
|
p->bytes = pHdr_->dwBytesRecorded - bufferIndex_
|
||||||
@ -970,8 +988,7 @@ fhandler_dev_dsp::Audio_in::buf_info (audio_buf_info *p,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p->fragments = 0;
|
default_buf_info(p, rate, bits, channels);
|
||||||
p->bytes = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1345,9 +1362,13 @@ fhandler_dev_dsp::_ioctl (unsigned int cmd, void *buf)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
audio_buf_info *p = (audio_buf_info *) buf;
|
audio_buf_info *p = (audio_buf_info *) buf;
|
||||||
audio_out_->buf_info (p, audiofreq_, audiobits_, audiochannels_);
|
if (audio_out_) {
|
||||||
debug_printf ("buf=%p frags=%d fragsize=%d bytes=%d",
|
audio_out_->buf_info (p, audiofreq_, audiobits_, audiochannels_);
|
||||||
buf, p->fragments, p->fragsize, p->bytes);
|
} else {
|
||||||
|
Audio_out::default_buf_info(p, audiofreq_, audiobits_, audiochannels_);
|
||||||
|
}
|
||||||
|
debug_printf ("buf=%p frags=%d fragsize=%d bytes=%d",
|
||||||
|
buf, p->fragments, p->fragsize, p->bytes);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1359,9 +1380,13 @@ fhandler_dev_dsp::_ioctl (unsigned int cmd, void *buf)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
audio_buf_info *p = (audio_buf_info *) buf;
|
audio_buf_info *p = (audio_buf_info *) buf;
|
||||||
audio_in_->buf_info (p, audiofreq_, audiobits_, audiochannels_);
|
if (audio_in_) {
|
||||||
debug_printf ("buf=%p frags=%d fragsize=%d bytes=%d",
|
audio_in_->buf_info (p, audiofreq_, audiobits_, audiochannels_);
|
||||||
buf, p->fragments, p->fragsize, p->bytes);
|
} else {
|
||||||
|
Audio_in::default_buf_info(p, audiofreq_, audiobits_, audiochannels_);
|
||||||
|
}
|
||||||
|
debug_printf ("buf=%p frags=%d fragsize=%d bytes=%d",
|
||||||
|
buf, p->fragments, p->fragsize, p->bytes);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,6 +371,11 @@ format_process_fd (void *data, char *&destbuf)
|
|||||||
case a trailing slash and more followup chars are allowed, provided the
|
case a trailing slash and more followup chars are allowed, provided the
|
||||||
descriptor symlink points to a directory. */
|
descriptor symlink points to a directory. */
|
||||||
char *fdp = strchr (path, '/') + 3;
|
char *fdp = strchr (path, '/') + 3;
|
||||||
|
if (!p)
|
||||||
|
{
|
||||||
|
set_errno (ENOENT);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
/* The "fd" directory itself? */
|
/* The "fd" directory itself? */
|
||||||
if (fdp[0] =='\0' || (fdp[0] == '/' && fdp[1] == '\0'))
|
if (fdp[0] =='\0' || (fdp[0] == '/' && fdp[1] == '\0'))
|
||||||
{
|
{
|
||||||
@ -479,7 +484,7 @@ format_process_root (void *data, char *&destbuf)
|
|||||||
cfree (destbuf);
|
cfree (destbuf);
|
||||||
destbuf = NULL;
|
destbuf = NULL;
|
||||||
}
|
}
|
||||||
destbuf = p->root (fs);
|
destbuf = p ? p->root (fs) : NULL;
|
||||||
if (!destbuf || !*destbuf)
|
if (!destbuf || !*destbuf)
|
||||||
{
|
{
|
||||||
destbuf = cstrdup ("<defunct>");
|
destbuf = cstrdup ("<defunct>");
|
||||||
@ -499,7 +504,7 @@ format_process_cwd (void *data, char *&destbuf)
|
|||||||
cfree (destbuf);
|
cfree (destbuf);
|
||||||
destbuf = NULL;
|
destbuf = NULL;
|
||||||
}
|
}
|
||||||
destbuf = p->cwd (fs);
|
destbuf = p ? p->cwd (fs) : NULL;
|
||||||
if (!destbuf || !*destbuf)
|
if (!destbuf || !*destbuf)
|
||||||
{
|
{
|
||||||
destbuf = cstrdup ("<defunct>");
|
destbuf = cstrdup ("<defunct>");
|
||||||
@ -519,7 +524,7 @@ format_process_cmdline (void *data, char *&destbuf)
|
|||||||
cfree (destbuf);
|
cfree (destbuf);
|
||||||
destbuf = NULL;
|
destbuf = NULL;
|
||||||
}
|
}
|
||||||
destbuf = p->cmdline (fs);
|
destbuf = p ? p->cmdline (fs) : NULL;
|
||||||
if (!destbuf || !*destbuf)
|
if (!destbuf || !*destbuf)
|
||||||
{
|
{
|
||||||
destbuf = cstrdup ("<defunct>");
|
destbuf = cstrdup ("<defunct>");
|
||||||
|
@ -134,7 +134,7 @@ tty_min::kill_pgrp (int sig)
|
|||||||
for (unsigned i = 0; i < pids.npids; i++)
|
for (unsigned i = 0; i < pids.npids; i++)
|
||||||
{
|
{
|
||||||
_pinfo *p = pids[i];
|
_pinfo *p = pids[i];
|
||||||
if (!p->exists () || p->ctty != ntty || p->pgid != pgid)
|
if (!p || !p->exists () || p->ctty != ntty || p->pgid != pgid)
|
||||||
continue;
|
continue;
|
||||||
if (p == myself)
|
if (p == myself)
|
||||||
killself = sig != __SIGSETPGRP && !exit_state;
|
killself = sig != __SIGSETPGRP && !exit_state;
|
||||||
|
@ -3932,7 +3932,7 @@ fcwd_access_t::Free (PVOID heap)
|
|||||||
{
|
{
|
||||||
/* Decrement the reference count. If it's down to 0, free
|
/* Decrement the reference count. If it's down to 0, free
|
||||||
structure from heap. */
|
structure from heap. */
|
||||||
if (this && InterlockedDecrement (&ReferenceCount ()) == 0)
|
if (InterlockedDecrement (&ReferenceCount ()) == 0)
|
||||||
{
|
{
|
||||||
/* In contrast to pre-Vista, the handle on init is always a
|
/* In contrast to pre-Vista, the handle on init is always a
|
||||||
fresh one and not the handle inherited from the parent
|
fresh one and not the handle inherited from the parent
|
||||||
@ -4320,7 +4320,8 @@ cwdstuff::override_win32_cwd (bool init, ULONG old_dismount_count)
|
|||||||
f_cwd->CopyPath (upp_cwd_str);
|
f_cwd->CopyPath (upp_cwd_str);
|
||||||
upp_cwd_hdl = dir;
|
upp_cwd_hdl = dir;
|
||||||
RtlLeaveCriticalSection (peb.FastPebLock);
|
RtlLeaveCriticalSection (peb.FastPebLock);
|
||||||
old_cwd->Free (heap);
|
if (old_cwd)
|
||||||
|
old_cwd->Free (heap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -514,7 +514,7 @@ _pinfo::set_ctty (fhandler_termios *fh, int flags)
|
|||||||
bool __reg1
|
bool __reg1
|
||||||
_pinfo::exists ()
|
_pinfo::exists ()
|
||||||
{
|
{
|
||||||
return this && process_state && !(process_state & (PID_EXITED | PID_REAPED | PID_EXECED));
|
return process_state && !(process_state & (PID_EXITED | PID_REAPED | PID_EXECED));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -685,7 +685,7 @@ _pinfo::commune_request (__uint32_t code, ...)
|
|||||||
res.s = NULL;
|
res.s = NULL;
|
||||||
res.n = 0;
|
res.n = 0;
|
||||||
|
|
||||||
if (!this || !pid)
|
if (!pid)
|
||||||
{
|
{
|
||||||
set_errno (ESRCH);
|
set_errno (ESRCH);
|
||||||
goto err;
|
goto err;
|
||||||
@ -783,7 +783,7 @@ out:
|
|||||||
fhandler_pipe *
|
fhandler_pipe *
|
||||||
_pinfo::pipe_fhandler (int64_t unique_id, size_t &n)
|
_pinfo::pipe_fhandler (int64_t unique_id, size_t &n)
|
||||||
{
|
{
|
||||||
if (!this || !pid)
|
if (!pid)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (pid == myself->pid)
|
if (pid == myself->pid)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -796,7 +796,7 @@ char *
|
|||||||
_pinfo::fd (int fd, size_t &n)
|
_pinfo::fd (int fd, size_t &n)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
if (!this || !pid)
|
if (!pid)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (pid != myself->pid)
|
if (pid != myself->pid)
|
||||||
{
|
{
|
||||||
@ -820,7 +820,7 @@ char *
|
|||||||
_pinfo::fds (size_t &n)
|
_pinfo::fds (size_t &n)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
if (!this || !pid)
|
if (!pid)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (pid != myself->pid)
|
if (pid != myself->pid)
|
||||||
{
|
{
|
||||||
@ -848,7 +848,7 @@ char *
|
|||||||
_pinfo::root (size_t& n)
|
_pinfo::root (size_t& n)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
if (!this || !pid)
|
if (!pid)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (pid != myself->pid && !ISSTATE (this, PID_NOTCYGWIN))
|
if (pid != myself->pid && !ISSTATE (this, PID_NOTCYGWIN))
|
||||||
{
|
{
|
||||||
@ -893,7 +893,7 @@ char *
|
|||||||
_pinfo::cwd (size_t& n)
|
_pinfo::cwd (size_t& n)
|
||||||
{
|
{
|
||||||
char *s = NULL;
|
char *s = NULL;
|
||||||
if (!this || !pid)
|
if (!pid)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (ISSTATE (this, PID_NOTCYGWIN))
|
if (ISSTATE (this, PID_NOTCYGWIN))
|
||||||
{
|
{
|
||||||
@ -939,7 +939,7 @@ char *
|
|||||||
_pinfo::cmdline (size_t& n)
|
_pinfo::cmdline (size_t& n)
|
||||||
{
|
{
|
||||||
char *s = NULL;
|
char *s = NULL;
|
||||||
if (!this || !pid)
|
if (!pid)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (ISSTATE (this, PID_NOTCYGWIN))
|
if (ISSTATE (this, PID_NOTCYGWIN))
|
||||||
{
|
{
|
||||||
|
@ -263,7 +263,7 @@ _pinfo::kill (siginfo_t& si)
|
|||||||
}
|
}
|
||||||
this_pid = pid;
|
this_pid = pid;
|
||||||
}
|
}
|
||||||
else if (si.si_signo == 0 && this && process_state == PID_EXITED)
|
else if (si.si_signo == 0 && process_state == PID_EXITED)
|
||||||
{
|
{
|
||||||
this_process_state = process_state;
|
this_process_state = process_state;
|
||||||
this_pid = pid;
|
this_pid = pid;
|
||||||
@ -299,8 +299,12 @@ kill0 (pid_t pid, siginfo_t& si)
|
|||||||
syscall_printf ("signal %d out of range", si.si_signo);
|
syscall_printf ("signal %d out of range", si.si_signo);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (pid > 0) {
|
||||||
return (pid > 0) ? pinfo (pid)->kill (si) : kill_pgrp (-pid, si);
|
pinfo p(pid);
|
||||||
|
return p && p->kill(si);
|
||||||
|
} else {
|
||||||
|
return kill_pgrp(-pid, si);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -326,7 +330,7 @@ kill_pgrp (pid_t pid, siginfo_t& si)
|
|||||||
{
|
{
|
||||||
_pinfo *p = pids[i];
|
_pinfo *p = pids[i];
|
||||||
|
|
||||||
if (!p->exists ())
|
if (!p || !p->exists ())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Is it a process we want to kill? */
|
/* Is it a process we want to kill? */
|
||||||
|
@ -155,7 +155,8 @@ proc_can_be_signalled (_pinfo *p)
|
|||||||
bool __reg1
|
bool __reg1
|
||||||
pid_exists (pid_t pid)
|
pid_exists (pid_t pid)
|
||||||
{
|
{
|
||||||
return pinfo (pid)->exists ();
|
pinfo p(pid);
|
||||||
|
return p && p->exists ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return true if this is one of our children, false otherwise. */
|
/* Return true if this is one of our children, false otherwise. */
|
||||||
@ -1143,7 +1144,7 @@ remove_proc (int ci)
|
|||||||
if (_my_tls._ctinfo != procs[ci].wait_thread)
|
if (_my_tls._ctinfo != procs[ci].wait_thread)
|
||||||
procs[ci].wait_thread->terminate_thread ();
|
procs[ci].wait_thread->terminate_thread ();
|
||||||
}
|
}
|
||||||
else if (procs[ci]->exists ())
|
else if (procs[ci] && procs[ci]->exists ())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
sigproc_printf ("removing procs[%d], pid %d, nprocs %d", ci, procs[ci]->pid,
|
sigproc_printf ("removing procs[%d], pid %d, nprocs %d", ci, procs[ci]->pid,
|
||||||
|
@ -542,7 +542,7 @@ clock_gettime (clockid_t clk_id, struct timespec *tp)
|
|||||||
pid = getpid ();
|
pid = getpid ();
|
||||||
|
|
||||||
pinfo p (pid);
|
pinfo p (pid);
|
||||||
if (!p->exists ())
|
if (!p || !p->exists ())
|
||||||
{
|
{
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
@ -765,7 +765,8 @@ clock_setres (clockid_t clk_id, struct timespec *tp)
|
|||||||
extern "C" int
|
extern "C" int
|
||||||
clock_getcpuclockid (pid_t pid, clockid_t *clk_id)
|
clock_getcpuclockid (pid_t pid, clockid_t *clk_id)
|
||||||
{
|
{
|
||||||
if (pid != 0 && !pinfo (pid)->exists ())
|
pinfo p(pid);
|
||||||
|
if (pid != 0 && (!p || !p->exists ()))
|
||||||
return (ESRCH);
|
return (ESRCH);
|
||||||
*clk_id = (clockid_t) PID_TO_CLOCKID (pid);
|
*clk_id = (clockid_t) PID_TO_CLOCKID (pid);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user