src/audio/dsp/SDL_dspaudio.c
author Sam Lantinga <slouken@lokigames.com>
Mon, 09 Jul 2001 15:46:41 +0000
changeset 96 799bea5504e2
parent 94 ae6e6b73333f
child 97 c7bcdece4845
permissions -rw-r--r--
Fixed blocking open bug when using blocking audio writes
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@0
     3
    Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@0
     6
    modify it under the terms of the GNU Library General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@0
     8
    version 2 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@0
    13
    Library General Public License for more details.
slouken@0
    14
slouken@0
    15
    You should have received a copy of the GNU Library General Public
slouken@0
    16
    License along with this library; if not, write to the Free
slouken@0
    17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@0
    20
    slouken@devolution.com
slouken@0
    21
*/
slouken@0
    22
slouken@0
    23
#ifdef SAVE_RCSID
slouken@0
    24
static char rcsid =
slouken@0
    25
 "@(#) $Id$";
slouken@0
    26
#endif
slouken@0
    27
slouken@0
    28
/* Allow access to a raw mixing buffer */
slouken@0
    29
slouken@0
    30
#include <stdlib.h>
slouken@0
    31
#include <stdio.h>
slouken@0
    32
#include <string.h>
slouken@0
    33
#include <errno.h>
slouken@0
    34
#include <unistd.h>
slouken@0
    35
#include <fcntl.h>
slouken@0
    36
#include <signal.h>
slouken@0
    37
#include <sys/time.h>
slouken@0
    38
#include <sys/ioctl.h>
slouken@0
    39
#include <sys/stat.h>
slouken@94
    40
#ifdef OSS_USE_SOUNDCARD_H
slouken@94
    41
/* This is installed on some systems */
slouken@94
    42
#include <soundcard.h>
slouken@94
    43
#else
slouken@94
    44
/* This is recommended by OSS */
slouken@0
    45
#include <sys/soundcard.h>
slouken@94
    46
#endif
slouken@0
    47
slouken@0
    48
#include "SDL_audio.h"
slouken@0
    49
#include "SDL_error.h"
slouken@0
    50
#include "SDL_audiomem.h"
slouken@0
    51
#include "SDL_audio_c.h"
slouken@0
    52
#include "SDL_timer.h"
slouken@0
    53
#include "SDL_audiodev_c.h"
slouken@0
    54
#include "SDL_dspaudio.h"
slouken@0
    55
slouken@0
    56
/* The tag name used by DSP audio */
slouken@0
    57
#define DSP_DRIVER_NAME         "dsp"
slouken@0
    58
slouken@0
    59
/* Open the audio device for playback, and don't block if busy */
slouken@93
    60
#define USE_BLOCKING_WRITES
slouken@0
    61
#define OPEN_FLAGS	(O_WRONLY|O_NONBLOCK)
slouken@0
    62
slouken@0
    63
/* Audio driver functions */
slouken@0
    64
static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec);
slouken@0
    65
static void DSP_WaitAudio(_THIS);
slouken@0
    66
static void DSP_PlayAudio(_THIS);
slouken@0
    67
static Uint8 *DSP_GetAudioBuf(_THIS);
slouken@0
    68
static void DSP_CloseAudio(_THIS);
slouken@0
    69
slouken@0
    70
/* Audio driver bootstrap functions */
slouken@0
    71
slouken@0
    72
static int Audio_Available(void)
slouken@0
    73
{
slouken@0
    74
	int fd;
slouken@0
    75
	int available;
slouken@0
    76
slouken@0
    77
	available = 0;
slouken@0
    78
	fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 0);
slouken@0
    79
	if ( fd >= 0 ) {
slouken@0
    80
		available = 1;
slouken@0
    81
		close(fd);
slouken@0
    82
	}
slouken@0
    83
	return(available);
slouken@0
    84
}
slouken@0
    85
slouken@0
    86
