posix

Compiling/Matching POSIX Regular Expressions in C

I'm trying to match the following items in the string pcode: u followed by a 1 or 2 digit number phaseu phasep x (surrounded by non-word chars) y (surrounded by non-word chars) z (surrounded by non-word chars) I've tried to implement a regex match using the POSIX regex functions (shown below), but have two problems: The compiled pa...

POSIX Process Groups

Hi, I'm currently implementing process groups into my operating system project's POSIX subsystem. However, I've become a little confused at the POSIX specification (setsid) (along by Wikipedia's page on Process groups). Our terminal layer sends SIGINT to the foreground process (group, whose id should equal the group leader's PID). In t...

How to access the default stdin while using file redirection?

I need to run a script and have access to the default stdin (terminal input) in my program. I could do ./program "script", opening and parsing the script through the program, but I want to make it POSIX style, accepting input from pipes or from redirection. I mean, since my program is a parser, I could run ./program, type the script and...

Windows API vs. UNIX shell (equiv?) -- Or -- When is a programming language a language and not a script?

I've seen a number of question's closed as "Not programming related" (e.g. http://stackoverflow.com/questions/397854/what-process-accesses-my-hdd) I understand that their's several alternative site (stackoverflow) themed-forums and to attempt keep site question's to a minimum also some may argue that this is too subjective, o well, I go...

Is there a Java library of Unix functions?

I am looking for a Java library to interface with standard Unix functions, i.e. stat(), getpwuid(), readlink(). This used to exist, and was called javaunix. It was released back in 2000. See this announcement. But the project page is now gone. Is there any modern replacement for these types of functions in Java today? One could mak...

Has anyone seen a programming language that handles threads like this?

Most of the multithreaded work I have done has been in C/C++, Python, or Delphi (Object Pascal). All on Windows. I'll use Delphi for my discussion here. Delphi has a nice class called TThread which abstracts the thread creation process. The class provides an Execute method which is the created thread's thread function. You override ...

mq_unlink setting errno to EEXIST

I'm using message queues for inter-thread communication in a server. The server was functioning as expected on Thursday evening. When I picked the project back up on Monday, it was unable to create two of the six queues in use, citing that they were already open (O_EXCL is set). This should not have been the case, but nevertheless I a...

Which is better for windows? pthreads or CreateMutex?

Hi all, I am porting my application to windows from Linux. I am fairly new to the fine-art of porting application across platforms. As far as I know, Windows does not natively support POSIX threads implementation. Is this true? I have heard about some implementation of pthreads for windows (a wrapper or something), would it be better to ...

UNIX Portable Atomic Operations

Is there a (POSIX-)portable way in C for atomic variable operations similar to a portable threading with pthread? Atomic operations are operations like "increment and get" that are executed atomically that means that no context switch can interfere with the operation. In Linux kernel space, we have to atomic_t type, in Java we have the ...

A portable way of getting the nr of processing units (# cpu,cores) in c?

Is there a way to get the nr of processing units like cpus or cores in a system? I am going to write an app with pthreads so if there is a posix call that would be great. I know about reading from /proc/cpuinfo but that is not so portable. Is there another more portable way? ...

What's MonoPosixHelper.dll all about?

In my effort to learn more about cross-platform developping in C# I tried checking out the Banshee project. In it's current form it is not compiling. So I'm trying to fix it up as far as my knowledge is stretching. Firstly almost all of the projects have broken references. I thought this was the easiest part to fix. I thought wrong... A...

Why would Textpad ask if you want to use POSIX regular expression syntax?

I need to separate out a bunch of image urls from a document in which the images are associated with names like this: bellpepper = "http://images.com/bellpepper.jpg" cabbage = "http://images.com/cabbage.jpg" lettuce = "http://images.com/lettuce.jpg" pumpkin = "http://images.com/pumpkin.jpg" I want to remove all text except the URLs fr...

How to enumerate all IP addresses attached to a machine, in POSIX C?

Background: I'm writing a daemon that makes outgoing TCP/IP connections. It will be running on machines with multiple (non-loopback) IP addresses. I'd like the users to be able to specify, in the daemon's config file, which IP address(es) to use for outgoing connections, or * to use all. The addresses will be used in a rotation, each...

Naming scheme for typedefs

I'm working on a library that extensively used constructs like typedef struct foo_bar_s { ... } foo_bar_t; It's a bad idea to use the _t suffix, because it's a POSIX reserved namespace. The _s suffix for structs is also pretty useless. So I thought I can change it all to typedef struct foo_bar { ... } foo_bar; or if the str...

What are the Python thread + Unix signals semantics?

What are the rules surrounding Python threads and how Unix signals are handled? Is KeyboardInterrupt, which is triggered by SIGINT but handled internally by the Python runtime, handled differently? ...

What is the best way to manage unix process from java?

I'm looking for some simple tasks like listing all the running process of a user, or kill a particular process by pid etc. Basic unix process management from Java. Is there a library out there that is relatively mature and documented? I could run a external command from the JVM and then parse the standard output/error but that seems like...

Win32 API analog of sending/catching SIGTERM

Under POSIX OS there is signal API that allows to send a signal to process to shut it down with kill and you can catch it with sigaction and do what you need; However, Win32 is not POSIX system, so: How can I handle shutdown events that may come, for example from "End Process" in "Task manager"? What is the standard API for sending sh...

Understanding POSIX Threads

I have some confusion with POSIX Threads, I want to know if my understanding of Pthreads is proper, According to me its a layer above the native layer which helps in dealing with multithreading. It provides a common syntax, which helps while porting from one OS to other. It internally takes care of the various OS specific constructs. ...

Compiling C++ program with POSIX AIO lib on Linux

I'm having difficulty with the linker when it comes to compiling a sample program that uses the POSIX aio library (e.g. aio_read(), aio_write(), etc) on Linux. I'm running Ubuntu with a 2.6 kernel, and have used the apt-get utility to install libaio. But even though I'm linking with the aio library, the compiler still gives me linker er...

What is the SIGKILL permissions policy?

What is the SIGKILL permissions policy? I assume I can't kill something of the kernel, or of some other user, while running on non-root, but I haven't found any document about this. ...