Build error on HP-UX
Rick Jones
rick.jones2 at hp.com
Fri Jun 20 06:13:22 EST 2003
Ben Lindstrom wrote:
>
> How does HP/UX define utimes?
Thusly on 11.0:
utimes(2)
utimes(2)
NAME
utimes - set file access and modification times
SYNOPSIS
#include <sys/time.h>
int utimes(const char *path, const struct timeval times[2]);
and then in sys/time.h:
# ifdef _PROTOTYPES
extern int getitimer(int, struct itimerval *);
extern int setitimer(int, const struct itimerval *, struct
itimerval *);
extern int utimes(const char *path, const struct timeval
amtimes[2]);
extern int gettimeofday(struct timeval *, void *);
# if defined(__INCLUDE_FROM_TIME_H) &&
!defined(_XOPEN_SOURCE_EXTENDED)
extern int select(size_t, int *, int *, int *, const struct
timeval *);
# else /* __INCLUDE_FROM_TIME_H && !_XOPEN_SOURCE_EXTENDED */
extern int select(int, fd_set *, fd_set *, fd_set *, struct
timeval *);
# endif /* __INCLUDE_FROM_TIME_H && !_XOPEN_SOURCE_EXTENDED */
# else /* !_PROTOTYPES */
> This is how most OSes define it:
>
> int utimes(char *filename, struct timeval *tvp);
>
> Outside the fact we skip variable names in the definition we do:
>
> bsd-misc.c:int utimes(char *filename, struct timeval *tvp)
> bsd-misc.h:int utimes(char *, struct timeval *);
>
> Try in the bsd-misc.h changing it to be exactly as it's defined in the
> bsd-misc.c. Maybe your compiler is picky.
Perhaps the use of const in the UX headers is the trigger for this?
If there is a utimes on the platform, should that bsd-misc.[ch] stuff
even be included? Or does the configure script for ssh consider utimes
broken under HP-UX?
The compiler (at least my rev) doesn't mind the omission of the variable
name:
$ cat foo.h
int utimes(char *, int *);
$ cat foo.c
#include "foo.h"
int utimes(char *filename, int *tvp) {
}
main(int argc,char *argv[]) {
}
(I dropped the timeval stuff initially to avoid having to include more)
However, when I then add-back the struct timeval, and include
sys/time.h:
$ cat foo.c
#include <sys/time.h>
#include "foo.h"
int utimes(char *filename, struct timeval *tvp) {
}
main(int argc,char *argv[]) {
}
I get:
$ cc foo.c
cc: "foo.h", line 1: error 1711: Inconsistent parameter list declaration
for "utimes".
cc: "foo.c", line 3: error 1711: Inconsistent parameter list declaration
for "utimes".
and then if I add const:
$ cat foo.h
int utimes(const char *, const struct timeval *);
$ cat foo.c
#include <sys/time.h>
#include "foo.h"
int utimes(const char *filename, const struct timeval *tvp) {
}
main(int argc,char *argv[]) {
}
the compiler is happy:
$ cc foo.c
/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (foo.o) was
detected. The linked output may not run on a PA 1.x system.
rick jones
--
Wisdom Teeth are impacted, people are affected by the effects of events.
these opinions are mine, all mine; HP might not want them anyway... :)
feel free to post, OR email to raj in cup.hp.com but NOT BOTH...
More information about the openssh-unix-dev
mailing list