static void Audio_DeleteDevice(SDL_AudioDevice *device)
slouken@0
    87
{
slouken@0
    88
	free(device->hidden);
slouken@0
    89
	free(device);
slouken@0
    90
}
slouken@0
    91
slouken@0
    92
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
slouken@0
    93
{
slouken@0
    94
	SDL_AudioDevice *this;
slouken@0
    95
slouken@0
    96
	/* Initialize all variables that we clean on shutdown */
slouken@0
    97
	this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
slouken@0
    98
	if ( this ) {
slouken@0
    99
		memset(this, 0, (sizeof *this));
slouken@0
   100
		this->hidden = (struct SDL_PrivateAudioData *)
slouken@0
   101
				malloc((sizeof *this->hidden));
slouken@0
   102
	}
slouken@0
   103
	if ( (this == NULL) || (this->hidden == NULL) ) {
slouken@0
   104
		SDL_OutOfMemory();
slouken@0
   105
		if ( this ) {
slouken@0
   106
			free(this);
slouken@0
   107
		}
slouken@0
   108
		return(0);
slouken@0
   109
	}
slouken@0
   110
	memset(this->hidden, 0, (sizeof *this->hidden));
slouken@0
   111
	audio_fd = -1;
slouken@0
   112
slouken@0
   113
	/* Set the function pointers */
slouken@0
   114
	this->OpenAudio = DSP_OpenAudio;
slouken@0
   115
	this->WaitAudio = DSP_WaitAudio;
slouken@0
   116
	this->PlayAudio = DSP_PlayAudio;
slouken@0
   117
	this->GetAudioBuf = DSP_GetAudioBuf;
slouken@0
   118
	this->CloseAudio = DSP_CloseAudio;
slouken@0
   119
slouken@0
   120
	this->free = Audio_DeleteDevice;
slouken@0
   121
slouken@0
   122
	return this;
slouken@0
   123
}
slouken@0
   124
slouken@0
   125
AudioBootStrap DSP_bootstrap = {
slouken@0
   126
	DSP_DRIVER_NAME, "OSS /dev/dsp standard audio",
slouken@0
   127
	Audio_Available, Audio_CreateDevice
slouken@0
   128
};
slouken@0
   129
slouken@0
   130
/* This function waits until it is possible to write a full sound buffer */
slouken@0
   131
static void DSP_WaitAudio(_THIS)
slouken@0
   132
{
slouken@0
   133
	/* Check to see if the thread-parent process is still alive */
slouken@0
   134
	{ static int cnt = 0;
slouken@0
   135
		/* Note that this only works with thread implementations 
slouken@0
   136
		   that use a different process id for each thread.
slouken@0
   137
		*/
slouken@0
   138
		if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */
slouken@0
   139
			if ( kill(parent, 0) < 0 ) {
slouken@0
   140
				this->enabled = 0;
slouken@0
   141
			}
slouken@0
   142
		}
slouken@0
   143
	}
slouken@0
   144
slouken@93
   145
#ifndef USE_BLOCKING_WRITES /* Not necessary when using blocking writes */
slouken@0
   146
	/* See if we need to use timed audio synchronization */
