Re: [SLUG] c programming - structures

2004-10-15 Thread Benno
On Sat Oct 16, 2004 at 16:21:04 +1000, Lucas King wrote:
>hello,
>
>how does one compare two structures of the same type?
>
>Anjuta is returning an error when i compile :
> if (sin1 == sin2) {
>   ..
>   ..
> }
>
>where sin1 and sin2 are structures of the same type.  the sin structure 
>is sockaddr_in.
>
>thanking you in advance,


You need to either compare each element, or use memcp; eg:

if (memcmp(&sin1, &sin2, sizeof sin1) == 0) {


}

Benno
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] c programming - structures

2004-10-15 Thread Lucas King
hello,
how does one compare two structures of the same type?
Anjuta is returning an error when i compile :
 if (sin1 == sin2) {
   ..
   ..
 }
where sin1 and sin2 are structures of the same type.  the sin structure 
is sockaddr_in.

thanking you in advance,
Lucas


The information contained in this e-mail message and any accompanying files
is or may be confidential.If you are not the intended recipient, any use, 
dissemination, reliance,forwarding, printing or copying of this e-mail or
any attached files is unauthorised.This e-mail is subject to copyright. No
part of it should be reproduced,adapted or communicated without the written
consent of the copyright owner.If you have received this e-mail in error,
please advise the sender immediately by return e-mail, or telephone and
delete all copies.Fairfax does not guarantee the accuracy or completeness
of any information contained in this e-mail or attached files. Internet
communications are not secure, therefore Fairfax does not accept legal
responsibility for the contents of this message or attached files.


--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Maximum process ID

2004-10-15 Thread Glen Turner
Robert Collins wrote:
On Fri, 2004-10-15 at 15:33 +1000, Michael Kraus wrote:
I'm developing a database application that  uses the inserting processes
pid. Problem is that I'm wondering how big this pid should be?

sizeof(pid_t) IIRC. Its system specific.
Technically, PID is also signed since
  pid_t f;
  f = fork();
can return -1 on error.
Personally I'd go with a signed 32bit integer, since that is what
the GNU C library uses for pid_t. And its really the C library's
definition, rather than the kernel's, which counts.
Any kernel in it's right mind is going to avoid negative PIDs as
that isn't the user's expectation; I note the Amos' message saying
that the Linux kernel currently allows PID values 1 to 4,194,303.
--
 Glen Turner Tel: (08) 8303 3936 or +61 8 8303 3936
 Australia's Academic & Research Network  www.aarnet.edu.au
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] Case insensitive tab completetion not working

2004-10-15 Thread Mike MacCana
Haya folks,

I'd like tab completion to be case insensitive. I've added
set completion-ignore-case on
to my .inputrc.

And restarted a shell. I've made a directory 'TEst dir', and tried to
change into it by typing: 
cd te

But no luck. Any ideas?

Mike
 

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Scirpt Via browser Gives code=SERVER_RESPONSE_CLOSE !

2004-10-15 Thread Phil Scarratt
[EMAIL PROTECTED] wrote:
I think what he ment is that:
1. Access http://initiate-2-hour-process.cgi
This runs the script which writes to an HTML file and
returns an HTTP header with redirects the browser to another
URL. The script forks into the background so the parent returns
the HTTP redirect (if evrything startted fine) and the son runs
the long-term process whic writes to poll-the-html-file.html
2. The browser goes to the redirected URL:
http://poll-the-html-file.html
This is the file being generated by the 2 hour process child. Its
content can tell the browser to come back and re-fetch the file
every few seconds/minutes. In addition, it content might show progress
like time of last update and number of records processed so far and
such.
Does that make better sense?
Cheers,
--Amos
This is what i meant
Fil
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Scirpt Via browser Gives code=SERVER_RESPONSE_CLOSE !

