You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Henri Gomez <he...@gmail.com> on 2007/03/29 15:43:44 UTC
mktemp didn't exist on i5
While rebuild trunk from mod_jk I got an error on iSeries about
missing mktemp in iSeries.
if (!jk_shmem.lockname) {
if (shm_lock_reopen) {
int i;
jk_shmem.fd_lock = -1;
mode_t mask = umask(0);
for (i = 0; i < 8; i++) {
strcpy(flkname, "/tmp/jkshmlock.XXXXXX");
if (mktemp(flkname)) {
jk_shmem.fd_lock = open(flkname,
O_RDWR|O_CREAT|O_TRUNC, 0666);
if (jk_shmem.fd_lock >= 0)
break;
}
}
umask(mask);
}
How could we avoid this call ?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: mktemp didn't exist on i5
Posted by Ian Darwin <ia...@darwinsys.com>.
Henri Gomez wrote:
> Well I5, also known as iSeries or AS/400, run on i5/OS which is not
> Unix but IBM proprietary (called OS/400 previously)
Oh well, it's been broken longer :-) I stand by my suggestion on how
to fix it.
Ian
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: mktemp didn't exist on i5
Posted by Henri Gomez <he...@gmail.com>.
Well I5, also known as iSeries or AS/400, run on i5/OS which is not
Unix but IBM proprietary (called OS/400 previously)
2007/3/29, Ian Darwin <ia...@darwinsys.com>:
> Henri Gomez wrote:
> > While rebuild trunk from mod_jk I got an error on iSeries about
> > missing mktemp in iSeries.
> >
> > if (!jk_shmem.lockname) {
> > if (shm_lock_reopen) {
> > int i;
> > jk_shmem.fd_lock = -1;
> > mode_t mask = umask(0);
> > for (i = 0; i < 8; i++) {
> > strcpy(flkname, "/tmp/jkshmlock.XXXXXX");
> > if (mktemp(flkname)) {
> > jk_shmem.fd_lock = open(flkname,
> > O_RDWR|O_CREAT|O_TRUNC, 0666);
> > if (jk_shmem.fd_lock >= 0)
> > break;
> > }
> > }
> > umask(mask);
> > }
> >
> >
> > How could we avoid this call ?
>
> Wrong question. mktemp has been in UNIX for a dog's age and in POSIX/SUS
> for a decade or more. See
> http://www.opengroup.org/onlinepubs/007908799/xsh/mktemp.html which is
> the 1997 version of the SUS.
>
> The general approach to making C programs portable to broken systems
> that are missing libraries is to provide a default version, usually
> wrapped in an #ifdef.
>
> IANA(ASF)L but we should be able to incorporate the mktemp
> implementation from anything BSD licensed, like OpenBSD, for this purpose.
>
> Ian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: mktemp didn't exist on i5
Posted by Ian Darwin <ia...@darwinsys.com>.
Henri Gomez wrote:
> While rebuild trunk from mod_jk I got an error on iSeries about
> missing mktemp in iSeries.
>
> if (!jk_shmem.lockname) {
> if (shm_lock_reopen) {
> int i;
> jk_shmem.fd_lock = -1;
> mode_t mask = umask(0);
> for (i = 0; i < 8; i++) {
> strcpy(flkname, "/tmp/jkshmlock.XXXXXX");
> if (mktemp(flkname)) {
> jk_shmem.fd_lock = open(flkname,
> O_RDWR|O_CREAT|O_TRUNC, 0666);
> if (jk_shmem.fd_lock >= 0)
> break;
> }
> }
> umask(mask);
> }
>
>
> How could we avoid this call ?
Wrong question. mktemp has been in UNIX for a dog's age and in POSIX/SUS
for a decade or more. See
http://www.opengroup.org/onlinepubs/007908799/xsh/mktemp.html which is
the 1997 version of the SUS.
The general approach to making C programs portable to broken systems
that are missing libraries is to provide a default version, usually
wrapped in an #ifdef.
IANA(ASF)L but we should be able to incorporate the mktemp
implementation from anything BSD licensed, like OpenBSD, for this purpose.
Ian
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: mktemp didn't exist on i5
Posted by Henri Gomez <he...@gmail.com>.
The JK_SHM_LOCK_REOPEN will be defined where ?
autoconf / jk_shm.h ?
2007/3/30, Mladen Turk <mt...@apache.org>:
> Henri Gomez wrote:
> > Good thanks
> >
>
> Check now. I put that inside #ifdef JK_SHM_LOCK_REOPEN,
> like before, but now, the entire code is compile
> time dependent instead just using a var.
>
>
> Regards,
> Mladen.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: mktemp didn't exist on i5
Posted by Mladen Turk <mt...@apache.org>.
Henri Gomez wrote:
> Good thanks
>
Check now. I put that inside #ifdef JK_SHM_LOCK_REOPEN,
like before, but now, the entire code is compile
time dependent instead just using a var.
Regards,
Mladen.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: mktemp didn't exist on i5
Posted by Jean-Frederic <jf...@gmail.com>.
On Thu, 2007-03-29 at 23:46 +0200, Henri Gomez wrote:
> Good thanks
I don't like mktemp():
+++
BUGS
Never use mktemp(). Some implementations follow 4.3BSD and
replace
XXXXXX by the current process ID and a single letter, so that
at most
26 different names can be returned. Since on the one hand the
names
are easy to guess, and on the other hand there is a race between
test-
ing whether the name exists and opening the file, every use of
mktemp()
is a security risk. The race is avoided by mkstemp(3).
+++
Why no changing it to mkstemp so that Henri could use the APR call?
Cheers
Jean-Frederic
>
> 2007/3/29, Mladen Turk <mt...@apache.org>:
> > Henri Gomez wrote:
> > > While rebuild trunk from mod_jk I got an error on iSeries about
> > > missing mktemp in iSeries.
> > >
> > > if (!jk_shmem.lockname) {
> >
> > #ifnedef WHATEVER
> >
> > > if (shm_lock_reopen) {
> > > int i;
> > > jk_shmem.fd_lock = -1;
> > > mode_t mask = umask(0);
> > > for (i = 0; i < 8; i++) {
> > > strcpy(flkname, "/tmp/jkshmlock.XXXXXX");
> > > if (mktemp(flkname)) {
> > > jk_shmem.fd_lock = open(flkname,
> > > O_RDWR|O_CREAT|O_TRUNC, 0666);
> > > if (jk_shmem.fd_lock >= 0)
> > > break;
> > > }
> > > }
> > > umask(mask);
> > > }
> > >
> >
> > #endif
> >
> >
> > The shm_lock_reopen is compile time anyhow.
> >
> > Regards,
> > Mladen
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: dev-help@tomcat.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: mktemp didn't exist on i5
Posted by Henri Gomez <he...@gmail.com>.
Good thanks
2007/3/29, Mladen Turk <mt...@apache.org>:
> Henri Gomez wrote:
> > While rebuild trunk from mod_jk I got an error on iSeries about
> > missing mktemp in iSeries.
> >
> > if (!jk_shmem.lockname) {
>
> #ifnedef WHATEVER
>
> > if (shm_lock_reopen) {
> > int i;
> > jk_shmem.fd_lock = -1;
> > mode_t mask = umask(0);
> > for (i = 0; i < 8; i++) {
> > strcpy(flkname, "/tmp/jkshmlock.XXXXXX");
> > if (mktemp(flkname)) {
> > jk_shmem.fd_lock = open(flkname,
> > O_RDWR|O_CREAT|O_TRUNC, 0666);
> > if (jk_shmem.fd_lock >= 0)
> > break;
> > }
> > }
> > umask(mask);
> > }
> >
>
> #endif
>
>
> The shm_lock_reopen is compile time anyhow.
>
> Regards,
> Mladen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: mktemp didn't exist on i5
Posted by Mladen Turk <mt...@apache.org>.
Henri Gomez wrote:
> While rebuild trunk from mod_jk I got an error on iSeries about
> missing mktemp in iSeries.
>
> if (!jk_shmem.lockname) {
#ifnedef WHATEVER
> if (shm_lock_reopen) {
> int i;
> jk_shmem.fd_lock = -1;
> mode_t mask = umask(0);
> for (i = 0; i < 8; i++) {
> strcpy(flkname, "/tmp/jkshmlock.XXXXXX");
> if (mktemp(flkname)) {
> jk_shmem.fd_lock = open(flkname,
> O_RDWR|O_CREAT|O_TRUNC, 0666);
> if (jk_shmem.fd_lock >= 0)
> break;
> }
> }
> umask(mask);
> }
>
#endif
The shm_lock_reopen is compile time anyhow.
Regards,
Mladen
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org