unix

How to find out where all a closed source application is writing to?

I have an application (the source for which I don't have), which can be invoked from command line like this $ ./notmyapp I want to know all the locations where the application is writing to. It outputs some files in the directory it is being called from, but I need to make sure that those are the only files that are created. So, I ne...

Do UNIX message queues maintain order of messages?

If, under UNIX/Linux/BSD/OSX, I use this sequence of APIs in Application A: msgq_id = mq_open( full_queue_name, O_RDWR | O_CREAT, S_IRWXU | S_IRWXG, &msgq_attr); mq_send(msgq_id, ptrData1, len1, 0); mq_send(msgq_id, ptrData2, len2, 0); ... and thi...

Listing only directories in UNIX

i want to list only the directories in specified path(ls don't have such option). Also, can this be done with a single line command? ...

regex for finding Letter after Underscore

Hi I would like to write a regex using unix command that identifies all strings that do not confirm to the following format First Leter is UpperCase Followed by any number of letters Underscore Followed by UpperCase Letter Followed by any number of letters Underscore and so on ............. The number of underscores is variable ...

How to monitor which processes access a particular file in Unix?

I have a file and a lot of process (and process threads) are accessing it. I want to monitor the file to get a listing of what all processes tried to access the file. Being able to record the timestamps also would be excellent for logging purposes, though I can do without it. Is there any Unix utility that does something similar? In c...

shell script to capture keyboard activities

How to capture all keyboard strokes using shell script .Is there any command that is related to keyboard activities. ...

How can I change the case of a file in a Solaris CVS repository when most of the CVS clients are on Windows?

I have a file named FooBarBaz.xhtml checked into a CVS repository that resides on a Unix server. I'd like to rename the file to be foobarbaz.xhtml, but it has been my experience that this can cause problem since the CVS repository sees FooBarBaz.xhtml and foobarbaz.xhtml as separate files, while Windows sees them as the same file. To b...

Unexpected end of file

Hi, I've been asked to modify a bash script at my internship and since yesterday was the first time I started reading up on Bash syntax, I'm having a hard time figuring out a "syntax error: unexpected end of file" error. I was wondering if anyone would be able to help me out. The last part of the script is: echo " " >>${MAILLOG} ...

Mutex Initialization -(UNIX)

In the following code.A mutex is initialized.what is the significance of NULL. pthread_mutex_init(&a->monitor,NULL); I want to know why we pass NULL as the second parameter. ...

Issue with putenv() on UNIX when using free()

Hello, I am trying to use putenv() on UNIX by concatenating str1 and str2 before that. I want to add a variable, or modify a variable, in the environment, so I am calling putenv() (or I could call setenv() identically). Basically, I receive str1 and str2, I create str1=str2 and pass it in putenv() as a parameter. The code I am showing...

How to pass multiple parameters to a thread function.

I have created a function for a thread, but I want to pass multiple parameters to the function. Here's my source code : #include "work.h" #include <stdio.h> #include <unistd.h> #include <pthread.h> // compile with -lpthread int count = 20; void* ChildProc(void* arg) { int i; for(i = 1; i <= count; i++) { pr...

Relation between sql query and unix process

I have a procedure that gives below output. SID is 155 SERIAL# is 5466 PROCESS is 1323 SQL_HASH_VALUE is 2701082490 TIME_REM_MIN is 3 TIME_START is 09-07-08 15:38:10 TIME_ELP_MIN is 2 And a unix 'ps' command that would give output as below. $ ps -e -o pcpu -o pid -o user -o args |sort -r -k 1 |head -30 %CPU PID USER...

Difference between shared memory and pipe in unix?

Hi, what is main difference between shared memory and pipe in unix programming? ...

Adding User and Group in Unix

Hi, Does anyone know the api for adding users and groups in unix and removing them ? I want to do this programatically. Thanks, Frank ...

executing shell command in background from script

how can I execute a shell command in the background from within a bash script, if the command is in a string? For example: #!/bin/bash cmd="nohup mycommand"; other_cmd="nohup othercommand"; "$cmd &"; "$othercmd &"; this does not work -- how can I do this? ...

gzunip -c and gzcat

Hi fellows, Could anyone tell why is gunzip -c so much slower than gzcat ? I though they were essentially the same.. cheers, f. ...

Why is there no uncatchable coredump signal?

I recently came across an app that froze in a SIGABRT handler with no other signal registered to immediately core dump. Until we standardize leaving one of SIGSTOP, SIGABRT, SIGTRAP, etc., alone, we'll just use gcore and SIGKILL, but given that broken handling was the issue, I wondered why there isn't along with SIGSTOP and SIGKILL a st...

Move all files of same type in multiple directories up one folder.

I have about 2000 subfolders in one folder, in each of these folders there are .pdf files. I need a unix command that will move all these files up one folder. ...

Did I understand /dev/urandom?

Hi, I have been reading about /dev/urandom, and as far as I can tell, /dev/random creates cryptographically random numbers by taking advantage of several events like network packet timings, etc. However, did I understand right that /dev/urandom uses a PRNG, seeded with a number from /dev/random? Or does it just use /dev/random as long a...

return() versus pthread_exit() in pthread start functions

The following program shows that we can use return() or pthread_exit() to return a void* variable that is available to pthread_join()'s status variable. (1) Should there be a preference for using one over the other? (2) Why does using return() work? Normally we think of return putting a value on the stack but since the thread is comple...