2004-10-15 Thread amos
I think what he ment is that:
1. Access http://initiate-2-hour-process.cgi
This runs the script which writes to an HTML file and
returns an HTTP header with redirects the browser to another
URL. The script forks into the background so the parent returns
the HTTP redirect (if evrything startted fine) and the son runs
the long-term process whic writes to poll-the-html-file.html
2. The browser goes to the redirected URL:
http://poll-the-html-file.html
This is the file being generated by the 2 hour process child. Its
content can tell the browser to come back and re-fetch the file
every few seconds/minutes. In addition, it content might show progress
like time of last update and number of records processed so far and
such.
Does that make better sense?
Cheers,
--Amos
Louis wrote:
Hi Phil:
Thanks for the suggestion. I am looking at a way
to deal with this. But I want to see if I understood you here.
Source : The script that runs for 2-3 hrs;
Caller : Initiates Source, and polls every so and so
and update may be a progress window that the user sees.
So then to start off with, Caller starts off with an LWP
on Source. It sounds like with this approach Source has to
regularly send something back to Caller , and not wait till
the end (2 - 3 hrs).
But when u say polls the server every so and so what do u mean
here ?  The Caller if server is in Sussex mode does not know process
ids etc.. (not su here). Can you please clarify here ?
I will look further into this as well.
Thanks
Louis.
-Original Message-
From: Phil Scarratt [mailto:[EMAIL PROTECTED] 
Sent: Friday, 15 October 2004 16:37
To: Louis
Cc: [EMAIL PROTECTED]
Subject: Re: [SLUG] Scirpt Via browser Gives code=SERVER_RESPONSE_CLOSE
!

Louis wrote:
The script can be also be executed from the command line. It can take
anywhere
between 2 to 3 hrs to complete.
So does this mean that I cannot get it to run via browser ?
What about parsing the call via LWP ? If the browser times out would 
the
LWP
url called still run anyway ?

Louis.

Not sure if this is still an issue, but I doubt you'd get a web 
server/browser combination to control a script that runs for 2-3 hrs. 
What you'd be better of doing is something like modifying the script to 
output to a plain text file (for example) and then initiate it in the 
background from a web-based page. The returned page from the initiating 
page then polls the server every 5, 10, or whatever minutes to see if it

has finished and displays any results. Did that make any sense? Not sure
if this will do what you want
Fil

--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Maximum process ID

2004-10-15 Thread amos
On my 2.6.7 kernel (no tweaks to this value):
> cat /proc/sys/kernel/pid_max
32768
Since I'd expect databases to align such stuff to 32 bit
anyway, I think a 2^32 is a safe bet. And using this virtual
file will give you the correct answer for the current system.
Ref: proc(5):
/proc/sys/kernel/pid_max
This  file (new in Linux 2.5) specifies the value at which PIDs
wrap around (i.e., the value in this file is one  greater  than
the  maximum  PID).   The  default  value for this file, 32768,
results in the same range of PIDs as on earlier  kernels.   The
value  in  this  file  can  be  set  to  any  value  up to 2^22
(PID_MAX_LIMIT, approximately 4 million).
Cheers,
--Amos
Michael Kraus wrote:
G'day...
 
I'm developing a database application that  uses the inserting processes
pid. Problem is that I'm wondering how big this pid should be?
 
(OK, if I was a true guru, I'd know this magic number off the top of my
head...)
 
Is the maximum value of a pid on a UN*X system 65,535? (At least
generally speaking - I think on FreeBSD for example its at 30,000 by
default.)
 
I've been looking at a lot of web pages, but mostly they seem to deal
with the maximum number of concurrent processes. (Which is rather
defined by memory and sits at about 33,000 for modified Linux with an
average process -excluding the OS-being 30K, but only 4,090 unmodified.)
 
Regards,

 

Michael S. E. Kraus
Software Developer/Technical Support Specialist
Wild Technology Pty Ltd
[EMAIL PROTECTED]
Direct Line 02-8306-0007 


ABN 98 091 470 692
Level 4 Tiara, 306/9 Crystal Street, Waterloo NSW 2017, Australia
Telephone 1300-13-9453 |  Facsimile 1300-88-9453
http://www.wildtechnology.net http://www.wildtechnology.net/> 

The information contained in this email message and any attachments may
be confidential information and may also be the subject of client legal
- legal professional privilege. If you are not the intended recipient,
any use, interference with, disclosure or copying of this material is
unauthorised and prohibited.   This email and any attachments are also
subject to copyright.  No part of them may be reproduced, adapted or
transmitted without the written permission of the copyright owner.  If
you have received this email in error, please immediately advise the
sender by return email and delete the message from your system.
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Maximum process ID

2004-10-15 Thread Robert Collins
On Fri, 2004-10-15 at 15:33 +1000, Michael Kraus wrote:
> G'day...
>  
> I'm developing a database application that  uses the inserting processes
> pid. Problem is that I'm wondering how big this pid should be?

sizeof(pid_t) IIRC. Its system specific.

FWIW, I just wouldn't do that.

Rob
 

-- 
GPG key available at: .


signature.asc
Description: This is a digitally signed message part
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Re: [SLUG] Update on SLUG Goonellabah roadtrip

2004-10-15 Thread Jan Schmidt

> The next Slug roadtrip up to Lismore was scheduled to occur on the 30th and 31st
> of this month. We'd managed to get a good group of people together for the
> roadtrip, and all seemed to be set.

We've got a few definites keen on making the trip, but not enough to make
the trip worth it. If you would like to go, then let me know. We should be
able to organise accomodation with the GLUGgers, so all you should need is a
sleeping bag. At this stage, I'm thinking of driving, so travel costs will
just be time, petrol, and maybe a driving shift if you're licensed.

As I said, send me a mail if you'd like to be in our merry band. :)

> Unfortunately my treatment will be starting sometime around the meetup, and I
> don't believe that i'll be able to manage both treatment and getting up there,
> let alone give the five or so talks that I put myself up for. 

Good luck, Lindsay. I hope the treatment goes smoothly.

J.
-- 
Jan Schmidt  [EMAIL PROTECTED]

Pants Pants Pants Pants Pants Pants Pants Pants.
Lovely Pants, wonderful Pa-ants.
Lovely Pants, wonderful Pa-ants.
(Shut up! Bloody Vikings.)
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


RE: [SLUG] Scirpt Via browser Gives code=SERVER_RESPONSE_CLOSE !

2004-10-15 Thread Louis
Hi Phil:

Thanks for the suggestion. I am looking at a way
to deal with this. But I want to see if I understood you here.

Source : The script that runs for 2-3 hrs;
Caller : Initiates Source, and polls every so and so
and update may be a progress window that the user sees.

So then to start off with, Caller starts off with an LWP
on Source. It sounds like with this approach Source has to
regularly send something back to Caller , and not wait till
the end (2 - 3 hrs).

But when u say polls the server every so and so what do u mean
here ?  The Caller if server is in Sussex mode does not know process
ids etc.. (not su here). Can you please clarify here ?

I will look further into this as well.

Thanks

Louis.

-Original Message-
From: Phil Scarratt [mailto:[EMAIL PROTECTED] 
Sent: Friday, 15 October 2004 16:37
To: Louis
Cc: [EMAIL PROTECTED]
Subject: Re: [SLUG] Scirpt Via browser Gives code=SERVER_RESPONSE_CLOSE
!


Louis wrote:
> The script can be also be executed from the command line. It can take
> anywhere
> between 2 to 3 hrs to complete.
>  
> So does this mean that I cannot get it to run via browser ?
>  
> What about parsing the call via LWP ? If the browser times out would 
> the
> LWP
> url called still run anyway ?
>  
> Louis.
> 

Not sure if this is still an issue, but I doubt you'd get a web 
server/browser combination to control a script that runs for 2-3 hrs. 
What you'd be better of doing is something like modifying the script to 
output to a plain text file (for example) and then initiate it in the 
background from a web-based page. The returned page from the initiating 
page then polls the server every 5, 10, or whatever minutes to see if it

has finished and displays any results. Did that make any sense? Not sure

if this will do what you want


Fil


-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Maximum process ID

2004-10-15 Thread Mike K
G'day...

Thanks to Howard and Dave for their answers...! Greatly(!) appreciated.


On Fri, 2004-10-15 at 15:53, Dave Airlie wrote:
> #define PID_MAX_LIMIT (4*1024*1024)
> 
> so u32 is what you want to be safe..

Yep, and a u24 is just as safe I reckon... :)  (I.e. MEDIUMINT in
MySQL.)

Thanks heaps guys...

-Mike ... (now, to examine methods of Perl/Web Authentication
methods...)

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html