Skip to content
Advertisement

Tag: c++

Changing process priorities

Building off of this, I would like to change process priorities based on RAM usage. I’m perfectly aware that this isn’t always the best way to change priorities, but this is just for a project. I’m trying to use renice and execvp to set process priorities. The problem is that I want to launch renice with additional parameters to change

Is there a different memory allocation path other than the buddy allocator in linux?

I’m understanding memory allocation in Linux and doing some changes in buddy allocator (__alloc_pages_nodemask) for my experiments. I create a new flag in struct page->flags (by adding a new flag in enum pageflags in page-flags.h. I set this bit permanently in __alloc_pages_nodemask (to not to be cleared once set and survive all further allocation and freeing. I modify PAGE_FLAGS_CHECK_AT_PREP to

C Programming – Counting signals in signal handler

I am working on signals in C programming. I have parent process and 5 child processes, I am trying to send SIGUSR2 from child processes to parent process when they are done some calculations while parent waits for them with sigsuspend(). When all 5 child processes sends SIGUSR2, parent process continues its work. I increment a global variable in the

Can GNU Readline handle multiple streams?

I’m building a telnet application which uses GNU Readline to handle console input. Current implementation forks a new child for every new client connection – this assigns one readline instance for each child process. Fork-type network servers are not the most efficient, so I’d like to use poll/epoll instead, but for that readline would have to be configured to work

Segmentation fault when executed from linux command line [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 1 year ago. Improve this question My code compiles and runs fine in my IDE. However, when I use

How to check password on macOS?

The following C program can check the password of a user on Linux. But it does not work on macOS because some functions are Linux specific. Could anybody show me how to revise the program so that it works on macOS? Answer Both Linux and macOS use PAM for authentication; Linux uses Linux-PAM, and MacOS and BSDs OpenPAM. To authenticate

waitpid() function returns ERROR (-1), why?

I’m writing a Linux shell-like program in C. Among others, I’m implementing two built-in commands: jobs, history. In jobs, I print the list of currently working commands (in the background). In history I print the list of all commands history until now, specifying for each command if it’s RUNNING or DONE. To implement the two, my idea was to have

read directories withoud readdir

I’m working on POSIX linux to learn. I’m using C Programming Languages. I want to read a folder, but instead of using readdir or opendir, I want to use pure open and read, I want to extract subfolders or files in this folder as names as string. Is this possible with open() and read() as open and read (without using

Advertisement