Received: (from majordom@localhost) by hyperreal.com (8.8.4/8.8.4) id PAA22889; Sat, 19 Apr 1997 15:50:38 -0700 (PDT) Received: from twinlark.arctic.org (twinlark.arctic.org [204.62.130.91]) by hyperreal.com (8.8.4/8.8.4) with SMTP id PAA22882 for ; Sat, 19 Apr 1997 15:50:35 -0700 (PDT) Received: (qmail 2885 invoked by uid 500); 19 Apr 1997 22:50:34 -0000 Date: Sat, 19 Apr 1997 15:50:33 -0700 (PDT) From: Dean Gaudet To: new-httpd@apache.org Subject: Re: [PATCH] PR#344: 64-bit cleanups (take 2) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org Yeah you're right, it is a bit worrisome. How about this one which defines PTR_INT to be long on OSF and whenever __alpha__ is defined, otherwise defines it to be int. This shouldn't change behaviour on anything except 64-bit systems. ANSI does define ptrdiff_t which could be used for this, but that's likely to be about as portable as trying to grok the values in limits.h to automatically decide this. Dean Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache/src/CHANGES,v retrieving revision 1.237 diff -c -3 -r1.237 CHANGES *** CHANGES 1997/04/18 02:56:13 1.237 --- CHANGES 1997/04/19 22:47:50 *************** *** 1,5 **** --- 1,9 ---- Changes with Apache 1.2 + *) Cleanup pointer/int casting on 64-bit architectures. Define PTR_INT + to be long on 64-bit machines. + [Uwe F. Mayer, Dean Gaudet] PR#344 + *) Fixed SIGSEGV problem when a DirectoryIndex file is also the source of an external redirection. [Roy Fielding and Paul Sutton] Index: PORTING =================================================================== RCS file: /export/home/cvs/apache/src/PORTING,v retrieving revision 1.4 diff -c -3 -r1.4 PORTING *** PORTING 1997/02/25 21:04:42 1.4 --- PORTING 1997/04/19 22:47:50 *************** *** 239,244 **** --- 239,249 ---- Amount to move sbrk() breakpoint, if required, before attaching shared-memory segment. + PTR_INT: + Either long or int, to deal with (void*) and (int) casting of + pointers and integers on 64-bit architectures. This should be + long on 64-bit machines and int otherwise. + ----------- Conclusion: ----------- Index: alloc.c =================================================================== RCS file: /export/home/cvs/apache/src/alloc.c,v retrieving revision 1.26 diff -c -3 -r1.26 alloc.c *** alloc.c 1997/04/07 10:58:38 1.26 --- alloc.c 1997/04/19 22:47:50 *************** *** 778,793 **** * generic cleanup interface. */ ! static void fd_cleanup (void *fdv) { close ((int)fdv); } ! void note_cleanups_for_fd (pool *p, int fd) { ! register_cleanup (p, (void *)fd, fd_cleanup, fd_cleanup); } ! void kill_cleanups_for_fd(pool *p,int fd) ! { kill_cleanup(p,(void *)fd,fd_cleanup); ! } int popenf(pool *a, const char *name, int flg, int mode) { --- 778,797 ---- * generic cleanup interface. */ ! static void fd_cleanup (void *fdv) ! { ! close ((ptr_int)fdv); ! } ! void note_cleanups_for_fd (pool *p, ptr_int fd) ! { ! register_cleanup (p, (void *)fd, fd_cleanup, fd_cleanup); } ! void kill_cleanups_for_fd(pool *p, ptr_int fd) ! { kill_cleanup(p,(void *)fd,fd_cleanup); ! } int popenf(pool *a, const char *name, int flg, int mode) { *************** *** 803,809 **** return fd; } ! int pclosef(pool *a, int fd) { int res; int save_errno; --- 807,813 ---- return fd; } ! int pclosef(pool *a, ptr_int fd) { int res; int save_errno; Index: alloc.h =================================================================== RCS file: /export/home/cvs/apache/src/alloc.h,v retrieving revision 1.18 diff -c -3 -r1.18 alloc.h *** alloc.h 1997/04/07 10:58:38 1.18 --- alloc.h 1997/04/19 22:47:50 *************** *** 207,214 **** int popenf(struct pool *, const char *name, int flg, int mode); void note_cleanups_for_file (pool *, FILE *); ! void note_cleanups_for_fd (pool *, int); ! void kill_cleanups_for_fd (pool *p, int fd); regex_t *pregcomp(pool *p, const char *pattern, int cflags); --- 207,214 ---- int popenf(struct pool *, const char *name, int flg, int mode); void note_cleanups_for_file (pool *, FILE *); ! void note_cleanups_for_fd (pool *, ptr_int); ! void kill_cleanups_for_fd (pool *p, ptr_int fd); regex_t *pregcomp(pool *p, const char *pattern, int cflags); *************** *** 217,223 **** */ int pfclose(struct pool *, FILE *); ! int pclosef(struct pool *, int fd); /* ... even child processes (which we may want to wait for, * or to kill outright, on unexpected termination). --- 217,223 ---- */ int pfclose(struct pool *, FILE *); ! int pclosef(struct pool *, ptr_int fd); /* ... even child processes (which we may want to wait for, * or to kill outright, on unexpected termination). Index: conf.h =================================================================== RCS file: /export/home/cvs/apache/src/conf.h,v retrieving revision 1.93 diff -c -3 -r1.93 conf.h *** conf.h 1997/04/15 20:00:21 1.93 --- conf.h 1997/04/19 22:47:50 *************** *** 175,180 **** --- 175,181 ---- #define HAVE_MMAP #define HAVE_CRYPT_H #define NO_LONG_DOUBLE + #define PTR_INT long #elif defined(PARAGON) #define HAVE_GMTOFF *************** *** 551,556 **** --- 552,566 ---- int ap_snprintf(char *buf, size_t len, const char *format,...); int ap_vsnprintf(char *buf, size_t len, const char *format, va_list ap); #endif + + #ifndef PTR_INT + #if defined( __alpha__ ) + #define PTR_INT long + #else + #define PTR_INT int + #endif + #endif + typedef PTR_INT ptr_int; #if !defined(NEXT) && !defined(CONVEXOS) #include Index: http_config.c =================================================================== RCS file: /export/home/cvs/apache/src/http_config.c,v retrieving revision 1.48 diff -c -3 -r1.48 http_config.c *** http_config.c 1997/04/12 04:24:56 1.48 --- http_config.c 1997/04/19 22:47:51 *************** *** 702,708 **** { /* This one's pretty generic... */ ! int offset = (int)cmd->info; *(char **)(struct_ptr + offset) = pstrdup (cmd->pool, arg); return NULL; } --- 702,708 ---- { /* This one's pretty generic... */ ! ptr_int offset = (ptr_int)cmd->info; *(char **)(struct_ptr + offset) = pstrdup (cmd->pool, arg); return NULL; } *************** *** 711,717 **** { /* This one's pretty generic too... */ ! int offset = (int)cmd->info; *(int *)(struct_ptr + offset) = arg ? 1 : 0; return NULL; } --- 711,717 ---- { /* This one's pretty generic too... */ ! ptr_int offset = (ptr_int)cmd->info; *(int *)(struct_ptr + offset) = arg ? 1 : 0; return NULL; } Index: http_core.c =================================================================== RCS file: /export/home/cvs/apache/src/http_core.c,v retrieving revision 1.77 diff -c -3 -r1.77 http_core.c *** http_core.c 1997/04/12 04:24:56 1.77 --- http_core.c 1997/04/19 22:47:51 *************** *** 843,849 **** { /* This one's pretty generic... */ ! int offset = (int)cmd->info; char *struct_ptr = (char *)cmd->server; *(char **)(struct_ptr + offset) = pstrdup (cmd->pool, arg); --- 843,849 ---- { /* This one's pretty generic... */ ! ptr_int offset = (ptr_int)cmd->info; char *struct_ptr = (char *)cmd->server; *(char **)(struct_ptr + offset) = pstrdup (cmd->pool, arg); Index: mod_alias.c =================================================================== RCS file: /export/home/cvs/apache/src/mod_alias.c,v retrieving revision 1.15 diff -c -3 -r1.15 mod_alias.c *** mod_alias.c 1997/04/14 01:09:13 1.15 --- mod_alias.c 1997/04/19 22:47:52 *************** *** 137,143 **** server_rec *s = cmd->server; alias_server_conf *serverconf = (alias_server_conf *)get_module_config(s->module_config,&alias_module); ! int status = (int)cmd->info; char *f = arg2; char *url = arg3; --- 137,143 ---- server_rec *s = cmd->server; alias_server_conf *serverconf = (alias_server_conf *)get_module_config(s->module_config,&alias_module); ! ptr_int status = (ptr_int)cmd->info; char *f = arg2; char *url = arg3; Index: mod_browser.c =================================================================== RCS file: /export/home/cvs/apache/src/mod_browser.c,v retrieving revision 1.8 diff -c -3 -r1.8 mod_browser.c *** mod_browser.c 1997/03/07 14:15:38 1.8 --- mod_browser.c 1997/04/19 22:47:52 *************** *** 98,104 **** get_module_config (cmd->server->module_config, &browser_module); browser_entry *new, *entries = (browser_entry *)sconf->browsers->elts; char *var; ! int i, cflags = (int)cmd->info; /* First, try to merge into an existing entry */ --- 98,105 ---- get_module_config (cmd->server->module_config, &browser_module); browser_entry *new, *entries = (browser_entry *)sconf->browsers->elts; char *var; ! int i; ! ptr_int cflags = (ptr_int)cmd->info; /* First, try to merge into an existing entry */ Index: mod_dir.c =================================================================== RCS file: /export/home/cvs/apache/src/mod_dir.c,v retrieving revision 1.25 diff -c -3 -r1.25 mod_dir.c *** mod_dir.c 1997/04/18 02:56:14 1.25 --- mod_dir.c 1997/04/19 22:47:52 *************** *** 175,181 **** const char *add_opts_int(cmd_parms *cmd, void *d, int opts) { ! push_item(((dir_config_rec *)d)->opts_list, (char*)opts, NULL, cmd->path, NULL); return NULL; } --- 175,181 ---- const char *add_opts_int(cmd_parms *cmd, void *d, int opts) { ! push_item(((dir_config_rec *)d)->opts_list, (char*)(ptr_int)opts, NULL, cmd->path, NULL); return NULL; } *************** *** 382,388 **** return 0; } ! int find_opts(dir_config_rec *d, request_rec *r) { char *path = r->filename; array_header *list = d->opts_list; struct item *items = (struct item *)list->elts; --- 382,388 ---- return 0; } ! ptr_int find_opts(dir_config_rec *d, request_rec *r) { char *path = r->filename; array_header *list = d->opts_list; struct item *items = (struct item *)list->elts; *************** *** 392,398 **** struct item *p = &items[i]; if(!strcmp_match(path,p->apply_path)) ! return (int)p->type; } return 0; } --- 392,398 ---- struct item *p = &items[i]; if(!strcmp_match(path,p->apply_path)) ! return (ptr_int)p->type; } return 0; }