Programming :: Can't Understand The Value Returned By Semctl Using GETPID Option
Oct 18, 2010
I have got a program using semctl(). I cant understand the value returned by semctl using GETPID option and its difference with the actual pid obtined by getpid()as in the following code:
Code:
int semid,retval;
semid=semget(0*20,1,0666 | IPC_CREAT);
retval = semctl(semid,0,GETPID,0);
[code]....
View 4 Replies
ADVERTISEMENT
Oct 19, 2010
I cant understand y there is no dock option in this
View 4 Replies
View Related
Apr 24, 2011
Well I get my other 2 questions answered , I have one last question that has been buggy me.Anyone know why windows use so many files just to keep the OS going and so bloated? The under line of files of windows is messy and loads self every where and very bloated with windows and windows vista and windows 7 very much so.I'm not sure if Linux /Mac OS X is like this or not .
I know windows needs to support alot more software and hardwar but is that not where drivers come in for the hardware.And programmers need to write the software for windows or Linux / Mac OS X.
View 14 Replies
View Related
Mar 10, 2010
I write a little script by bash.
#!/bin/bash
a=`gawk '/Iterations /{print $0}' hoge.log | gawk 'BEGIN{FS=" "}{print ($4)}'`
a=`expr 3 '*' $a`
[code]...
View 13 Replies
View Related
Dec 9, 2010
In my book, this is an example of a recursive algorithm:
var reverseArray = function(x,indx,str) {
return indx == 0 ? str : reverseArray(x,--indx,(str+= " " + x[indx])) ;; }
var arr = new Array('apple','orange','peach','lime');
var str = reverseArray(arr,arr.length,"");
alert(str) ;
I'm trying to understand it, I'm stuck at the (str+= " " + x[indx])) part - that part of the function definition expects an ARGUMENT, am I right? What's being passed to it is a bit of PROGRAM, the str+= stuff. So - how is it working?
View 7 Replies
View Related
Aug 25, 2010
I have just started using Valgrind,which really is great. Most of the reported errors look kinda weird, though I can't really understand what's going on here, for example:
==00:00:02:52.033 7754== Invalid read of size 4
==00:00:02:52.033 7754== at 0x80B0987: MyCls::MyPrintf(long, char*, ...) (MyCls.cpp:270) ...
==00:00:02:52.033 7754== Address 0x47a5ee8 is 0 bytes after a block of size 296 alloc'd ...
==00:00:02:52.033 7754== by 0x809A6C1: ClsMain::taskRun(int, char**) (ClsMain.cpp:177)
==00:00:02:52.033 7754== by 0x816CFE8: main (main-C.cpp:2060)
==7754== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- Y
==00:00:02:57.410 7754== starting debugger with cmd: /usr/bin/gdb -nw /proc/7765/fd/1014 7765
GNU gdb Red Hat Linux (6.5-25.el5rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as
"i386-redhat-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".
Attaching to program: /proc/7765/fd/1014, process 7765
MyCls::MyPrintf (this=0x47a5dc0, iPrm=3,
sMsg=0x6974320 "blablabla"...) at MyCls.cpp:270
270 cout<<endl<<"m_FilePtr="<<hex<<m_FilePtr<<dec<<endl;
Basically, Valgrind reported the "Invalid Read" error at line 270 of file MyCls.cpp, which is simply a cout of the m_FilePtr variable, which is a member variable of the MyCls class. It's a FILE* variable I use to write repeatedly on a text file. The address reported (0x47a5ee8) is 296 bytes after the "this" pointer (0x47a5dc0),as Valgrind correctly tells me but I honestly don't understand that. And of course, I need to read that variable, not only for the cout (indeed,the error is reported at every reading attempt). Besides, the application doesn't crash, but still I would like to understand if I really have to worry about this "error".
View 10 Replies
View Related
Mar 4, 2011
I am unable to understand the highlighted code/syntax here and what do variable names starting with an underscore represent?
Code:
#include <iostream>
template <class Class, typename ReturnType, typename Parameter>
[code]....
View 14 Replies
View Related
Jun 4, 2010
I am getting shift/reduce and reduce/reduce conflict in my yacc grammar code. yacc generates (i.e yacc -d -v parser.y) its grammar and state information in the parser.output file.
How can i interpret the below information and understand which grammar state is conflicting with other grammar state? Please help me to understand.
State 159 conflicts: 1 shift/reduce
State 1863 conflicts: 1 shift/reduce
State 1865 conflicts: 1 shift/reduce
State 1960 conflicts: 1 shift/reduce
View 6 Replies
View Related
Dec 29, 2010
I needed to find the time it takes to execute a for loop... I decided to use the gettimeofday() function and wrote the following code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sched.h> // for use of sched_setaffinity
[code]....
View 9 Replies
View Related
Jun 10, 2010
I'm using ubuntu,i have a bin file under my /usr/bin, if i run the command under root user i'm getting no problem an it works fine,if i try it in with differnent user im getting
Code:
semctl:premission denied
so how can i edit my bin file and change it to right permission
View 3 Replies
View Related
Sep 18, 2010
I do not get what this method is seeking for? Where do i put a string or somethig that its sopposed to find.
[code]...
Seeks in the stream by the given offset, modified by type. If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned.
[code]...
TRUE if successful. If an error has occurred, this function will return FALSE and set error appropriately if present [URL]...
View 2 Replies
View Related
Apr 2, 2010
what "Message too long" error returned by the function dn_expand means?
The function call I used is as follows:
dn_expand(poutput, poutput + output_space_used, *out_rr, output_qname, 255);
I assumed that the error was due to the difference between the 1st argument and 2nd argument, However, changing the difference to the accepted dns message size (512 bytes) or even to no difference at all did nothing to remove the error.
Further, I am trying to check the output after having first compressed a domain name using dn_comp into *out_rr. This function call is in order to check whether the compression is happening correctly.
View 4 Replies
View Related
Feb 21, 2011
I'm running sed in WinXP on a text file using a script file. Every time I run it I get an unknown option to 's' error:C:Program FilesGnuWin32in>sed -f jagerize.sh input.txt>output.txtsed: file jagerize.sh line 22: unknown option to 's' I've tried two different implementations of sed, with the same result. Deleting the offending line in the script file still produces the same result (as the next line has the same syntax). I'm guessing the problem has something to do with WindowsXP, but I'm a complete newbie with sed and Linux.Here is the script file I am using:
#!/bin/sh
#
# Jagerizer 1.2
[code]...
View 1 Replies
View Related
Apr 21, 2010
(i) I usually make multiple dir using -p optionex: mkdir -p dicttest/audrep/tdriver/testNow after creating this dir's i stay in current dir instead i want to go directly to test dir how can i acheive this.(ii) When i execute which command as followswhich testerm i will get the location of testterm now i want to open this filewhen i did in this wayhich testterm | vi The file dosent get opened how can i acheive this ?ex:
linuxx86:110$ which testterm
/view/rdl110_linuxx86/vobs_usrrdl/sc/testterm
linuxx86:110$ which testterm| vi
[code]....
View 3 Replies
View Related
Apr 7, 2010
I am trying to compile a hello world program to run on a powerpc processor. I used GCC 4.4.1 from Ubuntu 9.10 on a X86 (PC) platform.
Which value should I use to indicate powerpc architecture?
View 3 Replies
View Related
Dec 2, 2010
I am a linux newbie (more so with using RedHat). I am trying to use yum to install packages, but have never really able to get this thing right. I want to install libXp-devel package. However, running yum install libXp-devel doesn't work.
When I downloaded the rpm for libXp-devel and tried to run yum install libXp-devel-1.0.0-8.1.el5.x86_64.rpm, I get the following:
Code:
Resolving Dependencies
--> Running transaction check
---> Package libXp-devel.x86_64 0:1.0.0-8.1.el5 set to be updated
--> Processing Dependency: libXp = 1.0.0-8.1.el5 for package: libXp-devel
--> Processing Dependency: libXau-devel for package: libXp-devel
[code]...
View 5 Replies
View Related
Feb 6, 2010
I'd like to pass the following arguments to a bash script in any order:
Code:
myscript -l <country> -r <file1> <file2> ... -o
I read the argument list in a switch shift loop. I figured out how to read the filelist but only if -f is the last option.
how to position the file list anywhere in the argument list?
View 5 Replies
View Related
Apr 24, 2010
I am creating a script for making a public folder in linux. The idea behind is to allow any user to write files in this folder and further each of those files can be used by any user. For this purpose I am using acl. This first requires to set acl as mount option in /etc/fstab which I need to do with help of (awk and sed) command available in linux.
The line below is the fstab entry which I need to make change in.
UUID=e9a3db4b-d8c0-40b4-a661-131e13afea1e
/ext3 relatime,errors=remount-ro 0 1
I want my script to identify this line (most probably with / which denotes the mountpoint) and then add (acl,) without brackets in options. Currently I use the command as below
sed 's/realtime/acl,relatime/' /etc/fstab
but the above command is in reference with (realtime) what I am planning is that my script should be able to find the line which has / and then go to options and add acl there.
View 3 Replies
View Related
Jul 11, 2010
I am working with a third party that use windows to compile. When we port that code I am running into a lot of case issues where the includes are not case sensitive. Is there any option in GCC to make it case insensitive. I know its a long shot, as I have done reading and does not seem so.
View 1 Replies
View Related
Aug 23, 2010
I am anticipating that someone could give more further information about that, not only simple explanations. How to understand User Time, sys time, wait time, idle time of CPU
View 1 Replies
View Related
Mar 29, 2011
(inside R) I am using system.time function to measure the execution time of two functions
> system.time(lapply(seq(1:1000000),returni))
user system elapsed
0.982 0.100 1.057
[code]....
View 3 Replies
View Related
Apr 19, 2011
I'm in way over my head and have absolutely no idea what I am doing.I set up a lamp server earlier today on ubuntu 10.10 and I'm trying to upload files to wordpress which I installed at local host using vsftpd. I am so lost.Something about this entire process has not clicked in my head;
View 1 Replies
View Related
Apr 28, 2011
In the beginning there is MBR. MBR looks for the active partition and tranfers control to the VBR of the active partition. MBR is where grub may be installed. which allows the user to choose an OS(a VBR) I am not sure what the program in the VBR does,but it manages to loads the OS. What am I trying to do: Backup. I ma tired of losign my partitions my bootloaders. I want to backup them all! partitions/MBR /VBR everything short of creating an disk image.
My questions:
1. say the ubuntu partition is formatted, will grub still load? if not is there a bootloader that would?am I making sense? i hope so...
2. what exactly does the VBR contain ?
2. How do I go about backing up? The mbr and the partiton table are backed up with a simple dd command. Then what else needs to be backed ? VBR's of every partition?
View 5 Replies
View Related
Aug 9, 2011
I have taken putty session of a server from two separate machines namely HOST1(3 sessions) and HOST2(1 Session) . However w command says there are 5 users
Code:
# w
09:29:36 up 34 days, 15:48, 5 users, load average: 0.62, 4.33, 8.16
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/17 HOST1 09:18 4:26 0.01s 0.01s -bash
root pts/18 HOST1 09:27 1:21 0.00s 0.00s -bash
root pts/21 HOST2 09:29 0.00s 0.00s 0.00s w
root pts/20 HOST1 09:29 1:39 0.00s 0.00s -bash
View 3 Replies
View Related
May 23, 2011
This problem is occurring on Red Hat EL 5 WS. However, I have two CentOS 5 systems, with similar configuration to RH EL 5, where this problem does not occur.
I am getting this error:
Can't exec "sendmail": No such file or directory at ./0logwatch line 1018, <TESTFILE> line 1.
Can't execute sendmail -t: No such file or directory
View 3 Replies
View Related
Sep 20, 2010
I don't understand the output from 'free' cmd.
[Code]....
WHy in first line in columns representing 'used', 'free', 'buffers', 'cached' are such values? I can't count them properly.
View 4 Replies
View Related
Sep 23, 2010
I am working for a product which was evolved over a decade. There I have some combination of C style coding and C++ coding in same libraries. I am landing on some instances where C style function is expecting forward declarations for some other function for which I can not declare (due to design and architecture). Is there any g++ compiler option that directs the g++ to look whole preprocessed file (because definition is there down in the preprocessed file) than only forward in the preprocessed file. All these years this code is working as we are using CC compiler and that looks entire preprocessed file than only in the forward direction.
<Sample Code
Header1.h file
Function1()
{
[code]....
if I can not include Header2.h first then Header1.h. I have to include Header1.h and Header2.h because on the design hierarchy in this product. Also the function definitions are in header files as they are either template functions or functions expanded through macros.
View 6 Replies
View Related
Feb 21, 2010
I am getting this error "Unknown filter "police", hence option "rate" is unparsable. This is in Linux Kernel 2.6 which is compiled with the "policing" option enabled in Qos (Kernel config). The error seems to be coming from the file tc.c in iproute2/
static int parse_nofopt(struct filter_util *qu, char *fhandle, int argc, char **argv, struct nlmsghdr *n) {
__u32 handle;
if (argc) {
fprintf(stderr, "Unknown filter "%s", hence option "%s" is unparsable
", qu->id, *argv);
return -1;
} if (fhandle) {
struct tcmsg *t = NLMSG_DATA(n);
if (get_u32(&handle, fhandle, 16)) {
fprintf(stderr, "Unparsable filter ID "%s"
", fhandle);
return -1; }
t->tcm_handle = handle; }
return 0; }
This is called from get_filter_kind() which is called from tc_filter_modify(), called from do_filter(), from do_cmd() from main()...all in tc.c. Is this a known "bug" in iproute2+2.6 as the 2.4 Kernel works with the same settings?
View 14 Replies
View Related
Oct 21, 2010
make a check list of things to do to see if i can figure out if my machine is or not compromised .
View 9 Replies
View Related
Apr 13, 2010
a lot of log file store in location /var/log/ but how to understand what the meaning in side the log file recorded down? how to find out the problem from the log file?
View 2 Replies
View Related