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.
3
votes
0answers
49 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
...
1
vote
0answers
16 views
Get process's timeslice in user mode [migrated]
How can I get the value of process's timeslice in user mode? I designed a new scheduling policy, and I want to check if processes with the same policy (my policy) have the same timeslice to run. It is ...
2
votes
0answers
24 views
Which Unix don't have a thread-safe malloc? [migrated]
I want my C program to be portable even on very old Unix OS but the problem is that I'm using pthreads and dynamic allocation (malloc). All Unix I know of have a thread-safe malloc (Linux, *BSD, Irix, ...
-3
votes
0answers
42 views
pipe() is not working well [closed]
I'm trying to make a program using the pipe communication. This is what I'm trying to do: the user sends positive integers. If the user sends a negative number the communication ends. The parent ...
0
votes
0answers
23 views
There's a way to get system info via C library [migrated]
I'm trying to implement a system which sends via Bluetooth sockets, information about the current system (in fact, a Linux server). This back-end code is in C. I'd like to know if there's an available ...
2
votes
1answer
13 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
0answers
45 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 ...
1
vote
1answer
33 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 ...
4
votes
4answers
372 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?
0
votes
0answers
16 views
__isoc99_scanf and scanf [migrated]
I was studying various compiler option in GCC and observing changes when I made changes in the standard to be used.
$ gcc Q1.c -Wall -save-temps -o Q1
$ vi Q1.s
I see one of the opcodes as
call ...
4
votes
1answer
53 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:
...
1
vote
0answers
18 views
Debugging information in GCC preprocessor output [migrated]
I was inspecting the preprocessed output generated by GCC, and I see a lot of these in the .i file that I generated using the -save-temps flag:
# 8 "/usr/include/i386-linux-gnu/gnu/stubs.h" 2 3 4
...
2
votes
3answers
92 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
41 views
Portions of the file Header
I was working through my C programs, I am new to Linux/UNIX development and was having a look around.
I created a simple C program of Hello world and was inspecting the compilation process.
I tried ...
1
vote
3answers
229 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:
...
0
votes
0answers
29 views
dynamic pool of process C [migrated]
I'm writing program in UNIX on C. I have to write client-server(TCP) program on sockets. Client sends some information and server answer. No matter what client sends or receives because I successfully ...
-3
votes
2answers
65 views
Using file system call
I'm trying to learn system calls for open,write and close a file.
I use this sample and the result is:
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
Here's my program:
...
0
votes
1answer
30 views
Understanding a XINU system call - getstk.c [closed]
I am having trouble conceptually understanding what is going on towards the end of this system call, and why. I understand the getstk.c method returns the highest memory address of available space, ...
2
votes
2answers
226 views
Why read() is slower than getc()? [closed]
Why is read slower than getc?
For example, this:
for (;;) {
chr++;
amr=read(file1, &wc1, 1);
amr2=read(file2, &wc2, 1);
if (wc1 == wc2) {
if ...
-2
votes
0answers
43 views
getc() convert to syscall read() [closed]
I'm writting utility like cmp in UNIX using system calls.
Found source code for Solaris. Started to convert fopen into open, etc.
When I almost finished, I found the getc() function and was upset ...
-1
votes
0answers
42 views
Client-Server with unnamed pipes and select [closed]
I try to write simple client-server program using fork(), pipe() and select(). Parent process is a server, which select pipe with data from client by FD_ISSET and write data to other clients. And ...
0
votes
0answers
33 views
GCC Constructor & Link order, Are they have relation? [migrated]
I have to write this question, I have try a lots to find the reason.
There is a.c:
UTEST_BEGIN()
UID(a_test)
{
printf("a test");
return true;
}
UTEST_END(a)
b.c is simlar:
UTEST_BEGIN()
...
1
vote
2answers
81 views
Monitoring script started by rc.local
We have a C program which is started using rc.local´. We added a line like this:
/usr/local/bin/pc
to the rc.local file. pc is a compiled C program. Everything is working fine at the moment. What ...
2
votes
0answers
20 views
Getting live info from /dev/input [migrated]
I am unsure if this is the correct place for this question. I am attempting to obtain the axis position values from a joystick /dev/input/js0 on my system. If I run jstest /dev/input/js0 it will give ...
0
votes
1answer
58 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
1answer
67 views
How to explicitly load shell interpreter in a C program
I want to create an executable script which is not readable/writable
However since an interpreter needs to read this file it is not possible to do so directly. Therefore I wanted to know if I could ...
0
votes
1answer
27 views
Can a GTK applet widget be instantiated through dbus?
I just posted this:
#274616: “Simple” gnome applets in Unity - stickynotes
... where I could instantiate a Gnome 2 bonobo applet in a standalone window,
... using ...
-1
votes
2answers
40 views
Why rsh not opens and reads PAM modules and limits.conf?
I am working on a project, that uses rsh utility for remote connection.
But my project needs some extra features for that, so I add that features.
Till now, all the things are going fine. But when I ...
2
votes
1answer
54 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
votes
3answers
176 views
telnet implementation using C [closed]
The program in general is I want to implement telnet program.
On the client side user send its logging name and password, and if it is correct he starts to send commands to the server
On the Server ...
0
votes
2answers
65 views
Which process updates /proc/scsi/scsi?
I wrote C that displays info about my hardware on ubuntu. Now I wonder how I can make it more flexible such as querying the hardware directly instead of the file the os updates. So I think I can look ...
1
vote
0answers
68 views
mod_rewrite: undefined symbol: lstat error
I compiled the mod rewrite for apache (version 1.3.0) however, when I try to run the server I have this error about mod_rewrite:
Syntax error on line 27 of /home/myuser/apache/etc/httpd.conf:
Cannot ...
3
votes
1answer
122 views
Send log messages to a different location
I want to send messages from C program and from Perl script to a file (for example, /var/log/my_log). I don't have access to the syslog daemon configuration, so I think in launch a differente syslog ...
-3
votes
2answers
63 views
Which Linux distro/mode offers lowest interference when running your own applications?
I'm interested in a Linux distro to build C projects and test their behavior in a very predictable and controlled environment. I'm especially concerned about letting the scheduler deal as much as ...
0
votes
1answer
77 views
Having trouble executing a compiled C program
I am running an Ubuntu v10.04 through VirtualBox. To test the persistence of files I create in the virtual machine, I wrote a very basic C program. When I shutdown the virtual machine and restart it, ...
0
votes
0answers
77 views
'dereferencing pointer to incomplete type' in compiling FreeBSD 4.2 custom system call - FreeBSD [closed]
I already posted this question on Stack overflow, but no luck there:
http://stackoverflow.com/questions/14784525/dereferencing-pointer-to-incomplete-type-in-compiling-freebsd-custom-system-caF
I am ...
-1
votes
2answers
118 views
Do BSD sockets give better performance than others eg. POSIX and other? [closed]
I am searching cross-platform techniques to write client-server applications on Mac. I used BSD sockets, Cocoa APIs but I need to know which would be better at performance.
2
votes
3answers
122 views
Linux GCC compiler options
I have recently started using Linux as a tool for programing. In my book, I have seen that the GCC is used with 2 options: -g and -o. Now, I know that -o is to set a filename, but what is the purpose ...
0
votes
0answers
54 views
explain the program in advanceunix? [closed]
I understand the fork concept. I'm trying to solve the following problem.
I have to write a program that forks. The parent process gets a valid Unix command from the user, and passes it to the child. ...
1
vote
0answers
127 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
1answer
181 views
How do I write a login daemon?
There are many guides to the steps for correctly launching a daemon process, such as Stevens' chapter in Advanced Programming in the UNIX Environment. There is less agreement on what steps should be ...
1
vote
1answer
111 views
Linux kernel 3.2 syscalls
Just trying to get the assembler instructions for <__execve> of the code below because i want to build the shell spawn opcode list:
#include <stdio.h>
int main()
{
char *happy[2];
...
2
votes
2answers
226 views
USB Driver Compilation Error
I'm currently trying to compile a Linux USB UART driver, which is provided here:
http://www.exar.com/connectivity/uart-and-bridging-solutions/usb-uarts/xr21v1410
The driver consists of 2 header files ...
1
vote
1answer
60 views
How do I keep 'indent' from moving curly braces to the next line?
I have several empty inline function definitions in C++ like so:
class C
{
void foo(){}
void bar(){}
};
now if I run indent -st -i4 -nut test.cc in order to just fix the indentation I get
...
2
votes
0answers
75 views
Command-line file reader (like “less”) that can tell the line where the user stopped reading
[Context] I'm developing a little app, as a hobby to learn ncurses, that catalogs and lists and searches within a set of documents (for now, they are the HOWTOs from TLDP).
The most tricky part of ...
1
vote
1answer
392 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 ...
1
vote
1answer
94 views
Writing a service in C: How to pass and process arguments to running service?
I want to write a service in C.
While this service is running in background and processing some information I need to grab the results from this service from other applications or from command line.
...
3
votes
1answer
148 views
IP_TRANSPARENT missing from glibc headers
I'm trying to use the IP_TRANSPARENT declaration. I am using debian 6.0.5. IP_TRANSPARENT is only defined in linux/in.h however it conflicts with netinet/in.h.
In centos for example, IP_TRANSPARENT is ...
2
votes
2answers
364 views
How does copy-on-write in fork() handle multiple fork?
According to wikipedia (which could be wrong)
When a fork() system call is issued, a copy of all the pages corresponding to the parent process is created, loaded into a separate memory location by ...
1
vote
0answers
110 views
Having problems with script and redirecting input to stdin [closed]
EDIT: found mistake, it was actually bug in my program, I had > instead of >= in my for loop that reads coefficients.
I'm fairly new to linux, and I need help with bash scripting.
I have C program, ...