Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fallback functions request #5

Open
kinichiro opened this issue Jan 19, 2015 · 4 comments
Open

fallback functions request #5

kinichiro opened this issue Jan 19, 2015 · 4 comments

Comments

@kinichiro
Copy link
Contributor

Hi,
I would like to port openntpd to other than *bsd and linux.
And I found that fallback functions below are needed in hpux environment.

  • vsyslog() and prototype in stdarg.h [used in log.c]
  • getifaddrs(), freeifaddrs() and ifaddrs.h [used in server.c]
  • strsignal() and prototype in string.h [used in ntpd.c]
  • daemon() and prototype in unistd.h [used in ntpd.c]

Can you add these functions like compat/bsd-asprintf.c ?

Thanks.

@busterb
Copy link
Member

busterb commented Jul 18, 2015

daemon and getifaddrs are added now. strsignal probably needs to be written in an OS-dependent way - e.g. OpenBSD possibly has a different set of available signals than HP-UX, such as SIGINFO.

@pbhenson
Copy link
Contributor

daemon I'd expect to work as is, it's pretty simple (although you'll need to copy it to daemon_hpux.c and twiddle some autoconf), the getifaddrs works under S10 but I'm not sure if it will work under hpux, you'll need to try it (with the same caveat of copying it to getifaddrs_hpux.c and tweaking autoconf).

Here's a vsyslog for hpux:

https://github.com/vincentbernat/lldpd/blob/master/src/compat/vsyslog.c

It's under the ISC license which I believe is ok to pull in.

As far as strsignal, that's just cosmetic. For a first pass I'd just use 'unknown' on systems where it doesn't exist.

Could you try to get it to compile again with these updates and see what else is missing? I might be able to give you a hand if you can get me shell access to an hpux box.

@kinichiro
Copy link
Contributor Author

kinichiro commented Jul 20, 2015 via email

@kinichiro
Copy link
Contributor Author

Hi,

more details on compilation issues on hpux 11i 11.31
as far as I am able to write down, here.

adjfreq_hpux.c
Now, I just copied this from adjfreq_osx.c.

daemon_hpux.c
I copied this from daemon_solaris.c, and no compilation issue.

getifaddrs_hpux.c
This contains blank functions, now.
At first, I copied this from getifaddrs_solaris.c, and try to see.
But I got this compilation error, since HP-UX does not have sys/sockio.h ,
and is not define SIOCGLIFBRDADDR .

  CC       getifaddrs_hpux.lo
"getifaddrs_hpux.c", line 38: error #3696-D: cannot open source file
          "sys/sockio.h"
  #include 
                         ^
"getifaddrs_hpux.c", line 47: error #2070: incomplete type is not allowed
        struct lifnum lifn;
                      ^
"getifaddrs_hpux.c", line 48: error #2070: incomplete type is not allowed
        struct lifconf lifc;
                       ^
"getifaddrs_hpux.c", line 95: error #2136: struct "lifreq" has no field
          "lifr_name"
                slen = strlen(lifrp->lifr_name) + 1;
                                     ^
"getifaddrs_hpux.c", line 110: error #2070: incomplete type is not allowed
        len = addr->ss_family == AF_INET ? sizeof (struct sockaddr_in) :
                                                   ^
"getifaddrs_hpux.c", line 111: error #2070: incomplete type is not allowed
            sizeof (struct sockaddr_in6);
                    ^
"getifaddrs_hpux.c", line 126: error #2136: struct "lifreq" has no field
          "lifr_name"
                (void) strcpy(ifa->ifa_name = buf, lifrp->lifr_name);
                                                          ^
"getifaddrs_hpux.c", line 127: error #2136: struct "lifreq" has no field
          "lifr_name"
                slen = strlen(lifrp->lifr_name) + 1;
                                     ^
"getifaddrs_hpux.c", line 136: error #2136: struct "lifreq" has no field
          "lifr_addr"
                        ifa->ifa_addr = addrcpy(&lifrp->lifr_addr, &buf);
                                                        ^
"getifaddrs_hpux.c", line 140: error #2136: struct "lifreq" has no field
          "lifr_addr"
                        ifa->ifa_netmask = addrcpy(&lifrp->lifr_addr, &buf);
                                                           ^
"getifaddrs_hpux.c", line 146: error #2136: struct "lifreq" has no field
          "lifr_dstaddr"
                                    addrcpy(&lifrp->lifr_dstaddr, &buf);
                                                    ^
"getifaddrs_hpux.c", line 148: error #2020: identifier "SIOCGLIFBRDADDR" is
          undefined
                        if (ioctl(fd, SIOCGLIFBRDADDR, lifrp) == -1)
                                      ^
"getifaddrs_hpux.c", line 152: error #2136: struct "lifreq" has no field
          "lifr_broadaddr"
                                    addrcpy(&lifrp->lifr_broadaddr, &buf);
                                                    ^
"getifaddrs_hpux.c", line 192: error #2070: incomplete type is not allowed
        ifa = malloc(nbytes(ifr4, nif4, sizeof (struct sockaddr_in)) +
                                                ^
"getifaddrs_hpux.c", line 193: error #2070: incomplete type is not allowed
            nbytes(ifr6, nif6, sizeof (struct sockaddr_in6)));
                                       ^
15 errors detected in the compilation of "getifaddrs_hpux.c".
*** Error exit code 1

compat/setproctitle.c
issue kinichiro#1
removing #include <stdio.h> solves this.

src/client.c
issue kinichiro#2
adding #include <netinet/in_systm.h> to src/ntpd.h solves this.

vsyslog.c
vsyslog.c you mentioned above seems ok,
but removing compat.h and including stdio.h seems to be needed.

strsignal()
HP-UX does not have this function.

src/util.c
CLOCK_MONOTONIC is not defined and not implemented on HP-UX.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants