1 /* abandon.c - shell backend abandon function */
4 * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
12 #include <ac/socket.h>
13 #include <ac/string.h>
26 struct shellinfo *si = (struct shellinfo *) be->be_private;
31 /* no abandon command defined - just kill the process handling it */
32 if ( si->si_abandon == NULL ) {
33 ldap_pvt_thread_mutex_lock( &conn->c_mutex );
35 LDAP_STAILQ_FOREACH( o, &conn->c_ops, o_next ) {
36 if ( o->o_msgid == msgid ) {
37 pid = (pid_t) o->o_private;
42 LDAP_STAILQ_FOREACH( o, &conn->c_pending_ops, o_next ) {
43 if ( o->o_msgid == msgid ) {
44 pid = (pid_t) o->o_private;
49 ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
52 Debug( LDAP_DEBUG_ARGS, "shell killing pid %d\n",
56 Debug( LDAP_DEBUG_ARGS, "shell could not find op %d\n",
62 if ( forkandexec( si->si_abandon, &rfp, &wfp ) == -1 ) {
66 /* write out the request to the abandon process */
67 fprintf( wfp, "ABANDON\n" );
68 fprintf( wfp, "msgid: %d\n", msgid );
69 print_suffixes( wfp, be );
72 /* no result from abandon */