slouken@0
   147
	if ( frame_ticks ) {
slouken@0
   148
		/* Use timer for general audio synchronization */
slouken@0
   149
		Sint32 ticks;
slouken@0
   150
slouken@0
   151
		ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS;
slouken@0
   152
		if ( ticks > 0 ) {
slouken@0
   153
			SDL_Delay(ticks);
slouken@0
   154
		}
slouken@0
   155
	} else {
slouken@0
   156
		/* Use select() for audio synchronization */
slouken@93
   157
		fd_set fdset;
slouken@0
   158
		struct timeval timeout;
slouken@93
   159
slouken@0
   160
		FD_ZERO(&fdset);
slouken@0
   161
		FD_SET(audio_fd, &fdset);
slouken@0
   162
		timeout.tv_sec = 10;
slouken@0
   163
		timeout.tv_usec = 0;
slouken@0
   164
#ifdef DEBUG_AUDIO
slouken@0
   165
		fprintf(stderr, "Waiting for audio to get ready\n");
slouken@0
   166
#endif
slouken@0
   167
		if ( select(audio_fd+1, NULL, &fdset, NULL, &timeout) <= 0 ) {
slouken@0
   168
			const char *message =
slouken@0
   169
			"Audio timeout - buggy audio driver? (disabled)";
slouken@0
   170
			/* In general we should never print to the screen,
slouken@0
   171
			   but in this case we have no other way of letting
slouken@0
   172
			   the user know what happened.
slouken@0
   173
			*/
slouken@0
   174
			fprintf(stderr, "SDL: %s\n", message);
slouken@0
   175
			this->enabled = 0;
slouken@0
   176
			/* Don't try to close - may hang */
slouken@0
   177
			audio_fd = -1;
slouken@0
   178
#ifdef DEBUG_AUDIO
slouken@0
   179
			fprintf(stderr, "Done disabling audio\n");
slouken@0
   180
#endif
slouken@0
   181
		}
slouken@0
   182
#ifdef DEBUG_AUDIO
slouken@0
   183
		fprintf(stderr, "Ready!\n");
slouken@0
   184
#endif
slouken@0
   185
	}
slouken@0
   186
#endif /* !USE_BLOCKING_WRITES */
slouken@0
   187
}
slouken@0
   188
slouken@0
   189
static void DSP_PlayAudio(_THIS)
slouken@0
   190
{
slouken@93
   191
	int written, p=0;
slouken@0
   192
slouken@0
   193
	/* Write the audio data, checking for EAGAIN on broken audio drivers */
slouken@0
   194
	do {
slouken@93
   195
		written = write(audio_fd, &mixbuf[p], mixlen-p);
slouken@93
   196
		if (written>0)
slouken@93
   197
		   p += written;
slouken@93
   198
		if (written == -1 && errno != 0 && errno != EAGAIN && errno != EINTR)
slouken@93
   199
		{
slouken@93
   200
		   /* Non recoverable error has occurred. It should be reported!!! */
slouken@93
   201
		   perror("audio");
slouken@93
   202
		   break;
slouken@93
   203
		}
slouken@93
   204
slouken@93
   205
		if ( p < written || ((written < 0) && ((errno == 0) || (errno == EAGAIN))) ) {
slouken@0
   206
			SDL_Delay(1);	/* Let a little CPU time go by */
slouken@0
   207
		}
slouken@93
   208
	} while ( p < written );
slouken@0
   209
slouken@0
   210
	/* If timer synchronization is enabled, set the next write frame */
slouken@0
   211
	if ( frame_ticks ) {
slouken@0
   212
		next_frame += frame_ticks;
slouken@0
   213
	}
slouken@0
   214
slouken@0
   215
	/* If we couldn't write, assume fatal error for now */
slouken@0
   216
	if ( written < 0 ) {
slouken@0
   217
		this->enabled = 0;
slouken@0
   218
	}
slouken@0
   219
#ifdef DEBUG_AUDIO
slouken@0
   220
	fprintf(stderr, "Wrote %d bytes of audio data\n", written);
slouken@0
   221
#endif
slouken@0
   222
}
slouken@0
   223
slouken@0
   224
static Uint8 *DSP_GetAudioBuf(_THIS)
slouken@0
   225
{
slouken@0
   226
	return(mixbuf);
slouken@0
   227
}
slouken@0
   228
slouken@0
   229
static void DSP_CloseAudio(_THIS)
slouken@0
   230
{
slouken@0
   231
	if ( mixbuf != NULL ) {
slouken@0
   232
		SDL_FreeAudioMem(mixbuf);
slouken@0
   233
		mixbuf = NULL;
slouken@0
   234
	}
slouken@0
   235
	if ( audio_fd >= 0 ) {
slouken@0
   236
		close(audio_fd);
slouken@0
   237
		audio_fd = -1;
slouken@0
   238
	}
slouken@0
   239
}
slouken@0
   240
