home *** CD-ROM | disk | FTP | other *** search
- head 1.3;
- access;
- symbols
- version39-41:1.1;
- locks;
- comment @ * @;
-
-
- 1.3
- date 92.08.09.20.40.01; author amiga; state Exp;
- branches;
- next 1.2;
-
- 1.2
- date 92.07.28.02.50.59; author mwild; state Exp;
- branches;
- next 1.1;
-
- 1.1
- date 92.05.14.19.55.40; author mwild; state Exp;
- branches;
- next ;
-
-
- desc
- @UnLock() and Close() replacements
- @
-
-
- 1.3
- log
- @change to use 2.x header files by default
- @
- text
- @/*
- * This file is part of ixemul.library for the Amiga.
- * Copyright (C) 1991, 1992 Markus M. Wild
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id: __unlock.c,v 1.2 1992/07/28 02:50:59 mwild Exp $
- *
- * $Log: __unlock.c,v $
- * Revision 1.2 1992/07/28 02:50:59 mwild
- * call FreeDosObject instead of kfree() when > 1.3
- *
- * Revision 1.1 1992/05/14 19:55:40 mwild
- * Initial revision
- *
- */
-
- #define KERNEL
- #include "ixemul.h"
-
-
- extern int _dos20;
-
-
- #if __GNUC__ != 2
- #define alloca __builtin_alloca
- #endif
-
- int
- __unlock (BPTR lock)
- {
- struct StandardPacket *sp;
-
- sp = alloca(sizeof(*sp)+2);
- sp = LONG_ALIGN (sp);
- __init_std_packet(sp);
-
- sp->sp_Pkt.dp_Port = u.u_sync_mp;
- sp->sp_Pkt.dp_Type = ACTION_FREE_LOCK;
- sp->sp_Pkt.dp_Arg1 = lock;
-
- PutPacket (((struct FileLock *)BTOCPTR (lock))->fl_Task, sp);
- __wait_sync_packet (sp);
-
- /* set up Result2 so that the IoErr() works */
- ((struct Process *)FindTask (0))->pr_Result2 = sp->sp_Pkt.dp_Res2;
-
- return sp->sp_Pkt.dp_Res1;
- }
-
- /* ATTENTION: name-clash between sysio-__close and DOS-__Close !! */
- int
- __Close (BPTR fh)
- {
- struct StandardPacket *sp;
- struct FileHandle *fhp = BTOCPTR (fh);
-
- /* only do this is not closing a dummy NIL: filehandle */
- if (fhp->fh_Type)
- {
- sp = alloca(sizeof(*sp)+2);
- sp = LONG_ALIGN (sp);
- __init_std_packet(sp);
-
- sp->sp_Pkt.dp_Port = u.u_sync_mp;
- sp->sp_Pkt.dp_Type = ACTION_END;
- sp->sp_Pkt.dp_Arg1 = fhp->fh_Arg1;
-
- PutPacket (fhp->fh_Type, sp);
- __wait_sync_packet (sp);
- }
-
- if (! _dos20)
- {
- /* free our filehandle. skip over the hidden length-field at the
- * start */
- kfree (((unsigned long *)fhp) - 1);
- }
- else
- FreeDosObject (DOS_FILEHANDLE, fhp);
-
- /* set up Result2 so that the IoErr() works */
- ((struct Process *)FindTask (0))->pr_Result2 = sp->sp_Pkt.dp_Res2;
-
- return sp->sp_Pkt.dp_Res1;
- }
- @
-
-
- 1.2
- log
- @call FreeDosObject instead of kfree() when > 1.3
- @
- text
- @d19 1
- a19 1
- * $Id: __unlock.c,v 1.1 1992/05/14 19:55:40 mwild Exp $
- d22 3
- a32 17
- #define BASE_EXT_DECL
- #define BASE_PAR_DECL
- #define BASE_PAR_DECL0
- #define BASE_NAME ix.ix_dos_base
- static __inline void
- FreeDosObject (BASE_PAR_DECL unsigned long type,APTR ptr)
- {
- BASE_EXT_DECL
- register struct DosLibrary *a6 __asm("a6") = BASE_NAME;
- register unsigned long d1 __asm("d1") = type;
- register APTR d2 __asm("d2") = ptr;
- __asm __volatile ("jsr a6@@(-0xea)"
- : /* no output */
- : "r" (a6), "r" (d1), "r" (d2)
- : "a0","a1","d0","d1","d2", "memory");
- }
- #define DOS_FILEHANDLE 0
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d19 1
- a19 1
- * $Id$
- d21 4
- a24 1
- * $Log$
- d30 21
- d99 8
- a106 3
- /* free our filehandle. skip over the hidden length-field at the
- * start */
- kfree (((unsigned long *)fhp) - 1);
- @
-