67ec3d7926
This commit resolves issue #620: Remove CONFIG_CAN_PASS_STRUCTS #620 The configuration option CONFIG_CAN_PASS_STRUCTS was added many years ago to support an old version of the SDCC compiler. That compiler is currently used only with the Z80 and Z180 targets. The limitation of that old compiler was that it could not pass structures or unions as either inputs or outputs. For example: #ifdef CONFIG_CAN_PASS_STRUCTS struct mallinfo mallinfo(void); #else int mallinfo(FAR struct mallinfo *info); #endif And even leads to violation of a few POSIX interfaces like: #ifdef CONFIG_CAN_PASS_STRUCTS int sigqueue(int pid, int signo, union sigval value); #else int sigqueue(int pid, int signo, FAR void *sival_ptr); #endif This breaks the 1st INVIOLABLES rule: Strict POSIX compliance ----------------------- o Strict conformance to the portable standard OS interface as defined at OpenGroup.org. o A deeply embedded system requires some special support. Special support must be minimized. o The portable interface must never be compromised only for the sake of expediency. o Expediency or even improved performance are not justifications for violation of the strict POSIX interface Also, it appears that the current SDCC compilers have resolve this issue and so, perhaps, this is no longer a problem: z88dk/z88dk#1132 NOTE: This commit cannot pass the PR checks because it depends on matching changes to the apps/ directory.
111 lines
3.0 KiB
C
111 lines
3.0 KiB
C
/****************************************************************************
|
|
* fs/aio/aio_signal.c
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
* this work for additional information regarding copyright ownership. The
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
* "License"); you may not use this file except in compliance with the
|
|
* License. You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
* License for the specific language governing permissions and limitations
|
|
* under the License.
|
|
*
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
* Included Files
|
|
****************************************************************************/
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <sys/types.h>
|
|
#include <sched.h>
|
|
#include <signal.h>
|
|
#include <aio.h>
|
|
#include <assert.h>
|
|
#include <errno.h>
|
|
#include <debug.h>
|
|
|
|
#include <nuttx/signal.h>
|
|
|
|
#include "aio/aio.h"
|
|
|
|
#ifdef CONFIG_FS_AIO
|
|
|
|
/****************************************************************************
|
|
* Public Functions
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
* Name: aio_signal
|
|
*
|
|
* Description:
|
|
* Signal the client that an I/O has completed.
|
|
*
|
|
* Input Parameters:
|
|
* pid - ID of the task to signal
|
|
* aiocbp - Pointer to the asynchronous I/O state structure that includes
|
|
* information about how to signal the client
|
|
*
|
|
* Returned Value:
|
|
* Zero (OK) if the client was successfully signalled. Otherwise, a
|
|
* negated errno value is returned.
|
|
*
|
|
* Assumptions:
|
|
* This function runs only in the context of the worker thread.
|
|
*
|
|
****************************************************************************/
|
|
|
|
int aio_signal(pid_t pid, FAR struct aiocb *aiocbp)
|
|
{
|
|
union sigval value;
|
|
int status;
|
|
int ret;
|
|
|
|
DEBUGASSERT(aiocbp);
|
|
|
|
ret = OK; /* Assume success */
|
|
|
|
/* Signal the client */
|
|
|
|
ret = nxsig_notification(pid, &aiocbp->aio_sigevent,
|
|
SI_ASYNCIO, &aiocbp->aio_sigwork);
|
|
if (ret < 0)
|
|
{
|
|
ferr("ERROR: nxsig_notification failed: %d\n", ret);
|
|
}
|
|
|
|
/* Send the poll signal in any event in case the caller is waiting
|
|
* on sig_suspend();
|
|
*/
|
|
|
|
value.sival_ptr = aiocbp;
|
|
status = nxsig_queue(pid, SIGPOLL, value);
|
|
if (status < 0)
|
|
{
|
|
ferr("ERROR: nxsig_queue #2 failed: %d\n", status);
|
|
if (ret >= OK)
|
|
{
|
|
ret = status;
|
|
}
|
|
}
|
|
|
|
/* Make sure that errno is set correctly on return */
|
|
|
|
if (ret < 0)
|
|
{
|
|
set_errno(-ret);
|
|
return ERROR;
|
|
}
|
|
|
|
return OK;
|
|
}
|
|
|
|
#endif /* CONFIG_FS_AIO */
|