slouken@0
   241
static int DSP_ReopenAudio(_THIS, const char *audiodev, int format,
slouken@0
   242
						SDL_AudioSpec *spec)
slouken@0
   243
{
slouken@0
   244
	int frag_spec;
slouken@0
   245
	int value;
slouken@0
   246
slouken@0
   247
	/* Close and then reopen the audio device */
slouken@0
   248
	close(audio_fd);
slouken@0
   249
	audio_fd = open(audiodev, O_WRONLY, 0);
slouken@0
   250
	if ( audio_fd < 0 ) {
slouken@0
   251
		SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
slouken@0
   252
		return(-1);
slouken@0
   253
	}
slouken@0
   254
slouken@0
   255
	/* Calculate the final parameters for this audio specification */
slouken@0
   256
	SDL_CalculateAudioSpec(spec);
slouken@0
   257
slouken@0
   258
	/* Determine the power of two of the fragment size */
slouken@0
   259
	for ( frag_spec = 0; (0x01<<frag_spec) < spec->size; ++frag_spec );
slouken@0
   260
	if ( (0x01<<frag_spec) != spec->size ) {
slouken@0
   261
		SDL_SetError("Fragment size must be a power of two");
slouken@0
   262
		return(-1);
slouken@0
   263
	}
slouken@0
   264
	frag_spec |= 0x00020000;	/* two fragments, for low latency */
slouken@0
   265
slouken@0
   266
	/* Set the audio buffering parameters */
slouken@0
   267
#ifdef DEBUG_AUDIO
slouken@0
   268
	fprintf(stderr, "Requesting %d fragments of size %d\n",
slouken@0
   269
		(frag_spec >> 16), 1<<(frag_spec&0xFFFF));
slouken@0
   270
#endif
slouken@0
   271
	if ( ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0 ) {
slouken@0
   272
		fprintf(stderr, "Warning: Couldn't set audio fragment size\n");
slouken@0
   273
	}
slouken@0
   274
#ifdef DEBUG_AUDIO
slouken@0
   275
	{ audio_buf_info info;
slouken@0
   276
	  ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info);
slouken@0
   277
	  fprintf(stderr, "fragments = %d\n", info.fragments);
slouken@0
   278
	  fprintf(stderr, "fragstotal = %d\n", info.fragstotal);
slouken@0
   279
	  fprintf(stderr, "fragsize = %d\n", info.fragsize);
slouken@0
   280
	  fprintf(stderr, "bytes = %d\n", info.bytes);
slouken@0
   281
	}
slouken@0
   282
#endif
slouken@0
   283
slouken@0
   284
	/* Set the audio format */
slouken@0
   285
	value = format;
slouken@0
   286
	if ( (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) ||
slouken@0
   287
						(value != format) ) {
slouken@0
   288
		SDL_SetError("Couldn't set audio format");
slouken@0
   289
		return(-1);
slouken@0
   290
	}
slouken@0
   291
slouken@0
   292
	/* Set the number of channels of output */
slouken@0
   293
	value = spec->channels;
slouken@0
   294
#ifdef SNDCTL_DSP_CHANNELS
slouken@0
   295
	if ( ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &value) < 0 ) {
slouken@0
   296
#endif
slouken@0
   297
		value = (spec->channels > 1);
slouken@0
   298
		ioctl(audio_fd, SNDCTL_DSP_STEREO, &value);
slouken@0
   299
		value = (value ? 2 : 1);
slouken@0
   300
#ifdef SNDCTL_DSP_CHANNELS
slouken@0
   301
	}
slouken@0
   302
#endif
slouken@0
   303
	if ( value != spec->channels ) {
slouken@0
   304
		SDL_SetError("Couldn't set audio channels");
slouken@0
   305
		return(-1);
slouken@0
   306
	}
