C is a general-purpose computer programming language used for operating systems, games and other high performance work and is clearly distinct from C++. It was developed in 1972 by Dennis Ritchie for use with the Unix operating system.

learn more… | top users | synonyms

6
votes
2answers
80 views

Get header of the C function from BASH

I want to get the header(s) that I need for a given C function - e.g. when I want to see what to include when I want to use fork(), I can type out man fork and see that it's #include <unistd.h>. ...
0
votes
1answer
320 views

Process tree using fork() [closed]

I am given the task of creating this process tree in C using fork, if and else: |_____1___ |___2__ | |_4_ | |_3_ | | | | | Or as a pstree like drawing: p(0)─┬─p(1)───p(3) ├─p(2) ...
-1
votes
1answer
40 views

IOCTL() Library for Windows [closed]

I am trying to cross compile my c code from debian linux to a windows platform. I have worked out most of the kinks but I am struggling with ioctl(). Windows doesn't seem to have a ioctl() equivalent ...
2
votes
1answer
252 views

Get output of `posix_spawn`

So I can run a process in Unix / Linux using POSIX, but is there some way I can store / redirect both the STDOUT and STDERR of the process to a file? The spawn.h header contains a deceleration of ...
2
votes
1answer
337 views

mount overlayFS as Read-Write FS

I want to mount my RO Filesystem using overlayFS - in order to use two layers FS (Lowerdir and Upperdir). I tried the following mounting command - mount -t overlayfs -o lowerdir=/,upperdir=/overlay ...
2
votes
1answer
147 views

Compiler for 32-bit LSB MIPS MIPS32 architecture

I have a TV set top box that i'm currently experimenting on: I established a serial console connection to it through a serial port located on the board. I am trying to compile a simple C executable ...
-3
votes
2answers
69 views

C Programming on command line [closed]

What to do after opening vim name.c and writing the source code? I mean, to compile and execute.
0
votes
0answers
25 views

Error libGL dlopen

I am starting learning SDL. I am reading a tutorial and it has this code: #include <SDL2/SDL.h> int main( int argc, char* args[] ) { SDL_Init(SDL_INIT_VIDEO); return 0; } And when ...
4
votes
5answers
414 views

File descriptors across exec

By default file descriptors remain open across the exec functions. The benefit is perhaps understandable for descriptors 0-2. But is there a practical use case for keeping other descriptors open? Are ...
2
votes
0answers
30 views

how to build kernel-tools-4.2.xx.rpm and kernel-ltools-libs-4.2.xx.rpm

I am trying to upgrade Centos-7 kernel (kernel-3.10) to (Kernel-4.2.6) and for that I downloaded kernel from kernel.org and create rpm for the custom configuration (arch x86_64)using "make rpm". ...
2
votes
0answers
45 views

Look up documentation on C types?

I'm reading over documentation on concurrency in C and trying to learn how to do things concurrently. As I'm reading, I'm coming across types I've never come across before like tss_t, etc. Is there ...
0
votes
1answer
30 views

Server port doenst go back to listen and is in closed_wait state , because of starting an daemon application from client

Below is the basic client and server code . While iam trying to start an appliaction(which has to keep running in the machine once we send a msg to server) during connect call. using ...
0
votes
0answers
15 views

How To Patch Bugs Manually in Software [duplicate]

We have been experiencing issues with winbind on our servers and I found a thread on Bugzilla regarding a bug which sounds much like the issue we are experiencing. Throughout the discussion, the ...
1
vote
1answer
170 views

Why is my stdbool.h not in /usr/include?

I'm used to standard C header files being in /usr/include (e.g. stdio.h, stdlib.h, string.h, ctype.h and so on); yet - stdbool.h isn't. Now, I know it's newer than the rest, only being part of C99. ...
0
votes
1answer
109 views

How to write a Patch for VyOS kernel

I am new to VyOS development. I have written a patch which will fetch info from the VyOS kernel module and write it on a netlink socket. But the problem is I am not sure if I should edit the kernel ...
1
vote
1answer
107 views

Using gcc compile flags

I am trying to understand how to properly setup gcc to find stuff in my environmental variables. Currently I compiled some code, SDL and I added it to my .bashrc and sourced that .bashrc as well. ...
2
votes
1answer
42 views

