Re: Graal and Tomcat Native

2019-07-22 Thread Giorgio Zoppi
Just a comment the function choosenum is not safe, the rand() is not a good
PRG, i would use if it is possible arc4random in bsd/linux.
Best Regards,
Giorgio.

El lun., 22 jul. 2019 a las 9:12, jean-frederic clere ()
escribió:

> On 18/07/2019 11:05, Rainer Jung wrote:
> > Hi Jean-Frederic and Rémy,
> >
> > I do not have a real answer, but a workaround. It is possible to get the
> > same result without any printf style functions or atoi, just by doing
> > arithmetics. But: maybe then the crash simply moves to another position.
>
> That is what happened, I have now:
> +++
> Thread 20 "apr-8443-exec-2" received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7fffaf7fe700 (LWP 11074)]
> 0x0169aa0d in free ()
> Missing separate debuginfos, use: dnf debuginfo-install
> sssd-client-2.2.0-3.fc30.x86_64 zlib-1.2.11-15.fc30.x86_64
> (gdb) bt
> #0  0x0169aa0d in free ()
> #1  0x016956cd in _dlerror_run ()
> #2  0x0169528d in __dlsym ()
> +++
>
> >
> > In src/ssl.c you can use:
> >
> > static int ssl_rand_choosenum(int l, int h)
> > {
> > double dbl;
> > int i;
> >
> > dbl = 1.0 * (rand() % RAND_MAX) * (h - l);
> > i = (dbl / RAND_MAX + 0.5) + 1;
> > if (i < l) i = l;
> > if (i > h) i = h;
> > return i;
> > }
> >
> > This will also be much faster.
>
> Cool, Please commit the improvement ;-)
>
> >
> > I tested the formula against the original one for each value of l and h
> > Note, that currently the function is always called with l==0 and h==127!
> > So you could also drop the h and l params and use fixed values, but of
> > course would loose future flexibility.
> >
> > between 0 and 499 (and h>=l) and for each seed between 0 and 499 on twi
> > different architectures (Linux 64 Bit on x64 and Solaris Sparc 32 Bit).
> > You can run the following test program to convince yourself about the
> > formula correctness on your platform:
> >
> > #include 
> > #include 
> >
> > #define MAX_SEED 500
> > #define MAX_BOUNDARY 500
> > #define FEEDBACK 10
> >
> > int main ()
> > {
> > int seed;
> > int l;
> > int h;
> > int i1;
> > int i2;
> > int rand_orig;
> > int rand_reduced;
> > double rand_normalized;
> > double rand_prod;
> > char buf[50];
> > long count = 0;
> >
> > fprintf(stdout, "RAND_MAX is %d\n", RAND_MAX);
> > fprintf(stdout, "Number of tests to run: %ld\n",
> > 1L*MAX_BOUNDARY*MAX_BOUNDARY/2*MAX_SEED);
> > fprintf(stdout, "Feedback dot every %d tests\n", FEEDBACK);
> > fprintf(stdout, "Expect %d feedback dots\n",
> > 1L*MAX_BOUNDARY*MAX_BOUNDARY/2*MAX_SEED / FEEDBACK);
> >
> > fprintf(stdout,
> > "l\th\tseed\trand\tred\tnorm\torig\tnew\tprod\tround\n");
> > fflush(stdout);
> >
> > for (seed = 0; seed < MAX_SEED; seed++) {
> > srand(seed);
> > for (l = 0; l < MAX_BOUNDARY; l++) {
> > for (h = l; h < MAX_BOUNDARY; h++) {
> > rand_orig = rand();
> > rand_reduced = rand_orig % RAND_MAX;
> >
> > rand_normalized = ((double)rand_reduced / RAND_MAX) * (h
> > - l);
> > /* %.0f does rounding */
> > sprintf(buf, "%.0f", rand_normalized);
> > i1 = atoi(buf) + 1;
> > if (i1 < l) i1 = l;
> > if (i1 > h) i1 = h;
> >
> > rand_prod = 1.0 * rand_reduced * (h - l);
> > i2 = (rand_prod / RAND_MAX + 0.5) + 1;
> > if (i2 < l) i2 = l;
> > if (i2 > h) i2 = h;
> >
> > if (i1 != i2) {
> > fprintf(stdout,
> "%d\t%d\t%d\t%d\t%d\t%f\t%d\t%d\t%f\n",
> > l, h, seed, rand_orig, rand_reduced,
> > rand_normalized,
> > i1, i2, rand_prod);
> > }
> > count++;
> > if (count % FEEDBACK == 0) {
> > fprintf(stderr, ".");
> > fflush(stderr);
> > }
> > }
> > }
> > }
> > }
> >
> > Regards,
> >
> > Rainer
> >
> > Am 18.07.2019 um 08:57 schrieb jean-frederic clere:
> >> On 12/07/2019 11:21, Rémy Maucherat wrote:
> >>> On Thu, Jul 11, 2019 at 11:01 PM Rainer Jung  >>> > wrote:
> >>>
> >>>  Am 11.07.2019 um 22:10 schrieb Rémy Maucherat:
> >>>  > On Thu, Jul 11, 2019 at 8:42 PM Rainer Jung
> >>>  mailto:rainer.j...@kippdata.de>
> >>>  >  >>> >>
> >>>  wrote:
> >>>  >
> >>>  > Hi Rémy,
> >>>  >
> >>>  > When one looks up the macros in native/include/tcn.h, this
> >>> boils
> >>>  > down to
> >>>  > the following returning null:
> >>>  >
> >>>  > (*env)->FindClass(env, "org/apache/tomcat/jni/FileInfo")
> >>>  >
> >>>  > So our own FileInfo class can not be found. FindClass docs
> >>>  indicate its
> >>> 

