From owner-freebsd-alpha@FreeBSD.ORG Tue Jul 29 15:18:53 2003 Return-Path: Delivered-To: freebsd-alpha@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1D41C37B401 for ; Tue, 29 Jul 2003 15:18:53 -0700 (PDT) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.88]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9F2ED43F3F for ; Tue, 29 Jul 2003 15:18:52 -0700 (PDT) (envelope-from rsato@mac.com) Received: from webmail01.mac.com (webmail01-en1 [10.13.11.143]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id h6TMIq5I028228 for ; Tue, 29 Jul 2003 15:18:52 -0700 (PDT) Received: from webmail01 (localhost [127.0.0.1]) by webmail01.mac.com (8.12.2/8.12.2) with ESMTP id h6TMIpYE010406 for ; Tue, 29 Jul 2003 15:18:51 -0700 (PDT) Message-ID: <8188769.1059517131841.JavaMail.rsato@mac.com> Date: Tue, 29 Jul 2003 15:18:51 -0700 From: Randy Sato To: freebsd-alpha@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: makecontext doesn't work? X-BeenThere: freebsd-alpha@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Alpha List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2003 22:18:53 -0000 In configure for gstreamer-0.6.2, a check for a working makecontext/swapcontext loops forever because it appears that makecontext does not work and the child function is never called. Instead execution continues just after the getcontext() call. Is this a bug in makecontext or in configure? This is using 5.1-Release on alpha. #include #include #include ucontext_t uc_child; ucontext_t uc_main; void child(void /**arg*/) { void *arg = NULL; if (arg != (void *)12345) exit(1); if (swapcontext(&uc_child, &uc_main) != 0) exit(1); } int main(int argc, char *argv[]) { FILE *fp; void *stack; /* the default is that it fails */ if ((fp = fopen("conftestval", "w")) == NULL) exit(1); fprintf(fp, "no\n"); fclose(fp); /* configure a child user-space context */ if ((stack = malloc(64*1024)) == NULL) exit(1); if (getcontext(&uc_child) != 0) exit(1); uc_child.uc_link = NULL; uc_child.uc_stack.ss_sp = (char *)stack+(32*1024); uc_child.uc_stack.ss_size = 32*1024; uc_child.uc_stack.ss_flags = 0; makecontext(&uc_child, child, 2, (void *)12345); /* switch into the user context */ if (swapcontext(&uc_main, &uc_child) != 0) exit(1); /* Fine, child came home */ if ((fp = fopen("conftestval", "w")) == NULL) exit(1); fprintf(fp, "yes\n"); fclose(fp); /* die successfully */ exit(0); }