building code from source and adding them to your path

Typically on Debian when you install things from the repository, they just work. It sets up things just fine and life is good. This is great for things that are up to date in the repository. I am ...
2
votes
1answer
107 views

Bash shell launched by forkpty() spawns child processes that ignore SIGINT. Why and how do I ensure SIGINT is not ignored?

I have a C program that uses forkpty to execute a bash shell. I'm finding that the programs launched by this shell are launched with SIGINT ignored, so when I send a Ctrl-C to the shell they never ...
1
vote
1answer
208 views

generate consistent machine unique ID in c programming

Is it possible to generate a unique ID that wouldn't change over time unless there is hardware changes. The hardware must be generated with a c program. That also would be great if it were robust to ...
1
vote
1answer
22 views

How to make program which will react on button pressing (such as “more” on 'q') [closed]

I' m trying to realize, how does work pg\more\less utilities. For example, cat somebigfile | more. More now in interactive mode. His fd table is: 0 (read pipe from cat) 1 (stdout) 2 (stderr) I can ...
0
votes
1answer
62 views

Calling a shell rsync command from C

I am creating a basic C file in order to learn the basic Linux commands a little better. I am trying to implement a tar back up function. I am struggling to implement it in C (still learning C) so ...
1
vote
3answers
342 views

How to make the shell execute only external echo, not the builtin one?

I have a C program which uses system() library function. Below is the source code. #include<stdlib.h> int main() { //Some code system("echo Hello World"); //some code return 0; ...
1
vote
1answer
158 views

Changing a Users Default Shell

I have created a simple C shell on my local Linux server. I am trying to learn how to change the default shell of another user (bob) to be this new C shell that I have created. Is it possible to ...
6
votes
1answer
1k views

Where is `scanf` implementation source code?

I want to find C source code for scanf implementation on Linux machine. Googling to find scanf implementation does not tell me the way to find it. I tried to find that source code from gcc source tree ...
0
votes
0answers
44 views

custom runtime environment - libpthread segmentation fault

I have built a project using gcc 4.9.2 (libstdc++.so.6.0.20). When I want to run that program on the virtual machine which is equipped with gcc 4.6.3 (libstdc++.so.6.0.16) I have to deliver ...
2
votes
0answers
57 views

How to remove a broken installation of glibc

I just attempted to install glibc version 2.19 to my computer as follows: 1) I cloned the glibc git repo with $ cd ~ $ git clone git://sourceware.org/git/glibc.git 2) I checked out version 2.19 ...
0
votes
0answers
99 views

system user + kernel time using /proc/stat

user: normal processes executing in user mode nice: niced processes executing in user mode system: processes executing in kernel mode idle: twiddling thumbs iowait: waiting for I/O to complete irq: ...
2
votes
1answer
307 views

Why does a “child” process finish before its parent?

This is the code example given: # include <stdio.h> # include <unistd.h> void main() { static char *mesg[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}; int display(char ...
2
votes
0answers
126 views

Can I add iptables rule from the inside of a C Linux program only with capabilities or do I need necessarily root?

I need to add an iptables rule from the inside of a C Linux program. How should I do? Do I need root privilege or can I just grant some capabilities? I tried granting CAP_NET_RAW+iep and using ...
1
vote
0answers
163 views

Error building and compiling GCC 5.2.0 from scratch on Vortex86DX

In order to upgrade a VortexDX86 custom linux with a gcc 3.2.3 compiler, I´m trying to built the GCC 5.2.0 compiler to support the latest C++ 11 standard. I have downloaded its source code from ...
-1
votes
1answer
248 views

Forwarding return value of shell script to C/C++ [closed]

I tried to find possible solution on Google, but all I found is explanation on how to return value, but not how to accept it in some programming language, in my case C/C++? Does anybody have idea on ...
0
votes
1answer
20 views

segmentation fault/ not booting main from rcS

I'm trying to boot a 'main' executable from the rcS file /soft/main & 2>&1 >> /var/log/app.log & but I'm getting a segmentation fault witch is strange because when i cd to the application ...
-2
votes
1answer
55 views

factorial program does not return prompt [closed]

