process.
PHP_FE(proc_get_status, NULL)
#endif
+#ifdef HAVE_NICE
+ PHP_FE(nice, NULL)
+#endif
+
PHP_FE(rand, NULL)
PHP_FE(srand, NULL)
PHP_FE(getrandmax, NULL)
PHP_CHECK_FUNC(dn_expand, resolv, bind, socket)
dnl already done PHP_CHECK_FUNC(dn_skipname, resolv, bind, socket)
+dnl
+dnl Check for the availability of the nice function
+dnl
+PHP_CHECK_FUNC(nice)
+
PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.c crypt.c \
cyr_convert.c datetime.c dir.c dl.c dns.c exec.c file.c filestat.c \
flock_compat.c formatted_print.c fsock.c head.c html.c image.c \
#include <fcntl.h>
#endif
+#if HAVE_NICE && HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/* {{{ php_Exec
* If type==0, only last line of output is returned (exec)
* If type==1, all lines will be printed and last lined returned (system)
}
/* }}} */
+#ifdef HAVE_NICE
+/* {{{ proto bool nice(int priority)
+ Change the priority of the current process */
+PHP_FUNCTION(nice)
+{
+ long pri;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pri) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ errno = 0;
+ nice(pri);
+ if (errno) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only a super user may attempt to increase the process priority.");
+ RETURN_FALSE;
+ }
+
+ RETURN_TRUE;
+}
+/* }}} */
+#endif
+
/*
* Local variables:
* tab-width: 4
PHP_FUNCTION(proc_get_status);
PHP_FUNCTION(proc_close);
PHP_FUNCTION(proc_terminate);
+PHP_FUNCTION(nice);
PHP_MINIT_FUNCTION(proc_open);
char *php_escape_shell_cmd(char *);