delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/10/27/03:04:59

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=UhEcDeruxs4L72EdMf2T9OZP7+dxt8Xlulo28PQhKq1
a71EaNDOOwbY1+qb620v2cMOvoPhK+rTE3SadXXoK2f7H0vpP6jZ/b7Np6EJPw3A
Ai6tgfnrbEFgU0DiYiL54ultg9dtaHlLLgfWkLL3X9dCuuwbG3HOkes/o8F/rJYQ
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=MT1yCe6+4WcM13ikQFrJNRugdmw=; b=OxW1IFD1zcNhJpHvI
FlXTxY8HdE/s91jSVKpoVb5mz/1ROYwf3KnrUDxdrsM/QXshvil4qaEKF+RSJjYm
rL0BkT49ZzSbGHdgCz0DnuxdNmo+7/j9os0v6ACPyDB+kqGdQeCs0B+1Wf5LIUyE
gJ7bKQGrEIPr2sepVFftTJNIwA=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-pb0-f52.google.com
X-Received: by 10.66.121.131 with SMTP id lk3mr19229369pab.61.1382857477739; Sun, 27 Oct 2013 00:04:37 -0700 (PDT)
Message-ID: <526CBB01.60407@users.sourceforge.net>
Date: Sun, 27 Oct 2013 02:04:33 -0500
From: "Yaakov (Cygwin/X)" <yselkowitz AT users DOT sourceforge DOT net>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Hooks do not work?
References: <81f61e1925b5d6639ac9ba6a64b80ae7 AT autistici DOT org>
In-Reply-To: <81f61e1925b5d6639ac9ba6a64b80ae7@autistici.org>

On 2013-10-26 01:32, niXman wrote:
> I try to create the hooks for open()/fopen().
>
> hook code:
> #include <stdio.h>

#ifdef __CYGWIN__
#include <sys/cygwin.h>
#endif

> int open(const char *fname, int mode, ...) {
>      printf("fname=%s\n", fname);
> }
>
> FILE* fopen(const char *fname, const char *mode) {
>      printf("fname=%s\n", fname);
> }

#ifdef __CYGWIN__
__attribute__((constructor))
void _init(void)
{
   cygwin_internal(CW_HOOK, "open", open);
   cygwin_internal(CW_HOOK, "fopen", fopen);
}
#endif

HTH,


Yaakov


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019