Re: [VOTE-RESTARTED] Release Apache Tomcat Native 1.2.4

2016-01-11 Thread Giorgio Zoppi
Jean,
trying to move to CMake for making portable?

2016-01-08 10:13 GMT+01:00 jean-frederic clere :

> On 01/06/2016 08:45 PM, Mark Thomas wrote:
> > On 06/01/2016 19:34, Rainer Jung wrote:
> >> Hi Mark,
> >>
> >> there's no file bin/openssl.exe in the Windows binariy zip files.
> >>
> >> It existed in 1.2.3 but was also missing for 1.2.2. It also exists in
> >> 1.2.0 and 1.2.1 as well as 1.1.33 and 1.1.34. So I guess it should be
> >> included for 1.2.4 as well?
> >
> > I think that is an artefact of how I built the release. I should update
> > the scripts to take a copy of the openssl.exe.
> >
> > I'm not particularly concerned. I could copy it across from 1.2.3 if
> > people think it is essential.
>
> It is probably better to have it as building on windows is a challenge
> for a lot of people.
>
> Cheers
>
> Jean-Frederic
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


-- 
Quiero ser el rayo de sol que cada día te despierta
para hacerte respirar y vivir en me.
"Favola -Moda".


Re: [Tomcat Wiki] Update of TomcatGridDesign by theimpaler

2015-06-22 Thread Giorgio Zoppi
Hello all,
it is my first post. Interested in the community. Looks like too complex.
Which is the rational of tomcat grid? which uses cases should it cover?
Best Regards,
Giorgio

2015-06-21 18:21 GMT+02:00 Apache Wiki wikidi...@apache.org:

 Dear Wiki user,

 You have subscribed to a wiki page or wiki category on Tomcat Wiki for
 change notification.

 The TomcatGridDesign page has been changed by theimpaler:
 https://wiki.apache.org/tomcat/TomcatGridDesign?action=diffrev1=1rev2=2


   Considering the profiles are usually shared between instances (the
 customer facing profiles are probably identical for all customer facing
 instances), they are defined only once. Each instance references them, so
 they can be easily tuned on a single place instead of being copied all over
 the place.

 - {{{
 + {{{#!python
   ?xml version=1.0?

   !DOCTYPE tomcat-grid SYSTEM 
 http://tomcat.apache.org/tomcat/grid/grid.dtd;
 @@ -365, +365 @@

   === Agent configuration file ===
   The Agent configuration file contains minimal information needed to
 identify the local configuration from the general grid configuration file.

 - {{{
 + {{{#!python
   ?xml version=1.0?

   !DOCTYPE tomcat-grid-agent SYSTEM 
 http://tomcat.apache.org/tomcat/grid/agent.dtd;

 -
 To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: dev-h...@tomcat.apache.org




-- 
Quiero ser el rayo de sol que cada día te despierta
para hacerte respirar y vivir en me.
Favola -Moda.