LOCK(2) System Calls Manual LOCK(2)NAME
lock - lock a process in primary memory
SYNOPSIS
lock(flag)
DESCRIPTION
If the flag argument is non-zero, the process executing this call will not be swapped except if it is required to grow. If the argument is
zero, the process is unlocked. This call may only be executed by the super-user.
BUGS
Locked processes interfere with the compaction of primary memory and can cause deadlock. This system call is not considered a permanent
part of the system.
ASSEMBLER
(lock = 53.)
sys lock; flag
local LOCK(2)
Check Out this Related Man Page
SHLOCK(1) InterNetNews Documentation SHLOCK(1)NAME
shlock - Create lock files for use in shell scripts
SYNOPSIS
shlock [-b|-c|-u] -f name -p pid
DESCRIPTION
shlock tries to create a lock file named name and write the process ID pid into it. If the file already exists, shlock will read the
process ID from the file and test to see whether the process is currently running. If the process exists, then the file will not be
created. shlock exits with a zero status if it could create the lock file, or non-zero if the file refers to a currently active process.
OPTIONS -b Process IDs are normally read and written in ASCII. If the -b flag is used, then they will be written as a binary int.
-c If the -c flag is used, then shlock will not create a lock file, but will instead use the file to see if the lock is held by another
program. If the lock is valid, the program will exit with a non-zero status; if the lock is not valid (i.e. invoking shlock without
the flag would have succeeded), then the program will exit with a zero status.
-f name
name is the name of the lock file shlock attempts to create. If the file already exists, it will read the process ID from the file and
exit with a non-zero status if this process is currently active.
-p pid
pid is the process ID to write into the file name.
-u For compatibility with other systems, the -u flag is accepted as a synonym for -b since binary locks are used by many UUCP packages.
EXAMPLES
The following example shows how shlock would be used within a shell script:
LOCK=<pathrun in inn.conf>/LOCK.send
trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
if shlock -p $$ -f ${LOCK} ; then
# Do appropriate work.
else
echo "Locked by `cat ${LOCK}`"
fi
HISTORY
Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews after a description of HDB UUCP locking given by Peter Honeyman, and improved by
Berend Reitsma to solve a race condition. Converted to POD by Julien Elie.
$Id: shlock.pod 8357 2009-02-27 17:56:00Z iulius $
INN 2.5.2 2009-05-21 SHLOCK(1)
I have a file which contains blocks of text - each block is a multi-lines text delimited by blank lines eg.
<blank line>
several lines of text
...
pattern found on this line
several more lines of text
...
<blank line>
How do you delete the block of text (including the blank lines) when... (17 Replies)
Hello.
I am trying to run xclock on newly built solaris box - These are the steps I followed:
# DISPLAY=localhost:0.0
# export DISPLAY
# xclock
xclock: not found
# cd /usr/openwin/bin
# ./xclock
Error: Can't open display: localhost:0.0
#
Please suggest, what am i doing wrong?
Thank... (27 Replies)
Hello all,
I have a text files that consists of blocks of text. Each block of text represents a set of Cartesian coordinates for a molecule. Each block of text starts with a line that has a only a number, which is equal to the total number of atoms in the molecule. After this number is a line... (15 Replies)
I have been thinking how to go around this problem but I just do not find a way to do it. So, I finally decided to ask. I have a real bunch of different sequences of different lenghts aligned in the following format:
Now, what I need is a 'window' of let say 10 characters that I have to 'slide'... (19 Replies)
Hello again, I am wanting to remove all duplicate blocks of XML code in a file. This is an example:
input:
<string-array name="threeItems">
<item>item1</item>
<item>item2</item>
<item>item3</item>
</string-array>
<string-array name="twoItems">
<item>item1</item>
<item>item2</item>... (19 Replies)
Hi
It happens when I try to delete a file of 250MB with the command rm -r on our old Intergraph CLIX that the filename disappears while the blocks remain on the machine. Only when I reboot the system the blocks really disappear. Then rm works again for sometime but after some time it happens... (15 Replies)
Hello to all,
I would like to search sequences of bytes inside big binary file.
The bin file contains blocks of information, each block begins is estructured as follow:
1- Each block begins with the hex 32 (1 byte) and ends with FF. After the FF of the last block, it follows 33.
2- Next... (59 Replies)
Hi UNIX Members,
I've been tasked with performing the following:
Extract a block of data in column form
#This data changes each time, therefore automating future procedures
Please Note the following:
line = reading a line from a file_list that leads to the data
The filename is called... (16 Replies)
I have a file say "SAMPLE.txt" with following content,
P1
10,9:6/123456
P2
blah blah
P1
10,9:5/98765
P2
blah
blah
P1
blah blah
P2
I want a output file say "RESULT.txt" as,
Value1:123456
Value2:98765
Value3:NULL (17 Replies)
I am trying to grep for a particular text (Do action on cell BL330) in a text file(sample.gz) which is searched in the content filtered by date+timestamp (2016-09-14 01:09:56,796 to 2016-09-15 04:10:29,719) on a remote machine and finally write the output into a output file on a local machine.
... (23 Replies)
I have a file that should be sorted by a string (shown in red in my example below) in the identifier. The RS is ^@M0, something like this:
@M04961:22:000000000-B5VGJ:1:1101:9280:7106 1:N:0:86
GGCATGAAAACATACAAACCGTCTTTCCAGAAATTGTTCCAAGTATCGGCAACAGCTTTATCAATACCATGAAAAATATCAACCACACCAGAAGCAGCAT... (16 Replies)
Hi Everybody,
Hope everybody is having fun with their Solaris installations and not pulling out too much of whatever hair they have left so far. :)
Just for sport, I bought an old Netra 240 used by Northern Telecom Turkish subsidiary Netas here in Turkey. My hope is to turn this into an ugly... (33 Replies)
2 scripts to convert IP ranges to CIDR notation using awk, gawk or mawk. The scripts are much faster than using ipcalc and will return the same results. The first script is reliably compatible with awk, gawk and mawk but is over 3 times as slow as the second script which is reliably compatible with... (38 Replies)