One of the bullet point features for Windows Vista Enterprize and Ultimate is the Unix subsystem for windows, which allows you to write posix... stuff? Anyway I'm outa my league talking about it... Anyone use this feature? Or explain it...
I know next to nothing about Unix programming, I'm interested in learning though.
...
I haven't completely understood how to use sigprocmask(). Particularly how the set and oldset in its syntax work and how to use them.
int sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
Please explain with an example used to block, say SIGUSR1 for a few seconds and then unblock and handle it.
...
I write tools that are used in a shared workspace. Since there are multiple OS's working in this space, we generally use Python and standardize the version that is installed across machines. However, if I wanted to write some things in C, I was wondering if maybe I could have the application wrapped in a Python script, that detected the ...
Is it possible to handle POSIX signals within the Java Virtual Machine?
At least SIGINT and SIGKILL should be quite platform independent.
...
The subject says it all - normally easy and cross platform way is to poll, intelligently. But every OS has some means to notify without polling. Is it possible in a reasonably cross platform way? (I only really care about Windows and Linux, but I use mac, so I thought posix may help?)
...
How can one detect being in a chroot jail without root privileges? Assume a standard BSD or Linux system. The best I came up with was to look at the inode value for "/" and to consider whether it is reasonably low, but I would like a more accurate method for detection.
[edit 20080916 142430 EST] Simply looking around the filesystem is...
There are pages scattered around the web that describe POSIX AIO facilities in varying amounts of detail. None of them are terribly recent. It's not clear what, exactly, they're describing. For example, the "official" (?) web site for Linux kernel asynchronous I/O support here says that sockets don't work, but the "aio.h" manual pages...
If by some miracle a segfault occurs in our program, I want to catch the SIGSEGV and let the user (possibly a GUI client) know with a single return code that a serious problem has occurred. At the same time I would like to display information on the command line to show which signal was caught.
Today our signal handler looks as follows...
This is the code:
unsigned int number;
FILE* urandom = fopen("/dev/urandom", "r");
if (urandom) {
size_t bytes_read = fread(&number, 1, sizeof(number), urandom);
DCHECK(bytes_read == sizeof(number));
fclose(urandom);
} else {
NOTREACHED();
}
If not, how do I make it thread-safe?
...
I'd like to get uniform distribution in range [0.0, 1.0)
If possible, please let the implementation make use of random bytes from /dev/urandom.
It would also be nice if your solution was thread-safe. If you're not sure, please indicate that.
See some solution I thought about after reading other answers.
...
Is it possible to unlisten on a socket after you have called listen(fd, backlog)?
Edit: My mistake for not making myself clear. I'd like to be able to temporarily unlisten on the socket. Calling close() will leave the socket in the M2LS state and prevent me from reopening it (or worse, some nefarious program could bind to that socket)
...
On POSIX systems rename(2) provides for an atomic rename operation, including overwriting of the destination file if it exists and if permissions allow.
Is there any way to get the same semantics on Windows? I know about MoveFileTransacted() on Vista and Server 2008, but I need this to support Win2k and up.
The key word here is atomic....
I'm not a C++ developer, but I've always been interested in compilers, and I'm interested in tinkering with some of the GCC stuff (particularly LLVM).
On Windows, GCC requires a POSIX-emulation layer (cygwin or MinGW) to run correctly.
Why is that?
I use lots of other software, written in C++ and cross-compiled for different platforms...
I'm working on a project in C and it requires memalign(). Really, posix_memalign() would do as well, but darwin/OSX lacks both of them.
What is a good solution to shoehorn-in memalign? I don't understand the licensing for posix-C code if I were to rip off memalign.c and put it in my project- I don't want any viral-type licensing LGPL-i...
Hi,
using the Symbian S60 5th edition SDK released on October 2nd, I am compiling/running(on sim) the following code snippet:
void test(wchar_t *dest, int size, const wchar_t *fmt, ...) {
va_list vl;
va_start(vl, fmt);
vswprintf(dest, size, fmt, vl);
va_end(vl);
}
...
wchar_t str[1024];
// this crashes (2nd string 12...
How do I convert a datetime or date object into a POSIX timestamp in python? There are methods to create a datetime object out of a timestamp, but I don't seem to find any obvious ways to do the operation the opposite way.
...
POSIX environments provide at least two ways of accessing files. There's the standard system calls open(), read(), write(), and friends, but there's also the option of using mmap() to map the file into virtual memory.
When is it preferable to use one over the other? What're their individual advantages that merit including two interfac...
Compiling a program on Linux that calls POSIX timer functions (eg: timer_create, timer_settime) returns errors such as:
In function `foo':
timer.c:(.text+0xbb): undefined reference to `timer_create'
timer.c:(.text+0x187): undefined reference to `timer_settime'
collect2: ld returned 1 exit status
Which library do I need to link?
...
Is there a standard posix C function to convert encodings, say from windows-1251 to utf-8 and back?
...
I have two Slackware Linux systems on which the POSIX semaphore sem_open() call fails with errno set to 38. Sample code to reproduce below (the code works fine on CentOS / RedHat).
Are there any kernel or system configuration options that could cause this? Other suggestions?
Systems with issue are Slackware 10.1.0 kernel 2.6.11 /lib/li...