Hi,
I've modified the syslogd source to include a thread that will keep track of a timer(or a timer thread). My intention is to check the file size of /var/log/messages in every one minute & if the size is more than 128KB, do a echo " " > /var/log/messages, so that the file size will be set... (7 Replies)
So in my shell i execute:
{ while true; do echo string; sleep 1; done } | read line This waits one second and returns.
But
{ while true; do /bin/echo string; sleep 1; done } | read line continues to run, and doesn't stop until i kill it explicitly.
I have tried this in bash as well as zsh,... (2 Replies)
Hello All
Nice to meet you all here in this forum,
it's my 1rst time here
i'm asking about a little issue that i face
i added a ksh script that echo " please insert your name " and store the output to a login.log file.
the script is working fine with normal telnet
but Xstart is not working... (8 Replies)
echo `echo ` doesn't echoes anything. And it's logic. But
echo `echo `echo ` ` does echoes "echo". What's the logic of it? the `echo `echo ` inside of the whole (first) echo, echoes nothing, so the first echo have to echo nothing but echoes "echo"
(too much echoing :P):o (2 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Hi Folks,
As per the subject, the following command is not working as expected.
echo $variable | mail -s "subject" "xxx@xxx.com"
Could anyone figure it out whats wrong with this. I am using AIX box.
Regards, (2 Replies)
I came across and unexpected behavior with redirections in tcsh. I know, csh is not best for redirections, but I'd like to understand what is happening here.
I have following script (called out_to_streams.csh):
#!/bin/tcsh -f
echo Redirected to STDOUT > /dev/stdout
echo Redirected to... (2 Replies)
Which one of the following are more accurate and why?
nohup myScript.sh 1>nohup_$(date +%Y%m%d%H%M%S).out 2>&1 &
nohup myScript.sh 1>>nohup_$(date +%Y%m%d%H%M%S).out 2>&1 &
nohup myScript.sh >nohup_$(date +%Y%m%d%H%M%S).out 2>&1 &
nohup myScript.sh >>nohup_$(date +%Y%m%d%H%M%S).out 2>&1 &... (3 Replies)
Dear Ladies & Gents,
I have a requirement to delete all the log files in /var/log/test directory that are older than 10 days and their first line begin with "MSH" or "<?xml" or "FHS". I've put together the following BASH script, but it's erroring out:
for filename in $(find /var/log/test... (2 Replies)
Discussion started by: Hiroshi
2 Replies
LEARN ABOUT FREEBSD
counter_u64_fetch
COUNTER(9) BSD Kernel Developer's Manual COUNTER(9)NAME
counter -- SMP-friendly kernel counter implementation
SYNOPSIS
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/counter.h>
counter_u64_t
counter_u64_alloc(int wait);
void
counter_u64_free(counter_u64_t c);
void
counter_u64_add(counter_u64_t c, int64_t v);
void
counter_enter();
void
counter_exit();
void
counter_u64_add_protected(counter_u64_t c, int64_t v);
uint64_t
counter_u64_fetch(counter_u64_t c);
void
counter_u64_zero(counter_u64_t c);
#include <sys/sysctl.h>
SYSCTL_COUNTER_U64(parent, nbr, name, access, ptr, descr);
SYSCTL_ADD_COUNTER_U64(ctx, parent, nbr, name, access, ptr, descr);
DESCRIPTION
counter is a generic facility to create counters that can be utilized for any purpose (such as collecting statistical data). A counter is
guaranteed to be lossless when several kernel threads do simultaneous updates. However, counter does not block the calling thread, also no
atomic(9) operations are used for the update, therefore the counters can be used in any non-interrupt context. Moreover, counter has special
optimisations for SMP environments, making counter update faster than simple arithmetic on the global variable. Thus counter is considered
suitable for accounting in the performance-critical code pathes.
counter_u64_alloc(wait)
Allocate a new 64-bit unsigned counter. The wait argument is the malloc(9) wait flag, should be either M_NOWAIT or M_WAITOK. If
M_NOWAIT is specified the operation may fail.
counter_u64_free(c)
Free the previously allocated counter c.
counter_u64_add(c, v)
Add v to c. The KPI does not guarantee any protection from wraparound.
counter_enter()
Enter mode that would allow to safely update several counters via counter_u64_add_protected(). On some machines this expands to
critical(9) section, while on other is a nop. See IMPLEMENTATION DETAILS.
counter_exit()
Exit mode for updating several counters.
counter_u64_add_protected(c, v)
Same as counter_u64_add(), but should be preceded by counter_enter().
counter_u64_fetch(c)
Take a snapshot of counter c. The data obtained is not guaranteed to reflect the real cumulative value for any moment.
counter_u64_zero(c)
Clear the counter c and set it to zero.
SYSCTL_COUNTER_U64(parent, nbr, name, access, ptr, descr)
Declare a static sysctl oid that would represent a counter. The ptr argument should be a pointer to allocated counter_u64_t. A read
of the oid returns value obtained through counter_u64_fetch(). Any write to the oid zeroes it.
SYSCTL_ADD_COUNTER_U64(ctx, parent, nbr, name, access, ptr, descr)
Create a sysctl oid that would represent a counter. The ptr argument should be a pointer to allocated counter_u64_t. A read of the
oid returns value obtained through counter_u64_fetch(). Any write to the oid zeroes it.
IMPLEMENTATION DETAILS
On all architectures counter is implemented using per-CPU data fields that are specially aligned in memory, to avoid inter-CPU bus traffic
due to shared use of the variables between CPUs. These are allocated using UMA_ZONE_PCPU uma(9) zone. The update operation only touches the
field that is private to current CPU. Fetch operation loops through all per-CPU fields and obtains a snapshot sum of all fields.
On amd64 a counter update is implemented as a single instruction without lock semantics, operating on the private data for the current CPU,
which is safe against preemption and interrupts.
On i386 architecture, when machine supports the cmpxchg8 instruction, this instruction is used. The multi-instruction sequence provides the
same guarantees as the amd64 single-instruction implementation.
On some architectures updating a counter require a critical(9) section.
SEE ALSO atomic(9), critical(9), locking(9), malloc(9), sysctl(9), uma(9)HISTORY
The counter facility first appeared in FreeBSD 10.0.
AUTHORS
The counter facility was written by Gleb Smirnoff and Konstantin Belousov.
BSD February 7, 2014 BSD