Programming :: Use Pthread Scheduling Policy Without Root User?

Jan 12, 2011

I am working on a large program in C to run on Puppy Linux. I have multiple pthreads running. I want to be able to set the pthread SCHED_POLICY and priority in my program but I want a user to be able to run the program without root privilege.
Using a sticky bit and root ownership gives the user too much power because they will be able to write and compile their own scripts. Is there a way to use 'sudo' when I set the thread parameters from my program or something like this?

View 1 Replies


ADVERTISEMENT

General :: Password Policy Affecting Root User ?

Aug 3, 2011

I am using pam module to set password policy in my SuSE linux machine. This is my /etc/pam.d/common-password file:

Now if root user tries to change the password of a normal user, giving the same password, it is throwing an error saying "Password has been already used. Choose another".

Example:
> passwd user1
> password1 (set successfully)
> passwd user1
> password1 (Password has been already used. Choose another)

This should not happen with the root user.

View 2 Replies View Related

Ubuntu :: Scheduling A Task To Run Weekly As A Normal (non-root) User?

Apr 11, 2010

I'm trying to get my backup script to run every week, but as a normal user, and not as root as it is done when the script is placed in /etc/cron.weekly. Anacron fits my needs in the sense that it doesn't require my computer to always be on, as opposed to cron, and will just run my script when it can, but at the most each week. Cron fits my needs in the sense that I can run the script as the user I am logged in as. The particular script backs up my home directory with rdiff-backup, and it is very convenient that I am the owner of that backup, since when root performs the backup, I am unable to browse my own backup files and must use "sudo" to do this.

Is there a way to let me use the feature of anacron that allows my computer to not always be on, but still get a weekly execution, and also run the script as a normal (non-root) user?

View 2 Replies View Related

Ubuntu :: Scheduling Automatic Updates As Root Without User Intervention

May 30, 2010

I'm setting up some computers as kiosks, and would to scedule updates to be downloaded and installed without the user having to enter their sudo password, perhaps at midnight or something like this. What is the quickest way to do this on ubuntu?

View 2 Replies View Related

Programming :: Remote Function With Pthread?

May 22, 2010

I wrote some code in c, using pthread (I configured the linker and compiler in eclipse IDE first).

Code: #include <pthread.h>
#include "starter.h"
#include "UI.h"
Page* MM;

[Code]....

View 6 Replies View Related

Programming :: Pthread Not Release Memory

Jan 1, 2011

I have faced a problem with my code (a small tcp server). After the thread returns, the memory not decreases, but when a new connection is made, memory not increases and the new connection initialize a new thread with a same thread id of the previous thread. When two connections are made at same time, two thread ids are created and when the respective threads returns the memory not decreases. The Valgrind indicates that not memory leak occurs, the pointers are released. Indeed, more memory are allocate when new thread id is created. i used gcc and debian.

[Code]....

View 1 Replies View Related

Programming :: Signal Handling In Pthread?

Mar 12, 2011

I have created a pthread, and installed a signal handler inside that, same way as we do in main( ) function. The thread's signal handler is a separate function. Surprisingly, it is not working, that is the thread's signal handler is not able to catch signals. Here is the code:

Code: #include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <signal.h>
typedef struct data

[Code]...

View 1 Replies View Related

Programming :: Pthread Memory Not Being Freed?

Apr 19, 2010

I have an application that has pretty large memory profile. The general program flow is as follows:

Code:
main:
do 10 times:

[code]....

View 9 Replies View Related

Programming :: Portable Pthread Library Out Of 10 Distros?

Mar 10, 2011

im writing a cross-platform software (linux/solaris/mac/bsd) so i was wondering, how portable is pthread library? out of 10 linux distros, how many will have it by default? and does it exists on mac/solaris/bsd by default? or user will have to install it?

View 6 Replies View Related

Programming :: Suspend/resume A Thread When Using Pthread.h?

Dec 14, 2010

I want to suspend/resume a thread. The library I am using is pthread.h.I am also running my application on linux.Is there any function in pthread. let me suspend a thread temporary?I have read a document in which it was mentioned thatthread does not support suspend/resume

View 4 Replies View Related

Programming :: Pthread Mapping From Compiler To Kernel?

Aug 20, 2010

I'm trying to figure out how pthreads are mapped from the compiler to the Linux kernel. The pthread prototypes are found in a compiler header file (pthread.h), yet the kernel would be responsible for scheduling the threads. So, how does the compiler resolve the pthread symbols at compile time?

View 1 Replies View Related

Programming :: Pthread And Mutex With Short Unlock Time?

Jun 15, 2010

I am wondering if pthread could make that a single thread keeps the "mutex" all the time if the time it remains unlocked is very small.

