posix

Posix and intl extension on windows

时光怂恿深爱的人放手 提交于 2020-01-13 16:22:50
问题 When I installed Symfony2 sandbox and try to check requirements by check.php I had 2 problems. My server don't have posix and intl extensions. I'm using WampServer 2.1e (32 bits) on Windows 7 32bit so my versions of apache and php are: Apache 2.2.17 VC6 ThreadSafe Php 5.3.5 I was trying to apply intl extension from http://windows.php.net/downloads/releases/php-5.3.5-Win32-VC6-x86.zip but i have weird error in apache log: "Can't find extension in c:/wamp/..." I'm sure that extension is in

Human readable, recursive, sorted list of largest files

旧街凉风 提交于 2020-01-13 09:42:47
问题 What is the best practice for printing a top 10 list of largest files in a POSIX shell? There has to be something more elegant than my current solution: DIR="." N=10 LIMIT=512000 find $DIR -type f -size +"${LIMIT}k" -exec du {} \; | sort -nr | head -$N | perl -p -e 's/^\d+\s+//' | xargs -I {} du -h {} where LIMIT is a file size threshold to limit the results of find. 回答1: This uses awk to create extra columns for sort keys. It only calls du once. The output should look exactly like du . I've

Human readable, recursive, sorted list of largest files

自闭症网瘾萝莉.ら 提交于 2020-01-13 09:42:28
问题 What is the best practice for printing a top 10 list of largest files in a POSIX shell? There has to be something more elegant than my current solution: DIR="." N=10 LIMIT=512000 find $DIR -type f -size +"${LIMIT}k" -exec du {} \; | sort -nr | head -$N | perl -p -e 's/^\d+\s+//' | xargs -I {} du -h {} where LIMIT is a file size threshold to limit the results of find. 回答1: This uses awk to create extra columns for sort keys. It only calls du once. The output should look exactly like du . I've

On Linux, is access() faster than stat()?

笑着哭i 提交于 2020-01-13 08:12:11
问题 I would have assumed that access() was just a wrapper around stat(), but I've been googling around and have found some anecdotes about replacing stat calls with 'cheaper' access calls. Assuming you are only interested in checking if a file exists, is access faster? Does it completely vary by filesystem? 回答1: Theory I doubt that. In lower layers of kernel there is no much difference between access() and stat() calls both are performing lookup operation : they map file name to an entry in

POSIX rlimit: What exactly can we assume about RLIMIT_DATA?

旧街凉风 提交于 2020-01-12 14:11:19
问题 Prequisites POSIX.1 2008 specifies the setrlimit() and getrlimit() functions. Various constants are provided for the resource argument, some of which are reproduced below for easier understaning of my question. The following resources are defined: (...) RLIMIT_DATA This is the maximum size of a data segment of the process, in bytes. If this limit is exceeded, the malloc() function shall fail with errno set to [ENOMEM]. (...) RLIMIT_STACK This is the maximum size of the initial thread's stack,

Terminating multithreaded application in C++11 by POSIX signal

最后都变了- 提交于 2020-01-12 07:34:07
问题 I wrote a simple multithreaded application in C++11 on Linux platform and I would like to terminate the server and its running threads by sending SIGINT signal. Obviously my server application uses thread support from C++11 ( std::thread etc.). Although I found some support for signal handling in C++11 ( std::signal ), I couldn't find any support for handling signals in multithreaded environment. So my question is - is there any way how to handle signals in multithreaded application in C++11

How to create a temporary file with portable shell in a secure way?

三世轮回 提交于 2020-01-12 07:33:31
问题 I want to create a temporary file in POSIX shell ( /bin/sh ). I found out that mktemp(1) doens't exist on my AIX box, and according to How portable is mktemp(1)?, it isn't that portable and/or secure anyway. So, what should I use instead ? 回答1: Why not use /dev/random ? It could be neater with perl but od and awk will do, something like: tempfile=XXX-$(od -N4 -tu /dev/random | awk 'NR==1 {print $2} {}') 回答2: You didn't exactly define "secure", but one element of it is probably to clean up

Differences between regex types

自闭症网瘾萝莉.ら 提交于 2020-01-12 07:03:14
问题 I'm reading the GNU find 's man page and stumbling upon this switch: -regextype type Changes the regular expression syntax understood by -regex and -iregex tests which occur later on the command line. Currently- implemented types are emacs (this is the default), posix-awk, posix- basic, posix-egrep and posix-extended. What's the difference between those regex syntaxes? I'm more familiar with Ruby's regex, so what type of regex should I use with find ? 回答1: Regular expressions are implemented

is it necessary to call pthread_mutex_destroy on a mutex?

半城伤御伤魂 提交于 2020-01-12 07:01:08
问题 I am using pthread_mutex_t in a C++ program, as follows: class Mutex : public noncopyable { public: Mutex() { pthread_mutex_init(&m_mutex, NULL); } void acquire() { pthread_mutex_lock(&m_mutex); } void release() { pthread_mutex_unlock(&m_mutex); } private: pthread_mutex_t m_mutex; }; (The class is not copyable - http://www.boost.org/doc/libs/1_53_0/boost/noncopyable.hpp) The thing that I don't understand - is it considered an error to not call pthread_mutex_destroy in the destructor? The

How do I tell what type my shell is

随声附和 提交于 2020-01-12 02:43:11
问题 How can I tell what type my shell is? ie, whether it's traditional sh, bash, ksh, csh, zsh etc. Note that checking $SHELL or $0 won't work because $SHELL isn't set by all shells, so if you start in one shell and then start a different one you may still have the old $SHELL . $0 only tells you where the shell binary is, but doesn't tell you whether /bin/sh is a real Bourne shell or bash. I presume that the answer will be "try some features and see what breaks", so if anyone can point me at a