slouken@0
   307
slouken@0
   308
	/* Set the DSP frequency */
slouken@0
   309
	value = spec->freq;
slouken@0
   310
	if ( ioctl(audio_fd, SOUND_PCM_WRITE_RATE, &value) < 0 ) {
slouken@0
   311
		SDL_SetError("Couldn't set audio frequency");
slouken@0
   312
		return(-1);
slouken@0
   313
	}
slouken@0
   314
	spec->freq = value;
slouken@0
   315
slouken@0
   316
	/* We successfully re-opened the audio */
slouken@0
   317
	return(0);
slouken@0
   318
}
slouken@0
   319
slouken@0
   320
static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec)
slouken@0
   321
{
slouken@0
   322
	char audiodev[1024];
slouken@0
   323
	int format;
slouken@0
   324
	int value;
slouken@0
   325
	Uint16 test_format;
slouken@0
   326
slouken@0
   327
	/* Reset the timer synchronization flag */
slouken@0
   328
	frame_ticks = 0.0;
slouken@0
   329
slouken@0
   330
	/* Open the audio device */
slouken@0
   331
	audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0);
slouken@0
   332
	if ( audio_fd < 0 ) {
slouken@0
   333
		SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
slouken@0
   334
		return(-1);
slouken@0
   335
	}
slouken@0
   336
	mixbuf = NULL;
slouken@0
   337
slouken@96
   338
#ifdef USE_BLOCKING_WRITES
slouken@96
   339
	/* Make the file descriptor use blocking writes with fcntl() */
slouken@96
   340
	{ long flags;
slouken@96
   341
		flags = fcntl(audio_fd, F_GETFL);
slouken@96
   342
		flags &= ~O_NONBLOCK;
slouken@96
   343
		if ( fcntl(audio_fd, F_SETFL, flags) < 0 ) {
slouken@96
   344
			SDL_SetError("Couldn't set audio blocking mode");
slouken@96
   345
			return(-1);
slouken@96
   346
		}
slouken@96
   347
	}
slouken@96
   348
#endif
slouken@96
   349
slouken@0
   350
	/* Get a list of supported hardware formats */
slouken@0
   351
	if ( ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0 ) {
slouken@0
   352
		SDL_SetError("Couldn't get audio format list");
slouken@0
   353
		return(-1);
slouken@0
   354
	}
slouken@0
   355
slouken@0
   356
	/* Try for a closest match on audio format */
slouken@0
   357
	format = 0;
slouken@0
   358
	for ( test_format = SDL_FirstAudioFormat(spec->format);
slouken@0
   359
						! format && test_format; ) {
slouken@0
   360
#ifdef DEBUG_AUDIO
slouken@0
   361
		fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
slouken@0
   362
#endif
slouken@0
   363
		switch ( test_format ) {
slouken@0
   364
			case AUDIO_U8:
slouken@0
   365
				if ( value & AFMT_U8 ) {
slouken@0
   366
					format = AFMT_U8;
slouken@0
   367
				}
slouken@0
   368
				break;
slouken@0
   369
			case AUDIO_S8:
slouken@0
   370
				if ( value & AFMT_S8 ) {
slouken@0
   371
					format = AFMT_S8;
slouken@0
   372
				}
slouken@0
   373
				break;
slouken@0
   374
			case AUDIO_S16LSB:
slouken@0
   375
				if ( value & AFMT_S16_LE ) {
slouken@0
   376
					format = AFMT_S16_LE;
slouken@0
   377
				}
slouken@0
   378
				break;
slouken@0
   379
			case AUDIO_S16MSB:
slouken@0
   380
				if ( value & AFMT_S16_BE ) {
slouken@0
   381
					format = AFMT_S16_BE;
slouken@0
   382
				}
slouken@0
   383
				break;
slouken@0
   384
			case AUDIO_U16LSB:
slouken@0
   385
				if ( value & AFMT_U16_LE ) {
slouken@0
   386
					format = AFMT_U16_LE;
slouken@0
   387
				}
slouken@0
   388
				break;
slouken@0
   389
			case AUDIO_U16MSB:
slouken@0
   390
				if ( value & AFMT_U16_BE ) {
slouken@0
   391
					format = AFMT_U16_BE;
slouken@0
   392
				}
slouken@0
   393
				break;
slouken@0
   394
			default:
slouken@0
   395
				break;
slouken@0
   396
		}
slouken@0
   397
		if ( ! format ) {
slouken@0
   398
			test_format = SDL_NextAudioFormat();
slouken@0
   399
		}
slouken@0
   400
	}
