File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
sysvmsg /
tests /
004.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:04 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
msg_set_queue() and msg_stat_queue()
--SKIPIF--
<?php if (!extension_loaded("sysvmsg")) die("skip sysvmsg extension is not available")?>
--FILE--
<?php
$id = ftok(__FILE__, 'r');
$q = msg_get_queue($id);
echo "Set mode:\n";
$arr = array('msg_perm.mode' => 0600);
var_dump(msg_set_queue($q, $arr));
echo "Did really work:\n";
var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
echo "Set uid:\n"; // same as the running user to make it succeed
$arr = array('msg_perm.uid' => getmyuid());
var_dump(msg_set_queue($q, $arr));
echo "Did really work:\n";
var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
echo "Set gid:\n"; // same as the running user to make it succeed
$arr = array('msg_perm.gid' => getmygid());
var_dump(msg_set_queue($q, $arr));
echo "Did really work:\n";
var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
echo "Set smaller qbytes:\n";
$res = msg_stat_queue($q);
$arr = array('msg_qbytes' => ($res['msg_qbytes'] -1));
var_dump(msg_set_queue($q, $arr));
echo "Did really work:\n";
var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
if (!msg_remove_queue($q)) {
echo "BAD: queue removal failed\n";
}
echo "Done\n";
?>
--EXPECTF--
Set mode:
bool(true)
Did really work:
bool(true)
Set uid:
bool(true)
Did really work:
bool(true)
Set gid:
bool(true)
Did really work:
bool(true)
Set smaller qbytes:
bool(true)
Did really work:
bool(true)
Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>