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

0
votes
0answers
6 views

What is the gcc -fstack-protector -S XXX.c function? [migrated]

I found out that for prevent to buffer overflow I can use that instruction (gcc -fstack-protector -S XXX.c). For example, I have a file that name is test.c and that file has a buffer overflow, (ex. ...
0
votes
0answers
11 views

Can I create a custom kernel module to extend functionality and use it in C code WITHOUT recompiling the kernel? [migrated]

I have a technical question. I want to write a program that can set the LED color of my DS4 controller on linux. Over USB I can already achieve this on all platforms. When the DS4 controller uses ...
1
vote
0answers
74 views

Getting “cannot open shared object file: No such file or directory” error while run time

I have successfully compiled the file but now I am getting following errors export LD_LIBRARY_PATH=/opt/mcr/v717/sys/java/jre/glnxa64/jre/lib/amd64/server/:D_LIBRARY_PATH ./invoke ./invoke: error ...
0
votes
1answer
18 views

-fPIC Flag System-wide?

Position Independent Code means that the generated machine code is not dependent on being located at a specific address in order to work. and the jumps are relative. So is it OK to declare -fPIC ...
1
vote
0answers
24 views

Linux and Embedded systems engineering [closed]

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!
2
votes
1answer
75 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 ...
1
vote
2answers
71 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
1answer
59 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
90 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
55 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 ...
4
votes
2answers
360 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? ...
0
votes
1answer
34 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
45 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
12 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
25 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
139 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
97 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
28 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
142 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
27 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
890 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
126 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
1answer
398 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
67 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
656 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
156 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
68 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
262 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
61 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
175 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
3k 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
88 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
103 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
461 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
41 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
210 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
95 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) : ...
11
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
110 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
382 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
151 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
697 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
88 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
472 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
80 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 ...
9
votes
7answers
2k 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 ...
0
votes
0answers
161 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 ...
2
votes
0answers
184 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 ...