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

1
vote
0answers
14 views

Linux and Embedded systems engineering [on hold]

First of all I hope everybody had a great weekend. My question is simple. Which version of linux is best suted for embedded software engineering and programming. Thank You AO!
0
votes
1answer
26 views

How to create makefile for compiling multiple programs

I have some problems with creating makefile. I have tried to compile some files from terminal and found right options for gcc to do this. But I have some troubles with creating one makefile to do all ...
2
votes
1answer
70 views

How to compile manual files .1

I have .c, .h, and .1 files, how can I compile them together in one executable file. Everything clear with .c and .h files, but I have also .1 as I can see from the content it is used for manual, how ...
0
votes
0answers
6 views

Get start and end of process segments C/C++ [migrated]

I need to get the start and end addresses of the following process segments: code, data, stack, environment. I understand how it is located in memory, but don't know how to get it using API calls or ...
1
vote
2answers
58 views

How can I link my C program against the Arb library?

I tried to compile the program Testing Li’s criterion in Ubuntu. However, when I do gcc demo.c, I get the output as, demo.c:2:19: fatal error: fmpcb.h: No such file or directory #include "fmpcb.h" ...
1
vote
0answers
26 views

Why aren't the argv and envp arguments to execve pointers to const? [migrated]

Take e.g. execve(2), which according to posix has this prototype [1]: int execve(const char *path, char *const argv[], char *const envp[]); To me, it seems as if int execve(const char *path, const ...
1
vote
1answer
44 views

Linking a static library when compiling a C program

I'm linking *.a file with *.c file, so I have used the following command: gcc abc.c -l ad.a (here abc is the C source file and ad is the static library file) then after executing the following ...
3
votes
1answer
74 views

Read .desktop files programmatically [closed]

I would like to make a C program (GTK) that reads a .desktop file. The only thing I need from the .desktop file is the exec command. Is there something built into GTK that would allow me to interact ...
1
vote
2answers
48 views

assign output of a c program to a shell variable: token error

I have a shell script to run several times a .c program ('switch') which admit 3 input paramenters. I want to run the program 4 times passing values {4,16,32,64}, and for parameters ...
0
votes
0answers
16 views

How do you check if a variable equals text in C? [migrated]

How do I check if a variable equals some text? For example: If I inputted "Hi" with scanf, then how could I check if the "Hi" was something else inputted. I made a program but it has errors. The ...
4
votes
3answers
319 views

How to check whether a process is daemon or not?

I have written a small daemon that starts at the boot time and does all the things perfectly like writing in the log file. But I want to know, how can we check whether that process is daemon or not? ...
2
votes
0answers
55 views

How to print something without using std lib functions? [migrated]

In the C language, when printing something on the screen, we usually use printf, puts and so on. Which are all defined in the or other header documents. Is there any way to print something on ...
1
vote
0answers
11 views

C/C++ Query EDID at boot time [migrated]

I'm looking for a way to query EDID data at boot time on my Android system. I think I can use ioctl calls and I see that the frame buffers are at /sys/class/graphics/fb*. But currently I'm just ...
0
votes
0answers
6 views

How to know if the following function is returning the correct result or an error condition in `jansson`? [migrated]

I am using the jansson JSON library for an application. I was reading the API and came across these functions: json_integer_value, json_real_value and json_number_value. The first one returns the ...
0
votes
0answers
18 views

#define SYSCALL_DEFINEx(x, sname, …) [migrated]

In the 3.14 linux kernel there is the following macro : #define SYSCALL_DEFINEx(x, sname, ...) It's located in include/linux/syscalls.h. I added a syscall in the source, I compiled it and I made ...
0
votes
1answer
23 views

Linux [admin] How to test pivot_root?

I want to test the pivot_root command line, which moves the root file system of the current process to the directory put_old and makes new_root the new root file system. ...
1
vote
0answers
28 views

PAM authentication program in C recognizes only the logged in user [closed]

I am trying to write a C program to authenticate users using PAM. Here is what I have at present: #include <security/pam_appl.h> #include <security/pam_misc.h> #include <stdio.h> ...
1
vote
1answer
10 views

snd_rawmidi_open() waits forever - no error message

I am trying to use ALSA for MIDI purposes in C. My problem is, snd_rawmidi_open() sort of "crashes" (waits forever like a while loop) when using valuable arguments : #include <stdio.h> ...
2
votes
0answers
20 views

Make GNU indent break long comments

Is there a way to convince GNU indent to break long comment and change it to multiline comment? Something like this: // Very long comment, longer than 80 characters. Just imagine that. To this: /* ...
2
votes
2answers
88 views

Linux cannot compile without GCC optimizations; implications? [closed]

One can find several threads on the Internet such as this: http://www.gossamer-threads.com/lists/linux/kernel/972619 where people complain they cannot build Linux with -O0, and are told that this is ...
4
votes
1answer
88 views

How to compile programs on Linux systems when I don't have sudo privileges to install the dev dependencies [duplicate]

How should I go about compiling programs that depend on libraries whose development packages (headers and such) aren't pre-installed on the system when I don't have sudo access? In this particular ...
0
votes
0answers
26 views

Inotify notifies only single change

I set the inotify_add_watch to watch /dev/disks. The entries in this directory are: by-id and by-uuid. When I plug-in a pen-drive, this directory gets added with two more directories: by-path and ...
3
votes
1answer
119 views

How to create GUIs (such as menuconfig) with lxdialog

I try to generate a menuconfig by my own with the help of lxdialog (source: lxdialog). Unfortunately this is not so well documented as I wished for. Example: So what I did: I included these files ...
1
vote
0answers
26 views

CPUFreq Kernel module

I would like to try the CPUFreq module on my board (Marvell Soc based on ARMv7 running a v3.15 linux kernel). My architecture is obviously not supported by the default source code (located in the ...
5
votes
4answers
671 views

chdir(<directory>) doesn't change directory after exiting to shell

I wanted to make a simple C program to change to my project directory. Its content is following: #include <unistd.h> int main(){ chdir("/home/enedil/projects/algo"); return 0; } I ...
0
votes
1answer
55 views

What are the disadvantages of uClibc?

I try to speed up my boot sequence, and somebody recommends to use the uClibc instead of Glibc. I've built an image with it, it gets smaller and faster to boot — but at which cost? Does anyone know ...
3
votes
1answer
115 views

How to programmatically retrieve the GID of a running process

I need to write some C code to check the effective GID of a running process whose PID I know. I've not found any direct way to do this. There are a number of heavyweight kludges I could use, such as ...
2
votes
0answers
263 views

what device name should I have to give in snd_pcm_open other than “default”

I want to record sound from 2 devices simultaneously: internal mic external usb webcam mic Using pulseaudio sound controller, I set either of these devices as default and could record sound with ...
1
vote
0answers
66 views

Limit program execution to a list of arguments

I would like that my Unix users can only run a specific command insecurecommand with a controlled list of arguments stored in a file. The only solution I have found at this time is to : Create a ...
0
votes
0answers
510 views

GTK3+ and C++ on OSX - “No GSettings schemas are installed” error

I'm trying to run a C++ example with GTK3+ and GStreamer components on OSX. I can gcc compile the source with: gcc -o basic5 basic-tutorial-5.c 'pkg-config --libs --cflags gstreamer-1.0 ...
2
votes
2answers
145 views

How does a parallelized Python program look with top command?

I work on a shared cluster. I've seen people run parallelized c code on this cluster which, when I use top to see what processes are running, are shown to be using (for example) 400% of the CPU, ...
2
votes
2answers
67 views

What is bitwise.c~? [duplicate]

I am new to Linux Debian and I am trying to made a program to experiment bitwise operators. The name of the program is bitwise.c Before compiling the program, I decided to look at the directory just ...
2
votes
1answer
213 views

closing the unwanted file descriptors

I am trying to understand how pipes work . This code snippet is from some website . So my understanding of the program goes like this : When we do pipe(fd) then fd[0]=3 and fd[0]=4 ( assuming only ...
3
votes
1answer
58 views

Is each process considered a thread?

Is a Linux process considered a thread? For example, if I write a simple c program that calls pthread_create to create a new thread in main(), does that mean that I now have 2 threads, one for ...
3
votes
0answers
165 views

How do I use ctags functionality in vim with cscope installed?

When I install cscope by adding the line Bundle 'chazy/cscope_maps to my .vimrc file, my tags menu (g+[) is replaced with a cscope list, which seems to contain a list of files where the tag is called, ...
1
vote
1answer
2k views

Default stack size for pthreads

As I understand the default stack size for a pthread on linux is 16K. I am getting strange sesults on my 64bit ubuntu install. $ ulimit -s 8192 Also pthread_attr_init(&attr); ...
0
votes
1answer
80 views

Difference between maximum resident set size as reported by /usr/bin/time vs. getrusage?

I ran the command a.out like this: $ /usr/bin/time -f"%M" ./a.out a.out also uses the function getrusage() and prints: printf("%ld",ru.ru_maxrss); where the first ru is the struct. When I run ...
1
vote
0answers
96 views

how to get user's last login including the year in C [closed]

I'm trying to write a program that can get the user's last login time. Then i want to do something with the data. eg. check which user havent login for 90 days. So I tried using last command. This ...
9
votes
5answers
1k 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
368 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 ...
1
vote
0answers
39 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 ...
0
votes
0answers
186 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 ...
0
votes
1answer
87 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) : ...
10
votes
6answers
2k 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
101 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= ...
5
votes
3answers
379 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 ...
1
vote
0answers
138 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
560 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 ...
2
votes
1answer
75 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
386 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 ...