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

8
votes
4answers
720 views

What is meant by “a system call” if not the implementation in the programing language?

I would like to understand the term "system call". I am familiar that system calls are used to get kernel services from a userspace application. The part i need clarification with is the difference ...
1
vote
1answer
22 views

ioctl: invalid argument for HDIO_GET_IDENTITY

I wrote a program to get the details of hard disk drive using HDIO_ ioctl calls. For writing program, I'm referring Documentation/ioctl/hdio.txt in kernel source(2.6.32). Here is my main part of ...
2
votes
2answers
2k views

Calculating total CPU system usage in C

I found this answer on StackOverflow for calculating total CPU usage: http://stackoverflow.com/questions/1420426/calculating-cpu-usage-of-a-process-in-linux/4497769#4497769 But how do I calculate ...
-2
votes
0answers
57 views

Why did Dennis Ritchie say “be a pointer my friend”? [closed]

Dennis Ritchie once said: Empty your memory. with a free(); like a pointer If you cast a pointer to a integer, it becomes the integer. If you cast a pointer to a struct, it becomes the ...
1
vote
0answers
17 views

How to get the authentication status from the last PAM module run

If I have the following PAM stack: auth required default_pam.so auth requisite my_custom_pam.so .... How do you obtain the authentication status from the last/previous PAM module run for use in ...
2
votes
1answer
344 views

Conky - string formatting

I have conky the record: ${color lightblue} Down: ${downspeed wlan0} Up: ${upspeed wlan0} Conky prints link speed, but the text moves: Down: OB Up: OB Down: 60B Up: 60B Down: 148B Up: 148B ...
0
votes
0answers
10 views

How do I run TinyWM inside Xephyr?

I'm trying to get into Window Manager hacking, so I found TinyWM and tried running it inside a Xephyr window. I tried: Xephyr -screen 1024x768 :1 & DISPLAY=:1 ./tinywm & DISPLAY=:1 scite ...
-1
votes
0answers
15 views

Use fts(3) functions to rename files and directories. only first level gets changed [migrated]

it's just a simple prog to replace spaces with underscores. i found a bash script that will do it but it's slow. from what i understand i want a depth-first search and i want my remove_space function ...
0
votes
3answers
85 views

In makefile when do we use .o files?

In the following make file, what is the significance of adding .o files instead of .c files? CC=gcc CFLAGS=-I. hellomake: hellomake.o hellofunc.o $(CC) -o hellomake hellomake.o hellofunc.o ...
0
votes
1answer
22 views

Error: Missing newline before EOF - inserted

In my application I am inserting some files in main file. In that there is common header file to all the code files (*.c). This giving me error: D:\New folder\COM_Port_Cont\COM_Port_Task.h(268) : ...
4
votes
1answer
19k views

gcc can't link to pthread?

I have recently installed XUbuntu 11.10 64bit, but I am having problem compiling the most simple pthread example. Here is the code pthread_simple.c: #include <stdio.h> #include ...
9
votes
6answers
590 views

What C library version does my system use?

How can I tell for sure what userland C library my system uses? Possible reasons to need this information include: There's a gigantic source package I am considering downloading which I'm sure will ...
0
votes
1answer
56 views

libext2fs gcc linking error

I am writing a C program which uses libext2fs: #include <ext2fs/ext2fs.h> int main(int argc, char *argv[]) { char *fsname = argv[1]; errcode_t err; ext2_filsys fs; err= ...
4
votes
3answers
349 views

Are there “esoteric” (weird) but standards-compliant C compilers or runtimes?

As we know, the C standard does not specify a lot of details of the implementation, for example value of NULL pointer, order of bits and bytes (endiannes), alignment in structs and of stack ...
0
votes
0answers
54 views

How to cause memory fragmentation on a Linux based embedded device?

Hardware ARM What am I trying to do: Answer: I am trying to create memory fragmentation on a Linux 2.6.31 based swapless embedded device. Why: Answer:I am trying to port some patches to Linux ...
1
vote
2answers
79 views

Writing own daemon. systemd error: Failed to read PID from file: Invalid argument