slouken@0
   401
	if ( format == 0 ) {
slouken@0
   402
		SDL_SetError("Couldn't find any hardware audio formats");
slouken@0
   403
		return(-1);
slouken@0
   404
	}
slouken@0
   405
	spec->format = test_format;
slouken@0
   406
slouken@0
   407
	/* Set the audio format */
slouken@0
   408
	value = format;
slouken@0
   409
	if ( (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) ||
slouken@0
   410
						(value != format) ) {
slouken@0
   411
		SDL_SetError("Couldn't set audio format");
slouken@0
   412
		return(-1);
slouken@0
   413
	}
slouken@0
   414
slouken@0
   415
	/* Set the number of channels of output */
slouken@0
   416
	value = spec->channels;
slouken@0
   417
#ifdef SNDCTL_DSP_CHANNELS
slouken@0
   418
	if ( ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &value) < 0 ) {
slouken@0
   419
#endif
slouken@0
   420
		value = (spec->channels > 1);
slouken@0
   421
		ioctl(audio_fd, SNDCTL_DSP_STEREO, &value);
slouken@0
   422
		value = (value ? 2 : 1);
slouken@0
   423
#ifdef SNDCTL_DSP_CHANNELS
slouken@0
   424
	}
slouken@0
   425
#endif
slouken@0
   426
	spec->channels = value;
slouken@0
   427
slouken@0
   428
	/* Because some drivers don't allow setting the buffer size
slouken@0
   429
	   after setting the format, we must re-open the audio device
slouken@0
   430
	   once we know what format and channels are supported
slouken@0
   431
	 */
slouken@0
   432
	if ( DSP_ReopenAudio(this, audiodev, format, spec) < 0 ) {
slouken@0
   433
		/* Error is set by DSP_ReopenAudio() */
slouken@0
   434
		return(-1);
slouken@0
   435
	}
slouken@0
   436
slouken@0
   437
	/* Allocate mixing buffer */
slouken@0
   438
	mixlen = spec->size;
slouken@0
   439
	mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen);
slouken@0
   440
	if ( mixbuf == NULL ) {
slouken@0
   441
		return(-1);
slouken@0
   442
	}
slouken@0
   443
	memset(mixbuf, spec->silence, spec->size);
slouken@0
   444
slouken@0
   445
#ifndef USE_BLOCKING_WRITES
slouken@0
   446
	/* Check to see if we need to use select() workaround */
slouken@0
   447
	{ char *workaround;
slouken@0
   448
		workaround = getenv("SDL_DSP_NOSELECT");
slouken@0
   449
		if ( workaround ) {
slouken@0
   450
			frame_ticks = (float)(spec->samples*1000)/spec->freq;
slouken@0
   451
			next_frame = SDL_GetTicks()+frame_ticks;
slouken@0
   452
		}
slouken@0
   453
	}
slouken@0
   454
#endif /* !USE_BLOCKING_WRITES */
slouken@0
   455
slouken@0
   456
	/* Get the parent process id (we're the parent of the audio thread) */
slouken@0
   457
	parent = getpid();
slouken@0
   458
slouken@0
   459
	/* We're ready to rock and roll. :-) */
slouken@0
   460
	return(0);
slouken@0
   461
}