Questions tagged [systems-programming]

System programming is the activity of computer programming system software. The primary distinguishing characteristic of systems programming when compared to application programming is that application programming aims to produce software which provides services to the user, whereas systems programming aims to produce software which provides services to the computer hardware.

Wiki:

System programming is a kind of computer programming which is intended to design a system software. Systems programming is used to produce such softwares which provide services to the computer hardware. thus It requires a greater extent of hardware compatibility.

Implementing certain parts in operating system and networking requires systems programming, for example implementing Paging (Virtual Memory) or a device driver for an operating system. A System programming language like C, PL360, BLISS, D is usually used to for systems programming".

Usage:

The tag can be used for all system programming related problems. Stackoverflow is a question-answer website for programming related problems, for theoretical and other problems you can ask your system programming problems on https://www.superuser.com and https://programmers.stackexchange.com/

Read more:

408 questions
4
votes
2 answers

C++: get native dll dependencies without loading it in process

I need to programmatically obtain DLL's dependencies list. Here is how I'm trying to solve this task: BSTR GetDllDependencies(const wchar_t* dllPath) { std::wstring dependencies; struct LibDeleter { typedef HMODULE pointer; …
4
votes
3 answers

working code for Advanced Programming in the UNIX Environment 2ed preferably on Ubuntu/gcc4

i was learning Linux system programming and i am going through the APUE 2ed book by W. Richard Stevens and Stephen A. Rago. The code given on http://www.apuebook.com/ does not work. Undefined definitions, un-implemented functions (given in…
deepak
  • 7,230
  • 5
  • 24
  • 26
4
votes
5 answers

How to list first level directories only in C?

In a terminal I can call ls -d */. Now I want a c program to do that for me, like this: #include #include #include #include int main( void ) { int status; char *args[] = { "/bin/ls", "-l",…
gsamaras
  • 71,951
  • 46
  • 188
  • 305
4
votes
1 answer

Does anyone see any problem in this program

After not getting an answer I liked for this question about chroot, I went and rolled my own solution: #include #include #include #include extern char **environ; int main(int argc, char** argv, char**…
BCS
  • 75,627
  • 68
  • 187
  • 294
4
votes
1 answer

c - understand if pipe/fifo is full

I have a fifo opened as RDWR(for communicate process-process) and pipes(process-thread), how can I understand when I reach pipes or fifos limit? When I try to write more than 64 KB it just wait in write().
user4612022
4
votes
2 answers

Micro-optimizations: using intptr_t for flag/bool types

From what I understand, the definition of intptr_t varies by architecture -- it is guaranteed to have the capacity to represent a pointer that can access all of the uniform address space of a process. Nginx (popular open source web-server) defines a…
Hassan Syed
  • 20,075
  • 11
  • 87
  • 171
4
votes
2 answers

Fail to make repeated SOCK_STREAM connection to the server while the server did not start?

I was doing Network Programming with sockets. And there is a problem while my client program was trying to make repeated connections to the server when the server did not start ( particular requirement of the project ). Here is the problem: Server…
4
votes
1 answer

How to get HWND of one or more hidden windows?

I need get the HANDLE or HWND of a hidden window to terminate it with EndTask((HWND)hProc,TRUE,TRUE);. I used all ways listed below but none of them work. When I manually set a handle to a hidden window with spy++, this worked correctly. NOTE: This…
3
votes
1 answer

dlmalloc's mspace_malloc returns strange addresses

[I've solved this problem--please see my last comment below.] In my application, I need to use my own special malloc, based on Doug Lea's dlmalloc: I map an anonymous file (using mmap), create an mspace out of part of the mapped file, and pass the…
Amittai Aviram
  • 2,270
  • 3
  • 25
  • 32
3
votes
2 answers

When does malloc not call mmap?

I'm studying operating systems at university and one of my tasks was find situation when malloc() doesn't cause mmap() system call. I used strace linux utility to trace system calls, but in my situation I saw mmap() syscalls every time when malloc()…
3
votes
1 answer

glibc documentation and endianness

glibc documentation on process completion status states that the macro WEXITSTATUS returns the low order 8 bytes of the completion status. Macro: int WEXITSTATUS (int status) If WIFEXITED is true of status, this macro returns the low-order 8 bits…
Sandip Bhattacharya
  • 1,042
  • 10
  • 11
3
votes
0 answers

Can I memory align data structures in C# to exactly match received messages like in C?

A neat feature in C low-level device/network programming is that you can control how a struct is aligned in memory. So if I know a hardware device will send me binary data in a given format, I can simply copy that raw data into a struct and then…
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
3
votes
1 answer

C SECCOMP blocks or closes STDIN/STDOUT

I am now implementing to run another program in child process after fork. int main(int argc, char *argv[]) { pid_t pid = 0; int status; struct user_regs_struct regs; prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); …
pincoin
  • 665
  • 5
  • 19
3
votes
1 answer

Is there any overhead in Rust-style method calling approach compared to the usual use of functions in other system programming languages such as C?

I am just starting to use Rust, under the impression of its ownership paradigm. Reading the tutorial, I found the following code let secret_number = rand::thread_rng().gen_range(1, 101); I assume that a random integer is generated after…
Andrew Sonin
  • 141
  • 9
3
votes
2 answers

Equivalent to RUSAGE_THREAD darwin?

I need to measure the cpu usage of individual threads on darwin. On linux I use getrusage(RUSAGE_THREAD, ...) but it's not available on darwin.
melisgl
  • 308
  • 2
  • 13