I'm trying to write own daemon a la very simple MPD (it's operating systems laboratory work). I made it work: it starts like a daemon (output of ps): 1 14877 14877 14877 ? -1 Ss 0 ...
7
votes
7answers
737 views

Possible to find out the sizes of data types (int, float, double, …) on a system, without writing a C program?

Is it possible to find out the sizes of data types (int, float, double, ...) on a Linux system, without writing a C program? Would the results for C same as for C++, and other programming languages ...
2
votes
1answer
26 views

Can you use LXC through C?

I want to use LXC to 'container' plugins my application is loading. Am I able to do this through C? I have been Googling a lot about it, but there don't seem to be any headers, only scripts that can ...
3
votes
1answer
73 views

How to let a user execute a script owned by root? Setuid doesn't seem to work anymore [duplicate]

I have some bash scripts that I use with the user 'root' to manage iptable rules. The problem is that I want these things at the same time: The script must be owned by root Permissions must be 700 ...
-2
votes
1answer
51 views

How to compile c, c++ and python code as “Released/Final” version? [closed]

I want to know if there are ways to compile C, C++ and Python code in order to not be able to reverse engineering it over Linux or not? I have heard there are some ways over Windows to do it, but I ...
0
votes
0answers
55 views

Reading from named pipe freezes when piping tshark output

I'm trying to implement a web prefetching system. The purpose of a system like this is to “predict” future requests and prefetch them. The system builds a predictive model from web navigation logs ...
5
votes
1answer
376 views

command substitution handling in fish vs. other shells (sh, bash, zsh)