thread1
{
while (1)
{
lock; do_task(); unlock();

[code]...

I experiment the thread2 never getting access to the mutex and never printing the nice message. I would expect that once thread2 calls "lock", it would get the mutex as soon as thread1 calls unlock() but it does not seem to be the case. If I add a sleep of some microseconds (100) in thread1 after unlocking the mutex, it solves the problem.

Does anyone know if this behaviour is normal? Is there a way to configure my mutex so that thread2 receives it when unlocked?I use

pthread_mutexattr_settype(&att, PTHREAD_MUTEX_RECURSIVE_NP);
pthread_mutex_init(&handle, &att);

to create my mutex. I am running ubuntu 9.04

View 3 Replies View Related

Programming :: Pthread - Optimize Computing Function / Loop With Threads?

Sep 4, 2010

I have to compute prime numbers with threads in C. So I choose the algorithm "Sieve of Eratosthenes" and I tried to create 2 threads, but I don't know how to optimize my computing function with threads I beg for help. This is my function:

[Code]...

but it seems like the both of the threads are calculating the same function twice? Is it possible to be optimized or not?

View 7 Replies View Related

General :: Display Password Policy Information For A User - Ubuntu?

Jun 9, 2010

Ubuntu Documentation > Ubuntu 9.04 > Ubuntu Server Guide > Security > User Management states that there is a default minimum password length for Ubuntu:

Say the password is to be modified by the user using passwd. Is there a command for displaying the current password policies for a user (such as the chage command displays the password expiration information for a specific user)?

This is rather than examining various places that control the policy and interpreting them since the process could contain errors. A command that reports the composed policy would be used to check the policy setting steps.

View 1 Replies View Related

Programming :: Socket Server Using Pthread Doesn't Wait For Accept() Properly?

Apr 19, 2010

I'm building a simple(?) socket server using threads to serve up a few requests. The spec is such that I have to listen to three ports at once, so I decided to use pthread to create three separate threads that would wait for connections, then spawn new threads to handle them.

The problem is that when I do this, for some reason the program never enters the wait loop and instead terminates (All three threads did get created since the messages get printed properly.) It gets to the line which prints "???", but not the line after the accept() call.I don't see an open port when I check for one either so I'm 99% sure they're terminating.Basically I have a main() method which has three calls to pthread_create, which should result in three threads being run that all wait for connections (listenOnPort). After each thread creation I print some info to make sure it's actually being created.

By the way, when I just run listenOnPortwithout threading, the server appears to enter the loop correctly and seems to be waiting for requests. It's only when I run the functions as threads that the problem seems to happen.The source is attached below. Any help will be appreciated. Much of the code is borrowed from a website (I can't post it because I am new here.) You need not worry about the handler_ methods because those are just methods that are run by the threads themselves.

Also--the original source was in C and I changed it to C++. Should I just use C?
server.h Code: /*
* server.h

[code]....

View 1 Replies View Related

OpenSUSE Hardware :: Using Policy Kit To Restrict Removable Mounting To Prompt For Root Password?

May 26, 2010

i using policy kit to restrict removable mounting to prompt for root password, but on 11.2, I am unable to do so.i read out, ver 11.2 not longer using hal and policykit, rather sth like freedesktop.org policy.

View 9 Replies View Related

Programming :: Run Software Compiled As Root On User?

Jul 27, 2009

I've compiled some code which I've given to other people, however when they try to run it they get segemtation fault. After some testing I've found if it's ran from root (where I compiled it) everything works, if I try to run from a user there's a fault.

View 3 Replies View Related

Programming :: Rules To Set The Pthread Stack Size - Compute The Memory Needed By Each Thread?

Jul 26, 2010

i have an application that launches several pthreads, i know that the default size used by Linux is 8Mb for each pthread. However i would like to optimize the total memory usage by my application by decreasing the default stack size of each pthread to the needed resources. My questions:

- Are there any rules to set the pthread stack size.
- How to compute the memory needed by each thread.
- Is the malloc call inside a thread counted from the stack size of the same pthread?

View 2 Replies View Related

Programming :: Non-root User Determine Which Days The Computer Ran?

Mar 22, 2010

Is there any way a non-root user can programmatically determine which days the computer ran during, say, the last month?

The information is in /var/log/messages.* but those files are root:root 640.

Non of the world-readable /var/log files on the Slackware 13.0 development system can be used:boot Not present if boot logging not enabled (default). dmesg No timestamps. lastlog Not enough info. wtmp Rewritten on each boot so not enough info. EDIT: not correct: by default wtmp is rotated weekly and kept for one month as configured in /etc/logrotate.conf xdm.log Not present if xdm not used. Xorg.0.log Not present if X not run.

View 5 Replies View Related

Programming :: How To Create Raw Socket With Non Root User Successfully?

Jun 30, 2011

I am writing a ping kind of program for my own application. This application needs to run with non root user privileges. This needs me to create a raw socket. But the ping connection is failing because of creating raw socket with non root user.How can I run the application successfully with non root user privileges using raw socket creation?

View 4 Replies View Related

Programming :: Preemption And Scheduling Of Pthreads

Feb 10, 2010

i think we can simulate preemption by using 2 different priority thread, am i true? I just try these scenario :
1. Create Thread A with priority 99 , SCHED_FIFO..
2. Create Thread B with priority 4 , SCHED_FIFO

Thread A started and doing some busy work.. I guess that Thread B wouldn't start until thread A finished, but I get thread B can run before Thread A finished (It just like a common task switching).. I'm sure my 2 thread has right priority. and if thread B is doing some work and if i yield it to thread A, it should preempt it but this doesnt happen, do someone kno wats happening?

View 1 Replies View Related

Programming :: Thread Scheduling And Signalling

Mar 23, 2010

I have a program which is uses sigaction to register for a SIGIO signal (for incoming data on a fd) with an appropriate event handler. I also create a new detached thread 'B' that does some work with the received data. Normally the thread B runs properly. But when my event handler is called (because a there is new incoming data), after the event is handled, the thread B is not called immediately. There is a noticeable delay of the order of many seconds before it is scheduled again .During this delay, my program is doing nothing.

What am i doing wrong? Is there someway i can run thread B as soon as the event is handled (and assuming no other work is to be carried out)?

View 3 Replies View Related

Programming :: Scheduling Through Round Robin?

May 10, 2011

Does anyone know how to run 2 threads with round robin scheduling. & can we get the time of these threads when they are context switching. That means I want to know at how much time each thread is taking to run

View 3 Replies View Related

Programming :: C++ Codes To Check Whether User Is Root Or Has Admin Rights

Jan 8, 2011

One of the feature in my application involve changing of hardware setting. This require the user to be root or have administrative right.Before my application enable that feature, I want it to check whether the user is "root" or not, or whether user use "sudo" command to run the application or not, or whether the user has administrative rights or not.What are the codes or library that can do this?

NOTE: Sometimes, advanced linux user may set the user id of root to something else other than 0. So, getuid() may not be helpful in this case.

View 4 Replies View Related

Software :: Change A Process Running In Root-user To Non-root User ?

Oct 28, 2009

Is It possible to change a process running in root-user to non-root-user by setting suid / uid / euid / gid etc... I so please instruct how, when and wat to set in order to change a process running in root-user to non-root user

View 4 Replies View Related

Programming :: Which Is Scheduling Algorithm Which Will Make Thread O?

May 4, 2011

I have a timer thread, and when it expires, it sets a flag. The only problem is, if any higher priority thread comes in between, then the timer is not expired in real time.Thus i want to set a highest priority to my thread. Now, i know 2 algos, which can make my thread in real time are: SCHED_FIFO and SCHED_RR.

So, here are my queries: 1) Which scheduling algo is best suited for this purpose? 2) Is it guaranted to work in real time if i use that algo (you suggest in 1) and set the max_priority by getting the maximum settable priority for that particular algorithm using, int sched_get_priority_max(int policy);

View 2 Replies View Related

Programming :: Need To Find Appropriate Thread Scheduling And Priority

Sep 9, 2009

I am new to thread programming. I need to generate one thread in one process using posix thread. Which scheduling and priority do i need to use? I want to generate the thread with the lowest priority. As i know there are 3 scheduling policy available SCHED_FIFO, SCHED_RR or SCHED_OTHAR.

View 1 Replies View Related

Programming :: Pthread - Take String From The Command Line And Creates A Thread To Print The String

May 3, 2011

I've been trying to understand pthread in C a little better. So I made a simple program that takes in a string from the command line and creates a thread to print the string. I've looked online and copied the basic concepts but there are something things I'm confused about. The programs works just fine, but I have questions. Here's what I have so far.

[Code]....

One thing I'd like to know is why the 3rd argument in the pthread_create function which is my SendMessage function needs to be typecasted to a void pointer and then send the address of the function. Also as for the 4th argument, I would see typecasting to void pointer in some of the pthread examples I saw online, but in my case I'm passing a char pointer, would this be correct? In which case would I ever want to pass a void pointer?

Do I need a pthread_exit(NULL) in my main and in the SendMessage function? If so, why? I added the sleep() function so that I could let the pthread_exit function in my SendMessage function execute first. I simply saw that the online examples on pthread had pthread_exit() in both locations.

View 6 Replies View Related

OpenSUSE Install :: Get Root Privileges On User Account Without Using Root Login?

Feb 5, 2011

i am having problems with privileges i have created a new user with my name, but i cant get root privileges on it. i need the same privileges as the root profile.

View 9 Replies View Related

Ubuntu :: Root User Directory Does Not Exist, Root Password Not Recognised?

Oct 26, 2010

I no longer have access to my root desktop. On a session I attempted to change the root username but i apparently assigned it a wrong directory that does not exist. When I rebooted with my new root username, i was instead recognised as a simple user (no root privileges). I tried the console to change to "old" root but root password is not accepted and there is no way to access to sudoer files. it seems that inserting a new username requires root privileges and i am back to square one. Simply logging with old root username and password after restart gives me a blank screen with nothing on it and cannot even reboot.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved