On Feb 19 14:25, Christian Franke via Cygwin wrote: > Hi Corinna, > > Corinna Vinschen via Cygwin wrote: > > Hi Christian, > > > > On Feb 19 11:14, Christian Franke via Cygwin wrote: > > > Testcase: > > > > > > $ uname -r > > > 3.6.0-0.375.ged18acfe8c76.x86_64 > > > > > > $ cygcheck -f /usr/include/bsd/unistd.h > > > libbsd-devel-0.11.7-3 > > > > > > $ cat spt.c > > > #include <unistd.h> > > > > > > int main(int argc, char **argv, char **envp) > > > { > > > initsetproctitle(argc, argv, envp); > > > setproctitle("argc = %d", argc); > > > sleep(2); > > > return 0; > > > } > > > > > > $ gcc -o spt-bsdovl -isystem /usr/include/bsd -DLIBBSD_OVERLAY spt.c -l > > > bsd > > > > > > $ gcc -o spt-bsd spt.c -l bsd > > > > > > $ gcc -o spt-nobsd spt.c > > > > > > $ ./spt-bsdovl > > > spt-bsdovl: setproctitle not initialized, please either call > > > setproctitle_init() or link against libbsd-ctor. > > > > > > $ ./spt-bsd > > > spt-bsd: setproctitle not initialized, please either call > > > setproctitle_init() or link against libbsd-ctor. > > > > > > $ ./spt-nobsd & procps -o pid,args -p $! > > > [1] 2750 > > > PID COMMAND > > > 2750 spt-nobsd: argc = 1 > > The problem the Cygwin patch was supposed to fix is that the libbsd > > version of setproctitle just doesn't work correctly on Cygwin: > > > > $ uname -r > > 3.5.7-1.x86_64 > > $ ./spt-bsdovl & procps -o pid,args -p $! > > [1] 140 > > PID COMMAND > > 140 spt-bsdovl: > > > > The way the include file /usr/include/bsd/unistd.h is designed, > > we could make sure the libbsd version is used, by tweaking > > /usr/include/sys/unistd.h: > > > > diff --git a/newlib/libc/include/sys/unistd.h > > b/newlib/libc/include/sys/unistd.h > > index e62e38d10ccf..732356d6a14e 100644 > > --- a/newlib/libc/include/sys/unistd.h > > +++ b/newlib/libc/include/sys/unistd.h > > @@ -212,7 +212,7 @@ int setpgid (pid_t __pid, pid_t __pgid); > > #if __SVID_VISIBLE || __XSI_VISIBLE >= 500 > > int setpgrp (void); > > #endif > > -#if defined(__CYGWIN__) && __BSD_VISIBLE > > +#if defined(__CYGWIN__) && __BSD_VISIBLE && !defined(LIBBSD_OVERLAY) > > /* Stub for Linux libbsd compatibility. */ > > #define initsetproctitle(c, a, e) setproctitle_init((c), (a), (e)) > > static inline void setproctitle_init (int, char *[], char *[]) {} > > > > But that still allows to link against a non-working setproctitle. > > Yes, and it won't work if bsd/unistd.h is included without LIBBSD_OVERLAY > which is discouraged but still documented on libbsd(7). > > > > So I think we rather shouldn't supply the libbsd version of > > setproctitle_init/setproctitle anymore, as soon as cygwin 3.6.0 is > > released. > > > > What do you think? > > Makes sense. But then existing programs already using the functions from > cygbsd-0.dll would no longer start. Perhaps keep the symbols in the DLL only > for some time?
Sure! The new version will just disable the header definitions but still export the symbols for backward compat. Thanks, Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple