[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [] Adding code for fork/vfork?

From: Bob Friesenhahn
Subject: Re: [] Adding code for fork/vfork?
Date: Sat, 16 Apr 2011 09:27:37 -0500 (CDT)
User-agent: Alpine 2.01 (GSO 1266 2009-07-14)

On Sat, 16 Apr 2011, Gilles wrote:

On Sat, 16 Apr 2011 02:31:56 -0700, Harlan Stenn <address@hidden>
A quick hack (and it may not work well) would be to detect these
systems, and stuff in something that effectively does '#define fork

What I'd like, is to learn how to modify the linker so that it
displays a warning instead of an error, like it used to.

Does someone know how to do this?

What you are looking to do ultimately has nothing to do with autoconf. Autoconf is all about configuration prior to compilation of the application software. It has nothing to do with link-time or run-time configuration.

An alternate approach you could use is to use dlopen(0,RTLD_NOLOAD) and then dlsym() to see if the "fork" symbol is available at run time to the running program. If it is available, then use it. This avoids directly linking against fork().

Here is some completely untested code which might even compile:

#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <link.h>

int my_fork_func(void)
  void *dl_handle;
  pid_t (*fork_f)(void);
  int status=-1;

  if (dl_handle)
      if !(fork_f)
      if (fork_f)
      (void) dlclose(dl_handle);
  return status;

Bob Friesenhahn
GraphicsMagick Maintainer,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]