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
20 views

C code to send simulated Alt-C to another App window using X11 calls and ioctl [migrated]

I am writing a C program to allow me to send simulated keyboard input to another Application's window open on my desktop. I need to be able to find the App window by name and get an id for it, and ...
0
votes
0answers
65 views

writing my first exploit in linux [migrated]

How can I modify the source code in the func( ) so that the address to which the program returns after executing func () is changed in such a manner that the instruction printf("first print\n”) is ...
0
votes
1answer
41 views

Cabal error: Cannot run c compiled programs

I have an old version of cabal-install so I downloaded cabal-install 1.20 and When installing it errors out. Additional note: ghc 7.8.3 OS: CentOS 6.6 Error: Building network-2.4.2.3... ....... ...
-1
votes
0answers
25 views

Why does this simple test fail in travis-ci.org? [closed]

I implemented a simple stack and committed it to my github repository and I have enabled travis-ci for that repository. I am using check test framework as I am writing the code in C. I am using ...
-1
votes
0answers
13 views

Can't find where __put_user_1 is defined [migrated]

I have been going through the linux kernel module programming guide, and I decided to find out how put_user(*(msg_Ptr), buffer) works. After all macro expansion is done, it appears that this inline ...
1
vote
1answer
20 views

Cannot find -lgcc

I'm trying to compile my next basic c program after hello-world. This contains two supporting modules. I have Ubuntu running in a VM through VirtualBox on a mac. Everything is up to date but I ...
-1
votes
0answers
19 views

how to pass command line arguments from c programm to the bash script? [migrated]

i have written one bash script and now am calling this script from c program. Now i want to pass arguments i.e. argv[1] and argv[2] to the script from command line.
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
133 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
19 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
26 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
79 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
82 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
69 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
94 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
66 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
440 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
44 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
52 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
28 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
188 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
104 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
156 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
982 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
132 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
466 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
68 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
739 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
162 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
71 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
303 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
181 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, ...
2
votes
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
92 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
110 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
519 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
43 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
221 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
107 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
116 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
387 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
1answer
123 views

Compile OS with gcc and ld on Linux

I'm practicing operating system development and am having trouble getting gcc and ld to produce pure binary without any metadata or section labels. For example: int function(){ return 100;} would ...