The program mc (Midnight Commander) is not intended to be used for command substitution, but I would like to know why different shells behave differently when this program (and it seems like other ...
2
votes
0answers
55 views

How can I compile minix when I make changes in libraries

I am looking for a way to compile minix. The make hdboot command seems to do nothing with the directories under /usr/src/lib. I changed only one .c file in syslib. Do I have to do make world for this ...
7
votes
2answers
3k views

How to compile a c program without leaving the editor?

I am using vim editor on Linux mint. I want to know if there is any way to compile c program without leaving the editor.
1
vote
4answers
2k views

I can not get my Realtek 8723 driver source compiled

I have a Lenovo IdeaPad Yoga 13. WLAN won't work out of box with fedora 18. So I googled around and found this 2 links: ...
5
votes
2answers
332 views

What would I get when sudo a kernel-destructive program?

It suddenly comes to me how easy it will be for a sudoer to crash the kernel, so I tried something like this: #include<stdio.h> int main(){ printf("hello world"); int a; ...
2
votes
1answer
366 views

Error compiling FTDI VCP drivers: Cannot find version.h

driver installation fails of FTDI VCP driver during make install. Running ElementaryOS with kernel 3.11.0-14-generic make install awk: cannot open ...
2
votes
0answers
92 views

Writing to Arbitrary Memory Addresses [closed]

I'm reading "Art of Exploitation 2nd Ed." and I have a question regarding a section on format string attacks. Target program Below code (fmt_vuln.c) is a target program. #include <stdio.h> ...
0
votes
0answers
37 views

How to `cat` file with syntax highlight? [duplicate]

In my hello.c: /* Hello World program */ #include main() { printf("Hello World"); } How can i cat this file on terminal with syntax highlight?
0
votes
1answer
219 views

USB-Serial Driver(Exar Xr21v1414) Run Error

I'm currently trying to run the bellow driver in linux-3.8.3 on Exar xr21v1414 http://www.exar.com/connectivity/uart-and-bridging-solutions/usb-uarts/xr21v1410, but when i install the driver ...
1
vote
3answers
107 views

Is there any manual about C in Linux? If any, what is it?

While I find that we can read some manuals about Library calls (C library functions) & acsii in Linux. But I still do not find any manual about C precedence order so far. So you can recommend ...
2
votes
2answers
105 views

How to make processes not die after its parent dies?

I've been messing with forkbombs and noticed that if I just fork() processes repeatedly, killing the initial process will bring down the whole tree. This is not the case for forkbombs written in BASH ...
10
votes
2answers
205 views

Is there a way to mirror USB outputs?

I'm currently writing a program for a project. It is for a braille reading system where I have a braille display connected via USB that is controlled by a program called brltty. One of the ...
123
votes
4answers
45k views

Why is FreeBSD deprecating GCC in favor of Clang/LLVM?

So I was surfing the net and stumbled upon this article. It basically states that FreeBSD, starting from Version 10 and above will deprecate GCC in favor of Clang/LLVM. From what I have seen around ...
0
votes
1answer
81 views

C-library HMAC_MD5 questions

We are working with an older software product that has some limited programming capabilities - specifically, no bit manipulation functions. This has created a significant problem as we need to ...
3
votes
2answers
85 views

How to write software to compile with external libraries?

I want to code open source software with dependencies. I have skills in C/C++ and a minimum makefile knowledge. But im curious about coding this like ./configure && make stuff and how to ...
2
votes
1answer
795 views

Start 4 programs on startup in Linux Mint via terminal

I'm working on a project and I hope you can help me solve a problem. I have four programs that are written in C. They have been compiled using gcc and they work as they should. Because the four ...
11
votes
4answers
3k views

After fork(), where does the child begin its execution?

I'm trying to learn UNIX programming and came across a question regarding fork(). I understand that fork() creates an identical process of the currently running process, but where does it start? For ...
8
votes
4answers
2k views

Why should a child of a vfork or fork call _exit() instead of exit()?

From the man page of vfork(): vfork() differs from fork() in that the parent is suspended until the child makes a call to execve(2) or _exit(2). The child shares all memory with its ...
0
votes
1answer
107 views

Read and parse XML input via TCP [closed]

I'm setting up something where I'll need to be able to setup a service that accepts input on a TCP port and then parses the XML provided and extracts the necessary data, then posts that to Google's ...
2
votes
2answers
504 views

Why does Linux have a C compiler by default?

Why does a Linux distribution have gcc installed in advance? Is it because most of the applications in linux are written in C? What would happen if the gcc directory is deleted?
0
votes
3answers
4k views

/usr/ucb/cc: language optional software package not installed

I tried to compile some C code to get object file from a shell prompt: $cc a.c But this gives me the following error: /usr/ucb/cc: language optional software package not installed How can I ...
3
votes
1answer
145 views

Make Completion Progress Script

Any time I'm executing a build process that takes several hours, I inevitably stare at my terminal and wonder, "how much longer?" Sometimes, I manually pick up on some pathname echoed to the terminal ...
1
vote
1answer
115 views

Parsing protocol and url from packet payload

We are using pf_ring to capture packets. We are able to decipher information like source and destination ip, mac etc from the header information. Now we are moving into payload to decide the type of ...
3
votes
0answers
131 views

Fork vs. thread system time [closed]

I got the following logs: Program 1: Taken from a program executed 64 fork calls: real 0m0.023s user 0m0.068s sys 0m0.008s Program 2: Taken from a program executed 64 thread calls: real 0m0.613s ...
2
votes
1answer
142 views

Dependencies problem with automake

I am using automake on Debian Squeeze for compiling a very simple C project with 6 source files. The issue comes when I try to compile the sources using the generated Makefile. One of the sources ...
4
votes
4answers
519 views

Is it possible to make multi-level directory? [duplicate]

Using mkdir() (the C function) I can create a 1-level directory, if I want to create multi_level directory like: folder/subfolder/subsubfolder is it possible? if so, how?
1
vote
1answer
128 views

How to trace process scheduling of certain process?

For a project at my university I am researching ways to trace, log and manipulate the process scheduling of certain processes. I would like to launch an number of applications, everyone in a single ...
3
votes
3answers
324 views

default wordsize in UNIX/Linux

I was inspecting the preprocessed output of my C program and happened to look at the header file wordsize.h It is located in /usr/include/i386-linux-gnu/bits/wordsize.h the file contains only one ...
4
votes
1answer
124 views

Effect of static and dynamic linking on start address

I have a simple C program. I run: $ gcc Q1.c -Wall -save-temps -o Q1 Then I inspect the executable generated: $ objdump -f Q1 Q1: file format elf32-i386 architecture: i386, flags 0x00000112: ...