public function __construct($path, $segsize, $name, $create = false)
{
$this->path = $path;
$this->segsize = $segsize;
$this->name = $name;
if ($create && !touch($this->path)) {
Daemon::log('Couldn\'t touch IPC file \'' . $this->path . '\'.');
exit(0);
}
if (!is_file($this->path) || ($this->key = ftok($this->path, 't')) === false) {
Daemon::log('Couldn\'t ftok() IPC file \'' . $this->path . '\'.');
exit(0);
}
if (!$this->open(0, $create) && $create) {
Daemon::log('Couldn\'t open IPC-' . $this->name . ' shared memory segment (key=' . $this->key . ', segsize=' . $this->segsize . ', uid=' . posix_getuid() . ', path = ' . $this->path . ').');
exit(0);
}
}