Takashi Sakamoto [Mon, 16 Nov 2020 02:45:41 +0000 (11:45 +0900)]
rawmidi: skip check of return value from g_malloc()
In GLib implementation, the call of g_malloc() can bring program abort
due to memory starvation. This is necessarily preferable because applications
cannot handle the case and GLib has alternative APIs named 'try' to
allow applications to handle the case.
On the other hand, the memory starvation is system wide issue and it's
hard for applications to solve the issue. It's reasonable for the
implementation to have program abort somehow.
Furthermore, the call of g_object_new() can bring program abort due
to memory starvation. It's impossible for applications to handle the
case.
This commit skips check of return value from g_malloc().
Takashi Sakamoto [Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)]
hwdep: query: use GFileError to report error
This commit uses GFileError to report errors in library global functions.
It's better to add new GLib enumerations and GQuark for the reporting,
however it's cumbersome to add them just for the global functions.
Thus this commit just uses the existent error in GLib.
Takashi Sakamoto [Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)]
hwdep: query: simplify count check
Usually, when creating list of something, count decision at first, then
generate items of the list. At last, the number of items is checked as
the same as the count. However, it's unlikely to have different number
of items.
Takashi Sakamoto [Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)]
hwdep: add checks for method arguments
In Rules for use of GError, it's just used for recoverable runtime
error, not for programming error. The invalid arguments are a kind of
programming error.
Takashi Sakamoto [Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)]
hwdep: skip check of return value from g_malloc()
In GLib implementation, the call of g_malloc() can bring program abort
due to memory starvation. This is necessarily preferable because applications
cannot handle the case and GLib has alternative APIs named 'try' to
allow applications to handle the case.
On the other hand, the memory starvation is system wide issue and it's
hard for applications to solve the issue. It's reasonable for the
implementation to have program abort somehow.
Furthermore, the call of g_object_new() can bring program abort due
to memory starvation. It's impossible for applications to handle the
case.
This commit skips check of return value from g_malloc().
Takashi Sakamoto [Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)]
timer: instance_param: simplify count check
Usually, when creating list of something, count decision at first, then
generate items of the list. At last, the number of items is checked as
the same as the count. However, it's unlikely to have different number
of items.
Takashi Sakamoto [Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)]
ctl: query: simplify count check
Usually, when creating list of something, count decision at first, then
generate items of the list. At last, the number of items is checked as
the same as the count. However, it's unlikely to have different number
of items.
Takashi Sakamoto [Sun, 15 Nov 2020 02:54:07 +0000 (11:54 +0900)]
seq: query: use GFileError to report error
In design of ALSA sequencer, sequencer character device is not
corresponding to each substance in ALSA Sequencer. It's a kind of
interface to query and operate. Applications adds user client
and operates it to use its services. Nevertheless, the interface
has some functionality without adding the user instances.
For the functionality, this library has global functions. The functions
are not relevant to the user instance, therefore it's not reasonable to
use error domain specific to the user instance.
This commit uses GFileError to report errors in the global functions.
Takashi Sakamoto [Sun, 15 Nov 2020 02:54:07 +0000 (11:54 +0900)]
seq: user_client: report error for queue access permission
Queue in ALSA sequencer has locking mechanism and client has access
permission to operate the queue. When unpermitted, the operation fails
and return EPERM error code.
Takashi Sakamoto [Sun, 15 Nov 2020 02:54:07 +0000 (11:54 +0900)]
seq: user_client: report error for port access permission
Port in ALSA sequencer has capability and client has access permission
to operate the port. When unpermitted, the operation fails and return
EPERM error code.
Takashi Sakamoto [Sun, 15 Nov 2020 02:54:07 +0000 (11:54 +0900)]
seq: add checks for method arguments
In Rules for use of GError, it's just used for recoverable runtime
error, not for programming error. The invalid arguments are a kind of
programming error.
Takashi Sakamoto [Sun, 15 Nov 2020 02:54:07 +0000 (11:54 +0900)]
seq: skip check of return value from g_malloc()
In GLib implementation, the call of g_malloc() can bring program abort
due to memory starvation. This is necessarily preferable because applications
cannot handle the case and GLib has alternative APIs named 'try' to
allow applications to handle the case.
On the other hand, the memory starvation is system wide issue and it's
hard for applications to solve the issue. It's reasonable for the
implementation to have program abort somehow.
Furthermore, the call of g_object_new() can bring program abort due
to memory starvation. It's impossible for applications to handle the
case.
This commit skips check of return value from g_malloc().
Takashi Sakamoto [Sat, 14 Nov 2020 08:28:09 +0000 (17:28 +0900)]
timer: query: use GFileError to report error
In design of ALSA timer, timer character device is not corresponding to
each substance of timer device. It's a kind of interface to query and
operate. Applications adds user instance and operates it to use its
services. Nevertheless, the interface has some functionality without
adding the user instances.
For the functionality, this library has global functions. The functions
are not relevant to the user instance, therefore it's not reasonable to
use error domain specific to the user instance.
This commit uses GFileError to report errors in the global functions.
Takashi Sakamoto [Sat, 14 Nov 2020 08:28:09 +0000 (17:28 +0900)]
timer: user_instance: report error for timer already attached
After opening character device, applications can select event type. The
operation should be done before attaching to any timer device or the other
instances, Else it fails and returns EBUSY error to the applications.
Takashi Sakamoto [Sat, 14 Nov 2020 08:28:09 +0000 (17:28 +0900)]
timer: user_instance: report error for unattached timer instance
When querying or starting the user instance, the instance should be
attached to any timer device or the other instances. Else, applications
receives EBADFD error.
Takashi Sakamoto [Sat, 14 Nov 2020 08:28:09 +0000 (17:28 +0900)]
timer: user_instance: report error for timer instance not found
After instantiation and opening character device, application can attach
any timer device to the instance according to the identifier information.
If ALSA timer system has no substance identified by the information,
application receives ENODEV error.
Takashi Sakamoto [Sat, 14 Nov 2020 08:28:09 +0000 (17:28 +0900)]
timer: instance-params: add checks for method arguments
In Rules for use of GError, it's just used for recoverable runtime
error, not for programming error. The invalid arguments are a kind of
programming error.
Takashi Sakamoto [Sat, 14 Nov 2020 08:28:09 +0000 (17:28 +0900)]
timer: add checks for method arguments
In Rules for use of GError, it's just used for recoverable runtime
error, not for programming error. The invalid arguments are a kind of
programming error.
Takashi Sakamoto [Sat, 14 Nov 2020 08:28:09 +0000 (17:28 +0900)]
timer: skip check of return value from g_malloc()
In GLib implementation, the call of g_malloc() can bring program abort
due to memory starvation. This is necessarily preferable because applications
cannot handle the case and GLib has alternative APIs named 'try' to
allow applications to handle the case.
On the other hand, the memory starvation is system wide issue and it's
hard for applications to solve the issue. It's reasonable for the
implementation to have program abort somehow.
Furthermore, the call of g_object_new() can bring program abort due
to memory starvation. It's impossible for applications to handle the
case.
This commit skips check of return value from g_malloc().
Takashi Sakamoto [Sat, 14 Nov 2020 08:28:09 +0000 (17:28 +0900)]
timer: user_instance: fix function comment
The function comment for documentation includes wrong descriptions.
This commit corrects it.
Fixes: 3a6d788bf47d ("timer: user_instance: add an API to attach user instance to another instance as slave") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Takashi Sakamoto [Fri, 13 Nov 2020 07:26:26 +0000 (16:26 +0900)]
ctl: query: use GFileError to report error
This commit uses GFileError to report errors in library global functions.
It's better to add new GLib enumerations and GQuark for the reporting,
however it's cumbersome to add them just for the global functions.
Thus this commit just uses the existent error in GLib.
Takashi Sakamoto [Fri, 13 Nov 2020 07:26:26 +0000 (16:26 +0900)]
ctl: add checks for method arguments
In Rules for use of GError, it's just used for recoverable runtime
error, not for programming error. The invalid arguments are a kind of
programming error.
Takashi Sakamoto [Fri, 13 Nov 2020 07:26:26 +0000 (16:26 +0900)]
ctl: skip check of return value from g_malloc()
In GLib implementation, the call of g_malloc() can bring program abort
due to memory starvation. This is necessarily preferable because applications
cannot handle the case and GLib has alternative APIs named 'try' to
allow applications to handle the case.
On the other hand, the memory starvation is system wide issue and it's
hard for applications to solve the issue. It's reasonable for the
implementation to have program abort somehow.
Furthermore, the call of g_object_new() can bring program abort due
to memory starvation. It's impossible for applications to handle the
case.
This commit skips check of return value from g_malloc().