diff --git a/reference/sem/functions/ftok.xml b/reference/sem/functions/ftok.xml index 714ea729df..8dc1c5647a 100644 --- a/reference/sem/functions/ftok.xml +++ b/reference/sem/functions/ftok.xml @@ -1,13 +1,13 @@ - - + ftok Convert a pathname and a project identifier to a System V IPC key - - Description + + + &reftitle.description; intftok stringpathname @@ -15,20 +15,54 @@ The function converts the pathname of an existing - accessible file and a project identifier (proj) - into a + accessible file and a project identifier into an integer for use with for example - shmop_open and other System V IPC keys. The - proj parameter must be a one character string. + shmop_open and other System V IPC keys. + + + + &reftitle.parameters; + + + + pathname + + + Path to an accessible file. + + + + + proj + + + Project identifier. This must be a one character string. + + + + + + + + + &reftitle.returnvalues; On success the return value will be the created key value, otherwise -1 is returned. + + + + &reftitle.seealso; - See also shmop_open and sem_get. + + shmop_open + sem_get + + + msg_get_queue Create or attach to a message queue - - Description + + + &reftitle.description; resourcemsg_get_queue intkey @@ -16,21 +17,58 @@ msg_get_queue returns an id that can be used to access the System V message queue with the given key. The first call creates the message queue with - the optional perms (default: 0666). + the optional perms. A second call to msg_get_queue for the same key will return a different message queue identifier, but both identifiers access the same underlying message queue. - If the message queue already exists, the perms - will be ignored. - - - See also msg_remove_queue, - msg_receive, msg_send, - msg_stat_queue and - msg_set_queue. + + + &reftitle.parameters; + + + + key + + + + + + + perms + + + Queue permissions. Default to 0666. If the message queue already + exists, the perms will be ignored. + + + + + + + + + &reftitle.returnvalues; + + Returns an id that can be used to access the System V message queue. + + + + + &reftitle.seealso; + + + msg_remove_queue + msg_receive + msg_send + msg_stat_queue + msg_set_queue + + + + + msg_receive Receive a message from a message queue - - Description + + + &reftitle.description; boolmsg_receive resourcequeue @@ -22,73 +23,140 @@ msg_receive will receive the first message from the specified queue of the type specified by desiredmsgtype. - The type of the message that was received will be stored in - msgtype. - The maximum size of message to be accepted is specified by the - maxsize; if the message in the queue is larger - than this size the function will fail (unless you set - flags as described below). - The received message will be stored in message, - unless there were errors receiving the message, in which case the - optional errorcode will be set to the value of the - system errno variable to help you identify the cause. + + + + &reftitle.parameters; - If desiredmsgtype is 0, the message from the front - of the queue is returned. If desiredmsgtype is - greater than 0, then the first message of that type is returned. - If desiredmsgtype is less than 0, the first - message on the queue with the lowest type less than or equal to the - absolute value of desiredmsgtype will be read. - If no messages match the criteria, your script will wait until a suitable - message arrives on the queue. You can prevent the script from blocking - by specifying MSG_IPC_NOWAIT in the - flags parameter. + + + queue + + + + + + + desiredmsgtype + + + If desiredmsgtype is 0, the message from the front + of the queue is returned. If desiredmsgtype is + greater than 0, then the first message of that type is returned. + If desiredmsgtype is less than 0, the first + message on the queue with the lowest type less than or equal to the + absolute value of desiredmsgtype will be read. + If no messages match the criteria, your script will wait until a suitable + message arrives on the queue. You can prevent the script from blocking + by specifying MSG_IPC_NOWAIT in the + flags parameter. + + + + + msgtype + + + The type of the message that was received will be stored in this + parameter. + + + + + maxsize + + + The maximum size of message to be accepted is specified by the + maxsize; if the message in the queue is larger + than this size the function will fail (unless you set + flags as described below). + + + + + message + + + The received message will be stored in message, + unless there were errors receiving the message. + + + + + unserialize + + + unserialize defaults to &true;; if it is set to + &true;, the message is treated as though it was serialized using the + same mechanism as the session module. The message will be unserialized + and then returned to your script. This allows you to easily receive + arrays or complex object structures from other PHP scripts, or if you + are using the WDDX serializer, from any WDDX compatible source. + + + If unserialize is &false;, the message will be + returned as a binary-safe string. + + + + + flags + + + The optional flags allows you to pass flags to the + low-level msgrcv system call. It defaults to 0, but you may specify one + or more of the following values (by adding or ORing them together). + + Flag values for msg_receive + + + + MSG_IPC_NOWAIT + If there are no messages of the + desiredmsgtype, return immediately and do not + wait. The function will fail and return an integer value + corresponding to MSG_ENOMSG. + + + + MSG_EXCEPT + Using this flag in combination with a + desiredmsgtype greater than 0 will cause the + function to receive the first message that is not equal to + desiredmsgtype. + + + MSG_NOERROR + + If the message is longer than maxsize, + setting this flag will truncate the message to + maxsize and will not signal an error. + + + + +
+
+
+
+ + errorcode + + + If the function fails, the optional errorcode + will be set to the value of the system errno variable. + + + +
+
+ + + &reftitle.returnvalues; - unserialize defaults to &true;; if it is set to - &true;, the message is treated as though it was serialized using the same - mechanism as the session module. The message will be unserialized and - then returned to your script. This allows you to easily receive arrays - or complex object structures from other PHP scripts, or if you are using - the WDDX serializer, from any WDDX compatible source. - If unserialize is &false;, the message will be - returned as a binary-safe string. - - - The optional flags allows you to pass flags to the - low-level msgrcv system call. It defaults to 0, but you may specify one - or more of the following values (by adding or ORing them together). - - Flag values for msg_receive - - - - MSG_IPC_NOWAIT - If there are no messages of the - desiredmsgtype, return immediately and do not - wait. The function will fail and return an integer value - corresponding to MSG_ENOMSG. - - - - MSG_EXCEPT - Using this flag in combination with a - desiredmsgtype greater than 0 will cause the - function to receive the first message that is not equal to - desiredmsgtype. - - - MSG_NOERROR - - If the message is longer than maxsize, - setting this flag will truncate the message to - maxsize and will not signal an error. - - - - -
+ &return.success;
Upon successful completion the message queue data structure is updated as @@ -96,19 +164,20 @@ calling process, msg_qnum is decremented by 1 and msg_rtime is set to the current time. - - msg_receive returns &true; on success or &false; on - failure. If the function fails, the optional - errorcode will be set to the value of the system - errno variable. - - - See also msg_remove_queue, - msg_send, - msg_stat_queue and - msg_set_queue. -
+ + + &reftitle.seealso; + + + msg_remove_queue + msg_send + msg_stat_queue + msg_set_queue + + + +
+ msg_remove_queue Destroy a message queue - - Description + + + &reftitle.description; boolmsg_remove_queue resourcequeue @@ -17,13 +18,42 @@ processes have finished working with the message queue and you need to release the system resources held by it. + + + + &reftitle.parameters; - See also msg_get_queue, - msg_receive, - msg_stat_queue and - msg_set_queue. + + + queue + + + + + + + + + &reftitle.returnvalues; + + &return.success; + + + + + &reftitle.seealso; + + + msg_get_queue + msg_receive + msg_stat_queue + msg_set_queue + + + + + msg_send Send a message to a message queue - - Description + + + &reftitle.description; boolmsg_send resourcequeue @@ -21,25 +22,79 @@ msgtype (which MUST be greater than 0) to the message queue specified by queue. + + + + &reftitle.parameters; - If the message is too large to fit in the queue, your script will wait - until another process reads messages from the queue and frees enough - space for your message to be sent. - This is called blocking; you can prevent blocking by setting the - optional blocking parameter to &false;, in which - case msg_send will immediately return &false; if the - message is too big for the queue, and set the optional - errorcode to MSG_EAGAIN, indicating that you should - try to send your message again a little later on. + + + queue + + + + + + + msgtype + + + + + + + message + + + + + + + serialize + + + The optional serialize controls how the + message is sent. serialize + defaults to &true; which means that the message is + serialized using the same mechanism as the session module before being + sent to the queue. This allows complex arrays and objects to be sent to + other PHP scripts, or if you are using the WDDX serializer, to any WDDX + compatible client. + + + + + blocking + + + If the message is too large to fit in the queue, your script will wait + until another process reads messages from the queue and frees enough + space for your message to be sent. + This is called blocking; you can prevent blocking by setting the + optional blocking parameter to &false;, in which + case msg_send will immediately return &false; if the + message is too big for the queue, and set the optional + errorcode to MSG_EAGAIN, + indicating that you should try to send your message again a little + later on. + + + + + errorcode + + + + + + + + + + &reftitle.returnvalues; - The optional serialize controls how the - message is sent. serialize - defaults to &true; which means that the message is - serialized using the same mechanism as the session module before being - sent to the queue. This allows complex arrays and objects to be sent to - other PHP scripts, or if you are using the WDDX serializer, to any WDDX - compatible client. + &return.success; Upon successful completion the message queue data structure is updated as @@ -47,14 +102,22 @@ calling process, msg_qnum is incremented by 1 and msg_stime is set to the current time. - - See also msg_remove_queue, - msg_receive, - msg_stat_queue and - msg_set_queue. - + + + &reftitle.seealso; + + + msg_remove_queue + msg_receive + msg_stat_queue + msg_set_queue + + + + + + msg_set_queue Set information in the message queue data structure - - Description + + + &reftitle.description; boolmsg_set_queue resourcequeue @@ -16,8 +17,6 @@ msg_set_queue allows you to change the values of the msg_perm.uid, msg_perm.gid, msg_perm.mode and msg_qbytes fields of the underlying message queue data structure. - You specify the values you require by setting the value of the keys that - you require in the data array. Changing the data structure will require that PHP be running as the same @@ -26,13 +25,51 @@ root privileges are required to raise the msg_qbytes values above the system defined limit. + + + + &reftitle.parameters; - See also msg_remove_queue, - msg_receive, - msg_stat_queue and - msg_get_queue. + + + queue + + + + + + + data + + + You specify the values you require by setting the value of the keys + that you require in the data array. + + + + + + + &reftitle.returnvalues; + + &return.success; + + + + + &reftitle.seealso; + + + msg_remove_queue + msg_receive + msg_stat_queue + msg_get_queue + + + + + msg_stat_queue Returns information from the message queue data structure - - Description + + + &reftitle.description; arraymsg_stat_queue resourcequeue @@ -17,6 +18,25 @@ This is useful, for example, to determine which process sent the message that was just received. + + + + &reftitle.parameters; + + + + queue + + + + + + + + + + + &reftitle.returnvalues; The return value is an array whose keys and values have the following meanings: @@ -89,13 +109,20 @@ - - See also msg_remove_queue, - msg_receive, - msg_get_queue and - msg_set_queue. - + + + &reftitle.seealso; + + + msg_remove_queue + msg_receive + msg_get_queue + msg_set_queue + + + + - + sem_acquire Acquire a semaphore - - Description + + + &reftitle.description; boolsem_acquire resourcesem_identifier - sem_acquire blocks (if necessary) until the - semaphore can be acquired. A process attempting to acquire a - semaphore which it has already acquired will block forever - if acquiring the semaphore would cause its maximum number - of semaphore to be exceeded. - sem_identifier is a semaphore resource, - obtained from sem_get. + sem_acquire blocks (if necessary) until the semaphore + can be acquired. A process attempting to acquire a semaphore which it has + already acquired will block forever if acquiring the semaphore would cause + its maximum number of semaphore to be exceeded. + + After processing a request, any semaphores acquired by the process but not + explicitly released will be released automatically and a warning will be + generated. + + + + + &reftitle.parameters; + + + + sem_identifier + + + sem_identifier is a semaphore resource, + obtained from sem_get. + + + + + + + + + &reftitle.returnvalues; &return.success; - - After processing a request, any semaphores acquired by the - process but not explicitly released will be released automatically - and a warning will be generated. - - - See also - sem_get, and - sem_release. - + + + &reftitle.seealso; + + + sem_get + sem_release + + + + - + sem_get Get a semaphore id - - Description + + + &reftitle.description; resourcesem_get intkey @@ -18,31 +18,100 @@ sem_get returns an id that can be used to access the System V semaphore with the given key. - The semaphore is created if necessary using the permission bits specified in - perm (defaults to 0666). The number of processes that can - acquire the semaphore simultaneously is set to max_acquire - (defaults to 1). Actually this value is set only if the process - finds it is the only process currently attached to the semaphore. - - - Optional parameter auto_release specifies if the - semaphore should be automatically released on request shutdown. - It is available since PHP 4.3.0. - - - Returns a positive semaphore identifier on success, or &false; on - error. A second call to sem_get for the same key will return a different semaphore identifier, but both identifiers access the same underlying semaphore. + + + + &reftitle.parameters; - See also sem_acquire, - sem_release, and ftok. + + + key + + + + + + + max_acquire + + + The number of processes that can acquire the semaphore simultaneously + is set to max_acquire (defaults to 1). + + + + + perm + + + The semaphore permissions. Defaults to 0666. Actually this value is + set only if the process finds it is the only process currently + attached to the semaphore. + + + + + auto_release + + + Specifies if the semaphore should be automatically released on request + shutdown. + + + + + + + &reftitle.returnvalues; + + Returns a positive semaphore identifier on success, or &false; on + error. + + + + + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 4.3.0 + + The auto_release parameter was added. + + + + + + + + + + &reftitle.seealso; + + + sem_acquire + sem_release + ftok + + + + - + sem_release Release a semaphore - - Description + + + &reftitle.description; boolsem_release resourcesem_identifier @@ -17,19 +17,44 @@ is currently acquired by the calling process, otherwise a warning is generated. - - &return.success; - After releasing the semaphore, sem_acquire may be called to re-acquire it. + + + + &reftitle.parameters; - See also - sem_get and - sem_acquire. + + + sem_identifier + + + + + + + + + &reftitle.returnvalues; + + &return.success; + + + + + &reftitle.seealso; + + + sem_get + sem_acquire + + + + - + sem_remove Remove a semaphore - - Description + + + &reftitle.description; boolsem_remove resourcesem_identifier - sem_remove removes the semaphore - sem_identifier if it - has been created by sem_get, - otherwise generates a warning. + sem_remove removes the given semaphore. + + After removing the semaphore, it is no more accessible. + + + + + &reftitle.parameters; + + + + sem_identifier + + + The semaphore identifier. Must have been created with + sem_get, otherwise a warning is generated. + + + + + + + + + &reftitle.returnvalues; &return.success; - - After removing the semaphore, it is no more accessible. - - - See also sem_get, - sem_release and - sem_acquire. - + + + &reftitle.seealso; + + + sem_get + sem_release + sem_acquire + + + + - + shm_attach Creates or open a shared memory segment - - Description + + + &reftitle.description; intshm_attach intkey @@ -15,24 +15,71 @@ intperm - shm_attach returns an id that can be - used to access the System V shared memory with the given key, the - first call creates the shared memory segment with memsize - (default: sysvshm.init_mem in the &php.ini;, otherwise - 10000 bytes) and the optional perm-bits perm - (default: 0666). + shm_attach returns an id that can be used to access + the System V shared memory with the given key, the + first call creates the shared memory segment with + memsize and the optional perm-bits + perm. A second call to shm_attach for the same key will return a different shared memory identifier, but both identifiers access the same underlying - shared memory. Memsize and + shared memory. memsize and perm will be ignored. + + + + &reftitle.parameters; - See also ftok, and shm_detach. + + + key + + + + + + + memsize + + + The memory size. If not provided, default to the + sysvshm.init_mem in the &php.ini;, otherwise 10000 + bytes. + + + + + perm + + + The optional permission bits. Default to 0666. + + + + + + + &reftitle.returnvalues; + + Returns a shared memory segment identifier. + + + + + &reftitle.seealso; + + + sem_detach + ftok + + + + - + shm_detach Disconnects from shared memory segment - - Description + + + &reftitle.description; boolshm_detach intshm_identifier - shm_detach disconnects from the shared - memory given by the shm_identifier created - by shm_attach. Remember, that shared memory - still exist in the Unix system and the data is still present. + shm_detach disconnects from the shared memory given + by the shm_identifier created by + shm_attach. Remember, that shared memory still exist + in the Unix system and the data is still present. + + + + &reftitle.parameters; + + + + shm_identifier + + + + + + + + + + + &reftitle.returnvalues; shm_detach always returns &true;. - - See also shm_attach, shm_remove, - and shm_remove_var. - + + + &reftitle.seealso; + + + shm_attach + shm_remove + shm_remove_var + + + + - + shm_get_var Returns a variable from shared memory - - Description + + + &reftitle.description; mixedshm_get_var intshm_identifier @@ -15,13 +15,42 @@ shm_get_var returns the variable with a given - variable_key, in the shared memory - segment identified by shm_identifier. - shm_identifier was obtained from - shm_attach. The variable is still present - in the shared memory. + variable_key, in the given shared memory segment. + The variable is still present in the shared memory. + + + &reftitle.parameters; + + + + shm_identifier + + + Shared memory segment, obtained from shm_attach. + + + + + variable_key + + + The variable key. + + + + + + + + + &reftitle.returnvalues; + + Returns the variable with the given key. + + + - + shm_put_var Inserts or updates a variable in shared memory - - Description + + + &reftitle.description; boolshm_put_var intshm_identifier @@ -18,10 +18,6 @@ shm_put_var inserts or updates the variable with the given variable_key. - All variable-types are supported. - - - &return.success; Warnings (E_WARNING level) will be issued if @@ -30,6 +26,45 @@ request. + + + &reftitle.parameters; + + + + shm_identifier + + + + + + + variable_key + + + + + + + variable + + + The variable. All variable-types + are supported. + + + + + + + + + &reftitle.returnvalues; + + &return.success; + + + - + shm_remove_var Removes a variable from shared memory - - Description + + + &reftitle.description; boolshm_remove_var intshm_identifier @@ -18,10 +18,48 @@ Removes a variable with a given variable_key and frees the occupied memory. + + + + &reftitle.parameters; - See also shm_remove. + + + shm_identifier + + + The shared memory identifier. + + + + + variable_key + + + The variable key. + + + + + + + &reftitle.returnvalues; + + &return.success; + + + + + &reftitle.seealso; + + + shm_remove + + + + - + shm_remove Removes shared memory from Unix systems - - Description + + + &reftitle.description; boolshm_remove intshm_identifier @@ -16,10 +16,40 @@ shm_remove removes the shared memory shm_identifier. All data will be destroyed. + + + + &reftitle.parameters; - See also shm_remove_var. + + + shm_identifier + + + The shared memory identifier. + + + + + + + &reftitle.returnvalues; + + &return.success; + + + + + &reftitle.seealso; + + + shm_remove_var + + + +