I know a little bit of C from high school and uni (mostly forgotten). I would like to learn C for Unix developemnt. I have a book of Dietel but there is not any information on how to use make, configure, Makefile and Posix API.
I would like to have some resources, books, web sites, PDF, anything, to get started. I want to use gnu tools....
Hey, hopefully this should be my last PTY-related question and I can move onto more exciting issues. (c;
Here's a set of small functions I have written for creating and reading/writing to a pty: http://pastebin.com/m4fcee34d The only problem is that they don't work! After I run the initializer and writeToPty( "ls -l" ) , 'output' from...
I'm trying to write an app that can login to SSH with a password, by using pseudo terminals. But if I write() to the master device then the data somehow does not appear in the slave device. Here's a simple test case:
#include <sys/wait.h>
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#ifdef __linux__
#include <pty.h>...
How can I get the username of the process owner (the user who is executing my program) in C++?
...
I have a child process which runs in a pseudo terminal. The parent process does not run as root, but the child process does, through su or sudo. Because of this it is not possible to send a signal to the child process to force it to exit. I want to force it to exit by one of these means:
emulating a Ctrl-C.
emulating a terminal hangup....
posix does not appear when I run php -m cmd, however, I see it from the phpinfo() –enable-posix=shared on Linux with Plesk 9.
Basically, I can't use posix_*() functions as described at
http://www.php.net/manual/en/ref.posix.php
this shows doesn't exists:
if (function_exists(‘posix_getuid’)) {
echo “posix_getuid available”;
} else {
e...
Currently I have some code like (condensed and removed a bunch of error checking):
dp = readdir(dir);
if (dp->d_type == DT_DIR) {
}
This works swimmingly on my Linux machine. However on another machine (looks like SunOS, sparc):
SunOS HOST 5.10 Generic_127127-11 sun4u sparc SUNW,Ultra-5_10
I get the following error at compile time...
Is POSIX pselect available in Perl? A CPAN module is fine also.
...
Hi,
I'm on Windows 7, with Subsystem for Unix-based Applications (SUA) installed. I chose Custom installation and installed GCC in full.
Now I can call Korn shell and call gcc helloWorld.c to produce a.out.
What I want now is to set up the editor Notepad++ to compile source code when I Run > Run .. or F5.
If it helps, I can call Korn...
Could someone provide an example of (reasonably) using the function shmat() with non-null second parameter?
The manual says:
#include <sys/shm.h>
void *shmat(int shmid, const void *shmaddr, int shmflg);
The shmat() function attaches the shared memory segment associated with the shared memory identifier shmid to the data se...
I have an application that consists of two processes (let's call them A and B), connected to each other through Unix domain sockets. Most of the time it works fine, but some users report the following behavior:
A sends a request to B. This works. A now starts reading the reply from B.
B sends a reply to A. The corresponding write() cal...
What does "_np" suffix mean here:
pthread_mutex_timedlock_np
or in macros
PTHREAD_MUTEX_TIMED_NP
Upd:
From glibc2.2
enum
{
PTHREAD_MUTEX_TIMED_NP,
PTHREAD_MUTEX_RECURSIVE_NP,
PTHREAD_MUTEX_ERRORCHECK_NP,
PTHREAD_MUTEX_ADAPTIVE_NP
#ifdef __USE_UNIX98
,
PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP,
PTHREAD_M...
I am using the POSIX call nftw() for traversing a directory structure. The directory structure is flat - only 4 files and no subdirectories.
However when I call nftw() a lot of times on this flat directory then I get an error message after a while:
"too many open file handles".
It turned out that this happens when the flag FTW_CHDIR ...
Yes, this is a really lazy question but I figure this is problem that people have often enough that someone here would have something already written to share.
I have a ton of C files with #include statements using Windows relative paths. I'm working on compiling the code on other operating systems (immediately, on my OS X development m...
An application wants to parse and "execute" a file, and wants to assert the file is executable for security reasons.
A moments thought and you realize this initial code has a race condition that makes the security scheme ineffective:
import os
class ExecutionError (Exception):
pass
def execute_file(filepath):
"""Execute seria...
Hi.
Having learnt a bit about the subject, can anyone tell, what is the real difference between POSIX shared memory (shm_open) and POSIX mapped files (mmap)?
Both seems to use the /dev/tmpfs subsystem, rather then older IPC mechanism.
So is there any advantage of using mmap file over shared memory?
Thanks.
...
So i'm working on a program, wich is vaguely going to resemble
Br@y's Terminal, but running from the commandline in linux
It will do asynchronous transmission, out the serial (Com) port.
Now i think the Header/library i need for this is the termios.h
Now i've only used posix a little before and i;m finding it rather heavy going digging...
So i'm writing a serial transmision program, and have just changed over to using C++, it been a while since I used C++
(I've been working with C recently, and before that java)
Now I need to use LibSerial,
(it seems much simpler to use than C's termios)
my code is:
//gen1.cpp
#include "string2num.h" // a custom header
#include <iostr...
I have a chunk of shared memory containing some data. Reading / writing this data needs to be synchronized between different processes. At this moment I'm using unnamed POSIX semaphores.
Since my main concern is speed, I'd like to know if semaphores are optimal here? Do they end with a syscall for example (userspace -> kernel space), or...
I want my application (PHP, but that shouldn't matter) to store some data in a shared repository (the APC user cache, but again irrelevant). To prevent users from reading eachother's data I'd like to encrypt it per user.
I could have the user specify the key in his configuration file for the application, but I'd rather generate it autom...