This program (factorial.c) is running but it does not return the prompt at the end, unless you hit enter: #include <stdio.h> int main() { int num, i, fact = 1; printf("Enter a number to ...
0
votes
1answer
674 views

convert executable back to C source code

Unfortunately I lost my source code and I just have the output file that made with gcc in linux and I don’t have any access to my pc now.is there any way to convert output file to source file (in c ...
0
votes
0answers
43 views

Find system idle time using any system call in microseconds

For the perf analysis and to make decision based on system and app performance I need to find the idle time of system. I want the precise value in microseconds. I know that I can get the value in ...
0
votes
0answers
134 views

Calling a password checking command from PHP using exec() - how to escape user input?

I am working on a PHP-based website where the login form needs to authenticate against local users on the system via PAM - in other words, they should be able to login successfully if they enter a ...
1
vote
0answers
157 views

How to get minor and major page fault for individual or group of processes?

I am trying to write a code in Linux C. Basically I am trying to draw a statistic that should show like: pid, number of process, page fault(major/minor) and total number of page faults. val, pid, ...
0
votes
1answer
54 views

Compiling package for debian 8 - linking issues

I'm trying to recompile my software for debian 8, but i have run into this strange issue of libgssappi refusing to link with anything. >~/torque_github$ gcc test.c -lgssapi /usr/bin/ld: cannot ...
1
vote
2answers
446 views

Linux System calls in C on OSX

So I did a quick test and #include <sys/types.h> #include <unistd.h> #include <stdio.h> int main (int argc, char *argv[]) { printf("Hello World\n"); ...
6
votes
3answers
815 views

How does getpid work?

The getpid system call returns the process id of the invoking process. How does the kernel figure out which process is invoking the system call ?
0
votes
0answers
86 views

How do I send a variable through SSH so it can be used across servers? C Shell

EDIT: Would this be possible in bash? Note: I have to use C shell. (.csh) I have something very similar to the following code: set var = "string" ssh -X server "$var" << END * I ...
0
votes
0answers
214 views

Incorporating GTK into Eclipse

I do not understand what is missing here when incorporating gtk2 into eclipse . First - I know I have the devs installed since I have already successfully compiled an gtk-app through a makefile. gcc ...
0
votes
1answer
644 views

Difference between GNU AutoTool ToolChain, cross GCC and Linux GCC

I start using eclipse CDT. As I was trying to create project in C. I have to encounter with these options. When I select makefile project. I had options to choose toolchain from these GNU AutoChain, ...
2
votes
1answer
111 views

System call 'open' mode not working

I am writing a simple code about opening a file with O_CREAT | O_WDONLY | O_EXCL flags. The code looks like this: int fd = open(fileName, O_WRONLY | O_CREAT | O_EXCL, 0777); It works well, except ...
-1
votes
2answers
266 views

Squid cross compile

I've been trying to cross compile the Squid 3.5.7 on ARM Cortex A8 (Linux). I downloaded it from http://www.squid-cache.org/Versions/v3/3.5/ I have arm-linux-gnueabi-gcc and arm-linux-gnueabi-g++. ...
-2
votes
2answers
589 views

Pipe Named Fifo [closed]

I am implementing a named pipe to write and read data between two processes in cpp. The first process acquires a feature point from an image in real time while the second reads this feature point. It ...
-1
votes
1answer
97 views

Why does grep goes into blocking stage? [closed]

I am making a test My task will be one child pipelining the output to the input of another another child. I am using ps -ef as the first command(by using execlp()) and grep root as the second ...
0
votes
1answer
245 views

Trying to compile GNU Screen

I am trying to compile GNU Screen in my home folder on a machine where I don't have super user rights. I am taking GNU Screen version used by Linux from Scratch. tar xvzf screen-4.3.1.tar.gz cd ...
0
votes
1answer
42 views

Two or more threads on single core [closed]

What are the advantages of using threads on single core, does that makes sense to use multithreading on single core?
0
votes
1answer
225 views

Why is my CD command not working on a home-built shell? [duplicate]

I have written a very basic shell in C. It reads the input, then runs it using system(lineCopy); (lineCopy being a copy of the input). All commands will run fine in it, other than cd. When I try to cd ...